MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xModelPoolInit

Function xModelPoolInit

src/SB/Core/x/xModel.cpp:48–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void xModelPoolInit(U32 count, U32 numMatrices)
49{
50 S32 i;
51 U8* buffer;
52 RwMatrix* mat;
53 xModelPool *pool, *curr, **prev;
54 xModelInstance* inst;
55
56 if (numMatrices < 1)
57 numMatrices = 1;
58
59 buffer = (U8*)xMemAllocSizeAlign(count * numMatrices * sizeof(RwMatrix) + sizeof(xModelPool) +
60 count * sizeof(xModelInstance),
61 16);
62
63 mat = (RwMatrix*)buffer;
64 buffer += count * numMatrices * sizeof(RwMatrix);
65
66 pool = (xModelPool*)buffer;
67 buffer += sizeof(xModelPool);
68
69 inst = (xModelInstance*)buffer;
70
71 for (i = 0; i < (S32)count; i++)
72 {
73 inst[i].Next = &inst[i + 1];
74 inst[i].Pool = pool;
75 inst[i].Mat = mat;
76 mat += numMatrices;
77 }
78 inst[count - 1].Next = NULL;
79
80 pool->NumMatrices = numMatrices;
81 pool->List = inst;
82
83 curr = sxModelPoolList;
84 prev = &sxModelPoolList;
85 while (curr && numMatrices < curr->NumMatrices)
86 {
87 prev = &curr->Next;
88 curr = curr->Next;
89 }
90 pool->Next = curr;
91 *prev = pool;
92}
93
94xModelInstance* xModelInstanceAlloc(RpAtomic* data, void* object, U16 flags, U8 boneIndex,
95 U8* boneRemap)

Callers 2

xSceneInitFunction · 0.70
zMainLoopFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected