summaryrefslogtreecommitdiff
path: root/src/JSystem/J3DGraphAnimator/J3DModel.cpp
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2023-10-25 21:08:09 -0700
committerJasper St. Pierre <jstpierre@mecheye.net>2023-10-25 21:08:09 -0700
commitd3698fba4b2f8ced3fa074f487600f4143e86839 (patch)
tree063cb952a871cf3d2126162f69e41e192fcbe348 /src/JSystem/J3DGraphAnimator/J3DModel.cpp
parenteabcab65a648d0524f58f77bb7fbfb4659ccee23 (diff)
J3DModel::createBumpMtxArray work
Diffstat (limited to 'src/JSystem/J3DGraphAnimator/J3DModel.cpp')
-rw-r--r--src/JSystem/J3DGraphAnimator/J3DModel.cpp53
1 files changed, 51 insertions, 2 deletions
diff --git a/src/JSystem/J3DGraphAnimator/J3DModel.cpp b/src/JSystem/J3DGraphAnimator/J3DModel.cpp
index 2efb3af1..81b41039 100644
--- a/src/JSystem/J3DGraphAnimator/J3DModel.cpp
+++ b/src/JSystem/J3DGraphAnimator/J3DModel.cpp
@@ -319,8 +319,57 @@ s32 J3DModel::createMatPacket(J3DModelData* pModelData, u32 flag) {
}
/* 802EDF60-802EE1D4 .text createBumpMtxArray__8J3DModelFP12J3DModelDataUl */
-s32 J3DModel::createBumpMtxArray(J3DModelData*, unsigned long) {
+s32 J3DModel::createBumpMtxArray(J3DModelData* modelData, u32 flag) {
/* Nonmatching */
+ if (modelData->getModelDataType() == 0) {
+ u16 num = 0;
+ for (s32 matIdx = 0; matIdx < modelData->getMaterialNum(); matIdx++) {
+ J3DMaterial * pMaterial = getModelData()->getMaterialNodePointer(matIdx);
+ if (pMaterial->getNBTScale()->mbHasScale == 1)
+ num += pMaterial->getShape()->countBumpMtxNum();
+ }
+
+ if (num != 0 && flag != 0) {
+ for (s32 i = 0; i < 2; i++) {
+ mpBumpMtxArr[i] = new Mtx33**[num];
+ if (mpBumpMtxArr[i] == NULL)
+ return kJ3DError_Alloc;
+ }
+ }
+
+ for (s32 i = 0; i < 2; i++) {
+ u32 bumpMtxOffset = 0;
+ for (s32 matIdx = 0; matIdx < modelData->getMaterialNum(); matIdx++) {
+ J3DMaterial * pMaterial = getModelData()->getMaterialNodePointer(matIdx);
+ if (pMaterial->getNBTScale()->mbHasScale == 1) {
+ mpBumpMtxArr[i][matIdx] = new Mtx33*[num];
+ if (mpBumpMtxArr[i][matIdx] == NULL)
+ return kJ3DError_Alloc;
+ pMaterial->getShape()->setBumpMtxOffset(bumpMtxOffset);
+ bumpMtxOffset++;
+ }
+ }
+ }
+
+ for (s32 i = 0; i < 2; i++) {
+ u32 bumpMtxOffset = 0;
+ for (s32 matIdx = 0; matIdx < modelData->getMaterialNum(); matIdx++) {
+ J3DMaterial * pMaterial = getModelData()->getMaterialNodePointer(matIdx);
+ if (pMaterial->getNBTScale()->mbHasScale == 1) {
+ for (u32 j = 0; j < flag; j++) {
+ mpBumpMtxArr[i][matIdx][j] = new(0x20) Mtx33[modelData->getDrawMtxNum()];
+ if (mpBumpMtxArr[i][matIdx][j] == NULL)
+ return kJ3DError_Alloc;
+ }
+ }
+ }
+ }
+
+ if (num != 0)
+ getModelData()->setBumpFlag(1);
+ }
+
+ return kJ3DError_Success;
}
/* 802EE1D4-802EE254 .text newDifferedDisplayList__8J3DModelFUl */
@@ -372,7 +421,7 @@ void J3DModel::calcMaterial() {
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
j3dSys.setMatPacket(&mpMatPacket[i]);
-
+
J3DMaterial* pMaterial = mModelData->getMaterialNodePointer(i);
if (pMaterial->getMaterialAnm() != NULL)
pMaterial->getMaterialAnm()->calc(pMaterial);