Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions src/SB/Core/gc/iModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,62 @@

#include <types.h>

RwFrame* GetChildFrameHierarchy(RwFrame* frame, void* data)
{
RpHAnimHierarchy* hierarchy = RpHAnimFrameGetHierarchy(frame);
if (hierarchy == 0)
{
RwFrameForAllChildren(frame, GetChildFrameHierarchy, data);
}
else
{
data = hierarchy;
frame = 0;
}
return frame;
}

void* GetHierarchy(RpAtomic* frame)
{
void* unk_0[2];
unk_0[0] = 0;
GetChildFrameHierarchy((RwFrame*)frame, unk_0);
return unk_0[0];
}

RpAtomic* iModelFileNew(void* buffer, U32 size)
{
RwStream* rwmem;
S32 unk_0 = (S32)buffer;
RwStreamType type;
RwStreamAccessType accessType;

type = (RwStreamType)3;
accessType = (RwStreamAccessType)1;

rwmem = RwStreamOpen(type, accessType, buffer);
return iModelStreamRead(rwmem);
}

void iModelUnload(RpAtomic* userdata)
{
RpClump* clump;
RwFrame* frame = 0;
RwFrame* root;

clump = (RpClump*)userdata + 0x3c;
if ((RpClump*)userdata != 0)
{
RwFrameGetRoot((RwFrame*)userdata);
RwFrameDestroyHierarchy(frame);
userdata = 0;
}
if (clump != 0)
{
RpClumpDestroy(clump);
}
}

void iModelCacheAtomic(RpAtomic*)
{
}
4 changes: 4 additions & 0 deletions src/SB/Core/gc/iModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@

#include <rwcore.h>
#include <rpworld.h>
#include <rphanim.h>

void iModelInit();
U32 iModelNumBones(RpAtomic* model);
S32 iModelCull(RpAtomic* model, RwMatrixTag* mat);
S32 iModelSphereCull(xSphere* sphere);
RpAtomic* iModelStreamRead(RwStream*);
RpAtomic* iModelFileNew(void* buffer, U32 size);
RpAtomic* iModelFile_RWMultiAtomic(RpAtomic* model);
void iModelSetMaterialTexture(RpAtomic* model, void* texture);
void iModelResetMaterial(RpAtomic* model);
void iModelUnload(RpAtomic* userdata);
S32 iModelCullPlusShadow(RpAtomic* model, RwMatrix* mat, xVec3* shadowVec, S32* shadowOutside);
void iModelTagEval(RpAtomic* model, const xModelTag* tag, RwMatrixTag* mat, xVec3* dest);
U32 iModelTagSetup(xModelTag* tag, RpAtomic* model, F32 x, F32 y, F32 z);
Expand Down