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

Function FindAndInstanceAtomicCallback

src/SB/Core/gc/iModel.cpp:72–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 RpLightSetColor(sEmptyAmbientLight, &black); // Redundant sEmptyAmbientLight load here.
71 }
72}
73
74RpAtomic* FindAndInstanceAtomicCallback(RpAtomic* model, void* data)
75{
76 RpHAnimHierarchy* hierarchy = (RpHAnimHierarchy*)GetHierarchy(model);
77 RpGeometry* geom = model->geometry;
78 RpSkin* skin = RpSkinGeometryGetSkin(geom);
79
80 if ((skin != NULL) && (hierarchy == NULL))
81 {
82 hierarchy = (RpHAnimHierarchy*)RpHAnimHierarchyCreate(
83 RpSkinGetNumBones(skin), 0, 0, rpHANIMHIERARCHYLOCALSPACEMATRICES, 0x24);
84 RpHAnimFrameSetHierarchy((RwFrame*)(model->object).object.parent, hierarchy);
85 }
86 if ((hierarchy != NULL) && (skin != NULL))
87 {
88 RpSkinAtomicSetHAnimHierarchy(model, hierarchy);
89 }
90 if (hierarchy != NULL)
91 {
92 hierarchy->flags = 0x4000;
93 }
94 if (gLastAtomicCount < 0x100)
95 {
96 // sda scheduling
97 gLastAtomicList[gLastAtomicCount] = model;
98 gLastAtomicCount++;
99 }
100
101 RwFrame* root = RwFrameGetRoot((RwFrame*)(model->object).object.parent);
102 RpMaterialList* matList = &geom->matList;
103 S32 i = 0;
104 S32 numMats = matList->numMaterials;
105
106 for (; i < numMats; i++)
107 {
108 RpMaterial* pRVar4 = (RpMaterial*)_rpMaterialListGetMaterial(matList, i);
109 if ((pRVar4 != NULL) && (RpMatFXMaterialGetEffects(pRVar4) != 0))
110 {
111 RpMatFXAtomicEnableEffects(model);
112 model->pipeline =
113 (RxPipeline*)RpMatFXGetGameCubePipeline(rpMATFXGAMECUBEATOMICPIPELINE);
114 if (RpSkinGeometryGetSkin(geom) != 0)
115 {
116 RpSkinAtomicSetType(model, rpSKINTYPEMATFX);
117 }
118 break;
119 }
120 }
121
122 if (gLastAtomicCount < 0x100)
123 {
124 // sda scheduling
125 gLastAtomicList[gLastAtomicCount] = model;
126 gLastAtomicCount++;
127 }
128

Callers

nothing calls this directly

Calls 1

GetHierarchyFunction · 0.85

Tested by

no test coverage detected