diff options
| author | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2026-10-08 16:13:37 -0400 |
|---|---|---|
| committer | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2026-10-09 13:30:55 -0400 |
| commit | 04531efddf0e32183167f5dc28c63a4268e8f08b (patch) | |
| tree | 4a046f4c7080b26ec323c185ac1eb404de7e7d59 /include/JSystem/J3DGraphBase | |
| parent | 2f9fca9d1bddd12a8e65d2acdd8ee9fd77b7af7a (diff) | |
Clean up J3D inlines
Diffstat (limited to 'include/JSystem/J3DGraphBase')
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DMaterial.h | 85 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DPacket.h | 9 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DShape.h | 53 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DVertex.h | 5 |
4 files changed, 90 insertions, 62 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DMaterial.h b/include/JSystem/J3DGraphBase/J3DMaterial.h index d5e49978..30adb53b 100644 --- a/include/JSystem/J3DGraphBase/J3DMaterial.h +++ b/include/JSystem/J3DGraphBase/J3DMaterial.h @@ -45,16 +45,20 @@ public: ~J3DMaterial() {} J3DMaterial* getNext() { return mNext; } - void setNext(J3DMaterial* material) {mNext = material; } J3DShape* getShape() { return mShape; } J3DJoint* getJoint() { return mJoint; } u32 getMaterialMode() { return mMaterialMode; } void setMaterialMode(u32 mode) { mMaterialMode = mode; } - J3DTevBlock* getTevBlock() { return mTevBlock; } + bool isDrawModeOpaTexEdge() { return (mMaterialMode & 3) == 0; } + u16 getIndex() { return mIndex; } + void onInvalid() { mInvalid = 1; } + J3DColorBlock* getColorBlock() { return mColorBlock; } J3DTexGenBlock* getTexGenBlock() { return mTexGenBlock; } - J3DDisplayListObj* getSharedDisplayListObj() { return mSharedDLObj; } + J3DTevBlock* getTevBlock() { return mTevBlock; } J3DIndBlock* getIndBlock() { return mIndBlock; } + J3DPEBlock* getPEBlock() { return mPEBlock; } + J3DMaterialAnm* getMaterialAnm() { if ((uintptr_t)mMaterialAnm < 0xC0000000) { return mMaterialAnm; @@ -62,36 +66,59 @@ public: return NULL; } } + void setMaterialAnm(J3DMaterialAnm* i_anm) { mMaterialAnm = i_anm; } + J3DDisplayListObj* getSharedDisplayListObj() { return mSharedDLObj; } + + J3DColorChan* getColorChan(u32 i) { return mColorBlock->getColorChan(i); } + void setLight(u32 i, J3DLightObj* i_light) { mColorBlock->setLight(i, i_light); } + void setCullMode(u8 i_mode) { mColorBlock->setCullMode(i_mode); } + + u32 getTexGenNum() const { return mTexGenBlock->getTexGenNum(); } + J3DTexCoord* getTexCoord(u32 idx) { return mTexGenBlock->getTexCoord(idx); } + void setTexMtx(u32 idx, J3DTexMtx* texMtx) { mTexGenBlock->setTexMtx(idx, texMtx); } + J3DTexMtx* getTexMtx(u32 idx) { return mTexGenBlock->getTexMtx(idx); } J3DNBTScale* getNBTScale() { return mTexGenBlock->getNBTScale(); } + u16 getTexNo(u32 idx) { return mTevBlock->getTexNo(idx); } - J3DGXColor* getTevKColor(u32 param_0) { return mTevBlock->getTevKColor(param_0); } - J3DGXColorS10* getTevColor(u32 param_0) { return mTevBlock->getTevColor(param_0); } - J3DFog* getFog() { return mPEBlock->getFog(); } - J3DZMode* getZMode() { return mPEBlock->getZMode(); } - J3DBlend* getBlend() { return mPEBlock->getBlend(); } - J3DAlphaComp* getAlphaComp() { return mPEBlock->getAlphaComp(); } - u8 getZCompLoc() { return mPEBlock->getZCompLoc(); } - J3DTexMtx* getTexMtx(u32 idx) { return mTexGenBlock->getTexMtx(idx); } - void setTexMtx(u32 idx, J3DTexMtx* texMtx) { mTexGenBlock->setTexMtx(idx, texMtx); } - J3DTexCoord* getTexCoord(u32 idx) { return mTexGenBlock->getTexCoord(idx); } - u16 getIndex() { return mIndex; } - bool isDrawModeOpaTexEdge() { return (mMaterialMode & 3) == 0; } - J3DPEBlock* getPEBlock() { return mPEBlock; } - void onInvalid() { mInvalid = 1; } - u32 getTexGenNum() const { return mTexGenBlock->getTexGenNum(); } + J3DTevOrder* getTevOrder(u32 i) { return mTevBlock->getTevOrder(i); } + void setTevColor(u32 i, const J3DGXColorS10* i_color) { mTevBlock->setTevColor(i, i_color); } + J3DGXColorS10* getTevColor(u32 i) { return mTevBlock->getTevColor(i); } + void setTevKColor(u32 i, const J3DGXColor* i_color) { mTevBlock->setTevKColor(i, i_color); } + J3DGXColor* getTevKColor(u32 i) { return mTevBlock->getTevKColor(i); } + u8 getTevKColorSel(u32 i) { return mTevBlock->getTevKColorSel(i); } + u8 getTevKAlphaSel(u32 i) { return mTevBlock->getTevKAlphaSel(i); } + void setTevStageNum(u8 num) { mTevBlock->setTevStageNum(num); } u8 getTevStageNum() const { return mTevBlock->getTevStageNum(); } + J3DTevStage* getTevStage(u32 i) { return mTevBlock->getTevStage(i); } + J3DTevSwapModeTable* getTevSwapModeTable(u32 i) { return mTevBlock->getTevSwapModeTable(i); } + + u8 getIndTexStageNum() const { return mIndBlock->getIndTexStageNum(); } J3DIndTexOrder* getIndTexOrder(u32 i) { return mIndBlock->getIndTexOrder(i); } J3DIndTexMtx* getIndTexMtx(u32 i) { return mIndBlock->getIndTexMtx(i); } - u8 getIndTexStageNum() const { return mIndBlock->getIndTexStageNum(); } - void setTevColor(u32 i, const J3DGXColorS10* i_color) { mTevBlock->setTevColor(i, i_color); } - void setTevKColor(u32 i, const J3DGXColor* i_color) { mTevBlock->setTevKColor(i, i_color); } - void setMaterialAnm(J3DMaterialAnm* i_anm) { mMaterialAnm = i_anm; } - void setCullMode(u8 i_mode) { mColorBlock->setCullMode(i_mode); } + J3DFog* getFog() { return mPEBlock->getFog(); } + J3DAlphaComp* getAlphaComp() { return mPEBlock->getAlphaComp(); } + J3DBlend* getBlend() { return mPEBlock->getBlend(); } + J3DZMode* getZMode() { return mPEBlock->getZMode(); } + u8 getZCompLoc() { return mPEBlock->getZCompLoc(); } + + void addShape(J3DShape* pShape) { + J3D_ASSERT_NULLPTR(618, pShape != NULL); + mShape = pShape; + } + + void setNext(J3DMaterial* pMaterial) { + J3D_ASSERT_NULLPTR(623, pMaterial != NULL); + mNext = pMaterial; + } + + void setJoint(J3DJoint* pJoint) { + J3D_ASSERT_NULLPTR(628, pJoint != NULL); + mJoint = pJoint; + } - void addShape(J3DShape*) {} + // TODO (possibly only used in debug?) void getAmbColor(u32) {} - void getColorChan(u32) {} void getColorChanNum() const {} void getCullMode() const {} void getCurrentMtx() const {} @@ -100,15 +127,7 @@ public: void getIndTexCoordScale(u32) {} void getLight(u32) {} void getMatColor(u32) {} - void getTevKAlphaSel(u32) {} - void getTevKColorSel(u32) {} - void getTevOrder(u32) {} - void getTevStage(u32) {} - void getTevSwapModeTable(u32) {} void getZCompLoc() const {} - void setJoint(J3DJoint*) {} - void setLight(u32, J3DLightObj*) {} - void setTevStageNum(u8) {} public: /* 0x04 */ J3DMaterial* mNext; diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h index a49e4ab1..fc726761 100644 --- a/include/JSystem/J3DGraphBase/J3DPacket.h +++ b/include/JSystem/J3DGraphBase/J3DPacket.h @@ -82,8 +82,8 @@ public: void beginPatch(); u32 endPatch(); - u8* getDisplayList(int idx) const { return (u8*)mpData[idx]; } - u32 getDisplayListSize() const { return mSize; } + u8* getDisplayList(int idx) { return (u8*)mpData[idx]; } + u32 getDisplayListSize() { return mSize; } static GDLObj sGDLObj; static s32 sInterruptFlag; @@ -177,9 +177,8 @@ public: void setScaleFlagArray(u8* pScaleFlagArray) { mpScaleFlagArray = pScaleFlagArray; } void setCurrentViewNoPtr(u32* pCurrentViewNo) { mpCurrentViewNo = pCurrentViewNo; } - J3DShape* getShape() const { return mpShape; } - J3DModel* getModel() const { return mpModel; } - Mtx* getBaseMtxPtr() const { return mpBaseMtxPtr; } + J3DShape* getShape() { return mpShape; } + Mtx* getBaseMtxPtr() { return mpBaseMtxPtr; } public: /* 0x24 */ J3DShape* mpShape; diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h index ff22d454..7ff1b45e 100644 --- a/include/JSystem/J3DGraphBase/J3DShape.h +++ b/include/JSystem/J3DGraphBase/J3DShape.h @@ -4,6 +4,7 @@ #include "JSystem/J3DAssert.h" #include "JSystem/J3DGraphBase/J3DShapeDraw.h" #include "JSystem/JUtility/JUTAssert.h" +#include "dolphin/gd/GDGeometry.h" #include "dolphin/gx/GX.h" #include "dolphin/types.h" @@ -42,12 +43,12 @@ public: u32 getMtxIdxRegA() const { return mMtxIdxRegA; } u32 getMtxIdxRegB() const { return mMtxIdxRegB; } - inline void load() const { - JRNLoadCPCmd(0x30, getMtxIdxRegA()); // CP_MATINDEX_A - JRNLoadCPCmd(0x40, getMtxIdxRegB()); // CP_MATINDEX_B - JRNLoadXFCmdHdr(0x1018, 2); - GXCmd1u32(getMtxIdxRegA()); - GXCmd1u32(getMtxIdxRegB()); + void load() const { + JRNLoadCPCmd(CP_REG_MTXIDXA_ID, mMtxIdxRegA); + JRNLoadCPCmd(CP_REG_MTXIDXB_ID, mMtxIdxRegB); + JRNLoadXFCmdHdr(GX_XF_REG_MATRIXINDEX0, 2); + GXCmd1u32(mMtxIdxRegA); + GXCmd1u32(mMtxIdxRegB); } void setCurrentTexMtx(u8 t0, u8 t1, u8 t2, u8 t3, u8 t4, u8 t5, u8 t6, u8 t7) { @@ -98,33 +99,43 @@ public: void onFlag(u32 flag) { mFlags |= flag; } void offFlag(u32 flag) { mFlags &= ~flag; } - bool checkFlag(u32 flag) const { return !!(mFlags & flag); } - void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) { mDrawMtxData = pMtxData; } - void setVertexDataPointer(J3DVertexData* pVtxData) { mVertexData = pVtxData; } - void* getVcdVatCmd() const { return mVcdVatCmd; } + bool checkFlag(u32 flag) const { return (mFlags & flag) ? true : false; } + void setMaterial(J3DMaterial* pMaterial) { + J3D_ASSERT_NULLPTR(509, pMaterial != NULL); + mMaterial = pMaterial; + } + void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) { + J3D_ASSERT_NULLPTR(554, pMtxData != NULL); + mDrawMtxData = pMtxData; + } + void setVertexDataPointer(J3DVertexData* pVtxData) { + J3D_ASSERT_NULLPTR(657, pVtxData != NULL); + mVertexData = pVtxData; + } + void* getVcdVatCmd() { return mVcdVatCmd; } void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; } void show() { offFlag(J3DShpFlag_Hide); } void hide() { onFlag(J3DShpFlag_Hide); } - void setCurrentViewNoPtr(u32* pViewNoPtr) { mCurrentViewNo = pViewNoPtr; } + void setCurrentViewNoPtr(u32* pViewNoPtr) { + J3D_ASSERT_NULLPTR(584, pViewNoPtr != NULL); + mCurrentViewNo = pViewNoPtr; + } void setCurrentMtx(J3DCurrentMtx& mtx) { mCurrentMtx = mtx; } - void setScaleFlagArray(u8* pScaleFlagArray) { mScaleFlagArray = pScaleFlagArray; } + void setScaleFlagArray(u8* pScaleFlagArray) { + J3D_ASSERT_NULLPTR(595, pScaleFlagArray != NULL); + mScaleFlagArray = pScaleFlagArray; + } void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; } void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; } - void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; } - bool getNBTFlag() const { return mHasNBT; } u32 getBumpMtxOffset() const { return mBumpMtxOffset; } void setBumpMtxOffset(u32 offs) { mBumpMtxOffset = offs; } - GXVtxDescList* getVtxDesc() const { return mVtxDesc; } + GXVtxDescList* getVtxDesc() { return mVtxDesc; } J3DMaterial* getMaterial() const { return mMaterial; } u32 getIndex() const { return mIndex; } - u32 getPipeline() const { return (mFlags >> 2) & 0x07; } - u32 getTexMtxLoadType() const { return mFlags & 0xF000; } u32 getMtxGroupNum() const { return mMtxGroupNum; } - J3DShapeDraw* getShapeDraw(u16 idx) const { return mShapeDraw[idx]; } - J3DShapeMtx* getShapeMtx(u16 idx) const { return mShapeMtx[idx]; } - Vec* getMin() { return &mMin; } - Vec* getMax() { return &mMax; } + J3DShapeDraw* getShapeDraw(u16 idx) { return mShapeDraw[idx]; } + J3DShapeMtx* getShapeMtx(u16 idx) { return mShapeMtx[idx]; } static void resetVcdVatCache() { sOldVcdVatCmd = NULL; } diff --git a/include/JSystem/J3DGraphBase/J3DVertex.h b/include/JSystem/J3DGraphBase/J3DVertex.h index 114f3aa6..cacc1343 100644 --- a/include/JSystem/J3DGraphBase/J3DVertex.h +++ b/include/JSystem/J3DGraphBase/J3DVertex.h @@ -24,11 +24,9 @@ public: J3DVertexData(); ~J3DVertexData(); - inline void clear() { mPacketNum = 0; } - void* getVtxPosArray() { return mVtxPosArray; } void* getVtxNrmArray() { return mVtxNrmArray; } - GXColor* getVtxColorArray(u8 idx) const { return mVtxColorArray[idx]; } + GXColor* getVtxColorArray(u8 idx) { return mVtxColorArray[idx]; } void* getVtxTexCoordArray(u8 idx) { return mVtxTexCoordArray[idx]; } void* getVtxNBTArray() { return mVtxNBTArray; } u32 getNrmNum() const { return mNrmNum; } @@ -46,6 +44,7 @@ public: private: friend class J3DModelLoader; + friend class J3DModelData; /* 0x00 */ u32 mVtxNum; /* 0x04 */ u32 mNrmNum; |
