summaryrefslogtreecommitdiff
path: root/include/JSystem/J3DGraphBase
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2023-09-23 18:33:12 -0700
committerJasper St. Pierre <jstpierre@mecheye.net>2023-09-23 18:33:12 -0700
commit4e40d0643968886b2c8cdacfed655400fd8ffb49 (patch)
tree77383a2d0fced3b2fcadd1598a8ce4cd871c7b95 /include/JSystem/J3DGraphBase
parent2741687de13ee1e9b86d78908a2c87eb26f217c4 (diff)
J3DShapeMtx progress
Diffstat (limited to 'include/JSystem/J3DGraphBase')
-rw-r--r--include/JSystem/J3DGraphBase/J3DShape.h32
-rw-r--r--include/JSystem/J3DGraphBase/J3DShapeMtx.h81
-rw-r--r--include/JSystem/J3DGraphBase/J3DSys.h80
3 files changed, 121 insertions, 72 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h
index a1fdf247..a4a95716 100644
--- a/include/JSystem/J3DGraphBase/J3DShape.h
+++ b/include/JSystem/J3DGraphBase/J3DShape.h
@@ -72,22 +72,22 @@ public:
kVcdVatDLSize = 0xC0,
};
- /* 80314B48 */ void initialize();
- /* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32);
- /* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr);
- /* 80314DA8 */ void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
- /* 80314E28 */ u32 countBumpMtxNum() const;
- /* 80314EEC */ void loadVtxArray() const;
- /* 80314F5C */ bool isSameVcdVatCmd(J3DShape*);
- /* 80314F98 */ void makeVtxArrayCmd();
- /* 80315260 */ void makeVcdVatCmd();
- /* 80315300 */ void loadPreDrawSetting() const;
- /* 80315398 */ void setArrayAndBindPipeline() const;
-
- /* 803155E0 */ virtual void draw() const;
- /* 8031544C */ virtual void drawFast() const;
- /* 80315628 */ virtual void simpleDraw() const;
- /* 803156AC */ virtual void simpleDrawCache() const;
+ void initialize();
+ void addTexMtxIndexInDL(_GXAttr, u32);
+ void addTexMtxIndexInVcd(_GXAttr);
+ void calcNBTScale(Vec const&, Mtx33*, Mtx33*);
+ u32 countBumpMtxNum() const;
+ void loadVtxArray() const;
+ bool isSameVcdVatCmd(J3DShape*);
+ void makeVtxArrayCmd();
+ void makeVcdVatCmd();
+ void loadPreDrawSetting() const;
+ void setArrayAndBindPipeline() const;
+
+ virtual void draw() const;
+ virtual void drawFast() const;
+ virtual void simpleDraw() const;
+ virtual void simpleDrawCache() const;
void onFlag(u32 flag) { mFlags |= flag; }
void offFlag(u32 flag) { mFlags &= ~flag; }
diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h
index 8c2a29f8..5435ed7d 100644
--- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h
+++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h
@@ -27,13 +27,10 @@ public:
static J3DTexMtxObj* sTexMtxObj;
};
-extern u8 struct_804515B0;
-extern u8 struct_804515B1;
-extern u8 struct_804515B2;
-extern u8 struct_804515B3;
-
class J3DShapeMtx {
public:
+ typedef void (J3DShapeMtx::*MtxLoadIndx)(int mtxNo, u16 index) const;
+
J3DShapeMtx(u16 useMtxIndex) : mUseMtxIndex(useMtxIndex) {}
void resetMtxLoadCache();
@@ -49,25 +46,58 @@ public:
virtual void load() const;
virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
- static u8 sMtxLoadPipeline[48];
- static u16 sMtxLoadCache[10 + 2 /* padding */];
+ static MtxLoadIndx sMtxLoadPipeline[4];
static u32 sCurrentPipeline;
- // static J3DScaleFlag sCurrentScaleFlag;
static u8* sCurrentScaleFlag;
static u8 sNBTFlag;
- static u32 sTexMtxLoadType;
static void setCurrentPipeline(u32 pipeline) { sCurrentPipeline = pipeline; }
- static void setLODFlag(u8 flag) { struct_804515B1 = flag; }
- static u8 getLODFlag() { return struct_804515B1; }
static void resetMtxLoadCache();
-private:
+protected:
/* 0x04 */ u16 mUseMtxIndex;
};
+class J3DShapeMtxImm : public J3DShapeMtx {
+public:
+ typedef void (J3DShapeMtxImm::*MtxLoadImm)(int mtxNo, u16 index) const;
+
+ J3DShapeMtxImm(u16 useMtxIndex) : J3DShapeMtx(useMtxIndex) {}
+
+ virtual ~J3DShapeMtxImm();
+ virtual u32 getType() const;
+ virtual void load() const;
+ virtual void loadNrmMtx(int, u16) const;
+
+ void loadMtxImm_PNGP(int, u16) const;
+ void loadMtxImm_PCPU(int, u16) const;
+ void loadMtxImm_NCPU(int, u16) const;
+ void loadMtxImm_PNCPU(int, u16) const;
+ void loadMtxImm_PNGP_LOD(int, u16) const;
+
+ static MtxLoadImm sMtxLoadPipeline[4];
+};
+
+class J3DShapeMtxMultiImm : public J3DShapeMtxImm {
+public:
+ J3DShapeMtxMultiImm(u16 useMtxIndex) : J3DShapeMtxImm(useMtxIndex) {}
+
+ virtual ~J3DShapeMtxMultiImm();
+ virtual u32 getType() const;
+ virtual u32 getUseMtxNum() const;
+ virtual u32 getUseMtxIndex(u16) const;
+ virtual void load() const;
+ virtual void loadNrmMtx(int, u16) const;
+
+private:
+ /* 0x6 */ u16 mUseMtxNum;
+ /* 0x8 */ u16* mUseMtxIndexTable;
+};
+
class J3DShapeMtxConcatView : public J3DShapeMtx {
public:
+ typedef void (J3DShapeMtxConcatView::*MtxLoadConcatView)(int mtxNo, u16 index) const;
+
J3DShapeMtxConcatView(u16 useMtxIndex) : J3DShapeMtx(useMtxIndex) {}
virtual ~J3DShapeMtxConcatView();
@@ -82,9 +112,26 @@ public:
void loadMtxConcatView_PNCPU(int, u16) const;
void loadMtxConcatView_PNGP_LOD(int, u16) const;
- static u8 sMtxLoadPipeline[48];
- static u8 sMtxLoadLODPipeline[48];
- static u8 sMtxPtrTbl[8];
+ static MtxLoadConcatView sMtxLoadPipeline[4];
+ static Mtx * sMtxPtrTbl[2];
+};
+
+class J3DShapeMtxBBoardImm : public J3DShapeMtxImm {
+public:
+ J3DShapeMtxBBoardImm(u16 useMtxIndex) : J3DShapeMtxImm(useMtxIndex) {}
+
+ virtual ~J3DShapeMtxBBoardImm();
+ virtual u32 getType() const;
+ virtual void load() const;
+};
+
+class J3DShapeMtxYBBoardImm : public J3DShapeMtxImm {
+public:
+ J3DShapeMtxYBBoardImm(u16 useMtxIndex) : J3DShapeMtxImm(useMtxIndex) {}
+
+ virtual ~J3DShapeMtxYBBoardImm();
+ virtual u32 getType() const;
+ virtual void load() const;
};
class J3DShapeMtxYBBoardConcatView : public J3DShapeMtxConcatView {
@@ -115,7 +162,7 @@ public:
virtual u32 getUseMtxNum() const;
virtual u32 getUseMtxIndex(u16) const;
virtual void load() const;
- virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
+ virtual void calcNBTScale(Vec const&, Mtx33*, Mtx33*);
private:
/* 0x6 */ u16 mUseMtxNum;
@@ -141,4 +188,4 @@ private:
/* 0x8 */ u16* mUseMtxIndexTable;
};
-#endif /* J3DSHAPEMTX_H */ \ No newline at end of file
+#endif /* J3DSHAPEMTX_H */
diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h
index 471bd69a..7fd03008 100644
--- a/include/JSystem/J3DGraphBase/J3DSys.h
+++ b/include/JSystem/J3DGraphBase/J3DSys.h
@@ -30,45 +30,7 @@ enum J3DSysFlag {
};
struct J3DSys {
- /* 0x000 */ Mtx mViewMtx;
- /* 0x030 */ J3DMtxCalc* mCurrentMtxCalc;
- /* 0x034 */ u32 mFlags;
- /* 0x038 */ J3DModel* mModel;
- /* 0x03C */ J3DMatPacket* mMatPacket;
- /* 0x040 */ J3DShapePacket* mShapePacket;
- /* 0x044 */ J3DShape* mShape;
- /* 0x048 */ J3DDrawBuffer* mDrawBuffer[2];
- /* 0x050 */ u32 mDrawMode;
- /* 0x054 */ u32 mMaterialMode;
- /* 0x058 */ J3DTexture* mTexture;
- /* 0x05C */ u8 field_0x5c[0x04];
- /* 0x060 */ u32 mTexCacheRegionNum;
- /* 0x064 */ GXTexRegion mTexCacheRegion[8];
- /* 0x0E4 */ u8 field_0xe4[0x20];
- /* 0x104 */ void* field_0x104;
- /* 0x108 */ Mtx* mModelDrawMtx;
- /* 0x10C */ Mtx33* mModelNrmMtx;
- /* 0x110 */ void* mVtxPos;
- /* 0x114 */ void* mVtxNrm;
- /* 0x118 */ _GXColor* mVtxCol;
- /* 0x11C */ Vec* mNBTScale;
- /* 0x120 */ void* field_0x120;
- /* 0x124 */ void* field_0x124;
-
- J3DSys();
- void loadPosMtxIndx(int, u16) const;
- void loadNrmMtxIndx(int, u16) const;
- void setTexCacheRegion(_GXTexCacheSize);
- void drawInit();
- void reinitGX();
- void reinitGenMode();
- void reinitLighting();
- void reinitTransform();
- void reinitTexture();
- void reinitTevStages();
- void reinitIndStages();
- void reinitPixelProc();
-
+public:
enum DrawMode {
/* 0x3 */ OPA_TEX_EDGE = 3,
/* 0x4 */ XLU,
@@ -130,11 +92,51 @@ struct J3DSys {
void setViewMtx(Mtx m) { MTXCopy(m, mViewMtx); }
J3DModel* getModel() { return mModel; }
+ Vec& getNBTScale() { return *mNBTScale; }
static Mtx mCurrentMtx;
static Vec mCurrentS;
static Vec mParentS;
static u16 sTexCoordScaleTable[32];
+
+ /* 0x000 */ Mtx mViewMtx;
+ /* 0x030 */ J3DMtxCalc* mCurrentMtxCalc;
+ /* 0x034 */ u32 mFlags;
+ /* 0x038 */ J3DModel* mModel;
+ /* 0x03C */ J3DMatPacket* mMatPacket;
+ /* 0x040 */ J3DShapePacket* mShapePacket;
+ /* 0x044 */ J3DShape* mShape;
+ /* 0x048 */ J3DDrawBuffer* mDrawBuffer[2];
+ /* 0x050 */ u32 mDrawMode;
+ /* 0x054 */ u32 mMaterialMode;
+ /* 0x058 */ J3DTexture* mTexture;
+ /* 0x05C */ u8 field_0x5c[0x04];
+ /* 0x060 */ u32 mTexCacheRegionNum;
+ /* 0x064 */ GXTexRegion mTexCacheRegion[8];
+ /* 0x0E4 */ u8 field_0xe4[0x20];
+ /* 0x104 */ void* field_0x104;
+ /* 0x108 */ Mtx* mModelDrawMtx;
+ /* 0x10C */ Mtx33* mModelNrmMtx;
+ /* 0x110 */ void* mVtxPos;
+ /* 0x114 */ void* mVtxNrm;
+ /* 0x118 */ _GXColor* mVtxCol;
+ /* 0x11C */ void* field_0x11c;
+ /* 0x120 */ void* field_0x120;
+ /* 0x124 */ Vec* mNBTScale;
+
+ J3DSys();
+ void loadPosMtxIndx(int, u16) const;
+ void loadNrmMtxIndx(int, u16) const;
+ void setTexCacheRegion(_GXTexCacheSize);
+ void drawInit();
+ void reinitGX();
+ void reinitGenMode();
+ void reinitLighting();
+ void reinitTransform();
+ void reinitTexture();
+ void reinitTevStages();
+ void reinitIndStages();
+ void reinitPixelProc();
};
extern u32 j3dDefaultViewNo;