summaryrefslogtreecommitdiff
path: root/include/JSystem/J3DGraphBase
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2022-10-19 00:38:01 -0700
committerGitHub <noreply@github.com>2022-10-19 00:38:01 -0700
commitf03b959831d308b63ba72d79f7814faaa6818481 (patch)
treee5b31e52e6755877e7402cd81f8f490565b1855c /include/JSystem/J3DGraphBase
parent4913395dbd1a33d794028ceb82579b4baffe954d (diff)
parentc3a6d117295705a486bbd67cc0c84991b4d139c3 (diff)
Merge pull request #211 from TakaRikka/work1
d_attention / d_a_player / d_demo + misc
Diffstat (limited to 'include/JSystem/J3DGraphBase')
-rw-r--r--include/JSystem/J3DGraphBase/J3DDrawBuffer.h39
-rw-r--r--include/JSystem/J3DGraphBase/J3DPacket.h20
-rw-r--r--include/JSystem/J3DGraphBase/J3DShape.h16
-rw-r--r--include/JSystem/J3DGraphBase/J3DShapeMtx.h36
-rw-r--r--include/JSystem/J3DGraphBase/J3DSys.h3
-rw-r--r--include/JSystem/J3DGraphBase/J3DTransform.h7
6 files changed, 94 insertions, 27 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h
index 38cc0e08c2..b937d16387 100644
--- a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h
+++ b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h
@@ -11,22 +11,37 @@ class J3DDrawPacket;
class J3DMatPacket;
class J3DShapePacket;
-typedef void (*J3DDrawBuffer_DrawFunc)(const J3DDrawBuffer* this_);
+typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*);
+typedef void (J3DDrawBuffer::*drawFunc)() const;
class J3DDrawBuffer {
public:
+ enum EDrawType {
+ DRAW_HEAD,
+ DRAW_TAIL,
+ };
+
+ enum ESortType {
+ SORT_MAT,
+ SORT_MAT_ANM,
+ SORT_Z,
+ SORT_MODEL,
+ SORT_INVALID,
+ SORT_NON,
+ };
+
J3DDrawBuffer() { initialize(); }
~J3DDrawBuffer();
void initialize();
J3DError allocBuffer(u32);
void frameInit();
- void entryMatSort(J3DMatPacket*);
- void entryMatAnmSort(J3DMatPacket*);
- void entryZSort(J3DMatPacket*);
- void entryModelSort(J3DMatPacket*);
- void entryInvalidSort(J3DMatPacket*);
- bool entryNonSort(J3DMatPacket*);
- bool entryImm(J3DPacket* pPacket, u16 index);
+ int entryMatSort(J3DMatPacket*);
+ int entryMatAnmSort(J3DMatPacket*);
+ int entryZSort(J3DMatPacket*);
+ int entryModelSort(J3DMatPacket*);
+ int entryInvalidSort(J3DMatPacket*);
+ int entryNonSort(J3DMatPacket*);
+ int entryImm(J3DPacket* pPacket, u16 index);
void draw() const;
void drawHead() const;
void drawTail() const;
@@ -43,12 +58,12 @@ public:
/* 0x10 */ f32 mZNear;
/* 0x14 */ f32 mZFar;
/* 0x18 */ f32 mZRatio;
- /* 0x1C */ Mtx* mpZMtx;
+ /* 0x1C */ MtxP mpZMtx;
/* 0x20 */ J3DPacket* mpCallBackPacket;
- static u8 sortFuncTable[72];
- static u8 drawFuncTable[24];
- static u8 entryNum[4 + 4 /* padding */];
+ static sortFunc sortFuncTable[6];
+ static drawFunc drawFuncTable[2];
+ static int entryNum;
};
#endif /* J3DDRAWBUFFER_H */
diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h
index 6552c461af..232db283d3 100644
--- a/include/JSystem/J3DGraphBase/J3DPacket.h
+++ b/include/JSystem/J3DGraphBase/J3DPacket.h
@@ -51,27 +51,29 @@ public:
class J3DPacket {
public:
J3DPacket() {
- mpNextSibling = NULL;
+ mpNextPacket = NULL;
mpFirstChild = NULL;
mpUserData = NULL;
}
void addChildPacket(J3DPacket*);
- J3DPacket* getNextPacket() const { return mpNextSibling; }
+
+ J3DPacket* getNextPacket() const { return mpNextPacket; }
+ void setNextPacket(J3DPacket* i_packet) { mpNextPacket = i_packet; }
- inline void clear() {
- mpNextSibling = NULL;
+ void drawClear() {
+ mpNextPacket = NULL;
mpFirstChild = NULL;
}
void setUserArea(u32 area) { mpUserData = (void*)area; }
- virtual bool entry(J3DDrawBuffer*);
+ virtual int entry(J3DDrawBuffer*);
virtual void draw();
virtual ~J3DPacket() {}
public:
- /* 0x04 */ J3DPacket* mpNextSibling;
+ /* 0x04 */ J3DPacket* mpNextPacket;
/* 0x08 */ J3DPacket* mpFirstChild;
/* 0x0C */ void* mpUserData;
}; // Size: 0x10
@@ -143,19 +145,21 @@ public:
void endDiff();
bool isSame(J3DMatPacket*) const;
+ J3DMaterial* getMaterial() const { return mpMaterial; }
J3DShapePacket* getShapePacket() const { return mpShapePacket; }
void setShapePacket(J3DShapePacket* packet) { mpShapePacket = packet; }
void setInitShapePacket(J3DShapePacket* packet) { mpInitShapePacket = packet; }
+ bool isChanged() const { return mDiffFlag < 0; }
virtual ~J3DMatPacket();
- virtual bool entry(J3DDrawBuffer*);
+ virtual int entry(J3DDrawBuffer*);
virtual void draw();
public:
/* 0x28 */ J3DShapePacket* mpInitShapePacket;
/* 0x2C */ J3DShapePacket* mpShapePacket;
/* 0x30 */ J3DMaterial* mpMaterial;
- /* 0x34 */ u32 mSortFlags;
+ /* 0x34 */ u32 mDiffFlag;
/* 0x38 */ J3DTexture* mpTexture;
/* 0x3C */ J3DMaterialAnm* mpMaterialAnm;
}; // Size: 0x40
diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h
index f18551d7ed..85cf0da8e9 100644
--- a/include/JSystem/J3DGraphBase/J3DShape.h
+++ b/include/JSystem/J3DGraphBase/J3DShape.h
@@ -27,6 +27,11 @@ static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) {
class J3DCurrentMtx : public J3DCurrentMtxInfo {
public:
+ J3DCurrentMtx() {
+ mMtxIdxRegA = 0x3cf3cf00;
+ mMtxIdxRegB = 0x00f3cf3c;
+ }
+
u32 getMtxIdxRegA() const { return mMtxIdxRegA; }
u32 getMtxIdxRegB() const { return mMtxIdxRegB; }
@@ -54,6 +59,14 @@ enum J3DShpFlag {
class J3DShape {
public:
+ J3DShape() {
+ initialize();
+ }
+
+ enum {
+ kVcdVatDLSize = 0xC0,
+ };
+
/* 80314B48 */ void initialize();
/* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32);
/* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr);
@@ -93,11 +106,14 @@ public:
inline u32 getMtxGroupNum() const { return mMtxGroupNum; }
inline J3DShapeDraw* getShapeDraw(u32 idx) const { return mShapeDraw[idx]; }
inline J3DShapeMtx* getShapeMtx(u32 idx) const { return mShapeMtx[idx]; }
+
static void resetVcdVatCache() { sOldVcdVatCmd = NULL; }
static void* sOldVcdVatCmd;
private:
+ friend struct J3DShapeFactory;
+
/* 0x04 */ J3DMaterial* mMaterial;
/* 0x08 */ u16 mIndex;
/* 0x0A */ u16 mMtxGroupNum;
diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h
index 0a346b2068..1b745e5fc1 100644
--- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h
+++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h
@@ -24,6 +24,10 @@ extern u8 struct_804515B0[4];
class J3DShapeMtx {
public:
+ J3DShapeMtx(u16 useMtxIndex)
+ : mUseMtxIndex(useMtxIndex)
+ {}
+
/* 803130A8 */ void resetMtxLoadCache();
/* 803130E4 */ void loadMtxIndx_PNGP(int, u16) const;
/* 80313128 */ void loadMtxIndx_PCPU(int, u16) const;
@@ -54,6 +58,10 @@ private:
class J3DShapeMtxConcatView : public J3DShapeMtx {
public:
+ J3DShapeMtxConcatView(u16 useMtxIndex)
+ : J3DShapeMtx(useMtxIndex)
+ {}
+
/* 80314730 */ virtual ~J3DShapeMtxConcatView();
/* 803147E0 */ virtual u32 getType() const;
/* 80313C54 */ virtual void load() const;
@@ -73,6 +81,10 @@ public:
class J3DShapeMtxYBBoardConcatView : public J3DShapeMtxConcatView {
public:
+ J3DShapeMtxYBBoardConcatView(u16 useMtxIndex)
+ : J3DShapeMtxConcatView(useMtxIndex)
+ {}
+
/* 80314520 */ virtual ~J3DShapeMtxYBBoardConcatView();
/* 803147E0 */ virtual u32 getType() const;
/* 803143E4 */ virtual void load() const;
@@ -80,6 +92,10 @@ public:
class J3DShapeMtxBBoardConcatView : public J3DShapeMtxConcatView {
public:
+ J3DShapeMtxBBoardConcatView(u16 useMtxIndex)
+ : J3DShapeMtxConcatView(useMtxIndex)
+ {}
+
/* 803145A4 */ virtual ~J3DShapeMtxBBoardConcatView();
/* 803147E0 */ virtual u32 getType() const;
/* 803142D4 */ virtual void load() const;
@@ -87,6 +103,12 @@ public:
class J3DShapeMtxMulti : public J3DShapeMtx {
public:
+ J3DShapeMtxMulti(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable)
+ : J3DShapeMtx(useMtxIndex)
+ , mUseMtxNum(useMtxNum)
+ , mUseMtxIndexTable(useMtxIndexTable)
+ {}
+
/* 803146B0 */ virtual ~J3DShapeMtxMulti();
/* 803147E0 */ virtual u32 getType() const;
/* 80273E08 */ virtual u32 getUseMtxNum() const;
@@ -96,11 +118,17 @@ public:
private:
/* 0x6 */ u16 mUseMtxNum;
- /* 0x8 */ u16* mUseMtxIndex;
+ /* 0x8 */ u16* mUseMtxIndexTable;
};
-class J3DShapeMtxMultiConcatView : public J3DShapeMtx {
+class J3DShapeMtxMultiConcatView : public J3DShapeMtxConcatView {
public:
+ J3DShapeMtxMultiConcatView(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable)
+ : J3DShapeMtxConcatView(useMtxIndex)
+ , mUseMtxNum(useMtxNum)
+ , mUseMtxIndexTable(useMtxIndexTable)
+ {}
+
/* 8031461C */ virtual ~J3DShapeMtxMultiConcatView();
/* 803147E0 */ virtual u32 getType() const;
/* 80273E08 */ virtual u32 getUseMtxNum() const;
@@ -111,7 +139,7 @@ public:
private:
/* 0x6 */ u16 mUseMtxNum;
- /* 0x8 */ u16* mUseMtxIndex;
+ /* 0x8 */ u16* mUseMtxIndexTable;
};
-#endif /* J3DSHAPEMTX_H */
+#endif /* J3DSHAPEMTX_H */ \ No newline at end of file
diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h
index fd75fc48f7..01f882e3f4 100644
--- a/include/JSystem/J3DGraphBase/J3DSys.h
+++ b/include/JSystem/J3DGraphBase/J3DSys.h
@@ -93,6 +93,9 @@ struct J3DSys {
void setMaterialMode(u32 mode) { mMaterialMode = mode; }
void setTexture(J3DTexture* pTex) { mTexture = pTex; }
+ J3DTexture* getTexture() { return mTexture; }
+
+ void setNBTScale(Vec* scale) { mNBTScale = scale; }
void onFlag(u32 flag) { mFlags |= flag; }
diff --git a/include/JSystem/J3DGraphBase/J3DTransform.h b/include/JSystem/J3DGraphBase/J3DTransform.h
index 1bdc7ebb88..a162bd5b7c 100644
--- a/include/JSystem/J3DGraphBase/J3DTransform.h
+++ b/include/JSystem/J3DGraphBase/J3DTransform.h
@@ -1,13 +1,14 @@
#ifndef J3DTRANSFORM_H
#define J3DTRANSFORM_H
+#include "JSystem/JGeometry.h"
#include "dolphin/mtx/mtxvec.h"
#include "dolphin/types.h"
struct J3DTransformInfo {
- /* 0x00 */ Vec mScale;
- /* 0x0C */ SVec mRotation;
- /* 0x14 */ Vec mTranslate;
+ /* 0x00 */ JGeometry::TVec3<f32> mScale;
+ /* 0x0C */ JGeometry::TVec3<s16> mRotation;
+ /* 0x14 */ JGeometry::TVec3<f32> mTranslate;
}; // Size: 0x20
extern J3DTransformInfo const j3dDefaultTransformInfo;