mirror of https://github.com/zeldaret/tp.git
J3D debug (#3037)
* J3DGraphBase debug * J3DGraphAnimator debug * J3DGraphLoader debug
This commit is contained in:
parent
dd03bf861f
commit
1a65a6bbbd
|
|
@ -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(); }
|
||||
|
|
|
|||
|
|
@ -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(); }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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++) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <string>
|
||||
|
|
@ -675,4 +676,23 @@ void J3DVtxColorCalc::calc(J3DModel* pModel) {
|
|||
calc(pModel->getVertexBuffer());
|
||||
}
|
||||
|
||||
void J3DVtxColorCalc::calc(J3DVertexBuffer* buffer) {
|
||||
J3D_ASSERT_NULLPTR(1366, buffer != NULL);
|
||||
if (checkFlag(1) && mpVtxColor) {
|
||||
buffer->swapVtxColArrayPointer();
|
||||
u16 anmTableNum = mpVtxColor->getAnmTableNum(0);
|
||||
GXColor* colorArray = buffer->getVtxColArrayPointer(0);
|
||||
for (u32 i = 0; i < anmTableNum; i++) {
|
||||
GXColor color;
|
||||
mpVtxColor->getColor(0, i, &color);
|
||||
J3DAnmVtxColorIndexData* r28 = mpVtxColor->getAnmVtxColorIndexData(0, i);
|
||||
for (u32 j = 0; j < r28->mNum; j++) {
|
||||
colorArray[((u16*)r28->mpData)[j]] = color;
|
||||
}
|
||||
}
|
||||
DCStoreRange(colorArray, buffer->getVertexData()->getColNum() * 4);
|
||||
buffer->setCurrentVtxCol(colorArray);
|
||||
}
|
||||
}
|
||||
|
||||
J3DSkinDeform::~J3DSkinDeform() {}
|
||||
|
|
|
|||
|
|
@ -72,9 +72,11 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
|||
GXVtxDescList* vtxDesc = getVtxDesc();
|
||||
s32 attrCount = 0;
|
||||
|
||||
for (; vtxDesc->attr != GX_VA_NULL; attrCount++, vtxDesc++) {
|
||||
if (vtxDesc->attr == GX_VA_PNMTXIDX)
|
||||
for (; vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
|
||||
if (vtxDesc->attr == GX_VA_PNMTXIDX) {
|
||||
attrIdx = stride;
|
||||
}
|
||||
attrCount++;
|
||||
}
|
||||
|
||||
if (attrIdx == -1)
|
||||
|
|
@ -85,7 +87,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
|||
|
||||
vtxDesc = getVtxDesc();
|
||||
GXVtxDescList* dst = newVtxDesc;
|
||||
for (; vtxDesc->attr != GX_VA_NULL; dst++, vtxDesc++) {
|
||||
for (; vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
|
||||
if ((attr < vtxDesc->attr) && !inserted) {
|
||||
dst->attr = attr;
|
||||
dst->type = GX_DIRECT;
|
||||
|
|
@ -98,6 +100,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
|||
dst->attr = vtxDesc->attr;
|
||||
dst->type = vtxDesc->type;
|
||||
stride = stride + kSize[vtxDesc->type];
|
||||
dst++;
|
||||
}
|
||||
|
||||
dst->attr = GX_VA_NULL;
|
||||
|
|
|
|||
|
|
@ -271,9 +271,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
|||
MTXInverse(j3dSys.getViewMtx(), sp_a8);
|
||||
MTXConcat(sp_e8, sp_a8, sp_e8);
|
||||
MTXConcat(sp_e8, param_0, sp_e8);
|
||||
sp_e8[2][3] = 0.0f;
|
||||
sp_e8[1][3] = 0.0f;
|
||||
sp_e8[0][3] = 0.0f;
|
||||
sp_e8[0][3] = sp_e8[1][3] = sp_e8[2][3] = 0.0f;
|
||||
mtx = &sp_e8;
|
||||
break;
|
||||
}
|
||||
|
|
@ -415,6 +413,11 @@ void J3DShapeMtxMulti::calcNBTScale(Vec const& param_0, Mtx33* param_1, Mtx33* p
|
|||
}
|
||||
|
||||
void J3DShapeMtxMultiConcatView::load() const {
|
||||
static u8 mtxCache[20] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
sMtxPtrTbl[0] = j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(0);
|
||||
sMtxPtrTbl[1] = j3dSys.getModel()->getWeightAnmMtx(0);
|
||||
|
||||
|
|
@ -434,8 +437,7 @@ void J3DShapeMtxMultiConcatView::load() const {
|
|||
|
||||
int use_mtx_num = mUseMtxNum;
|
||||
for (int i = 0; i < use_mtx_num; i++) {
|
||||
u32 current_pipeline = sCurrentPipeline;
|
||||
J3DShapeMtxConcatView_LoadFunc func = sMtxLoadLODPipeline[current_pipeline];
|
||||
J3DShapeMtxConcatView_LoadFunc func = sMtxLoadLODPipeline[sCurrentPipeline];
|
||||
|
||||
if (mUseMtxIndexTable[i] != 0xffff) {
|
||||
u16 important_mtx_index = important_mtx_indices[mUseMtxIndexTable[i]];
|
||||
|
|
@ -546,8 +548,5 @@ void J3DShapeMtxYBBoardConcatView::load() const {
|
|||
}
|
||||
|
||||
static void dummy() {
|
||||
static u8 mtxCache[20] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,41 @@
|
|||
#include "JSystem/J3DGraphBase/J3DStruct.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
bool J3DTextureSRTInfo::operator==(J3DTextureSRTInfo& other) const {
|
||||
if (mScaleX == other.mScaleX &&
|
||||
mScaleY == other.mScaleY &&
|
||||
mRotation == other.mRotation &&
|
||||
mTranslationX == other.mTranslationX &&
|
||||
mTranslationY == other.mTranslationY
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool J3DLightInfo::operator==(J3DLightInfo& other) const {
|
||||
if (mLightPosition.x == other.mLightPosition.x &&
|
||||
mLightPosition.y == other.mLightPosition.y &&
|
||||
mLightPosition.z == other.mLightPosition.z &&
|
||||
mLightDirection.x == other.mLightDirection.x &&
|
||||
mLightDirection.y == other.mLightDirection.y &&
|
||||
mLightDirection.z == other.mLightDirection.z &&
|
||||
mColor.r == other.mColor.r &&
|
||||
mColor.g == other.mColor.g &&
|
||||
mColor.b == other.mColor.b &&
|
||||
mColor.a == other.mColor.a &&
|
||||
mCosAtten.x == other.mCosAtten.x &&
|
||||
mCosAtten.y == other.mCosAtten.y &&
|
||||
mCosAtten.z == other.mCosAtten.z &&
|
||||
mDistAtten.x == other.mDistAtten.x &&
|
||||
mDistAtten.y == other.mDistAtten.y &&
|
||||
mDistAtten.z == other.mDistAtten.z
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
J3DLightInfo& J3DLightInfo::operator=(J3DLightInfo const& param_0) {
|
||||
JMath::gekko_ps_copy6(&mLightPosition, ¶m_0.mLightPosition);
|
||||
mColor = param_0.mColor;
|
||||
|
|
@ -14,6 +49,42 @@ J3DLightInfo& J3DLightInfo::operator=(J3DLightInfo const& param_0) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool J3DTexMtxInfo::operator==(J3DTexMtxInfo& other) const {
|
||||
if (mProjection != other.mProjection ||
|
||||
mInfo != other.mInfo ||
|
||||
!(mSRT == other.mSRT)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (mEffectMtx[0][0] != other.mEffectMtx[0][0] ||
|
||||
mEffectMtx[0][1] != other.mEffectMtx[0][1] ||
|
||||
mEffectMtx[0][2] != other.mEffectMtx[0][2] ||
|
||||
mEffectMtx[0][3] != other.mEffectMtx[0][3] ||
|
||||
mEffectMtx[1][0] != other.mEffectMtx[1][0] ||
|
||||
mEffectMtx[1][1] != other.mEffectMtx[1][1] ||
|
||||
mEffectMtx[1][2] != other.mEffectMtx[1][2] ||
|
||||
mEffectMtx[1][3] != other.mEffectMtx[1][3] ||
|
||||
mEffectMtx[2][0] != other.mEffectMtx[2][0] ||
|
||||
mEffectMtx[2][1] != other.mEffectMtx[2][1] ||
|
||||
mEffectMtx[2][2] != other.mEffectMtx[2][2] ||
|
||||
mEffectMtx[2][3] != other.mEffectMtx[2][3] ||
|
||||
mEffectMtx[3][0] != other.mEffectMtx[3][0] ||
|
||||
mEffectMtx[3][1] != other.mEffectMtx[3][1] ||
|
||||
mEffectMtx[3][2] != other.mEffectMtx[3][2] ||
|
||||
mEffectMtx[3][3] != other.mEffectMtx[3][3]
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
mCenter.x != other.mCenter.x ||
|
||||
mCenter.y != other.mCenter.y ||
|
||||
mCenter.z != other.mCenter.z
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
J3DTexMtxInfo& J3DTexMtxInfo::operator=(J3DTexMtxInfo const& param_0) {
|
||||
mProjection = param_0.mProjection;
|
||||
mInfo = param_0.mInfo;
|
||||
|
|
@ -47,7 +118,30 @@ J3DIndTexMtxInfo& J3DIndTexMtxInfo::operator=(J3DIndTexMtxInfo const& param_0) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
J3DFogInfo& J3DFogInfo::operator=(J3DFogInfo const& param_0) {
|
||||
bool J3DFogInfo::operator==(J3DFogInfo& other) const {
|
||||
if (mType == other.mType &&
|
||||
mAdjEnable == other.mAdjEnable &&
|
||||
mCenter == other.mCenter &&
|
||||
mStartZ == other.mStartZ &&
|
||||
mEndZ == other.mEndZ &&
|
||||
mNearZ == other.mNearZ &&
|
||||
mFarZ == other.mFarZ &&
|
||||
mColor.r == other.mColor.r &&
|
||||
mColor.g == other.mColor.g &&
|
||||
mColor.b == other.mColor.b &&
|
||||
mColor.a == other.mColor.a
|
||||
) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (mFogAdjTable.r[i] != other.mFogAdjTable.r[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
J3DFogInfo& J3DFogInfo::operator=(const J3DFogInfo& param_0) {
|
||||
mType = param_0.mType;
|
||||
mAdjEnable = param_0.mAdjEnable;
|
||||
mCenter = param_0.mCenter;
|
||||
|
|
@ -55,15 +149,31 @@ J3DFogInfo& J3DFogInfo::operator=(J3DFogInfo const& param_0) {
|
|||
mEndZ = param_0.mEndZ;
|
||||
mNearZ = param_0.mNearZ;
|
||||
mFarZ = param_0.mFarZ;
|
||||
mColor = param_0.mColor;
|
||||
mColor.r = param_0.mColor.r;
|
||||
mColor.g = param_0.mColor.g;
|
||||
mColor.b = param_0.mColor.b;
|
||||
mColor.a = param_0.mColor.a;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
mFogAdjTable.r[i] = param_0.mFogAdjTable.r[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DNBTScaleInfo& J3DNBTScaleInfo::operator=(J3DNBTScaleInfo const& param_0) {
|
||||
mbHasScale = param_0.mbHasScale;
|
||||
mScale = param_0.mScale;
|
||||
bool J3DNBTScaleInfo::operator==(const J3DNBTScaleInfo& other) const {
|
||||
if (mbHasScale == other.mbHasScale &&
|
||||
mScale.x == other.mScale.x &&
|
||||
mScale.y == other.mScale.y &&
|
||||
mScale.z == other.mScale.z
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
J3DNBTScaleInfo& J3DNBTScaleInfo::operator=(const J3DNBTScaleInfo& other) {
|
||||
mbHasScale = other.mbHasScale;
|
||||
mScale.x = other.mScale.x;
|
||||
mScale.y = other.mScale.y;
|
||||
mScale.z = other.mScale.z;
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ J3DSys::J3DSys() {
|
|||
}
|
||||
|
||||
void J3DSys::loadPosMtxIndx(int addr, u16 indx) const {
|
||||
// J3DFifoLoadPosMtxIndx(indx, addr * 3); // matches debug, not retail
|
||||
//J3DFifoLoadPosMtxIndx(indx, addr * 3); // matches debug, not retail
|
||||
J3DFifoLoadIndx(GX_LOAD_INDX_A, indx, 0xB000 | ((u16)(addr * 0x0C)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void J3DTexMtx::calcTexMtx(const Mtx param_0) {
|
|||
};
|
||||
|
||||
u32 r28 = mTexMtxInfo.mInfo & 0x3f;
|
||||
u32 r30 = (mTexMtxInfo.mInfo >> 7) & 1;
|
||||
u32 r30 = u32(mTexMtxInfo.mInfo & 0x80) >> 7;
|
||||
switch (r28) {
|
||||
case 8:
|
||||
case 9:
|
||||
|
|
@ -176,7 +176,7 @@ void J3DTexMtx::calcPostTexMtx(const Mtx param_0) {
|
|||
};
|
||||
|
||||
u32 r29 = mTexMtxInfo.mInfo & 0x3f;
|
||||
u32 r30 = (mTexMtxInfo.mInfo >> 7) & 1;
|
||||
u32 r30 = u32(mTexMtxInfo.mInfo & 0x80) >> 7;
|
||||
switch (r29) {
|
||||
case 8:
|
||||
case 11:
|
||||
|
|
|
|||
|
|
@ -55,18 +55,22 @@ void J3DCalcBBoardMtx(__REGISTER Mtx mtx) {
|
|||
|
||||
__REGISTER f32 zero = 0.0f;
|
||||
// zero out gaps of zeroes
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
#if DEBUG || !defined(__MWERKS__)
|
||||
mtx[0][1] = 0.0f;
|
||||
mtx[0][2] = 0.0f;
|
||||
mtx[2][0] = 0.0f;
|
||||
mtx[2][1] = 0.0f;
|
||||
#else // clang-format off
|
||||
asm {
|
||||
psq_st zero, 0x04(mtx), 0, 0
|
||||
|
||||
psq_st zero, 0x20(mtx), 0, 0
|
||||
}
|
||||
#endif // clang-format on
|
||||
|
||||
mtx[0][0] = x;
|
||||
mtx[1][0] = zero;
|
||||
mtx[1][0] = 0.0f;
|
||||
mtx[1][1] = y;
|
||||
mtx[1][2] = zero;
|
||||
mtx[1][2] = 0.0f;
|
||||
mtx[2][2] = z;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -210,6 +210,10 @@ s32 J3DVertexBuffer::allocTransformedVtxNrmArray() {
|
|||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
static void dummy(J3DVertexData* vertexData) {
|
||||
vertexData->getColNum();
|
||||
}
|
||||
|
||||
J3DDrawMtxData::J3DDrawMtxData() {
|
||||
mEntryNum = 0;
|
||||
mDrawMtxFlag = NULL;
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@
|
|||
#include "dolphin/os.h"
|
||||
|
||||
J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseFlag flag) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
J3D_ASSERT_NULLPTR(48, i_data);
|
||||
if (!i_data) {
|
||||
return NULL;
|
||||
}
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
if (header->mMagic == 'J3D1') {
|
||||
switch (header->mType) {
|
||||
case 'bck1': {
|
||||
|
|
@ -90,9 +91,10 @@ J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseF
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void J3DAnmLoaderDataBase::setResource(J3DAnmBase* param_1, const void* param_2) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_2;
|
||||
if (!header) {
|
||||
void J3DAnmLoaderDataBase::setResource(J3DAnmBase* param_1, const void* i_data) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
J3D_ASSERT_NULLPTR(188, i_data);
|
||||
if (!i_data) {
|
||||
return;
|
||||
}
|
||||
if (header->mMagic != 'J3D1') {
|
||||
|
|
@ -101,64 +103,64 @@ void J3DAnmLoaderDataBase::setResource(J3DAnmBase* param_1, const void* param_2)
|
|||
switch (header->mType) {
|
||||
case 'bck1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bpk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'blk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'btk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'brk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
if (param_1->getKind() == 5) {
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'bxk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bca1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bpa1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'btp1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bla1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bxa1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bva1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
@ -176,8 +178,9 @@ J3DAnmKeyLoader_v15::J3DAnmKeyLoader_v15() {}
|
|||
|
||||
J3DAnmKeyLoader_v15::~J3DAnmKeyLoader_v15() {}
|
||||
|
||||
J3DAnmBase* J3DAnmFullLoader_v15::load(const void* param_1) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_1;
|
||||
J3DAnmBase* J3DAnmFullLoader_v15::load(const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(357, i_data);
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
const JUTDataBlockHeader* block = &header->mFirstBlock;
|
||||
for (int i = 0; i < header->mBlockNum; i++) {
|
||||
switch (block->mType) {
|
||||
|
|
@ -203,49 +206,59 @@ J3DAnmBase* J3DAnmFullLoader_v15::load(const void* param_1) {
|
|||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
return mAnm;
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setResource(J3DAnmBase* param_1, const void* param_2) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_2;
|
||||
void J3DAnmFullLoader_v15::setResource(J3DAnmBase* param_1, const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(416, i_data);
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
const JUTDataBlockHeader* block = &header->mFirstBlock;
|
||||
for (int i = 0; i < header->mBlockNum; i++) {
|
||||
switch (block->mType) {
|
||||
case 'ANF1':
|
||||
JUT_ASSERT_MSG(428, param_1->getKind() == 9, "Error: Resource type inconsistency");
|
||||
setAnmTransform((J3DAnmTransformFull*)param_1, (const J3DAnmTransformFullData*)block);
|
||||
break;
|
||||
case 'PAF1':
|
||||
JUT_ASSERT_MSG(435, param_1->getKind() == 10, "Error: Resource type inconsistency");
|
||||
setAnmColor((J3DAnmColorFull*)param_1, (const J3DAnmColorFullData*)block);
|
||||
break;
|
||||
case 'TPT1':
|
||||
JUT_ASSERT_MSG(441, param_1->getKind() == 2, "Error: Resource type inconsistency");
|
||||
setAnmTexPattern((J3DAnmTexPattern*)param_1, (const J3DAnmTexPatternFullData*)block);
|
||||
break;
|
||||
case 'CLF1':
|
||||
JUT_ASSERT_MSG(448, param_1->getKind() == 12, "Error: Resource type inconsistency");
|
||||
setAnmCluster((J3DAnmClusterFull*)param_1, (const J3DAnmClusterFullData*)block);
|
||||
break;
|
||||
case 'VAF1':
|
||||
JUT_ASSERT_MSG(454, param_1->getKind() == 6, "Error: Resource type inconsistency");
|
||||
setAnmVisibility((J3DAnmVisibilityFull*)param_1,
|
||||
(const J3DAnmVisibilityFullData*)block);
|
||||
break;
|
||||
case 'VCF1':
|
||||
JUT_ASSERT_MSG(461, param_1->getKind() == 14, "Error: Resource type inconsistency");
|
||||
setAnmVtxColor((J3DAnmVtxColorFull*)param_1, (const J3DAnmVtxColorFullData*)block);
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmTransform(const J3DAnmTransformFullData* param_1) {
|
||||
setAnmTransform((J3DAnmTransformFull*)mAnm, param_1);
|
||||
J3DAnmTransformFull* anm = (J3DAnmTransformFull*)mAnm;
|
||||
setAnmTransform(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmTransform(J3DAnmTransformFull* param_1,
|
||||
const J3DAnmTransformFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(504, param_1);
|
||||
J3D_ASSERT_NULLPTR(505, param_2);
|
||||
param_1->field_0x1e = param_2->field_0xc;
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
|
|
@ -259,11 +272,14 @@ void J3DAnmFullLoader_v15::setAnmTransform(J3DAnmTransformFull* param_1,
|
|||
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmColor(const J3DAnmColorFullData* param_1) {
|
||||
setAnmColor((J3DAnmColorFull*)mAnm, param_1);
|
||||
J3DAnmColorFull* anm = (J3DAnmColorFull*)mAnm;
|
||||
setAnmColor(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmColor(J3DAnmColorFull* param_1,
|
||||
const J3DAnmColorFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(550, param_1);
|
||||
J3D_ASSERT_NULLPTR(551, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
|
|
@ -281,11 +297,14 @@ void J3DAnmFullLoader_v15::setAnmColor(J3DAnmColorFull* param_1,
|
|||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmTexPattern(const J3DAnmTexPatternFullData* param_1) {
|
||||
setAnmTexPattern((J3DAnmTexPattern*)mAnm, param_1);
|
||||
J3DAnmTexPattern* anm = (J3DAnmTexPattern*)mAnm;
|
||||
setAnmTexPattern(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmTexPattern(J3DAnmTexPattern* param_1,
|
||||
const J3DAnmTexPatternFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(603, param_1);
|
||||
J3D_ASSERT_NULLPTR(604, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
|
|
@ -301,11 +320,14 @@ void J3DAnmFullLoader_v15::setAnmTexPattern(J3DAnmTexPattern* param_1,
|
|||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmVisibility(const J3DAnmVisibilityFullData* param_1) {
|
||||
setAnmVisibility((J3DAnmVisibilityFull*)mAnm, param_1);
|
||||
J3DAnmVisibilityFull* anm = (J3DAnmVisibilityFull*)mAnm;
|
||||
setAnmVisibility(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmVisibility(J3DAnmVisibilityFull* param_1,
|
||||
const J3DAnmVisibilityFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(654, param_1);
|
||||
J3D_ASSERT_NULLPTR(655, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
|
|
@ -317,11 +339,14 @@ void J3DAnmFullLoader_v15::setAnmVisibility(J3DAnmVisibilityFull* param_1,
|
|||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmCluster(const J3DAnmClusterFullData* param_1) {
|
||||
setAnmCluster((J3DAnmClusterFull*)mAnm, param_1);
|
||||
J3DAnmClusterFull* anm = (J3DAnmClusterFull*)mAnm;
|
||||
setAnmCluster(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmCluster(J3DAnmClusterFull* param_1,
|
||||
const J3DAnmClusterFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(697, param_1);
|
||||
J3D_ASSERT_NULLPTR(698, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
|
|
@ -331,11 +356,14 @@ void J3DAnmFullLoader_v15::setAnmCluster(J3DAnmClusterFull* param_1,
|
|||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmVtxColor(const J3DAnmVtxColorFullData* param_1) {
|
||||
setAnmVtxColor((J3DAnmVtxColorFull*)mAnm, param_1);
|
||||
J3DAnmVtxColorFull* anm = (J3DAnmVtxColorFull*)mAnm;
|
||||
setAnmVtxColor(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmVtxColor(J3DAnmVtxColorFull* dst,
|
||||
const J3DAnmVtxColorFullData* data) {
|
||||
J3D_ASSERT_NULLPTR(738, dst);
|
||||
J3D_ASSERT_NULLPTR(739, data);
|
||||
dst->mFrameMax = data->mFrameMax;
|
||||
dst->mAttribute = data->field_0x8;
|
||||
dst->mFrame = 0.0f;
|
||||
|
|
@ -368,6 +396,7 @@ void J3DAnmFullLoader_v15::setAnmVtxColor(J3DAnmVtxColorFull* dst,
|
|||
}
|
||||
|
||||
J3DAnmBase* J3DAnmKeyLoader_v15::load(const void* param_1) {
|
||||
J3D_ASSERT_NULLPTR(801, param_1);
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_1;
|
||||
const JUTDataBlockHeader* block = &header->mFirstBlock;
|
||||
for (int i = 0; i < header->mBlockNum; i++) {
|
||||
|
|
@ -394,48 +423,58 @@ J3DAnmBase* J3DAnmKeyLoader_v15::load(const void* param_1) {
|
|||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
return mAnm;
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setResource(J3DAnmBase* param_1, const void* param_2) {
|
||||
J3D_ASSERT_NULLPTR(858, param_2);
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_2;
|
||||
const JUTDataBlockHeader* block = &header->mFirstBlock;
|
||||
for (int i = 0; i < header->mBlockNum; i++) {
|
||||
switch (block->mType) {
|
||||
case 'ANK1':
|
||||
JUT_ASSERT_MSG(870, param_1->getKind() == 8, "Error: Resource type inconsistency");
|
||||
setAnmTransform((J3DAnmTransformKey*)param_1, (const J3DAnmTransformKeyData*)block);
|
||||
break;
|
||||
case 'PAK1':
|
||||
JUT_ASSERT_MSG(876, param_1->getKind() == 11, "Error: Resource type inconsistency");
|
||||
setAnmColor((J3DAnmColorKey*)param_1, (const J3DAnmColorKeyData*)block);
|
||||
break;
|
||||
case 'CLK1':
|
||||
JUT_ASSERT_MSG(883, param_1->getKind() == 13, "Error: Resource type inconsistency");
|
||||
setAnmCluster((J3DAnmClusterKey*)param_1, (const J3DAnmClusterKeyData*)block);
|
||||
break;
|
||||
case 'TTK1':
|
||||
JUT_ASSERT_MSG(888, param_1->getKind() == 4, "Error: Resource type inconsistency");
|
||||
setAnmTextureSRT((J3DAnmTextureSRTKey*)param_1, (const J3DAnmTextureSRTKeyData*)block);
|
||||
break;
|
||||
case 'TRK1':
|
||||
JUT_ASSERT_MSG(894, param_1->getKind() == 5, "Error: Resource type inconsistency");
|
||||
setAnmTevReg((J3DAnmTevRegKey*)param_1, (const J3DAnmTevRegKeyData*)block);
|
||||
break;
|
||||
case 'VCK1':
|
||||
JUT_ASSERT_MSG(901, param_1->getKind() == 15, "Error: Resource type inconsistency");
|
||||
setAnmVtxColor((J3DAnmVtxColorKey*)param_1, (const J3DAnmVtxColorKeyData*)block);
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmTransform(const J3DAnmTransformKeyData* param_1) {
|
||||
setAnmTransform((J3DAnmTransformKey*)mAnm, param_1);
|
||||
J3DAnmTransformKey* anm = (J3DAnmTransformKey*)mAnm;
|
||||
setAnmTransform(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmTransform(J3DAnmTransformKey* param_1,
|
||||
const J3DAnmTransformKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(944, param_1);
|
||||
J3D_ASSERT_NULLPTR(945, param_2);
|
||||
param_1->field_0x1e = param_2->field_0xc;
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
|
|
@ -450,11 +489,14 @@ void J3DAnmKeyLoader_v15::setAnmTransform(J3DAnmTransformKey* param_1,
|
|||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmTextureSRT(const J3DAnmTextureSRTKeyData* param_1) {
|
||||
setAnmTextureSRT((J3DAnmTextureSRTKey*)mAnm, param_1);
|
||||
J3DAnmTextureSRTKey* anm = (J3DAnmTextureSRTKey*)mAnm;
|
||||
setAnmTextureSRT(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmTextureSRT(J3DAnmTextureSRTKey* param_1,
|
||||
const J3DAnmTextureSRTKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(987, param_1);
|
||||
J3D_ASSERT_NULLPTR(988, param_2);
|
||||
param_1->mTrackNum = param_2->field_0xc;
|
||||
param_1->mFrameMax = param_2->field_0xa;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
|
|
@ -505,10 +547,13 @@ void J3DAnmKeyLoader_v15::setAnmTextureSRT(J3DAnmTextureSRTKey* param_1,
|
|||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmColor(const J3DAnmColorKeyData* param_1) {
|
||||
setAnmColor((J3DAnmColorKey*)mAnm, param_1);
|
||||
J3DAnmColorKey* anm = (J3DAnmColorKey*)mAnm;
|
||||
setAnmColor(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmColor(J3DAnmColorKey* param_1, const J3DAnmColorKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(1097, param_1);
|
||||
J3D_ASSERT_NULLPTR(1098, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
|
|
@ -531,11 +576,14 @@ void J3DAnmKeyLoader_v15::setAnmColor(J3DAnmColorKey* param_1, const J3DAnmColor
|
|||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmCluster(const J3DAnmClusterKeyData* param_1) {
|
||||
setAnmCluster((J3DAnmClusterKey*)mAnm, param_1);
|
||||
J3DAnmClusterKey* anm = (J3DAnmClusterKey*)mAnm;
|
||||
setAnmCluster(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmCluster(J3DAnmClusterKey* param_1,
|
||||
const J3DAnmClusterKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(1156, param_1);
|
||||
J3D_ASSERT_NULLPTR(1157, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
|
|
@ -546,11 +594,14 @@ void J3DAnmKeyLoader_v15::setAnmCluster(J3DAnmClusterKey* param_1,
|
|||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmTevReg(const J3DAnmTevRegKeyData* param_1) {
|
||||
setAnmTevReg((J3DAnmTevRegKey*)mAnm, param_1);
|
||||
J3DAnmTevRegKey* anm = (J3DAnmTevRegKey*)mAnm;
|
||||
setAnmTevReg(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmTevReg(J3DAnmTevRegKey* param_1,
|
||||
const J3DAnmTevRegKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(1195, param_1);
|
||||
J3D_ASSERT_NULLPTR(1196, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
|
|
@ -588,11 +639,14 @@ void J3DAnmKeyLoader_v15::setAnmTevReg(J3DAnmTevRegKey* param_1,
|
|||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmVtxColor(const J3DAnmVtxColorKeyData* param_1) {
|
||||
setAnmVtxColor((J3DAnmVtxColorKey*)mAnm, param_1);
|
||||
J3DAnmVtxColorKey* anm = (J3DAnmVtxColorKey*)mAnm;
|
||||
setAnmVtxColor(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmVtxColor(J3DAnmVtxColorKey* dst,
|
||||
const J3DAnmVtxColorKeyData* data) {
|
||||
J3D_ASSERT_NULLPTR(1275, dst);
|
||||
J3D_ASSERT_NULLPTR(1276, data);
|
||||
dst->mFrameMax = data->mFrameMax;
|
||||
dst->mAttribute = data->field_0x8;
|
||||
dst->mFrame = 0.0f;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <string>
|
||||
|
||||
void* J3DClusterLoaderDataBase::load(const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(41, i_data);
|
||||
const JUTDataFileHeader* fileHeader = (JUTDataFileHeader*)i_data;
|
||||
if (fileHeader->mMagic == 'J3D1' && fileHeader->mType == 'bls1') {
|
||||
J3DClusterLoader_v15 loader;
|
||||
|
|
@ -27,6 +28,7 @@ J3DClusterLoader_v15::J3DClusterLoader_v15() {}
|
|||
J3DClusterLoader_v15::~J3DClusterLoader_v15() {}
|
||||
|
||||
void* J3DClusterLoader_v15::load(const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(98, i_data);
|
||||
mpDeformData = new J3DDeformData();
|
||||
|
||||
const JUTDataFileHeader* fileHeader = (JUTDataFileHeader*)i_data;
|
||||
|
|
@ -40,13 +42,14 @@ void* J3DClusterLoader_v15::load(const void* i_data) {
|
|||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
|
||||
return mpDeformData;
|
||||
}
|
||||
|
||||
void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
|
||||
J3D_ASSERT_NULLPTR(147, block);
|
||||
mpDeformData->mClusterNum = block->mClusterNum;
|
||||
mpDeformData->mClusterKeyNum = block->mClusterKeyNum;
|
||||
mpDeformData->mVtxPosNum = block->mVtxPosNum;
|
||||
|
|
@ -70,11 +73,11 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
|
|||
mpDeformData->mVtxNrm = JSUConvertOffsetToPtr<f32>(block, block->mVtxNrm);
|
||||
|
||||
void* clusterPointer = block->mClusterPointer;
|
||||
int clusterKeyPointerSize = (intptr_t)block->mClusterKeyPointer - (intptr_t)clusterPointer;
|
||||
int clusterVertexPointerSize = (intptr_t)block->mClusterVertex - (intptr_t)clusterPointer;
|
||||
int vtxPosSize = (intptr_t)block->mVtxPos - (intptr_t)clusterPointer;
|
||||
int clusterKeyPointerSize = (intptr_t)block->mClusterKeyPointer - (intptr_t)block->mClusterPointer;
|
||||
int clusterVertexPointerSize = (intptr_t)block->mClusterVertex - (intptr_t)block->mClusterPointer;
|
||||
int vtxPosSize = (intptr_t)block->mVtxPos - (intptr_t)block->mClusterPointer;
|
||||
u8* arr = new (0x20) u8[vtxPosSize];
|
||||
memcpy(arr, JSUConvertOffsetToPtr<J3DCluster>(block, clusterPointer), vtxPosSize);
|
||||
memcpy(arr, JSUConvertOffsetToPtr<J3DCluster>(block, block->mClusterPointer), vtxPosSize);
|
||||
mpDeformData->mClusterPointer = (J3DCluster*)arr;
|
||||
mpDeformData->mClusterKeyPointer = (J3DClusterKey*)&arr[clusterKeyPointerSize];
|
||||
mpDeformData->mClusterVertex = (J3DClusterVertex*)&arr[clusterVertexPointerSize];
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) {
|
|||
|
||||
J3DJoint* J3DJointFactory::create(int no) {
|
||||
J3DJoint* joint = new J3DJoint();
|
||||
J3D_ASSERT_ALLOCMEM(50, joint);
|
||||
joint->mJntNo = no;
|
||||
joint->mKind = getKind(no);
|
||||
joint->mScaleCompensate = getScaleCompensate(no);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DJointFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h"
|
||||
|
|
@ -26,26 +27,45 @@ J3DModelLoader::J3DModelLoader() :
|
|||
}
|
||||
|
||||
J3DModelData* J3DModelLoaderDataBase::load(void const* i_data, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(52, i_data);
|
||||
const J3DModelFileData* header = (const J3DModelFileData*)i_data;
|
||||
if (i_data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D1' && *(u32*)((uintptr_t)i_data + 4) == 'bmd1') {
|
||||
if (header->mMagic1 == 'J3D1' && header->mMagic2 == 'bmd1') {
|
||||
JUT_PANIC(64, "Error : version error.");
|
||||
return NULL;
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D2' && *(u32*)((uintptr_t)i_data + 4) == 'bmd2') {
|
||||
if (header->mMagic1 == 'J3D2' && header->mMagic2 == 'bmd2') {
|
||||
J3DModelLoader_v21 loader;
|
||||
return loader.load(i_data, i_flags);
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D2' && *(u32*)((uintptr_t)i_data + 4) == 'bmd3') {
|
||||
if (header->mMagic1 == 'J3D2' && header->mMagic2 == 'bmd3') {
|
||||
J3DModelLoader_v26 loader;
|
||||
return loader.load(i_data, i_flags);
|
||||
}
|
||||
JUT_PANIC(89, "Error : version error.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
J3DModelData* J3DModelLoaderDataBase::loadBinaryDisplayList(const void* i_data, u32 flags) {
|
||||
J3D_ASSERT_NULLPTR(138, i_data);
|
||||
const J3DModelFileData* header = (const J3DModelFileData*)i_data;
|
||||
if (!i_data) {
|
||||
return NULL;
|
||||
}
|
||||
if (header->mMagic1 == 'J3D2' && (header->mMagic2 == 'bdl3' || header->mMagic2 == 'bdl4')) {
|
||||
J3DModelLoader_v26 loader;
|
||||
return loader.loadBinaryDisplayList(i_data, flags);
|
||||
}
|
||||
JUT_PANIC(157, "Error : version error.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
||||
JKRGetCurrentHeap()->getTotalFreeSize();
|
||||
s32 freeSize = JKRGetCurrentHeap()->getTotalFreeSize();
|
||||
mpModelData = new J3DModelData();
|
||||
J3D_ASSERT_ALLOCMEM(177, mpModelData);
|
||||
mpModelData->clear();
|
||||
mpModelData->mpRawData = i_data;
|
||||
mpModelData->setModelDataType(0);
|
||||
|
|
@ -102,17 +122,19 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
|||
|
||||
|
||||
J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
||||
int flags = 0x51100000;
|
||||
mpMaterialTable = new J3DMaterialTable();
|
||||
J3D_ASSERT_ALLOCMEM(279, mpMaterialTable);
|
||||
mpMaterialTable->clear();
|
||||
J3DModelFileData const* data = (J3DModelFileData*)i_data;
|
||||
J3DModelBlock const* block = data->mBlocks;
|
||||
for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) {
|
||||
switch (block->mBlockType) {
|
||||
case 'MAT3':
|
||||
readMaterialTable((J3DMaterialBlock*)block, 0x51100000);
|
||||
readMaterialTable((J3DMaterialBlock*)block, flags);
|
||||
break;
|
||||
case 'MAT2':
|
||||
readMaterialTable_v21((J3DMaterialBlock_v21*)block, 0x51100000);
|
||||
readMaterialTable_v21((J3DMaterialBlock_v21*)block, flags);
|
||||
break;
|
||||
case 'TEX1':
|
||||
readTextureTable((J3DTextureBlock*)block);
|
||||
|
|
@ -125,12 +147,18 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
|||
}
|
||||
if (mpMaterialTable->mTexture == NULL) {
|
||||
mpMaterialTable->mTexture = new J3DTexture(0, NULL);
|
||||
J3D_ASSERT_ALLOCMEM(319, mpMaterialTable->mTexture);
|
||||
}
|
||||
return mpMaterialTable;
|
||||
}
|
||||
|
||||
inline u32 getBdlFlag_MaterialType(u32 flags) {
|
||||
return flags & (J3DMLF_13 | J3DMLF_DoBdlMaterialCalc);
|
||||
}
|
||||
|
||||
J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_flags) {
|
||||
mpModelData = new J3DModelData();
|
||||
J3D_ASSERT_ALLOCMEM(338, mpModelData);
|
||||
mpModelData->clear();
|
||||
mpModelData->mpRawData = i_data;
|
||||
mpModelData->setModelDataType(1);
|
||||
|
|
@ -139,6 +167,7 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl
|
|||
J3DModelBlock const* block = data->mBlocks;
|
||||
for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) {
|
||||
s32 flags;
|
||||
u32 materialType;
|
||||
switch (block->mBlockType) {
|
||||
case 'INF1':
|
||||
flags = i_flags;
|
||||
|
|
@ -170,9 +199,10 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl
|
|||
flags = 0x50100000;
|
||||
flags |= (i_flags & 0x3000000);
|
||||
mpMaterialBlock = (J3DMaterialBlock*)block;
|
||||
if (((u32)i_flags & 0x3000) == 0) {
|
||||
materialType = getBdlFlag_MaterialType(i_flags);
|
||||
if (materialType == 0) {
|
||||
readMaterial((J3DMaterialBlock*)block, flags);
|
||||
} else if (((u32)i_flags & 0x3000) == 0x2000) {
|
||||
} else if (materialType == 0x2000) {
|
||||
readPatchedMaterial((J3DMaterialBlock*)block, flags);
|
||||
}
|
||||
break;
|
||||
|
|
@ -195,31 +225,27 @@ void J3DModelLoader::setupBBoardInfo() {
|
|||
for (u16 i = 0; i < mpModelData->getJointNum(); i++) {
|
||||
J3DMaterial* mesh = mpModelData->getJointNodePointer(i)->getMesh();
|
||||
if (mesh != NULL) {
|
||||
u16 shape_index = mesh->getShape()->getIndex();
|
||||
u32 shape_index = mesh->getShape()->getIndex();
|
||||
u16* index_table = JSUConvertOffsetToPtr<u16>(mpShapeBlock,
|
||||
(uintptr_t)mpShapeBlock->mpIndexTable);
|
||||
J3DShapeInitData* shape_init_data =
|
||||
JSUConvertOffsetToPtr<J3DShapeInitData>(mpShapeBlock,
|
||||
(uintptr_t)mpShapeBlock->mpShapeInitData);
|
||||
J3DJoint* joint;
|
||||
switch (shape_init_data[index_table[shape_index]].mShapeMtxType) {
|
||||
J3DShapeInitData* r26 = &shape_init_data[index_table[shape_index]];
|
||||
switch (r26->mShapeMtxType) {
|
||||
case 0:
|
||||
joint = mpModelData->getJointNodePointer(i);
|
||||
joint->setMtxType(0);
|
||||
mpModelData->getJointNodePointer(i)->setMtxType(0);
|
||||
break;
|
||||
case 1:
|
||||
joint = mpModelData->getJointNodePointer(i);
|
||||
joint->setMtxType(1);
|
||||
mpModelData->getJointNodePointer(i)->setMtxType(1);
|
||||
mpModelData->mbHasBillboard = true;
|
||||
break;
|
||||
case 2:
|
||||
joint = mpModelData->getJointNodePointer(i);
|
||||
joint->setMtxType(2);
|
||||
mpModelData->getJointNodePointer(i)->setMtxType(2);
|
||||
mpModelData->mbHasBillboard = true;
|
||||
break;
|
||||
case 3:
|
||||
joint = mpModelData->getJointNodePointer(i);
|
||||
joint->setMtxType(0);
|
||||
mpModelData->getJointNodePointer(i)->setMtxType(0);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (__FILE__)\n");
|
||||
|
|
@ -230,6 +256,7 @@ void J3DModelLoader::setupBBoardInfo() {
|
|||
}
|
||||
|
||||
void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(506, i_block);
|
||||
mpModelData->mFlags = i_flags | i_block->mFlags;
|
||||
mpModelData->getJointTree().setFlag(mpModelData->mFlags);
|
||||
J3DMtxCalc* mtx_calc = NULL;
|
||||
|
|
@ -243,7 +270,11 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla
|
|||
case 2:
|
||||
mtx_calc = new J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformMaya,J3DMtxCalcJ3DSysInitMaya>();
|
||||
break;
|
||||
default:
|
||||
JUT_PANIC(529, "Error : Invalid MtxCalcType.");
|
||||
break;
|
||||
}
|
||||
J3D_ASSERT_ALLOCMEM(532, mtx_calc);
|
||||
mpModelData->setBasicMtxCalc(mtx_calc);
|
||||
mpModelData->getVertexData().mPacketNum = i_block->mPacketNum;
|
||||
mpModelData->getVertexData().mVtxNum = i_block->mVtxNum;
|
||||
|
|
@ -260,6 +291,7 @@ static _GXCompType getFmtType(_GXVtxAttrFmtList* i_fmtList, _GXAttr i_attr) {
|
|||
}
|
||||
|
||||
void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(577, i_block);
|
||||
J3DVertexData& vertex_data = mpModelData->getVertexData();
|
||||
vertex_data.mVtxAttrFmtList =
|
||||
JSUConvertOffsetToPtr<GXVtxAttrFmtList>(i_block, i_block->mpVtxAttrFmtList);
|
||||
|
|
@ -275,8 +307,12 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
|||
JSUConvertOffsetToPtr<void>(i_block, i_block->mpVtxTexCoordArray[i]);
|
||||
}
|
||||
|
||||
_GXCompType nrm_type = getFmtType(vertex_data.mVtxAttrFmtList, GX_VA_NRM);
|
||||
u32 nrm_size = nrm_type == GX_F32 ? 12 : 6;
|
||||
u32 nrm_size = 12;
|
||||
if (getFmtType(vertex_data.mVtxAttrFmtList, GX_VA_NRM) == GX_F32) {
|
||||
nrm_size = 12;
|
||||
} else {
|
||||
nrm_size = 6;
|
||||
}
|
||||
|
||||
void* nrm_end = NULL;
|
||||
if (vertex_data.mVtxNBTArray != NULL) {
|
||||
|
|
@ -310,14 +346,24 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
|||
vertex_data.mColNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxColorArray[0]) / 4 + 1;
|
||||
}
|
||||
|
||||
int local_28 = 0;
|
||||
if (vertex_data.mVtxTexCoordArray[1]) {
|
||||
color0_end = vertex_data.mVtxTexCoordArray[1];
|
||||
}
|
||||
|
||||
if (vertex_data.mVtxTexCoordArray[0] == NULL) {
|
||||
vertex_data.mTexCoordNum = 0;
|
||||
return;
|
||||
}
|
||||
if (local_28) {
|
||||
vertex_data.mTexCoordNum = (local_28 - (uintptr_t)vertex_data.mVtxTexCoordArray[0]) / 8 + 1;
|
||||
} else {
|
||||
vertex_data.mTexCoordNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxTexCoordArray[0]) / 8 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DModelLoader::readEnvelop(J3DEnvelopeBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(724, i_block);
|
||||
mpModelData->getJointTree().mWEvlpMtxNum = i_block->mWEvlpMtxNum;
|
||||
mpModelData->getJointTree().mWEvlpMixMtxNum =
|
||||
JSUConvertOffsetToPtr<u8>(i_block, i_block->mpWEvlpMixMtxNum);
|
||||
|
|
@ -330,50 +376,58 @@ void J3DModelLoader::readEnvelop(J3DEnvelopeBlock const* i_block) {
|
|||
}
|
||||
|
||||
void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) {
|
||||
J3DJointTree& joint_tree = mpModelData->getJointTree();
|
||||
joint_tree.mDrawMtxData.mEntryNum = i_block->mMtxNum - mpModelData->getJointTree().mWEvlpMtxNum;
|
||||
joint_tree.mDrawMtxData.mDrawMtxFlag = JSUConvertOffsetToPtr<u8>(i_block, i_block->mpDrawMtxFlag);
|
||||
joint_tree.mDrawMtxData.mDrawMtxIndex = JSUConvertOffsetToPtr<u16>(i_block, i_block->mpDrawMtxIndex);
|
||||
J3D_ASSERT_NULLPTR(747, i_block);
|
||||
J3DDrawMtxData* drawMtxData = mpModelData->getDrawMtxData();
|
||||
drawMtxData->mEntryNum = i_block->mMtxNum - mpModelData->getWEvlpMtxNum();
|
||||
drawMtxData->mDrawMtxFlag = JSUConvertOffsetToPtr<u8>(i_block, i_block->mpDrawMtxFlag);
|
||||
drawMtxData->mDrawMtxIndex = JSUConvertOffsetToPtr<u16>(i_block, i_block->mpDrawMtxIndex);
|
||||
u16 i;
|
||||
for (i = 0; i < joint_tree.mDrawMtxData.mEntryNum; i++) {
|
||||
if (joint_tree.mDrawMtxData.mDrawMtxFlag[i] == 1) {
|
||||
for (i = 0; i < drawMtxData->mEntryNum; i++) {
|
||||
if (drawMtxData->mDrawMtxFlag[i] == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
joint_tree.mDrawMtxData.mDrawFullWgtMtxNum = i;
|
||||
mpModelData->getJointTree().mWEvlpImportantMtxIdx = new u16[joint_tree.mDrawMtxData.mEntryNum];
|
||||
|
||||
drawMtxData->mDrawFullWgtMtxNum = i;
|
||||
mpModelData->getJointTree().mWEvlpImportantMtxIdx = new u16[drawMtxData->mEntryNum];
|
||||
J3D_ASSERT_ALLOCMEM(767, mpModelData->getJointTree().mWEvlpImportantMtxIdx);
|
||||
}
|
||||
|
||||
void J3DModelLoader::readJoint(J3DJointBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(781, i_block);
|
||||
J3DJointFactory factory(*i_block);
|
||||
mpModelData->getJointTree().mJointNum = i_block->mJointNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpModelData->getJointTree().mJointName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(791, mpModelData->getJointTree().mJointName);
|
||||
} else {
|
||||
mpModelData->getJointTree().mJointName = NULL;
|
||||
}
|
||||
mpModelData->getJointTree().mJointNodePointer =
|
||||
new J3DJoint*[mpModelData->getJointTree().mJointNum];
|
||||
for (u16 i = 0; i < mpModelData->getJointTree().getJointNum(); i++) {
|
||||
J3D_ASSERT_ALLOCMEM(797, mpModelData->getJointTree().mJointNodePointer);
|
||||
for (u16 i = 0; i < mpModelData->getJointNum(); i++) {
|
||||
mpModelData->getJointTree().mJointNodePointer[i] = factory.create(i);
|
||||
}
|
||||
}
|
||||
|
||||
void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(817, i_block);
|
||||
J3DMaterialFactory factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(832, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(841, mpMaterialTable->mMaterialNodePointer);
|
||||
if (i_flags & 0x200000) {
|
||||
mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
|
||||
J3D_ASSERT_ALLOCMEM(846, mpMaterialTable->field_0x10);
|
||||
} else {
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
}
|
||||
|
|
@ -404,18 +458,22 @@ void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_fla
|
|||
}
|
||||
|
||||
void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(913, i_block);
|
||||
J3DMaterialFactory_v21 factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(930, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(940, mpMaterialTable->mMaterialNodePointer);
|
||||
if (i_flags & 0x200000) {
|
||||
mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
|
||||
J3D_ASSERT_ALLOCMEM(945, mpMaterialTable->field_0x10);
|
||||
} else {
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
}
|
||||
|
|
@ -443,6 +501,7 @@ void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u
|
|||
}
|
||||
|
||||
void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1009, i_block);
|
||||
mpShapeBlock = i_block;
|
||||
J3DShapeTable* shape_table = mpModelData->getShapeTable();
|
||||
J3DShapeFactory factory(*i_block);
|
||||
|
|
@ -450,10 +509,12 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) {
|
|||
if (i_block->mpNameTable != NULL) {
|
||||
shape_table->mShapeName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1026, shape_table->mShapeName);
|
||||
} else {
|
||||
shape_table->mShapeName = NULL;
|
||||
}
|
||||
shape_table->mShapeNodePointer = new J3DShape*[shape_table->mShapeNum];
|
||||
J3D_ASSERT_ALLOCMEM(1034, shape_table->mShapeNodePointer);
|
||||
factory.allocVcdVatCmdBuffer(shape_table->mShapeNum);
|
||||
J3DModelHierarchy const* hierarchy_entry = mpModelData->getHierarchy();
|
||||
GXVtxDescList* vtx_desc_list = NULL;
|
||||
|
|
@ -467,27 +528,33 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) {
|
|||
}
|
||||
|
||||
void J3DModelLoader::readTexture(J3DTextureBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(1067, i_block);
|
||||
u16 texture_num = i_block->mTextureNum;
|
||||
ResTIMG* texture_res = JSUConvertOffsetToPtr<ResTIMG>(i_block, i_block->mpTextureRes);
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mTextureName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1077, mpMaterialTable->mTextureName);
|
||||
} else {
|
||||
mpMaterialTable->mTextureName = NULL;
|
||||
}
|
||||
mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res);
|
||||
J3D_ASSERT_ALLOCMEM(1084, mpMaterialTable->mTexture);
|
||||
}
|
||||
|
||||
void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1101, i_block);
|
||||
J3DMaterialFactory factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1114, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1121, mpMaterialTable->mMaterialNodePointer);
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
factory.create(NULL, J3DMaterialFactory::MATERIAL_TYPE_NORMAL, i, i_flags);
|
||||
|
|
@ -499,15 +566,18 @@ void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32
|
|||
}
|
||||
|
||||
void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1152, i_block);
|
||||
J3DMaterialFactory_v21 factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1165, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1172, mpMaterialTable->mMaterialNodePointer);
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
factory.create(NULL, i, i_flags);
|
||||
|
|
@ -519,28 +589,34 @@ void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_blo
|
|||
}
|
||||
|
||||
void J3DModelLoader::readTextureTable(J3DTextureBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(1200, i_block);
|
||||
u16 texture_num = i_block->mTextureNum;
|
||||
ResTIMG* texture_res = JSUConvertOffsetToPtr<ResTIMG>(i_block, i_block->mpTextureRes);
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mTextureName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1211, mpMaterialTable->mTextureName);
|
||||
} else {
|
||||
mpMaterialTable->mTextureName = NULL;
|
||||
}
|
||||
mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res);
|
||||
J3D_ASSERT_ALLOCMEM(1218, mpMaterialTable->mTexture);
|
||||
}
|
||||
|
||||
void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1234, i_block);
|
||||
J3DMaterialFactory factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1251, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1260, mpMaterialTable->mMaterialNodePointer);
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
|
|
@ -551,6 +627,7 @@ void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_
|
|||
}
|
||||
|
||||
void J3DModelLoader::readMaterialDL(J3DMaterialDLBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1290, i_block);
|
||||
J3DMaterialFactory factory(*i_block);
|
||||
s32 flags;
|
||||
if (mpMaterialTable->mMaterialNum == 0) {
|
||||
|
|
@ -560,10 +637,12 @@ void J3DModelLoader::readMaterialDL(J3DMaterialDLBlock const* i_block, u32 i_fla
|
|||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1312, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1320, mpMaterialTable->mMaterialNodePointer);
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
flags = i_flags;
|
||||
|
|
|
|||
|
|
@ -14,24 +14,29 @@
|
|||
u16 J3DModelLoader::countMaterialNum(const void* stream) {
|
||||
const J3DModelFileData* header = (const J3DModelFileData*)stream;
|
||||
const J3DModelBlock* block = header->mBlocks;
|
||||
for (int i = 0; i < header->mBlockNum; block = (const J3DModelBlock*)((u8*)block + block->mBlockSize), i++)
|
||||
for (int i = 0; i < header->mBlockNum; i++)
|
||||
{
|
||||
if (block->mBlockType == 'MAT3') {
|
||||
return ((const J3DMaterialBlock*)block)->mMaterialNum;
|
||||
const J3DMaterialBlock* materialBlock = (const J3DMaterialBlock*)block;
|
||||
return materialBlock->mMaterialNum;
|
||||
}
|
||||
block = (const J3DModelBlock*)((u8*)block + block->mBlockSize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
JUT_PANIC(0, "Error : null pointer.");
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
||||
int flags = flags_;
|
||||
const J3DModelFileData* header = static_cast<const J3DModelFileData*>(stream);
|
||||
size_t size = 0;
|
||||
const J3DModelBlock* nextBlock = header->mBlocks;
|
||||
u32 i = 0;
|
||||
// TODO: What sizeof will get us a size of 0xE4?
|
||||
size += 0xE4;
|
||||
for (; i < header->mBlockNum; i++) {
|
||||
const J3DModelFileData* header = static_cast<const J3DModelFileData*>(stream);
|
||||
const J3DModelBlock* nextBlock = header->mBlocks;
|
||||
for (u32 i = 0; i < header->mBlockNum; i++) {
|
||||
switch (nextBlock->mBlockType) {
|
||||
case 'INF1':
|
||||
size += calcSizeInformation((const J3DModelInfoBlock*)nextBlock, flags);
|
||||
|
|
@ -39,8 +44,6 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
|||
case 'JNT1':
|
||||
size += calcSizeJoint((const J3DJointBlock*)nextBlock);
|
||||
break;
|
||||
case 'MAT2':
|
||||
break;
|
||||
case 'MAT3':
|
||||
size += calcSizeMaterial((const J3DMaterialBlock*)nextBlock, flags);
|
||||
break;
|
||||
|
|
@ -58,6 +61,9 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
|||
break;
|
||||
case 'VTX1':
|
||||
break;
|
||||
case 'MAT2':
|
||||
JUT_PANIC(282, "Error : version error.");
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
|
|
@ -68,30 +74,27 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
|||
}
|
||||
|
||||
u32 J3DModelLoader::calcLoadMaterialTableSize(const void* stream) {
|
||||
size_t size;
|
||||
u32 flags = J3DMLF_21 | J3DMLF_Material_UseIndirect | J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn;
|
||||
size_t size = 0;
|
||||
// TODO: What sizeof will get us a size of 0x20? Is this just the file header???
|
||||
size += 0x20;
|
||||
const J3DModelBlock* nextBlock;
|
||||
bool hasTextureTable;
|
||||
u32 i;
|
||||
const J3DModelFileData* header = reinterpret_cast<const J3DModelFileData*>(stream);
|
||||
nextBlock = header->mBlocks;
|
||||
hasTextureTable = false;
|
||||
i = 0;
|
||||
// TODO: What sizeof will get us a size of 0x20? Is this just the file header???
|
||||
size = 0x20;
|
||||
for (; i < header->mBlockNum; i++) {
|
||||
for (u32 i = 0; i < header->mBlockNum; i++) {
|
||||
switch (nextBlock->mBlockType) {
|
||||
case 'MAT2':
|
||||
break;
|
||||
case 'MAT3':
|
||||
size +=
|
||||
calcSizeMaterialTable((const J3DMaterialBlock*)nextBlock,
|
||||
J3DMLF_21 | J3DMLF_Material_UseIndirect |
|
||||
J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn);
|
||||
size += calcSizeMaterialTable((const J3DMaterialBlock*)nextBlock, flags);
|
||||
break;
|
||||
case 'TEX1':
|
||||
size += calcSizeTextureTable((const J3DTextureBlock*)nextBlock);
|
||||
hasTextureTable = true;
|
||||
break;
|
||||
case 'MAT2':
|
||||
JUT_PANIC(334, "Error : version error.");
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
|
|
@ -132,8 +135,6 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
|
|||
case 'MDL3':
|
||||
size += calcSizeMaterialDL((const J3DMaterialDLBlock*)nextBlock, flags);
|
||||
break;
|
||||
case 'MAT2':
|
||||
break;
|
||||
case 'MAT3': {
|
||||
u32 flags2 = (J3DMLF_21 | J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn);
|
||||
flags2 |= (u32)flags & (J3DMLF_Material_UseIndirect | J3DMLF_26);
|
||||
|
|
@ -156,6 +157,9 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
|
|||
break;
|
||||
case 'VTX1':
|
||||
break;
|
||||
case 'MAT2':
|
||||
JUT_PANIC(436, "Error : version error.");
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
|
|
@ -166,18 +170,22 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
|
|||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeInformation(const J3DModelInfoBlock* block, u32 flags) {
|
||||
J3D_ASSERT_NULLPTR(462, block);
|
||||
int size = 0;
|
||||
switch ((flags | block->mFlags) & J3DMLF_MtxTypeMask) {
|
||||
u32 flags2 = flags | block->mFlags;
|
||||
int r27 = 0;
|
||||
switch (flags2 & J3DMLF_MtxTypeMask) {
|
||||
case J3DMLF_None: // Basic
|
||||
size = 4;
|
||||
size += 4;
|
||||
break;
|
||||
case J3DMLF_MtxSoftImageCalc:
|
||||
size = 4;
|
||||
size += 4;
|
||||
break;
|
||||
case J3DMLF_MtxMayaCalc:
|
||||
size = 4;
|
||||
size += 4;
|
||||
break;
|
||||
default:
|
||||
JUT_PANIC(481, "Error : Invalid MtxCalcType.");
|
||||
break;
|
||||
}
|
||||
mpModelHierarchy = JSUConvertOffsetToPtr<J3DModelHierarchy>(block, block->mpHierarchy);
|
||||
|
|
@ -185,9 +193,10 @@ u32 J3DModelLoader::calcSizeInformation(const J3DModelInfoBlock* block, u32 flag
|
|||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeJoint(const J3DJointBlock* block) {
|
||||
J3D_ASSERT_NULLPTR(499, block);
|
||||
int size = 0;
|
||||
if (block->mpNameTable) {
|
||||
size = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size += (block->mJointNum * sizeof(J3DJoint*));
|
||||
size += (block->mJointNum * sizeof(J3DJoint));
|
||||
|
|
@ -195,23 +204,28 @@ u32 J3DModelLoader::calcSizeJoint(const J3DJointBlock* block) {
|
|||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeEnvelope(const J3DEnvelopeBlock* block) {
|
||||
J3D_ASSERT_NULLPTR(522, block);
|
||||
mEnvelopeSize = block->mWEvlpMtxNum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeDraw(const J3DDrawBlock* block) {
|
||||
return (block->mMtxNum - mEnvelopeSize) * 2;
|
||||
J3D_ASSERT_NULLPTR(538, block);
|
||||
u32 size = 0;
|
||||
size += (block->mMtxNum - mEnvelopeSize) * 2;
|
||||
return size;
|
||||
}
|
||||
|
||||
u32 J3DModelLoader_v26::calcSizeMaterial(const J3DMaterialBlock* block, u32 flags) {
|
||||
int padding = 0;
|
||||
J3D_ASSERT_NULLPTR(558, block);
|
||||
size_t size = 0;
|
||||
J3DMaterialFactory factory(*block);
|
||||
u32 count = block->mMaterialNum;
|
||||
int uniqueCount = factory.countUniqueMaterials();
|
||||
if (block->mpNameTable != NULL) {
|
||||
padding = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size_t size = padding + (count * sizeof(J3DMaterial*));
|
||||
size += (count * sizeof(J3DMaterial*));
|
||||
|
||||
if ((flags & J3DMLF_UseUniqueMaterials) != 0) {
|
||||
// calc for allocated materials as well
|
||||
|
|
@ -229,15 +243,17 @@ u32 J3DModelLoader_v26::calcSizeMaterial(const J3DMaterialBlock* block, u32 flag
|
|||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeShape(const J3DShapeBlock* block, u32 flags) {
|
||||
J3D_ASSERT_NULLPTR(616, block);
|
||||
int size = 0;
|
||||
J3DShapeFactory factory(*block);
|
||||
int count = block->mShapeNum;
|
||||
if (block->mpNameTable) {
|
||||
size = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size += count * sizeof(J3DShape*);
|
||||
size += factory.calcSizeVcdVatCmdBuffer(count);
|
||||
for (J3DModelHierarchy* hierarchy = mpModelHierarchy; hierarchy->mType != 0; hierarchy++) {
|
||||
J3DModelHierarchy* hierarchy;
|
||||
for (hierarchy = mpModelHierarchy; hierarchy->mType != 0; hierarchy++) {
|
||||
if (hierarchy->mType == 0x12) {
|
||||
size += factory.calcSize(hierarchy->mValue, flags);
|
||||
}
|
||||
|
|
@ -246,12 +262,14 @@ u32 J3DModelLoader::calcSizeShape(const J3DShapeBlock* block, u32 flags) {
|
|||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeTexture(const J3DTextureBlock* block) {
|
||||
J3D_ASSERT_NULLPTR(663, block);
|
||||
// TODO: use sizeofs here.
|
||||
int padding = 0;
|
||||
int size = 0;
|
||||
if (block->mpNameTable) {
|
||||
padding = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
return padding + 0xC;
|
||||
size += 0xC;
|
||||
return size;
|
||||
}
|
||||
|
||||
u32 J3DModelLoader_v26::calcSizeMaterialTable(const J3DMaterialBlock* block, u32 flags) {
|
||||
|
|
@ -259,7 +277,7 @@ u32 J3DModelLoader_v26::calcSizeMaterialTable(const J3DMaterialBlock* block, u32
|
|||
u32 count = block->mMaterialNum;
|
||||
J3DMaterialFactory factory(*block);
|
||||
if (block->mpNameTable) {
|
||||
size = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size += (count * sizeof(J3DMaterial*));
|
||||
for (u16 i = 0; i < count; i++) {
|
||||
|
|
@ -273,13 +291,13 @@ u32 J3DModelLoader::calcSizeTextureTable(const J3DTextureBlock* block) {
|
|||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizePatchedMaterial(const J3DMaterialBlock* block, u32 flags) {
|
||||
int padding = 0;
|
||||
int size = 0;
|
||||
u32 count = block->mMaterialNum;
|
||||
J3DMaterialFactory factory(*block);
|
||||
if (block->mpNameTable) {
|
||||
padding = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
u32 size = padding + (count * sizeof(J3DMaterial*));
|
||||
size += (count * sizeof(J3DMaterial*));
|
||||
for (u16 i = 0; i < count; i++) {
|
||||
size += factory.calcSize(NULL, J3DMaterialFactory::MATERIAL_TYPE_PATCHED, i, flags);
|
||||
}
|
||||
|
|
@ -287,14 +305,14 @@ u32 J3DModelLoader::calcSizePatchedMaterial(const J3DMaterialBlock* block, u32 f
|
|||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeMaterialDL(const J3DMaterialDLBlock* block, u32 flags_) {
|
||||
J3D_ASSERT_NULLPTR(758, block);
|
||||
int flags = flags_;
|
||||
size_t size = 0;
|
||||
J3DMaterialFactory factory(*block);
|
||||
;
|
||||
if (!field_0x18) {
|
||||
u32 count = block->mMaterialNum;
|
||||
if (block->mpNameTable) {
|
||||
size = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size += count * sizeof(J3DLockedMaterial*);
|
||||
for (u16 i = 0; i < count; i++) {
|
||||
|
|
|
|||
|
|
@ -11,21 +11,24 @@
|
|||
J3DShapeFactory::J3DShapeFactory(J3DShapeBlock const& block) {
|
||||
mShapeInitData = JSUConvertOffsetToPtr<J3DShapeInitData>(&block, (uintptr_t)block.mpShapeInitData);
|
||||
mIndexTable = JSUConvertOffsetToPtr<u16>(&block, (uintptr_t)block.mpIndexTable);
|
||||
mVtxDescList = JSUConvertOffsetToPtr<GXVtxDescList>(&block, (uintptr_t)block.mpVtxDescList),
|
||||
mVtxDescList = JSUConvertOffsetToPtr<GXVtxDescList>(&block, (uintptr_t)block.mpVtxDescList);
|
||||
mMtxTable = JSUConvertOffsetToPtr<u16>(&block, (uintptr_t)block.mpMtxTable);
|
||||
mDisplayListData = JSUConvertOffsetToPtr<u8>(&block, (uintptr_t)block.mpDisplayListData),
|
||||
mMtxInitData = JSUConvertOffsetToPtr<J3DShapeMtxInitData>(&block, (uintptr_t)block.mpMtxInitData),
|
||||
mDrawInitData = JSUConvertOffsetToPtr<J3DShapeDrawInitData>(&block, (uintptr_t)block.mpDrawInitData),
|
||||
mDisplayListData = JSUConvertOffsetToPtr<u8>(&block, (uintptr_t)block.mpDisplayListData);
|
||||
mMtxInitData = JSUConvertOffsetToPtr<J3DShapeMtxInitData>(&block, (uintptr_t)block.mpMtxInitData);
|
||||
mDrawInitData = JSUConvertOffsetToPtr<J3DShapeDrawInitData>(&block, (uintptr_t)block.mpDrawInitData);
|
||||
mVcdVatCmdBuffer = NULL;
|
||||
}
|
||||
|
||||
J3DShape* J3DShapeFactory::create(int no, u32 flag, GXVtxDescList* vtxDesc) {
|
||||
J3DShape* shape = new J3DShape;
|
||||
J3D_ASSERT_ALLOCMEM(67, shape);
|
||||
shape->mMtxGroupNum = getMtxGroupNum(no);
|
||||
shape->mRadius = getRadius(no);
|
||||
shape->mVtxDesc = getVtxDescList(no);
|
||||
shape->mShapeMtx = new J3DShapeMtx*[shape->mMtxGroupNum];
|
||||
J3D_ASSERT_ALLOCMEM(74, shape->mShapeMtx);
|
||||
shape->mShapeDraw = new J3DShapeDraw*[shape->mMtxGroupNum];
|
||||
J3D_ASSERT_ALLOCMEM(76, shape->mShapeDraw);
|
||||
shape->mMin = getMin(no);
|
||||
shape->mMax = getMax(no);
|
||||
shape->mVcdVatCmd = mVcdVatCmdBuffer + no * J3DShape::kVcdVatDLSize;
|
||||
|
|
@ -56,7 +59,8 @@ J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo)
|
|||
const J3DShapeMtxInitData& mtxInitData =
|
||||
(&mMtxInitData[shapeInitData.mMtxInitDataIndex])[mtxGroupNo];
|
||||
|
||||
switch (getMdlDataFlag_MtxLoadType(flag)) {
|
||||
u32 mtxLoadType = getMdlDataFlag_MtxLoadType(flag);
|
||||
switch (mtxLoadType) {
|
||||
case J3DMdlDataFlag_ConcatView:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
|
|
@ -94,36 +98,41 @@ J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo)
|
|||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(167, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
J3DShapeDraw* J3DShapeFactory::newShapeDraw(int shapeNo, int mtxGroupNo) const {
|
||||
J3DShapeDraw* shapeDraw = NULL;
|
||||
const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]];
|
||||
const J3DShapeDrawInitData& drawInitData =
|
||||
(&mDrawInitData[shapeInitData.mDrawInitDataIndex])[mtxGroupNo];
|
||||
return new J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex],
|
||||
drawInitData.mDisplayListSize);
|
||||
shapeDraw = new J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
|
||||
J3D_ASSERT_ALLOCMEM(193, shapeDraw);
|
||||
return shapeDraw;
|
||||
}
|
||||
|
||||
void J3DShapeFactory::allocVcdVatCmdBuffer(u32 count) {
|
||||
mVcdVatCmdBuffer = new (0x20) u8[J3DShape::kVcdVatDLSize * count];
|
||||
J3D_ASSERT_ALLOCMEM(211, mVcdVatCmdBuffer);
|
||||
for (u32 i = 0; i < (J3DShape::kVcdVatDLSize * count) / 4; i++)
|
||||
((u32*)mVcdVatCmdBuffer)[i] = 0;
|
||||
}
|
||||
|
||||
s32 J3DShapeFactory::calcSize(int shapeNo, u32 flag) {
|
||||
s32 size = 0x68;
|
||||
s32 size = 0;
|
||||
|
||||
s32 mtxGroupNo = getMtxGroupNum(shapeNo);
|
||||
size += sizeof(J3DShape);
|
||||
size += mtxGroupNo * 4;
|
||||
size += mtxGroupNo * 4;
|
||||
|
||||
for (u32 i = 0; i < mtxGroupNo; i++) {
|
||||
s32 shapeMtxSize = calcSizeShapeMtx(flag, shapeNo, i);
|
||||
size += shapeMtxSize;
|
||||
size += calcSizeShapeMtx(flag, shapeNo, i);
|
||||
size += 0x0C;
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +144,9 @@ s32 J3DShapeFactory::calcSizeVcdVatCmdBuffer(u32 count) {
|
|||
}
|
||||
|
||||
s32 J3DShapeFactory::calcSizeShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) const {
|
||||
int local_18 = 0;
|
||||
const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]];
|
||||
J3DShapeMtxInitData& mtxInitData = (&mMtxInitData[shapeInitData.mMtxInitDataIndex])[mtxGroupNo];
|
||||
u32 ret = 0;
|
||||
|
||||
u32 mtxLoadType = getMdlDataFlag_MtxLoadType(flag);
|
||||
|
|
@ -143,16 +154,16 @@ s32 J3DShapeFactory::calcSizeShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) con
|
|||
case J3DMdlDataFlag_ConcatView:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
ret = 0x08;
|
||||
ret += sizeof(J3DShapeMtxConcatView);
|
||||
break;
|
||||
case J3DShapeMtxType_BBoard:
|
||||
ret = 0x08;
|
||||
ret += sizeof(J3DShapeMtxBBoardConcatView);
|
||||
break;
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = 0x08;
|
||||
ret += sizeof(J3DShapeMtxYBBoardConcatView);
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = 0x10;
|
||||
ret += sizeof(J3DShapeMtxMultiConcatView);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
|
|
@ -165,10 +176,10 @@ s32 J3DShapeFactory::calcSizeShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) con
|
|||
case J3DShapeMtxType_Mtx:
|
||||
case J3DShapeMtxType_BBoard:
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = 0x08;
|
||||
ret += 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = 0x10;
|
||||
ret += sizeof(J3DShapeMtxMultiConcatView);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue