diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2022-04-23 20:06:43 -0700 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2022-04-24 01:57:11 -0700 |
| commit | fb8b3251d6eeea44510e0bae251e63b122f56b36 (patch) | |
| tree | a9ce330cd940ea7ee0a3dce44872f972d800e848 /include/JSystem/J3DGraphBase | |
| parent | 2358fd042d3bf4d55294d63c1f72cf23003ee6b4 (diff) | |
J3DShape: more OK
Diffstat (limited to 'include/JSystem/J3DGraphBase')
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DPacket.h | 1 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DShape.h | 33 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphBase/J3DShapeMtx.h | 1 |
3 files changed, 29 insertions, 6 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h index 3ed3fe2804..14ed0fb5f4 100644 --- a/include/JSystem/J3DGraphBase/J3DPacket.h +++ b/include/JSystem/J3DGraphBase/J3DPacket.h @@ -123,6 +123,7 @@ public: J3DShape* getShape() const { return mpShape; } J3DModel* getModel() const { return mpModel; } + Mtx* getBaseMtxPtr() const { return mpBaseMtxPtr; } public: /* 0x28 */ J3DShape* mpShape; diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h index b37f074849..e2d0cccae9 100644 --- a/include/JSystem/J3DGraphBase/J3DShape.h +++ b/include/JSystem/J3DGraphBase/J3DShape.h @@ -13,10 +13,30 @@ public: u32 mMtxIdxRegB; }; +static inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) { + GFX_FIFO(u8) = GX_CMD_LOAD_CP_REG; + GFX_FIFO(u8) = cmd; + GFX_FIFO(u32) = param; +} + +static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) { + GFX_FIFO(u8) = GX_CMD_LOAD_XF_REG; + GFX_FIFO(u16) = (len - 1); + GFX_FIFO(u16) = cmd; +} + class J3DCurrentMtx : public J3DCurrentMtxInfo { public: u32 getMtxIdxRegA() const { return mMtxIdxRegA; } u32 getMtxIdxRegB() const { return mMtxIdxRegB; } + + inline void load() const { + J3DFifoWriteCPCmd(0x30, getMtxIdxRegA()); // CP_MATINDEX_A + J3DFifoWriteCPCmd(0x40, getMtxIdxRegB()); // CP_MATINDEX_B + J3DFifoWriteXFCmd(0x1018, 2); + GFX_FIFO(u32) = getMtxIdxRegA(); + GFX_FIFO(u32) = getMtxIdxRegB(); + } }; class J3DMaterial; @@ -24,11 +44,12 @@ class J3DVertexData; class J3DDrawMtxData; enum J3DShpFlag { - J3DShpFlag_Visible = 0x0001, - J3DShpFlag_SkinPosCpu = 0x0004, - J3DShpFlag_SkinNrmCpu = 0x0008, - J3DShpFlag_Hidden = 0x0010, - J3DShpFlag_EnableLod = 0x0100, + J3DShpFlag_Visible = 0x0001, + J3DShpFlag_SkinPosCpu = 0x0004, + J3DShpFlag_SkinNrmCpu = 0x0008, + J3DShpFlag_Hidden = 0x0010, + J3DShpFlag_EnableLod = 0x0100, + J3DShpFlag_NoMtx = 0x0200, }; class J3DShape { @@ -52,7 +73,7 @@ public: void onFlag(u32 flag) { mFlags |= flag; } void offFlag(u32 flag) { mFlags &= ~flag; } - bool checkFlag(u32 flag) { return !!(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; } diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h index ced0ec979b..4b0249ac4c 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h +++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h @@ -41,6 +41,7 @@ public: static void setCurrentPipeline(u32 pipeline) { sCurrentPipeline = pipeline; } static void setLODFlag(u8 flag) { struct_804515B0[1] = flag; } + static void resetMtxLoadCache(); private: /* 0x04 */ u16 mUseMtxIndex; |
