* J3DGraphBase debug

* J3DGraphAnimator debug

* J3DGraphLoader debug
This commit is contained in:
Jcw87
2026-01-13 17:49:09 +02:00
committed by GitHub
parent dd03bf861f
commit 1a65a6bbbd
34 changed files with 630 additions and 272 deletions
+20 -9
View File
@@ -54716,7 +54716,9 @@ lbl_80718B5E = .data:0x80718B5E; // type:object size:0x3A
@14158 = .data:0x80718D44; // type:object size:0xC scope:local data:string hash:0xA05FFBDC
__vt__16J3DMaterialTable = .data:0x80718D50; // type:object size:0xC scope:global hash:0x31696BE8 dhash:0xB1A7422F
@14159 = .data:0x80718D5C; // type:object size:0x11 scope:local data:string hash:0xA05FFBDD
lbl_80718D6D = .data:0x80718D6D; // type:object size:0x43
lbl_80718D70 = .data:0x80718D70; // type:object size:0x11 scope:local data:string
lbl_80718D84 = .data:0x80718D84; // type:object size:0x16 scope:local data:string
lbl_80718D9C = .data:0x80718D9C; // type:object size:0x11 scope:local data:string
@STRING@__ct__15J3DTevKColorAnmFUsP15J3DAnmTevRegKey@1 = .data:0x80718DB0; // type:object size:0x11 scope:local data:string hash:0x5A014D17 dhash:0x78112C26
@STRING@__ct__15J3DTevKColorAnmFUsP15J3DAnmTevRegKey@0 = .data:0x80718DC4; // type:object size:0x16 scope:local data:string hash:0x5A014D16 dhash:0x78112C26
@STRING@__ct__15J3DTevKColorAnmFUsP15J3DAnmTevRegKey = .data:0x80718DDC; // type:object size:0x11 scope:local data:string hash:0x9EFED366 dhash:0x78785EAA
@@ -54750,18 +54752,27 @@ lbl_80718D6D = .data:0x80718D6D; // type:object size:0x43
@STRING@getUpdateMaterialID__16J3DAnmTexPatternCFUs@1 = .data:0x80719030; // type:object size:0xF scope:local data:string hash:0x58473ADA dhash:0x456BEC1C
@STRING@getUpdateMaterialID__16J3DAnmTexPatternCFUs@0 = .data:0x80719040; // type:object size:0x14 scope:local data:string hash:0x58473ADB dhash:0x456BEC1C
@STRING@getUpdateMaterialID__16J3DAnmTexPatternCFUs = .data:0x80719054; // type:object size:0xF scope:local data:string hash:0x50B67C6B dhash:0xD46B0390
lbl_80719063 = .data:0x80719063; // type:object size:0x69
lbl_80719164 = .data:0x80719064; // type:object size:0xF scope:local data:string
lbl_80719174 = .data:0x80719074; // type:object size:0x14 scope:local data:string
lbl_80719188 = .data:0x80719088; // type:object size:0xF scope:local data:string
lbl_80719198 = .data:0x80719098; // type:object size:0xF scope:local data:string
lbl_807191A8 = .data:0x807190A8; // type:object size:0x14 scope:local data:string
lbl_807191BC = .data:0x807190BC; // type:object size:0xF scope:local data:string
@STRING@getUpdateMaterialID__11J3DAnmColorCFUs@1 = .data:0x807190CC; // type:object size:0xF scope:local data:string hash:0x452B19A1 dhash:0xB7C93AE0
@STRING@getUpdateMaterialID__11J3DAnmColorCFUs@0 = .data:0x807190DC; // type:object size:0x14 scope:local data:string hash:0x452B19A0 dhash:0xB7C93AE0
@STRING@getUpdateMaterialID__11J3DAnmColorCFUs = .data:0x807190F0; // type:object size:0xF scope:local data:string hash:0x8D586DD0 dhash:0x786A946C
@STRING@getUpdateTexMtxID__19J3DAnmTextureSRTKeyCFUs@1 = .data:0x80719100; // type:object size:0xF scope:local data:string hash:0x6B7EED0A dhash:0xD47505A3
@STRING@getUpdateTexMtxID__19J3DAnmTextureSRTKeyCFUs@0 = .data:0x80719110; // type:object size:0x14 scope:local data:string hash:0x6B7EED0B dhash:0xD47505A3
@STRING@getUpdateTexMtxID__19J3DAnmTextureSRTKeyCFUs = .data:0x80719124; // type:object size:0xF scope:local data:string hash:0xBEFB6A3B dhash:0xB482FA2F
lbl_80719133 = .data:0x80719133; // type:object size:0x35
lbl_80719134 = .data:0x80719134; // type:object size:0xF scope:local data:string
lbl_80719144 = .data:0x80719144; // type:object size:0x14 scope:local data:string
lbl_80719158 = .data:0x80719158; // type:object size:0xF scope:local data:string
@STRING@getSRTCenter__19J3DAnmTextureSRTKeyFUs@1 = .data:0x80719168; // type:object size:0xF scope:local data:string hash:0xBD35E163 dhash:0x8AF0DE6C
@STRING@getSRTCenter__19J3DAnmTextureSRTKeyFUs@0 = .data:0x80719178; // type:object size:0x14 scope:local data:string hash:0xBD35E162 dhash:0x8AF0DE6C
@STRING@getSRTCenter__19J3DAnmTextureSRTKeyFUs = .data:0x8071918C; // type:object size:0xF scope:local data:string hash:0xC92A5D12 dhash:0x943A0D60
lbl_8071919B = .data:0x8071919B; // type:object size:0x3D
lbl_8071919C = .data:0x8071919C; // type:object size:0x14 scope:local data:string
lbl_807191B0 = .data:0x807191B0; // type:object size:0x14 scope:local data:string
lbl_807191C4 = .data:0x807191C4; // type:object size:0x14 scope:local data:string
@15235 = .data:0x807191D8; // type:object size:0x17 scope:local data:string hash:0xA05F7375
@15236 = .data:0x807191F0; // type:object size:0x19 scope:local data:string hash:0xA05F7376
__vt__14J3DPEBlockNull = .data:0x8071920C; // type:object size:0x7C scope:global hash:0xA0930FF8 dhash:0x9EFBCF3D
@@ -64933,16 +64944,16 @@ sInterruptFlag__17J3DDisplayListObj = .sbss:0x8074D070; // type:object size:0x4
sCurrentPipeline__11J3DShapeMtx = .sbss:0x8074D078; // type:object size:0x4 scope:global data:4byte hash:0x50CBA64E dhash:0x4F12164E
sCurrentScaleFlag__11J3DShapeMtx = .sbss:0x8074D07C; // type:object size:0x4 scope:global data:4byte hash:0xCB85DCB8 dhash:0x577AF098
lbl_8074D080 = .sbss:0x8074D080; // type:object size:0x1 data:byte hash:0xE75AE0B7 dhash:0x2CA2A917
lbl_8074D081 = .sbss:0x8074D081; // type:object size:0x1 data:byte hash:0x987989B1 dhash:0x6DF89211
lbl_8074D082 = .sbss:0x8074D082; // type:object size:0x1 data:byte hash:0x0F9C84EE dhash:0x9C5D56AE
sNBTFlag__11J3DShapeMtx = .sbss:0x8074D081; // type:object size:0x1 data:byte hash:0x987989B1 dhash:0x6DF89211
sLODFlag__11J3DShapeMtx = .sbss:0x8074D082; // type:object size:0x1 data:byte hash:0x0F9C84EE dhash:0x9C5D56AE
sTexMtxLoadType__11J3DShapeMtx = .sbss:0x8074D084; // type:object size:0x4 scope:global data:4byte hash:0xAFD41013 dhash:0x51E0BE53
sMtxPtrTbl__21J3DShapeMtxConcatView = .sbss:0x8074D088; // type:object size:0x8 scope:global data:4byte hash:0x463C1072 dhash:0x3DA0F1F1
sTexGenBlock__17J3DDifferedTexMtx = .sbss:0x8074D090; // type:object size:0x4 scope:global data:4byte hash:0xD3582F52 dhash:0x9BA160B4
sTexMtxObj__17J3DDifferedTexMtx = .sbss:0x8074D094; // type:object size:0x4 scope:global data:4byte hash:0x8296A751 dhash:0x97A6E857
@LOCAL@makeVcdVatCmd__8J3DShapeFv@sInterruptFlag = .sbss:0x8074D098; // type:object size:0x4 scope:local data:4byte hash:0xED217CF0 dhash:0xA787D159
lbl_8074D09C = .sbss:0x8074D09C; // type:object size:0x1 data:byte hash:0xD4034C98 dhash:0xFE28A8B1
@GUARD@makeVcdVatCmd__8J3DShapeFv@sInterruptFlag = .sbss:0x8074D09C; // type:object size:0x1 data:byte hash:0xD4034C98 dhash:0xFE28A8B1
sOldVcdVatCmd__8J3DShape = .sbss:0x8074D0A0; // type:object size:0x4 scope:global data:4byte hash:0xC597E163 dhash:0xA1B8A75B
lbl_8074D0A4 = .sbss:0x8074D0A4; // type:object size:0x1 data:byte hash:0x13DE227E dhash:0xE33DEC66
sEnvelopeFlag__8J3DShape = .sbss:0x8074D0A4; // type:object size:0x1 data:byte hash:0x13DE227E dhash:0xE33DEC66
SizeOfJ3DColorBlockLightOffLoad = .sbss:0x8074D0A8; // type:object size:0x4 scope:global data:4byte hash:0x0199BDD7
SizeOfJ3DColorBlockAmbientOnLoad = .sbss:0x8074D0AC; // type:object size:0x4 scope:global data:4byte hash:0x940F173F
entryNum__13J3DDrawBuffer = .sbss:0x8074D0B0; // type:object size:0x4 scope:global data:4byte hash:0xFAD2AEB8 dhash:0xC16F8CFA
@@ -69871,7 +69882,7 @@ j2dDefaultAlphaCmp = .sdata2:0x80752896; // type:object size:0x2 scope:global da
@5795 = .sdata2:0x80752AB0; // type:object size:0x8 scope:local align:8 data:double hash:0x0C9C052B
j3dDefaultColInfo = .sdata2:0x80752AB8; // type:object size:0x4 scope:global data:4byte hash:0x80FD297D
j3dDefaultAmbInfo = .sdata2:0x80752ABC; // type:object size:0x4 scope:global data:4byte hash:0x387DE433
lbl_80752AC0 = .sdata2:0x80752AC0; // type:object size:0x1 data:byte hash:0x97541C9C
j3dDefaultNumChans = .sdata2:0x80752AC0; // type:object size:0x1 data:byte hash:0x97541C9C
j3dDefaultTevOrderInfoNull = .sdata2:0x80752AC4; // type:object size:0x4 scope:global hash:0xF84C08AF
j3dDefaultIndTexOrderNull = .sdata2:0x80752AC8; // type:object size:0x4 scope:global hash:0xBD68470C
j3dDefaultTevColor = .sdata2:0x80752AD0; // type:object size:0x8 scope:global data:4byte hash:0xD34E8CA9
@@ -693,6 +693,17 @@ public:
virtual s32 getKind() const { return 7; }
virtual void getColor(u8, u16, GXColor*) const {}
u16 getAnmTableNum(u8 idx) {
J3D_ASSERT_RANGE(1333, idx < 2);
return mAnmTableNum[idx];
}
J3DAnmVtxColorIndexData* getAnmVtxColorIndexData(u8 p1, u16 p2) {
J3D_ASSERT_RANGE(1339, p1 < 2);
J3D_ASSERT_RANGE(1340, p2 < mAnmTableNum[p1]);
return mAnmVtxColorIndexData[p1] + p2;
}
/* 0x0C */ u16 mAnmTableNum[2];
/* 0x10 */ J3DAnmVtxColorIndexData* mAnmVtxColorIndexData[2];
}; // Size: 0x18
@@ -897,7 +908,7 @@ public:
*/
class J3DAnmVisibilityFull : public J3DAnmBase {
public:
J3DAnmVisibilityFull() : J3DAnmBase(0) {
J3DAnmVisibilityFull() : J3DAnmBase() {
mUpdateMaterialNum = 0;
field_0xe = 0;
mAnmTable = NULL;
@@ -32,7 +32,10 @@ public:
}
J3DDeformer* getDeformer() { return mDeformer; }
void setDeformer(J3DDeformer* deformer) { mDeformer = deformer; }
void setDeformer(J3DDeformer* deformer) {
J3D_ASSERT_NULLPTR(111, deformer);
mDeformer = deformer;
}
/* 0x00 */ f32 mMaxAngle;
/* 0x04 */ f32 mMinAngle;
@@ -49,7 +49,7 @@ public:
virtual void calc(J3DMtxBuffer*, Vec const&, f32 const (&)[3][4]);
virtual ~J3DJointTree() {}
J3DModelHierarchy const* getHierarchy() { return mHierarchy; }
const J3DModelHierarchy* getHierarchy() const { return mHierarchy; }
void setHierarchy(J3DModelHierarchy* hierarchy) { mHierarchy = hierarchy; }
void setBasicMtxCalc(J3DMtxCalc* calc) { mBasicMtxCalc = calc; }
u16 getWEvlpMtxNum() const { return mWEvlpMtxNum; }
@@ -45,7 +45,7 @@ public:
J3DShape* getShapeNodePointer(u16 idx) const { return mShapeTable.getShapeNodePointer(idx); }
J3DJoint* getJointNodePointer(u16 idx) const { return mJointTree.getJointNodePointer(idx); }
J3DJointTree& getJointTree() { return mJointTree; }
J3DModelHierarchy const* getHierarchy() { return mJointTree.getHierarchy(); }
const J3DModelHierarchy* getHierarchy() const { return mJointTree.getHierarchy(); }
void setHierarchy(J3DModelHierarchy* hierarchy) { mJointTree.setHierarchy(hierarchy); }
void setBasicMtxCalc(J3DMtxCalc* calc) { mJointTree.setBasicMtxCalc(calc); }
JUTNameTab* getJointName() const { return mJointTree.getJointName(); }
+1 -1
View File
@@ -66,7 +66,7 @@ public:
J3DFog* getFog() { return mPEBlock->getFog(); }
J3DTexMtx* getTexMtx(u32 idx) { return mTexGenBlock->getTexMtx(idx); }
u16 getIndex() { return mIndex; }
bool isDrawModeOpaTexEdge() { return (mMaterialMode & 3) == 0; }
BOOL isDrawModeOpaTexEdge() { return (mMaterialMode & 3) ? 1 : 0; }
J3DPEBlock* getPEBlock() { return mPEBlock; }
void onInvalid() { mInvalid = 1; }
u32 getTexGenNum() const { return mTexGenBlock->getTexGenNum(); }
+28
View File
@@ -135,6 +135,34 @@ public:
/* 0xC */ u32 mMaxSize;
}; // Size: 0x10
/**
* @ingroup jsystem-j3d
*
*/
class J3DTexMtxObj {
public:
Mtx& getMtx(u16 idx) {
J3D_ASSERT_RANGE(275, idx < mTexMtxNum);
return mpTexMtx[idx];
}
void setMtx(u16 idx, const Mtx mtx) {
J3D_ASSERT_RANGE(288, idx < mTexMtxNum);
MTXCopy(mtx, mpTexMtx[idx]);
}
Mtx44& getEffectMtx(u16 idx) {
J3D_ASSERT_RANGE(293, idx < mTexMtxNum);
return mpEffectMtx[idx];
}
u16 getNumTexMtx() const { return mTexMtxNum; }
/* 0x00 */ Mtx* mpTexMtx;
/* 0x04 */ Mtx44* mpEffectMtx;
/* 0x08 */ u16 mTexMtxNum;
};
/**
* @ingroup jsystem-j3d
*
@@ -8,34 +8,6 @@
class J3DTexMtx;
class J3DTexGenBlock;
/**
* @ingroup jsystem-j3d
*
*/
class J3DTexMtxObj {
public:
Mtx& getMtx(u16 idx) {
J3D_ASSERT_RANGE(275, idx < mTexMtxNum);
return mpTexMtx[idx];
}
void setMtx(u16 idx, const Mtx mtx) {
J3D_ASSERT_RANGE(288, idx < mTexMtxNum);
MTXCopy(mtx, mpTexMtx[idx]);
}
Mtx44& getEffectMtx(u16 idx) {
J3D_ASSERT_RANGE(293, idx < mTexMtxNum);
return mpEffectMtx[idx];
}
u16 getNumTexMtx() const { return mTexMtxNum; }
/* 0x00 */ Mtx* mpTexMtx;
/* 0x04 */ Mtx44* mpEffectMtx;
/* 0x08 */ u16 mTexMtxNum;
};
/**
* @ingroup jsystem-j3d
*
+8 -3
View File
@@ -11,6 +11,7 @@
*
*/
struct J3DLightInfo {
bool operator==(J3DLightInfo& other) const;
J3DLightInfo& operator=(J3DLightInfo const&);
/* 0x00 */ Vec mLightPosition;
@@ -31,6 +32,7 @@ struct J3DTextureSRTInfo {
/* 0x0C */ f32 mTranslationX;
/* 0x10 */ f32 mTranslationY;
bool operator==(J3DTextureSRTInfo&) const;
inline void operator=(J3DTextureSRTInfo const& other) {
#ifdef __MWERKS__
__REGISTER const f32* src = &other.mScaleX;
@@ -74,6 +76,7 @@ enum J3DTexMtxMode {
*
*/
struct J3DTexMtxInfo {
bool operator==(J3DTexMtxInfo& other) const;
J3DTexMtxInfo& operator=(J3DTexMtxInfo const&);
void setEffectMtx(Mtx);
@@ -93,7 +96,7 @@ struct J3DTexMtxInfo {
struct J3DIndTexMtxInfo {
J3DIndTexMtxInfo& operator=(J3DIndTexMtxInfo const&);
/* 0x00 */ Mtx23 field_0x0;
/* 0x18 */ u8 field_0x18;
/* 0x18 */ s8 field_0x18;
}; // Size: 0x1C
/**
@@ -101,7 +104,8 @@ struct J3DIndTexMtxInfo {
*
*/
struct J3DFogInfo {
J3DFogInfo& operator=(J3DFogInfo const&);
bool operator==(J3DFogInfo&) const;
J3DFogInfo& operator=(const J3DFogInfo&);
/* 0x00 */ u8 mType;
/* 0x01 */ u8 mAdjEnable;
@@ -119,7 +123,8 @@ struct J3DFogInfo {
*
*/
struct J3DNBTScaleInfo {
J3DNBTScaleInfo& operator=(J3DNBTScaleInfo const&);
bool operator==(const J3DNBTScaleInfo& other) const;
J3DNBTScaleInfo& operator=(const J3DNBTScaleInfo&);
/* 0x0 */ u8 mbHasScale;
/* 0x4 */ Vec mScale;
+3 -1
View File
@@ -18,7 +18,9 @@ private:
/* 0x4 */ ResTIMG* mpRes;
public:
J3DTexture(u16 num, ResTIMG* res) : mNum(num), unk_0x2(0), mpRes(res) {}
J3DTexture(u16 num, ResTIMG* res) : mNum(num), unk_0x2(0), mpRes(res) {
J3D_ASSERT_NULLPTR(52, res && num);
}
void loadGX(u16, GXTexMapID) const;
void entryNum(u16);
+14 -1
View File
@@ -16,8 +16,10 @@ class J3DVertexBuffer;
struct J3DVtxColorCalc {
void calc(J3DModel*);
virtual void calc(J3DVertexBuffer*);
virtual ~J3DVtxColorCalc() {}
bool checkFlag(u32 flag) { return mFlags & flag ? true : false; }
/* 0x0 */ void* vtable; // inlined vtable?
/* 0x4 */ u32 mFlags;
/* 0x8 */ J3DAnmVtxColor* mpVtxColor;
};
@@ -38,6 +40,7 @@ public:
void* getVtxNBTArray() const { return mVtxNBTArray; }
u32 getNrmNum() const { return mNrmNum; }
u32 getVtxNum() const { return mVtxNum; }
u32 getColNum() const { return mColNum; }
GXVtxAttrFmtList* getVtxAttrFmtList() const { return mVtxAttrFmtList; }
u8 getVtxPosFrac() const { return mVtxPosFrac; }
u8 getVtxNrmFrac() const { return mVtxNrmFrac; }
@@ -129,6 +132,12 @@ public:
mVtxNrmArray[1] = temp;
}
void swapVtxColArrayPointer() {
GXColor* temp = mVtxColArray[0];
mVtxColArray[0] = mVtxColArray[1];
mVtxColArray[1] = temp;
}
void* getVtxPosArrayPointer(int index) {
return mVtxPosArray[index];
}
@@ -137,6 +146,10 @@ public:
return mVtxNrmArray[index];
}
GXColor* getVtxColArrayPointer(int index) {
return mVtxColArray[index];
}
private:
/* 0x00 */ J3DVertexData* mVtxData;
/* 0x04 */ void* mVtxPosArray[2];
@@ -30,7 +30,7 @@ struct J3DJointFactory {
J3DJointInitData* mJointInitData;
u16* mIndexTable;
u16 getKind(int no) const { return mJointInitData[mIndexTable[no]].mKind; }
u8 getKind(int no) const { return mJointInitData[mIndexTable[no]].mKind; }
u8 getScaleCompensate(int no) const { return mJointInitData[mIndexTable[no]].mScaleCompensate; }
const J3DTransformInfo& getTransformInfo(int no) const {
return mJointInitData[mIndexTable[no]].mTransformInfo;
@@ -77,7 +77,7 @@ public:
const u8 newDither(int) const;
J3DNBTScale newNBTScale(int) const;
u16 getMaterialID(u16 idx) { return mpMaterialID[idx]; }
u16 getMaterialID(int idx) const { return mpMaterialID[idx]; }
u8 getMaterialMode(int idx) const { return mpMaterialInitData[mpMaterialID[idx]].mMaterialMode; }
/* 0x00 */ u16 mMaterialNum;
@@ -333,6 +333,7 @@ public:
class J3DModelLoaderDataBase {
public:
static J3DModelData* load(void const* i_data, u32 i_flags);
static J3DModelData* loadBinaryDisplayList(const void* i_data, u32 flags);
};
/**
@@ -66,7 +66,7 @@ struct J3DShapeFactory {
/* 0x18 */ J3DShapeDrawInitData* mDrawInitData;
/* 0x1C */ u8* mVcdVatCmdBuffer;
u32 getMtxGroupNum(int no) const { return mShapeInitData[mIndexTable[no]].mMtxGroupNum; }
u16 getMtxGroupNum(int no) const { return mShapeInitData[mIndexTable[no]].mMtxGroupNum; }
GXVtxDescList* getVtxDescList(int no) const { return (GXVtxDescList*)((u8*)mVtxDescList + mShapeInitData[mIndexTable[no]].mVtxDescListIndex); }
f32 getRadius(int no) const { return mShapeInitData[mIndexTable[no]].mRadius; }
Vec& getMin(int no) const { return mShapeInitData[mIndexTable[no]].mMin; }
@@ -565,9 +565,8 @@ f32 J3DGetKeyFrameInterpolation(f32 frame, J3DAnmKeyTableBase* pKeyTable, T* pDa
}
if (pKeyTable->mType == 0) {
u32 idx = pKeyTable->mMaxFrame - 1;
if (pData[idx * 3] <= frame) {
return pData[idx * 3 + 1];
if (pData[(pKeyTable->mMaxFrame - 1) * 3] <= frame) {
return pData[(pKeyTable->mMaxFrame - 1) * 3 + 1];
}
u32 uVar7 = pKeyTable->mMaxFrame;
@@ -585,9 +584,8 @@ f32 J3DGetKeyFrameInterpolation(f32 frame, J3DAnmKeyTableBase* pKeyTable, T* pDa
f32 interpolated = J3DHermiteInterpolation(frame, &pData[0], &pData[1], &pData[2], &pData[3], &pData[4], &pData[5]);
return interpolated;
} else {
u32 idx = pKeyTable->mMaxFrame - 1;
if (pData[idx * 4] <= frame) {
return pData[idx * 4 + 1];
if (pData[(pKeyTable->mMaxFrame - 1) * 4] <= frame) {
return pData[(pKeyTable->mMaxFrame - 1) * 4 + 1];
}
u32 var_r27 = pKeyTable->mMaxFrame;
@@ -252,6 +252,10 @@ void J3DDeformer::deform(J3DVertexBuffer* i_buffer, u16 param_1, f32* i_weights)
}
}
static void dummy(J3DDeformData* data) {
data->getClusterNum();
}
void J3DDeformer::normalizeWeight(int i_keyNum, f32* i_weights) {
f32 totalWeight = 0.0f;
for (u16 i = 0; i < i_keyNum; i++) {
+53 -52
View File
@@ -10,16 +10,16 @@
void J3DMtxCalcJ3DSysInitBasic::init(Vec const& scale, Mtx const& mtx) {
J3DSys::mCurrentS = scale;
J3DSys::mParentS = (Vec){1.0f, 1.0f, 1.0f};
JMAMTXApplyScale(mtx, J3DSys::mCurrentMtx, J3DSys::mCurrentS.x, J3DSys::mCurrentS.y,
J3DSys::mCurrentS.z);
Vec init = {1.0f, 1.0f, 1.0f};
J3DSys::mParentS = init;
JMAMTXApplyScale(mtx, J3DSys::mCurrentMtx, scale.x, scale.y, scale.z);
}
void J3DMtxCalcJ3DSysInitMaya::init(Vec const& scale, Mtx const& mtx) {
J3DSys::mParentS = (Vec){1.0f, 1.0f, 1.0f};
Vec init = {1.0f, 1.0f, 1.0f};
J3DSys::mParentS = init;
J3DSys::mCurrentS = scale;
JMAMTXApplyScale(mtx, J3DSys::mCurrentMtx, J3DSys::mCurrentS.x, J3DSys::mCurrentS.y,
J3DSys::mCurrentS.z);
JMAMTXApplyScale(mtx, J3DSys::mCurrentMtx, scale.x, scale.y, scale.z);
}
J3DMtxBuffer* J3DMtxCalc::mMtxBuffer;
@@ -35,8 +35,9 @@ inline s32 checkScaleOne(const Vec& param_0) {
}
void J3DMtxCalcCalcTransformBasic::calcTransform(J3DTransformInfo const& transInfo) {
J3DJoint* joint = J3DMtxCalc::getJoint();
J3DMtxBuffer* mtxBuf = J3DMtxCalc::getMtxBuffer();
u16 jntNo = J3DMtxCalc::getJoint()->getJntNo();
u16 jntNo = joint->getJntNo();
MtxP anmMtx = mtxBuf->getAnmMtx(jntNo);
@@ -58,8 +59,9 @@ void J3DMtxCalcCalcTransformBasic::calcTransform(J3DTransformInfo const& transIn
}
void J3DMtxCalcCalcTransformSoftimage::calcTransform(J3DTransformInfo const& transInfo) {
J3DJoint* joint = J3DMtxCalc::getJoint();
J3DMtxBuffer* mtxBuf = J3DMtxCalc::getMtxBuffer();
u16 jntNo = J3DMtxCalc::getJoint()->getJntNo();
u16 jntNo = joint->getJntNo();
MtxP anmMtx = mtxBuf->getAnmMtx(jntNo);
@@ -104,20 +106,22 @@ void J3DMtxCalcCalcTransformMaya::calcTransform(J3DTransformInfo const& transInf
transInfo.mScale.z);
}
if (joint->getScaleCompensate() == 1) {
f32 invX = JMath::fastReciprocal(J3DSys::mParentS.x);
f32 invY = JMath::fastReciprocal(J3DSys::mParentS.y);
f32 invZ = JMath::fastReciprocal(J3DSys::mParentS.z);
u8 scaleCompensate = joint->getScaleCompensate();
if (scaleCompensate == 1) {
Vec inv;
inv.x = JMath::fastReciprocal(J3DSys::mParentS.x);
inv.y = JMath::fastReciprocal(J3DSys::mParentS.y);
inv.z = JMath::fastReciprocal(J3DSys::mParentS.z);
anmMtx[0][0] *= invX;
anmMtx[0][1] *= invX;
anmMtx[0][2] *= invX;
anmMtx[1][0] *= invY;
anmMtx[1][1] *= invY;
anmMtx[1][2] *= invY;
anmMtx[2][0] *= invZ;
anmMtx[2][1] *= invZ;
anmMtx[2][2] *= invZ;
anmMtx[0][0] *= inv.x;
anmMtx[0][1] *= inv.x;
anmMtx[0][2] *= inv.x;
anmMtx[1][0] *= inv.y;
anmMtx[1][1] *= inv.y;
anmMtx[1][2] *= inv.y;
anmMtx[2][0] *= inv.z;
anmMtx[2][1] *= inv.z;
anmMtx[2][2] *= inv.z;
}
MTXConcat(J3DSys::mCurrentMtx, anmMtx, J3DSys::mCurrentMtx);
@@ -131,13 +135,13 @@ void J3DMtxCalcCalcTransformMaya::calcTransform(J3DTransformInfo const& transInf
void J3DJoint::appendChild(J3DJoint* pChild) {
if (mChild == NULL) {
mChild = pChild;
} else {
J3DJoint* curChild = mChild;
while (curChild->getYounger() != NULL) {
curChild = curChild->getYounger();
}
curChild->setYounger(pChild);
return;
}
J3DJoint* curChild = mChild;
while (curChild->getYounger() != NULL) {
curChild = curChild->getYounger();
}
curChild->setYounger(pChild);
}
J3DJoint::J3DJoint() {
@@ -149,7 +153,8 @@ J3DJoint::J3DJoint() {
mJntNo = 0;
mKind = 1;
mScaleCompensate = false;
__memcpy(&mTransformInfo, &j3dDefaultTransformInfo, sizeof(J3DTransformInfo));
J3DTransformInfo* r30 = &mTransformInfo;
void* r29 = __memcpy(r30, &j3dDefaultTransformInfo, sizeof(J3DTransformInfo));
mBoundingSphereRadius = 0.0f;
mMtxCalc = NULL;
mMesh = NULL;
@@ -173,16 +178,16 @@ void J3DJoint::entryIn() {
j3dSys.getModel()->getShapePacket(mesh->getShape()->getIndex());
if (!matPacket->isLocked()) {
if (mesh->getMaterialAnm()) {
J3DMaterialAnm* piVar8 = mesh->getMaterialAnm();
piVar8->calc(mesh);
mesh->getMaterialAnm()->calc(mesh);
}
mesh->calc(anmMtx);
}
mesh->setCurrentMtx();
matPacket->setMaterialAnmID(mesh->getMaterialAnm());
matPacket->setShapePacket(shapePacket);
J3DDrawBuffer* drawBuffer = j3dSys.getDrawBuffer(mesh->isDrawModeOpaTexEdge());
if ((u8)matPacket->entry(drawBuffer)) {
bool isDrawModeOpaTexEdge = mesh->isDrawModeOpaTexEdge() == FALSE;
u8 r24 = matPacket->entry(j3dSys.getDrawBuffer(isDrawModeOpaTexEdge));
if (r24) {
j3dSys.setMatPacket(matPacket);
J3DDrawBuffer::entryNum++;
mesh->makeDisplayList();
@@ -197,18 +202,18 @@ J3DMtxCalc* J3DJoint::mCurrentMtxCalc;
void J3DJoint::recursiveCalc() {
J3DMtxCalc* prevMtxCalc = NULL;
Mtx prevCurrentMtx;
mDoMtx_copy(J3DSys::mCurrentMtx, prevCurrentMtx);
f32 currentX = J3DSys::mCurrentS.x;
f32 currentY = J3DSys::mCurrentS.y;
f32 currentZ = J3DSys::mCurrentS.z;
f32 parentX = J3DSys::mParentS.x;
f32 parentY = J3DSys::mParentS.y;
f32 parentZ = J3DSys::mParentS.z;
MTXCopy(J3DSys::mCurrentMtx, prevCurrentMtx);
Vec current, parent;
current = J3DSys::mCurrentS;
parent = J3DSys::mParentS;
if (getMtxCalc() != NULL) {
prevMtxCalc = getCurrentMtxCalc();
J3DMtxCalc* piVar2 = this->getMtxCalc();
setCurrentMtxCalc(piVar2);
J3DMtxCalc::setJoint(this);
#if DEBUG
J3DMtxCalc::setMtxBuffer(J3DMtxCalc::getMtxBuffer());
#endif
piVar2->calc();
} else {
if (getCurrentMtxCalc() != NULL) {
@@ -223,18 +228,14 @@ void J3DJoint::recursiveCalc() {
(*jointCallback)(this, 0);
}
J3DJoint* child = getChild();
if (child != NULL) {
child->recursiveCalc();
J3DJoint* joint = getChild();
if (joint != NULL) {
joint->recursiveCalc();
}
mDoMtx_copy(prevCurrentMtx, J3DSys::mCurrentMtx);
MTXCopy(prevCurrentMtx, J3DSys::mCurrentMtx);
J3DSys::mCurrentS.x = currentX;
J3DSys::mCurrentS.y = currentY;
J3DSys::mCurrentS.z = currentZ;
J3DSys::mParentS.x = parentX;
J3DSys::mParentS.y = parentY;
J3DSys::mParentS.z = parentZ;
J3DSys::mCurrentS = current;
J3DSys::mParentS = parent;
if (prevMtxCalc != NULL) {
setCurrentMtxCalc(prevMtxCalc);
@@ -243,8 +244,8 @@ void J3DJoint::recursiveCalc() {
(*jointCallback)(this, 1);
}
J3DJoint* younger = getYounger();
if (younger != NULL) {
younger->recursiveCalc();
joint = getYounger();
if (joint != NULL) {
joint->recursiveCalc();
}
}
+2 -2
View File
@@ -148,8 +148,8 @@ s32 J3DModel::createMatPacket(J3DModelData* pModelData, u32 mdlFlags) {
} else {
if (pModelData->getModelDataType() == 1) {
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
matPacket->mpDisplayListObj = materialNode->getSharedDisplayListObj();
matPacket->setDisplayListObj(matPacket->mpDisplayListObj);
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
matPacket->setDisplayListObj(dlobj);
} else {
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
ret = dlobj->single_To_Double();
+10 -7
View File
@@ -409,7 +409,10 @@ void J3DMtxBuffer::calcDrawMtx(u32 mdlFlag, Vec const& param_1, Mtx const& param
MtxP viewMtx;
Mtx viewBaseMtx;
u16 fullWgtNum;
u16 fullWgtNum; // r25
u16 local_68;
u16 local_6a;
u16 local_6c;
switch (mdlFlag) {
case 0:
@@ -424,19 +427,19 @@ void J3DMtxBuffer::calcDrawMtx(u32 mdlFlag, Vec const& param_1, Mtx const& param
}
return;
case 1:
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
for (u16 i = 0; i < fullWgtNum; i++) {
local_68 = mJointTree->getDrawFullWgtMtxNum();
for (u16 i = 0; i < local_68; i++) {
MTXCopy(getAnmMtx(mJointTree->getDrawMtxIndex(i)), *getDrawMtx(i));
}
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
for (u16 i = 0; i < fullWgtNum; i++) {
local_6a = mJointTree->getDrawFullWgtMtxNum();
for (u16 i = 0; i < local_6a; i++) {
MTXCopy(getWeightAnmMtx(i), *getDrawMtx(mJointTree->getDrawFullWgtMtxNum() + i));
}
break;
case 2:
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), param_1, param_2, viewBaseMtx);
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
for (u16 i = 0; i < fullWgtNum; i++) {
local_6c = mJointTree->getDrawFullWgtMtxNum();
for (u16 i = 0; i < local_6c; i++) {
MTXConcat(viewBaseMtx, getAnmMtx(mJointTree->getDrawMtxIndex(i)), *getDrawMtx(i));
}
if (mJointTree->getDrawMtxNum() > mJointTree->getDrawFullWgtMtxNum()) {

Some files were not shown because too many files have changed in this diff Show More