diff --git a/src/SB/Core/gc/iModel.cpp b/src/SB/Core/gc/iModel.cpp index 7f1ba36c1..818adc778 100644 --- a/src/SB/Core/gc/iModel.cpp +++ b/src/SB/Core/gc/iModel.cpp @@ -2,6 +2,11 @@ #include + +RpLight* sEmptyDirectionalLight; +RpLight* sEmptyAmbientLight; + + RwFrame* GetChildFrameHierarchy(RwFrame* frame, void* data) { RpHAnimHierarchy* hierarchy = RpHAnimFrameGetHierarchy(frame); @@ -25,6 +30,28 @@ void* GetHierarchy(RpAtomic* frame) return unk_0[0]; } + +void iModelInit() +{ + RwFrame* frame; + RwRGBAReal black; + void* tempVoid = 0; + + for (S32 i = 0; i < 4; i++) + { + frame = (RwFrame*)RpLightCreate(i); + //black = frame; + RpLightSetColor(sEmptyDirectionalLight, &black); + frame = RwFrameCreate(); + _rwObjectHasFrameSetFrame(sEmptyDirectionalLight, frame); + + sEmptyAmbientLight = RpLightCreate(2); + + RpLightSetColor(sEmptyAmbientLight, &black); + } +} + + RpAtomic* iModelFileNew(void* buffer, U32 size) { RwStream* rwmem; @@ -49,8 +76,16 @@ void iModelUnload(RpAtomic* userdata) if ((RpClump*)userdata != 0) { RwFrameGetRoot((RwFrame*)userdata); + + userdata = 0; + } + else + { + RwFrameDestroyHierarchy(frame); + RwFrameDestroyHierarchy(frame); userdata = 0; + } if (clump != 0) { @@ -58,6 +93,48 @@ void iModelUnload(RpAtomic* userdata) } } + +RpAtomic* NextAtomicCallback(RpAtomic* atomic, void* data) +{ + // What? + + RpAtomic** nextModel; + + if (data != atomic) + { + atomic = 0; + return atomic; + } + if (data != 0) + { + return atomic; + } + + atomic = (RpAtomic*)data; + + return atomic; +} + +RpAtomic* iModelFile_RWMultiAtomic(RpAtomic* model) +{ + RpClump* clump; + RpAtomic* nextModel = 0; + RpAtomic* modelArray[2]; + + if (model == 0) + { + modelArray[0] = 0; + } + else + { + //modelArray[0] = (S32)model; + modelArray[0] = nextModel; + RpClumpForAllAtomics(model->clump, (RpAtomicCallBack)NextAtomicCallback(nextModel, NULL), + modelArray); + } + return model; +} + void iModelCacheAtomic(RpAtomic*) { }