summaryrefslogtreecommitdiffstats
path: root/src/modelinfo/MloModelInfo.cpp
blob: dc5e64fa1dd43da0ce4c63e925327f65224e1aa2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "common.h"

#include "VisibilityPlugins.h"
#include "ModelInfo.h"

base::cRelocatableChunkClassInfo CMloModelInfo::msClassInfo("CMloModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
CMloModelInfo CMloModelInfo::msClassInstance;

void
CMloModelInfo::ConstructClump()
{
/*
	m_clump = RpClumpCreate();
	RwFrame *mainFrame = RwFrameCreate();
	RwFrameSetIdentity(mainFrame);
	RpClumpSetFrame(m_clump, mainFrame);

	for (int i = firstInstance; i < lastInstance; i++) {
		int modelId = CModelInfo::GetMloInstanceStore().store[i].m_modelIndex;
		RwMatrix *attMat = CModelInfo::GetMloInstanceStore().store[i].GetMatrix().m_attachment;
		CSimpleModelInfo *minfo = (CSimpleModelInfo*)CModelInfo::GetModelInfo(modelId);

		if (minfo->m_atomics[0] != nil) {
			RpAtomic *newAtomic = RpAtomicClone(minfo->m_atomics[0]);
			RwFrame *newFrame = RwFrameCreate();
			if (newAtomic != nil && newFrame != nil) {
				*RwFrameGetMatrix(newFrame) = *attMat;
				RpAtomicSetFrame(newAtomic, newFrame);
				RwFrameAddChild(mainFrame, newFrame);
				RpClumpAddAtomic(m_clump, newAtomic);
			} else {
				debug("Failed to allocate memory while creating template MLO.\n");
			}
		}
	}

	if (RpClumpGetNumAtomics(m_clump) != 0) {
		CVisibilityPlugins::SetClumpModelInfo(m_clump, this);
	} else {
		RpClumpDestroy(m_clump);
		m_clump = nil;
	}
*/
}

void
CMloModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
{
	writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
	writer.Class(VTABLE_ADDR(this), msClassInfo);
}

void
CMloModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
{
	writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
	writer.Class(VTABLE_ADDR(this), msClassInfo);
}