Finish merge

This commit is contained in:
Dylan Ascencio
2023-10-04 00:38:21 -04:00
1418 changed files with 15136 additions and 10050 deletions
+84 -4
View File
@@ -9,7 +9,7 @@ inline void J3DGDWrite_u8(u8 param) {
}
inline void J3DGDWrite_u16(u16 param) {
__GDWrite((param & 0xffff) >> 8);
__GDWrite((param >> 8) & 0xff);
__GDWrite(param & 0xff);
}
@@ -20,15 +20,53 @@ inline void J3DGDWrite_u32(u32 param) {
__GDWrite(param & 0xff);
}
inline void J3DGDWriteXFCmd(u16 param_1, u32 param_2) {
inline void J3DGDWrite_f32(f32 param) {
u32 tmp = *(u32*)&param;
J3DGDWrite_u32(tmp);
}
inline void J3DGDWriteBPCmd(u32 param_1) {
J3DGDWrite_u8(0x61);
J3DGDWrite_u32(param_1);
}
inline void J3DGDWriteXFCmd(u16 cmd, u32 param) {
J3DGDWrite_u8(0x10);
J3DGDWrite_u16(0);
J3DGDWrite_u16(param_1);
J3DGDWrite_u32(param_2);
J3DGDWrite_u16(cmd);
J3DGDWrite_u32(param);
}
inline void J3DGDWriteXFCmdHdr(u16 cmd, u8 len) {
J3DGDWrite_u8(0x10);
J3DGDWrite_u16(len - 1);
J3DGDWrite_u16(cmd);
}
void J3DGDSetGenMode(u8 texGenNum, u8 colorChanNum, u8 tevStageNum, u8 IndTexStageNum, _GXCullMode cullMode);
void J3DGDSetGenMode_3Param(u8 texGenNum, u8 tevStageNum, u8 indTexStageNum);
void J3DGDSetIndTexStageNum(u32);
void J3DGDSetLightAttn(_GXLightID, f32, f32, f32, f32, f32, f32);
void J3DGDSetLightColor(GXLightID, GXColor);
void J3DGDSetLightPos(GXLightID, f32, f32, f32);
void J3DGDSetLightDir(GXLightID, f32, f32, f32);
void J3DGDSetVtxAttrFmtv(GXVtxFmt, GXVtxAttrFmtList*, bool);
void J3DGDSetTexCoordGen(GXTexGenType, GXTexGenSrc);
void J3DGDSetTexCoordScale2(GXTexCoordID, u16, u8, u8, u16, u8, u8);
void J3DGDSetTexLookupMode(GXTexMapID, GXTexWrapMode, GXTexWrapMode, GXTexFilter, GXTexFilter, f32, f32, f32, u8, u8, GXAnisotropy);
void J3DGDSetTexImgAttr(GXTexMapID, u16, u16, GXTexFmt);
void J3DGDSetTexImgPtr(GXTexMapID, void*);
void J3DGDSetTexImgPtrRaw(GXTexMapID, u32);
void J3DGDSetTexTlut(GXTexMapID, u32, GXTlutFmt);
void J3DGDLoadTlut(void*, u32, GXTlutSize);
void J3DGDSetIndTexMtx(GXIndTexMtxID, Mtx23, s8);
void J3DGDSetIndTexCoordScale(GXIndTexStageID, GXIndTexScale, GXIndTexScale, GXIndTexScale, GXIndTexScale);
void J3DGDSetIndTexOrder(u32, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID);
void J3DGDSetTevOrder(GXTevStageID, GXTexCoordID, GXTexMapID, GXChannelID, GXTexCoordID, GXTexMapID, GXChannelID);
void J3DGDSetTevKColor(GXTevKColorID, GXColor);
void J3DGDSetTevColorS10(GXTevRegID, GXColorS10);
void J3DGDSetFog(GXFogType, f32, f32, f32, f32, GXColor);
void J3DGDSetFogRangeAdj(u8, u16, GXFogAdjTable*);
static inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
GFX_FIFO(u8) = cmd;
@@ -44,4 +82,46 @@ inline void J3DGDSetNumTexGens(u8 numTexGens) {
J3DGDWriteXFCmd(0x103f, numTexGens);
}
inline void J3DGDSetAlphaCompare(GXCompare cmp0, u8 ref0, GXAlphaOp op, GXCompare cmp1, u8 ref1) {
J3DGDWriteBPCmd(ref0 | ref1 << 8 | cmp0 << 16 | cmp1 << 19 | op << 22 | 0xF3 << 24);
}
inline void J3DGDSetBlendMode(GXBlendMode mode, GXBlendFactor srcFactor, GXBlendFactor dstFactor, GXLogicOp logicOp) {
J3DGDWriteBPCmd(0xFE001FE3);
J3DGDWriteBPCmd(
(mode == GX_BM_BLEND || mode == GX_BM_SUBTRACT) << 0 |
(mode == GX_BM_LOGIC) << 1 |
dstFactor << 5 |
srcFactor << 8 |
(mode == GX_BM_SUBTRACT) << 11 |
logicOp << 12 |
0x41 << 24);
}
inline void J3DGDSetBlendMode(GXBlendMode mode, GXBlendFactor srcFactor, GXBlendFactor dstFactor, GXLogicOp logicOp, u8 ditherEnable) {
J3DGDWriteBPCmd(0xFE001FE7);
J3DGDWriteBPCmd(
u32(mode == GX_BM_BLEND || mode == GX_BM_SUBTRACT) << 0 |
(mode == GX_BM_LOGIC) << 1 |
ditherEnable << 2 |
dstFactor << 5 |
srcFactor << 8 |
(mode == GX_BM_SUBTRACT) << 11 |
logicOp << 12 |
0x41 << 24);
}
inline void J3DGDSetZMode(u8 compareEnable, GXCompare func, u8 writeEnable) {
J3DGDWriteBPCmd(compareEnable | func << 1 | writeEnable << 4 | 0x40 << 24);
}
inline void J3DGDSetZCompLoc(u32 compLocEnable) {
J3DGDWriteBPCmd(0xFE000040);
J3DGDWriteBPCmd(compLocEnable << 6 | 0x43 << 24);
}
inline void J3DGDSetTevKonstantSel_SwapModeTable(GXTevStageID stage, GXTevKColorSel colorSel1, GXTevKAlphaSel alphaSel1, GXTevKColorSel colorSel2, GXTevKAlphaSel alphaSel2, GXTevColorChan chan1, GXTevColorChan chan2) {
J3DGDWriteBPCmd((stage / 2 + 0xf6) << 24 | (chan1 | chan2 << 2 | colorSel1 << 4 | alphaSel1 << 9 | colorSel2 << 14 | alphaSel2 << 19) & 0x00FFFFFF);
}
#endif /* J3DGD_H */
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -43,6 +43,8 @@ public:
J3DMaterial* getNext() const { return mNext; }
J3DShape* getShape() const { return mShape; }
u32 getMaterialMode() { return mMaterialMode; }
void setMaterialMode(u32 mode) { mMaterialMode = mode; }
J3DTevBlock* getTevBlock() const { return mTevBlock; }
J3DColorBlock* getColorBlock() const { return mColorBlock; }
J3DTexGenBlock* getTexGenBlock() const { return mTexGenBlock; }
@@ -59,8 +61,8 @@ public:
}
J3DNBTScale* getNBTScale() const { return mTexGenBlock->getNBTScale(); }
u16 getTexNo(u32 idx) const { return mTevBlock->getTexNo(idx); }
GXColor* getTevKColor(u32 param_0) { return mTevBlock->getTevKColor(param_0); }
GXColorS10* getTevColor(u32 param_0) { return mTevBlock->getTevColor(param_0); }
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(); }
J3DTexMtx* getTexMtx(u32 idx) { return mTexGenBlock->getTexMtx(idx); }
u16 getIndex() { return mIndex; }
+2
View File
@@ -170,6 +170,8 @@ public:
void setDrawMtx(Mtx** pDrawMtx) { mpDrawMtx = pDrawMtx; }
void setNrmMtx(Mtx33** pNrmMtx) { mpNrmMtx = pNrmMtx; }
void setBaseMtxPtr(Mtx* pMtx) { mpBaseMtxPtr = pMtx; }
void setScaleFlagArray(u8* pScaleFlagArray) { mpScaleFlagArray = pScaleFlagArray; }
void setCurrentViewNoPtr(u32* pCurrentViewNo) { mpCurrentViewNo = pCurrentViewNo; }
J3DShape* getShape() const { return mpShape; }
J3DModel* getModel() const { return mpModel; }
+3 -4
View File
@@ -42,10 +42,9 @@ public:
GFX_FIFO(u32) = getMtxIdxRegB();
}
void setCurrentTexMtx(u8 param_1, u8 param_2, u8 param_3, u8 param_4,
u8 param_5, u8 param_6, u8 param_7, u8 param_8) {
mMtxIdxRegA = ((param_1 & 0xff) << 6) | (param_2 << 0xc)| (param_3 << 0x12) | (param_4 << 0x18);
mMtxIdxRegB = (param_5) | param_6 << 6 | param_7 << 0xc | param_8 << 0x12;
void setCurrentTexMtx(u8 t0, u8 t1, u8 t2, u8 t3, u8 t4, u8 t5, u8 t6, u8 t7) {
mMtxIdxRegA = t0 << 6 | t1 << 12 | t2 << 18 | t3 << 24;
mMtxIdxRegB = t4 << 0 | t5 << 6 | t6 << 12 | t7 << 18;
}
};
+28 -28
View File
@@ -40,9 +40,9 @@ public:
void loadMtxIndx_PNCPU(int, u16) const;
virtual ~J3DShapeMtx() {}
virtual u32 getType() const;
virtual u32 getUseMtxNum() const;
virtual u32 getUseMtxIndex(u16) const;
virtual u32 getType() const { return 'SMTX'; }
virtual u32 getUseMtxNum() const { return 1; }
virtual u32 getUseMtxIndex(u16) const { return mUseMtxIndex; }
virtual void load() const;
virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
@@ -65,7 +65,7 @@ public:
J3DShapeMtxImm(u16 useMtxIndex) : J3DShapeMtx(useMtxIndex) {}
virtual ~J3DShapeMtxImm() {}
virtual u32 getType() const;
virtual u32 getType() const { return 'SMIM'; }
virtual void load() const;
virtual void loadNrmMtx(int, u16) const;
@@ -83,15 +83,15 @@ public:
J3DShapeMtxMultiImm(u16 useMtxIndex) : J3DShapeMtxImm(useMtxIndex) {}
virtual ~J3DShapeMtxMultiImm() {}
virtual u32 getType() const;
virtual u32 getUseMtxNum() const;
virtual u32 getUseMtxIndex(u16) const;
virtual u32 getType() const { return 'SMMI'; }
virtual u32 getUseMtxNum() const { return mUseMtxNum; }
virtual u32 getUseMtxIndex(u16 i) const { return mUseMtxIndexTable[i]; }
virtual void load() const;
virtual void loadNrmMtx(int, u16) const;
private:
/* 0x6 */ u16 mUseMtxNum;
/* 0x8 */ u16* mUseMtxIndexTable;
/* 0x8 */ u16 mUseMtxNum;
/* 0xC */ u16* mUseMtxIndexTable;
};
class J3DShapeMtxConcatView : public J3DShapeMtxImm {
@@ -101,9 +101,9 @@ public:
J3DShapeMtxConcatView(u16 useMtxIndex) : J3DShapeMtxImm(useMtxIndex) {}
virtual ~J3DShapeMtxConcatView() {}
virtual u32 getType() const;
virtual u32 getType() const { return 'SMCV'; }
virtual void load() const;
virtual void loadNrmMtx(int, u16) const;
virtual void loadNrmMtx(int, u16) const {}
virtual void loadNrmMtx(int, u16, f32 (*)[4]) const;
void loadMtxConcatView_PNGP(int, u16) const;
@@ -121,7 +121,7 @@ public:
J3DShapeMtxBBoardImm(u16 useMtxIndex) : J3DShapeMtxImm(useMtxIndex) {}
virtual ~J3DShapeMtxBBoardImm() {}
virtual u32 getType() const;
virtual u32 getType() const { return 'SMBB'; }
virtual void load() const;
};
@@ -130,21 +130,21 @@ public:
J3DShapeMtxYBBoardImm(u16 useMtxIndex) : J3DShapeMtxImm(useMtxIndex) {}
virtual ~J3DShapeMtxYBBoardImm() {}
virtual u32 getType() const;
virtual u32 getType() const { return 'SMYB'; }
virtual void load() const;
};
class J3DShapeMtxYBBoardConcatView : public J3DShapeMtxConcatView {
class J3DShapeMtxYBBoardConcatView : public J3DShapeMtxYBBoardImm {
public:
J3DShapeMtxYBBoardConcatView(u16 useMtxIndex) : J3DShapeMtxConcatView(useMtxIndex) {}
J3DShapeMtxYBBoardConcatView(u16 useMtxIndex) : J3DShapeMtxYBBoardImm(useMtxIndex) {}
virtual ~J3DShapeMtxYBBoardConcatView() {}
virtual void load() const;
};
class J3DShapeMtxBBoardConcatView : public J3DShapeMtxConcatView {
class J3DShapeMtxBBoardConcatView : public J3DShapeMtxBBoardImm {
public:
J3DShapeMtxBBoardConcatView(u16 useMtxIndex) : J3DShapeMtxConcatView(useMtxIndex) {}
J3DShapeMtxBBoardConcatView(u16 useMtxIndex) : J3DShapeMtxBBoardImm(useMtxIndex) {}
virtual ~J3DShapeMtxBBoardConcatView() {}
virtual void load() const;
@@ -156,15 +156,15 @@ public:
: J3DShapeMtx(useMtxIndex), mUseMtxNum(useMtxNum), mUseMtxIndexTable(useMtxIndexTable) {}
virtual ~J3DShapeMtxMulti() {}
virtual u32 getType() const;
virtual u32 getUseMtxNum() const;
virtual u32 getUseMtxIndex(u16) const;
virtual u32 getType() const { return 'SMML'; }
virtual u32 getUseMtxNum() const { return mUseMtxNum; }
virtual u32 getUseMtxIndex(u16 i) const { return mUseMtxIndexTable[i]; }
virtual void load() const;
virtual void calcNBTScale(Vec const&, Mtx33*, Mtx33*);
private:
/* 0x6 */ u16 mUseMtxNum;
/* 0x8 */ u16* mUseMtxIndexTable;
/* 0x8 */ u16 mUseMtxNum;
/* 0xC */ u16* mUseMtxIndexTable;
};
class J3DShapeMtxMultiConcatView : public J3DShapeMtxConcatView {
@@ -174,16 +174,16 @@ public:
mUseMtxIndexTable(useMtxIndexTable) {}
virtual ~J3DShapeMtxMultiConcatView() {}
virtual u32 getType() const;
virtual u32 getUseMtxNum() const;
virtual u32 getUseMtxIndex(u16) const;
virtual u32 getType() const { return 'SMMI'; }
virtual u32 getUseMtxNum() const { return mUseMtxNum; }
virtual u32 getUseMtxIndex(u16 i) const { return mUseMtxIndexTable[i]; }
virtual void load() const;
virtual void loadNrmMtx(int, u16) const;
virtual void loadNrmMtx(int, u16) const {}
virtual void loadNrmMtx(int, u16, f32 (*)[4]) const;
private:
/* 0x6 */ u16 mUseMtxNum;
/* 0x8 */ u16* mUseMtxIndexTable;
/* 0x8 */ u16 mUseMtxNum;
/* 0xC */ u16* mUseMtxIndexTable;
};
#endif /* J3DSHAPEMTX_H */
+164 -24
View File
@@ -8,7 +8,7 @@
class J3DLightInfo {
public:
/* 803256C4 */ void operator=(J3DLightInfo const&);
void operator=(J3DLightInfo const&);
/* 0x00 */ Vec mLightPosition;
/* 0x0C */ Vec mLightDirection;
@@ -17,23 +17,6 @@ public:
/* 0x28 */ Vec mDistAtten;
}; // Size = 0x34
extern "C" extern J3DLightInfo const j3dDefaultLightInfo;
class J3DLightObj {
public:
/* 80018C0C */ J3DLightObj() { mInfo = j3dDefaultLightInfo; }
/* 80323590 */ void load(u32) const;
J3DLightInfo& getLightInfo() { return mInfo; }
J3DLightObj& operator=(J3DLightObj const& other) {
mInfo = other.mInfo;
return *this;
}
/* 0x00 */ J3DLightInfo mInfo;
/* 0x34 */ u8 field_0x34[64];
}; // Size = 0x74
struct J3DTextureSRTInfo {
/* 0x00 */ f32 mScaleX;
/* 0x04 */ f32 mScaleY;
@@ -42,23 +25,71 @@ struct J3DTextureSRTInfo {
/* 0x10 */ f32 mTranslationY;
}; // Size: 0x14
enum J3DTexMtxMode {
J3DTexMtxMode_None,
J3DTexMtxMode_EnvmapBasic,
J3DTexMtxMode_ProjmapBasic,
J3DTexMtxMode_ViewProjmapBasic,
J3DTexMtxMode_Unknown4,
J3DTexMtxMode_Unknown5,
J3DTexMtxMode_EnvmapOld,
J3DTexMtxMode_Envmap,
J3DTexMtxMode_Projmap,
J3DTexMtxMode_ViewProjmap,
J3DTexMtxMode_EnvmapOldEffectMtx,
J3DTexMtxMode_EnvmapEffectMtx,
};
struct J3DTexMtxInfo {
/* 80325718 */ void operator=(J3DTexMtxInfo const&);
/* 80325794 */ void setEffectMtx(Mtx);
void operator=(J3DTexMtxInfo const& other) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
mEffectMtx[i][j] = other.mEffectMtx[i][j];
}
}
mCenter = other.mCenter;
mProjection = other.mProjection;
mInfo = other.mInfo;
mSRT = other.mSRT;
}
void setEffectMtx(Mtx);
/* 0x00 */ u8 mProjection;
/* 0x01 */ s8 mInfo;
/* 0x01 */ u8 mInfo;
/* 0x02 */ u8 padding[2];
/* 0x04 */ Vec mCenter;
/* 0x10 */ J3DTextureSRTInfo mSRT;
/* 0x24 */ Mtx44 mEffectMtx;
/* 0x24 */ Mtx44 mEffectMtx;
}; // Size: 0x64
struct J3DIndTexMtxInfo {
/* 0x00 */ Mtx23 field_0x0;
/* 0x18 */ u8 field_0x18;
void operator=(const J3DIndTexMtxInfo& other) {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
mOffsetMtx[i][j] = other.mOffsetMtx[i][j];
}
}
mScaleExp = other.mScaleExp;
}
/* 0x00 */ Mtx23 mOffsetMtx;
/* 0x18 */ u8 mScaleExp;
}; // Size: 0x1C
struct J3DFogInfo {
void operator=(const J3DFogInfo& other) {
mType = other.mType;
mAdjEnable = other.mAdjEnable;
mCenter = other.mCenter;
mStartZ = other.mStartZ;
mEndZ = other.mEndZ;
mNearZ = other.mNearZ;
mFarZ = other.mFarZ;
mColor = other.mColor;
for (int i = 0; i < 10; i++) {
mFogAdjTable[i] = other.mFogAdjTable[i];
}
}
/* 0x00 */ u8 mType;
/* 0x01 */ u8 mAdjEnable;
/* 0x02 */ u16 mCenter;
@@ -77,4 +108,113 @@ struct J3DNBTScaleInfo {
inline void operator=(const J3DNBTScaleInfo & other) { mbHasScale = other.mbHasScale; mScale = other.mScale; }
}; // Size: 0x10
struct J3DIndTexOrderInfo {
void operator=(const J3DIndTexOrderInfo& other) {
mCoord = other.mCoord;
mMap = other.mMap;
}
/* 0x0 */ u8 mCoord;
/* 0x1 */ u8 mMap;
/* 0x2 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
};
struct J3DTevSwapModeInfo {
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 field_0x1;
};
struct J3DTevSwapModeTableInfo {
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 field_0x1;
/* 0x2 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
};
struct J3DTevStageInfo {
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 field_0x1;
/* 0x2 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
/* 0x4 */ u8 field_0x4;
/* 0x5 */ u8 field_0x5;
/* 0x6 */ u8 field_0x6;
/* 0x7 */ u8 field_0x7;
/* 0x8 */ u8 field_0x8;
/* 0x9 */ u8 field_0x9;
/* 0xA */ u8 field_0xa;
/* 0xB */ u8 field_0xb;
/* 0xC */ u8 field_0xc;
/* 0xD */ u8 field_0xd;
/* 0xE */ u8 field_0xe;
/* 0xF */ u8 field_0xf;
/* 0x10 */ u8 field_0x10;
/* 0x11 */ u8 field_0x11;
/* 0x12 */ u8 field_0x12;
/* 0x13 */ u8 field_0x13;
};
struct J3DIndTevStageInfo {
/* 0x0 */ u8 mIndStage;
/* 0x1 */ u8 mIndFormat;
/* 0x2 */ u8 mBiasSel;
/* 0x3 */ u8 mMtxSel;
/* 0x4 */ u8 mWrapS;
/* 0x5 */ u8 mWrapT;
/* 0x6 */ u8 mPrev;
/* 0x7 */ u8 mLod;
/* 0x8 */ u8 mAlphaSel;
};
struct J3DTexCoordInfo {
/* 0x0 */ u8 mTexGenType __attribute__((aligned(4)));
/* 0x1 */ u8 mTexGenSrc;
/* 0x2 */ u8 mTexGenMtx;
};
struct J3DIndTexCoordScaleInfo {
void operator=(const J3DIndTexCoordScaleInfo& other) {
mScaleS = other.mScaleS;
mScaleT = other.mScaleT;
}
/* 0x0 */ u8 mScaleS;
/* 0x1 */ u8 mScaleT;
/* 0x2 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
};
struct J3DBlendInfo {
/* 0x0 */ u8 mBlendMode;
/* 0x1 */ u8 mSrcFactor;
/* 0x2 */ u8 mDstFactor;
/* 0x3 */ u8 mLogicOp;
};
struct J3DTevOrderInfo {
/* 0x0 */ u8 mTexCoord __attribute__((aligned(2)));
/* 0x1 */ u8 mTexMap;
/* 0x2 */ u8 mColorChan;
};
struct J3DColorChanInfo {
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 field_0x1;
/* 0x2 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
/* 0x4 */ u8 field_0x4;
/* 0x5 */ u8 field_0x5;
/* 0x6 */ u8 field_0x6;
/* 0x7 */ u8 field_0x7;
};
struct J3DZModeInfo {
/* 0x0 */ u8 mCompareEnable;
/* 0x1 */ u8 mFunc;
/* 0x2 */ u8 mUpdateEnable;
};
STATIC_ASSERT(sizeof(J3DTevStageInfo) == 0x14);
#endif /* J3DSTRUCT_H */
+9 -2
View File
@@ -23,6 +23,13 @@ class J3DShape;
class J3DDrawBuffer;
class J3DTexture;
struct J3DTexCoordScaleInfo {
/* 0x0 */ u16 field_0x00;
/* 0x2 */ u16 field_0x02;
/* 0x4 */ u16 field_0x04;
/* 0x6 */ u16 field_0x06;
};
enum J3DSysFlag {
J3DSysFlag_SkinPosCpu = 0x00000004,
J3DSysFlag_SkinNrmCpu = 0x00000008,
@@ -95,12 +102,12 @@ public:
void setViewMtx(Mtx m) { MTXCopy(m, mViewMtx); }
J3DModel* getModel() { return mModel; }
Vec& getNBTScale() { return *mNBTScale; }
Vec* getNBTScale() { return mNBTScale; }
static Mtx mCurrentMtx;
static Vec mCurrentS;
static Vec mParentS;
static u16 sTexCoordScaleTable[32];
static J3DTexCoordScaleInfo sTexCoordScaleTable[8];
/* 0x000 */ Mtx mViewMtx;
/* 0x030 */ J3DMtxCalc* mCurrentMtxCalc;
+126 -34
View File
@@ -1,66 +1,158 @@
#ifndef J3DTEVS_H
#define J3DTEVS_H
#include "dolphin/types.h"
#include "JSystem/J3DGraphBase/J3DGD.h"
#include "JSystem/J3DGraphBase/J3DStruct.h"
extern u8 j3dTevSwapTableTable[1024];
extern const J3DLightInfo j3dDefaultLightInfo;
extern const J3DTexCoordInfo j3dDefaultTexCoordInfo[8];
extern const J3DTexMtxInfo j3dDefaultTexMtxInfo;
extern const J3DIndTexMtxInfo j3dDefaultIndTexMtxInfo;
extern const J3DTevStageInfo j3dDefaultTevStageInfo;
extern const J3DIndTevStageInfo j3dDefaultIndTevStageInfo;
extern const J3DFogInfo j3dDefaultFogInfo;
extern const J3DNBTScaleInfo j3dDefaultNBTScaleInfo;
extern const GXColor j3dDefaultColInfo;
extern const GXColor j3dDefaultAmbInfo;
extern const u8 j3dDefaultColorChanNum;
extern const J3DTevOrderInfo j3dDefaultTevOrderInfoNull;
extern const J3DIndTexOrderInfo j3dDefaultIndTexOrderNull;
extern const GXColorS10 j3dDefaultTevColor;
extern const J3DIndTexCoordScaleInfo j3dDefaultIndTexCoordScaleInfo;
extern const GXColor j3dDefaultTevKColor;
extern const J3DTevSwapModeInfo j3dDefaultTevSwapMode;
extern const J3DTevSwapModeTableInfo j3dDefaultTevSwapModeTable;
extern const J3DBlendInfo j3dDefaultBlendInfo;
extern const J3DColorChanInfo j3dDefaultColorChanInfo;
extern const u8 j3dDefaultTevSwapTableID;
extern const u16 j3dDefaultAlphaCmpID;
extern const u16 j3dDefaultZModeID;
struct J3DTevStage {
J3DTevStage() {
setTevStageInfo(j3dDefaultTevStageInfo);
setTevSwapModeInfo(j3dDefaultTevSwapMode);
}
J3DTevStage(const J3DTevStageInfo& info) {
setTevStageInfo(info);
setTevSwapModeInfo(j3dDefaultTevSwapMode);
}
J3DTevStage& operator=(const J3DTevStage& other) {
this->field_0x1 = other.field_0x1;
this->field_0x2 = other.field_0x2;
this->field_0x3 = other.field_0x3;
this->field_0x5 = other.field_0x5;
this->field_0x6 = other.field_0x6;
this->mTevSwapModeInfo = other.mTevSwapModeInfo;
return *this;
}
void setTexSel(u8 param_0) { mTevSwapModeInfo = mTevSwapModeInfo & ~0x0C | param_0 << 2; }
void setRasSel(u8 param_0) { mTevSwapModeInfo = mTevSwapModeInfo & ~0x03 | param_0; }
void setTevSwapModeInfo(const J3DTevSwapModeInfo& info) {
setTexSel(info.field_0x1);
setRasSel(info.field_0x0);
}
void setTevStageInfo(const J3DTevStageInfo&);
void load(u32) const {
J3DGDWriteBPCmd(*(u32*)&field_0x0);
J3DGDWriteBPCmd(*(u32*)&field_0x4);
}
struct J3DTevStageInfo {
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 field_0x1;
/* 0x2 */ u8 field_0x2;
/* 0x1 */ u8 field_0x2;
/* 0x3 */ u8 field_0x3;
/* 0x4 */ u8 field_0x4;
/* 0x5 */ u8 field_0x5;
/* 0x6 */ u8 field_0x6;
/* 0x7 */ u8 field_0x7;
};
struct J3DTevStage : public J3DTevStageInfo {
J3DTevStage();
void setTevStageInfo(J3DTevStageInfo const&);
J3DTevStage(J3DTevStageInfo const&);
};
struct J3DIndTevStageInfo {
/* 0x0 */ u8 mIndStage;
/* 0x1 */ u8 mIndFormat;
/* 0x2 */ u8 mBiasSel;
/* 0x3 */ u8 mMtxSel;
/* 0x4 */ u8 mWrapS;
/* 0x5 */ u8 mWrapT;
/* 0x6 */ u8 mPrev;
/* 0x7 */ u8 mLod;
/* 0x8 */ u8 mAlphaSel;
/* 0x7 */ u8 mTevSwapModeInfo;
};
struct J3DIndTevStage {
J3DIndTevStage();
J3DIndTevStage() {
mInfo = 0;
setIndTevStageInfo(j3dDefaultIndTevStageInfo);
}
void setIndStage(u8 stage) { mInfo = mInfo & ~0x03 | stage; }
void setIndFormat(u8 format) { mInfo = mInfo & ~0x0C | format << 2; }
void setBiasSel(u8 sel) { mInfo = mInfo & ~0x70 | sel << 4; }
void setAlphaSel(u8 sel) { mInfo = mInfo & ~0x0180 | sel << 7; }
void setMtxSel(u8 sel) { mInfo = mInfo & ~0x1E00 | sel << 9; }
void setWrapS(u8 wrap) { mInfo = mInfo & ~0xE000 | wrap << 13; }
void setWrapT(u8 wrap) { mInfo = mInfo & ~0x070000 | wrap << 16; }
void setLod(u8 lod) { mInfo = mInfo & ~0x080000 | lod << 19; }
void setPrev(u8 prev) { mInfo = mInfo & ~0x100000 | prev << 20; }
void setIndTevStageInfo(const J3DIndTevStageInfo& info) {
setIndStage(info.mIndStage);
setIndFormat(info.mIndFormat);
setBiasSel(info.mBiasSel);
setMtxSel(info.mMtxSel);
setWrapS(info.mWrapS);
setWrapT(info.mWrapT);
setPrev(info.mPrev);
setLod(info.mLod);
setAlphaSel(info.mAlphaSel);
}
void load(u32 param_1) {
J3DGDWriteBPCmd(mInfo | (param_1 + 16) << 24);
}
/* 0x0 */ u32 mInfo;
};
struct J3DTevOrderInfo {
/* 0x0 */ u8 mTexCoord __attribute__((aligned(2)));
/* 0x1 */ u8 mTexMap;
/* 0x2 */ u8 mColorChan;
};
struct J3DTevOrder : public J3DTevOrderInfo {
J3DTevOrder();
J3DTevOrder() { *(J3DTevOrderInfo*)this = j3dDefaultTevOrderInfoNull; }
J3DTevOrderInfo& getTevOrderInfo() { return *this; }
u8 getTexMap() { return mTexMap; }
};
struct J3DTevSwapModeTable {
J3DTevSwapModeTable();
J3DTevSwapModeTable() { field_0x0 = j3dDefaultTevSwapTableID; }
u8 getR() { return j3dTevSwapTableTable[field_0x0 * 4]; }
u8 getG() { return j3dTevSwapTableTable[field_0x0 * 4 + 1]; }
u8 getB() { return j3dTevSwapTableTable[field_0x0 * 4 + 2]; }
u8 getA() { return j3dTevSwapTableTable[field_0x0 * 4 + 3]; }
/* 0x0 */ u8 field_0x0;
}; // Size: 0x1
struct J3DTevSwapModeInfo {
/* 0x0 */ u8 field_0x0;
class J3DLightObj {
public:
J3DLightObj() { mInfo = j3dDefaultLightInfo; }
void load(u32) const;
J3DLightInfo& getLightInfo() { return mInfo; }
J3DLightObj& operator=(J3DLightObj const& other) {
mInfo = other.mInfo;
return *this;
}
/* 0x00 */ J3DLightInfo mInfo;
/* 0x34 */ u8 field_0x34[64];
}; // Size = 0x74
struct J3DNBTScale : public J3DNBTScaleInfo {
J3DNBTScale() {}
J3DNBTScale(J3DNBTScaleInfo const& info) {
mbHasScale = info.mbHasScale;
mScale = info.mScale;
}
Vec* getScale() { return &mScale; }
};
struct J3DNBTScale;
class J3DTexCoord;
void loadTexCoordGens(u32, J3DTexCoord*);
void loadNBTScale(J3DNBTScale& param_0);
#endif /* J3DTEVS_H */
+38 -31
View File
@@ -1,11 +1,33 @@
#ifndef J3DTEXTURE_H
#define J3DTEXTURE_H
#include "JSystem/J3DGraphBase/J3DGD.h"
#include "JSystem/J3DGraphBase/J3DStruct.h"
#include "JSystem/J3DGraphBase/J3DTevs.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/types.h"
inline void J3DGDLoadTexMtxImm(Mtx pMtx, u32 i, GXTexMtxType mType) {
u16 cmd = i * 4;
u8 len = mType == GX_MTX2x4 ? 8 : 12;
J3DGDWriteXFCmdHdr(cmd, len);
J3DGDWrite_f32(pMtx[0][0]);
J3DGDWrite_f32(pMtx[0][1]);
J3DGDWrite_f32(pMtx[0][2]);
J3DGDWrite_f32(pMtx[0][3]);
J3DGDWrite_f32(pMtx[1][0]);
J3DGDWrite_f32(pMtx[1][1]);
J3DGDWrite_f32(pMtx[1][2]);
J3DGDWrite_f32(pMtx[1][3]);
if (mType == GX_MTX3x4) {
J3DGDWrite_f32(pMtx[2][0]);
J3DGDWrite_f32(pMtx[2][1]);
J3DGDWrite_f32(pMtx[2][2]);
J3DGDWrite_f32(pMtx[2][3]);
}
}
class J3DTexture {
private:
/* 0x0 */ u16 mNum;
@@ -28,11 +50,16 @@ public:
class J3DTexMtx {
public:
J3DTexMtx() { mTexMtxInfo = j3dDefaultTexMtxInfo; }
J3DTexMtx(const J3DTexMtxInfo& info) {
mTexMtxInfo = info;
}
void load(u32) const;
void calc(f32 const (*)[4]);
~J3DTexMtx() {}
void load(u32 i) const {
GDOverflowCheck(53);
J3DGDLoadTexMtxImm((Mtx&)mMtx, i * 3 + 30, (GXTexMtxType)mTexMtxInfo.mProjection);
};
void calc();
void calcTexMtx(f32 const (*)[4]);
void calcPostTexMtx(f32 const (*)[4]);
void loadTexMtx(u32) const;
@@ -41,42 +68,22 @@ public:
J3DTexMtxInfo& getTexMtxInfo() { return mTexMtxInfo; }
Mtx& getMtx() { return mMtx; }
void setEffectMtx(Mtx effectMtx) { mTexMtxInfo.setEffectMtx(effectMtx); }
Mtx& getViewMtx() { return mViewMtx; }
void setViewMtx(const Mtx viewMtx) { MTXCopy(viewMtx, mViewMtx); }
private:
/* 0x00 */ J3DTexMtxInfo mTexMtxInfo;
/* 0x64 */ Mtx mMtx;
}; // Size: 0x94
struct J3DTexCoordInfo {
/* 0x0 */ u8 mTexGenType;
/* 0x1 */ u8 mTexGenSrc;
/* 0x2 */ u8 mTexGenMtx;
};
/* 0x94 */ Mtx mViewMtx;
}; // Size: 0xc4
struct J3DTexCoord : public J3DTexCoordInfo {
J3DTexCoord();
void setTexCoordInfo(J3DTexCoordInfo *param_1) {
*(J3DTexCoordInfo*)this = *param_1;
}
u8 getTexGenMtx() { return mTexGenMtx & 0xff; }
u16 getTexMtxReg() { return mTexMtxReg & 0xff; }
J3DTexCoord() { *(J3DTexCoordInfo*)this = j3dDefaultTexCoordInfo[0]; }
u8 getTexGenType() { return mTexGenType; }
u8 getTexGenSrc() { return mTexGenSrc; }
u32 getTexGenMtx() { return mTexGenMtx & 0xFF; }
void setTexGenMtx(u8 v) { mTexGenMtx = v; }
void resetTexMtxReg() {
mTexMtxReg = mTexGenMtx;
}
/* 0x4 */ u8 mTexMtxReg;
}; // Size: 0x6
struct J3DDefaultTexCoordInfo {
/* 0x0 */ u8 mTexGenType;
/* 0x1 */ u8 mTexGenSrc;
/* 0x2 */ u8 mTexGenMtx;
/* 0x3 */ u8 pad;
};
}; // Size: 0x4
#endif /* J3DTEXTURE_H */
+16 -7
View File
@@ -4,6 +4,8 @@
#include "JSystem/JGeometry.h"
#include "dolphin/mtx/mtxvec.h"
struct J3DTextureSRTInfo;
struct J3DTransformInfo {
/* 0x00 */ JGeometry::TVec3<f32> mScale;
/* 0x0C */ JGeometry::TVec3<s16> mRotation;
@@ -15,13 +17,22 @@ extern Vec const j3dDefaultScale;
extern Mtx const j3dDefaultMtx;
extern f32 PSMulUnit01[2];
void J3DGQRSetup7(u32 param_0, u32 param_1, u32 param_2, u32 param_3);
f32 J3DCalcZValue(MtxP m, Vec v);
void J3DCalcBBoardMtx(Mtx);
void J3DCalcYBBoardMtx(Mtx);
void J3DPSCalcInverseTranspose(f32 (*param_0)[4], f32 (*param_1)[3]);
void J3DGetTranslateRotateMtx(J3DTransformInfo const&, Mtx);
void J3DGetTranslateRotateMtx(s16, s16, s16, f32, f32, f32, Mtx);
void J3DPSCalcInverseTranspose(f32 (*param_0)[4], f32 (*param_1)[3]);
void J3DGQRSetup7(u32 param_0, u32 param_1, u32 param_2, u32 param_3);
void J3DPSMtx33Copy(register Mtx3P src, register Mtx3P dst);
void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst);
void J3DGetTextureMtx(const J3DTextureSRTInfo&, Vec, f32(*)[4]);
void J3DGetTextureMtxOld(const J3DTextureSRTInfo&, Vec, f32(*)[4]);
void J3DGetTextureMtxMaya(const J3DTextureSRTInfo&, f32(*)[4]);
void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo&, f32(*)[4]);
void J3DScaleNrmMtx(Mtx, const Vec&);
void J3DScaleNrmMtx33(Mtx33, const Vec&);
void J3DMtxProjConcat(f32(*)[4], f32(*)[4], f32(*)[4]);
void J3DPSMtx33Copy(Mtx3P src, Mtx3P dst);
void J3DPSMtx33CopyFrom34(MtxP src, Mtx3P dst);
// regalloc issues
inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* dst) {
@@ -190,6 +201,4 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec
}
}
f32 J3DCalcZValue(register MtxP m, register Vec v);
#endif /* J3DTRANSFORM_H */
+1 -1
View File
@@ -11,7 +11,7 @@ class J3DAnmVtxColor;
class J3DVertexBuffer;
struct J3DVtxColorCalc {
/* 8032E180 */ void calc(J3DModel*);
void calc(J3DModel*);
virtual void calc(J3DVertexBuffer*);
/* 0x0 */ void* vtable; // inlined vtable?