diff options
| author | Jcw87 <Jcw87@users.noreply.github.com> | 2026-01-13 07:49:09 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-13 17:49:09 +0200 |
| commit | 1a65a6bbbd263538bd04faae2d9e899d59ec0d5d (patch) | |
| tree | 806aabed4c624787252b37072c36629c1a559bca /include | |
| parent | dd03bf861fdc92109c57d58cc7436066a8a02430 (diff) | |
J3D debug (#3037)
* J3DGraphBase debug
* J3DGraphAnimator debug
* J3DGraphLoader debug
Diffstat (limited to 'include')
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DAnimation.h | 13 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DCluster.h | 5 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DJointTree.h | 2 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DModelData.h | 2 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DMaterial.h | 2 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DPacket.h | 28 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DShapeMtx.h | 28 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DStruct.h | 11 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DTexture.h | 4 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DVertex.h | 15 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphLoader/J3DJointFactory.h | 2 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h | 2 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphLoader/J3DModelLoader.h | 1 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphLoader/J3DShapeFactory.h | 2 |
14 files changed, 76 insertions, 41 deletions
diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index e3d8810c80..d5c0bc94c3 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -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; diff --git a/include/JSystem/J3DGraphAnimator/J3DCluster.h b/include/JSystem/J3DGraphAnimator/J3DCluster.h index 83aec79dc1..969ad6ae71 100644 --- a/include/JSystem/J3DGraphAnimator/J3DCluster.h +++ b/include/JSystem/J3DGraphAnimator/J3DCluster.h @@ -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; diff --git a/include/JSystem/J3DGraphAnimator/J3DJointTree.h b/include/JSystem/J3DGraphAnimator/J3DJointTree.h index 53c93f810e..b4b3d5a1db 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJointTree.h +++ b/include/JSystem/J3DGraphAnimator/J3DJointTree.h @@ -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; } diff --git a/include/JSystem/J3DGraphAnimator/J3DModelData.h b/include/JSystem/J3DGraphAnimator/J3DModelData.h index 7ae8ba2919..e4436ea064 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModelData.h +++ b/include/JSystem/J3DGraphAnimator/J3DModelData.h @@ -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(); } diff --git a/include/JSystem/J3DGraphBase/J3DMaterial.h b/include/JSystem/J3DGraphBase/J3DMaterial.h index dcb74c1f46..a125cdf925 100644 --- a/include/JSystem/J3DGraphBase/J3DMaterial.h +++ b/include/JSystem/J3DGraphBase/J3DMaterial.h @@ -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(); } diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h index 374c41ebda..67dea2f83c 100644 --- a/include/JSystem/J3DGraphBase/J3DPacket.h +++ b/include/JSystem/J3DGraphBase/J3DPacket.h @@ -139,6 +139,34 @@ public: * @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 + * + */ class J3DPacket { public: J3DPacket() { diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h index 4c86f51367..7029ab3350 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h +++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h @@ -12,34 +12,6 @@ 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 - * - */ class J3DDifferedTexMtx { public: static void loadExecute(f32 const (*)[4]); diff --git a/include/JSystem/J3DGraphBase/J3DStruct.h b/include/JSystem/J3DGraphBase/J3DStruct.h index 3f9bafe12c..7ab166946a 100644 --- a/include/JSystem/J3DGraphBase/J3DStruct.h +++ b/include/JSystem/J3DGraphBase/J3DStruct.h @@ -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; diff --git a/include/JSystem/J3DGraphBase/J3DTexture.h b/include/JSystem/J3DGraphBase/J3DTexture.h index 177df65a38..8c95729d66 100644 --- a/include/JSystem/J3DGraphBase/J3DTexture.h +++ b/include/JSystem/J3DGraphBase/J3DTexture.h @@ -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); diff --git a/include/JSystem/J3DGraphBase/J3DVertex.h b/include/JSystem/J3DGraphBase/J3DVertex.h index 0aab64cd8e..1bfd011219 100644 --- a/include/JSystem/J3DGraphBase/J3DVertex.h +++ b/include/JSystem/J3DGraphBase/J3DVertex.h @@ -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]; diff --git a/include/JSystem/J3DGraphLoader/J3DJointFactory.h b/include/JSystem/J3DGraphLoader/J3DJointFactory.h index fe918fe377..9ab17fc65a 100644 --- a/include/JSystem/J3DGraphLoader/J3DJointFactory.h +++ b/include/JSystem/J3DGraphLoader/J3DJointFactory.h @@ -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; diff --git a/include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h b/include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h index e1369bbe5f..af166e1b13 100644 --- a/include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h +++ b/include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h @@ -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; diff --git a/include/JSystem/J3DGraphLoader/J3DModelLoader.h b/include/JSystem/J3DGraphLoader/J3DModelLoader.h index 59912caf1a..847397a7dc 100644 --- a/include/JSystem/J3DGraphLoader/J3DModelLoader.h +++ b/include/JSystem/J3DGraphLoader/J3DModelLoader.h @@ -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); }; /** diff --git a/include/JSystem/J3DGraphLoader/J3DShapeFactory.h b/include/JSystem/J3DGraphLoader/J3DShapeFactory.h index abee1f9bbb..702de3bdf4 100644 --- a/include/JSystem/J3DGraphLoader/J3DShapeFactory.h +++ b/include/JSystem/J3DGraphLoader/J3DShapeFactory.h @@ -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; } |
