summaryrefslogtreecommitdiff
path: root/include/JSystem/J3DGraphBase/J3DTevs.h
diff options
context:
space:
mode:
authorhatal175 <hatal175@users.noreply.github.com>2024-06-04 23:25:37 +0300
committerGitHub <noreply@github.com>2024-06-04 14:25:37 -0600
commit1c1e65bc4b018b87159348c80dc5ea8feed8c6f2 (patch)
treea5c69f23b4389fe671662aee05ae0008d07a8427 /include/JSystem/J3DGraphBase/J3DTevs.h
parent59175a46fdaa673640a29203850ff4558379dab9 (diff)
Work on J3DMatBlock (#2164)
Diffstat (limited to 'include/JSystem/J3DGraphBase/J3DTevs.h')
-rw-r--r--include/JSystem/J3DGraphBase/J3DTevs.h47
1 files changed, 43 insertions, 4 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DTevs.h b/include/JSystem/J3DGraphBase/J3DTevs.h
index a7b668bd2c..f27215544f 100644
--- a/include/JSystem/J3DGraphBase/J3DTevs.h
+++ b/include/JSystem/J3DGraphBase/J3DTevs.h
@@ -2,6 +2,8 @@
#define J3DTEVS_H
#include "dolphin/types.h"
+#include "dolphin/gx/GXStruct.h"
+#include "JSystem/J3DGraphBase/J3DGD.h"
/**
* @ingroup jsystem-j3d
@@ -126,6 +128,21 @@ struct J3DTevStage {
void setRasSel(u8 ras_sel) { mTevSwapModeInfo = (mTevSwapModeInfo & ~3) | ras_sel; }
void setTexSel(u8 tex_sel) { mTevSwapModeInfo = (mTevSwapModeInfo & ~0xc) | (tex_sel << 2); }
+ void load(u32 param_1) {
+ J3DGDWriteBPCmd(*(u32*)&field_0x0);
+ J3DGDWriteBPCmd(*(u32*)&field_0x4);
+ }
+
+ J3DTevStage& operator=(const J3DTevStage& other) {
+ mTevColorOp = other.mTevColorOp;
+ mTevColorAB = other.mTevColorAB;
+ mTevColorCD = other.mTevColorCD;
+ mTevAlphaOp = other.mTevAlphaOp;
+ mTevAlphaAB = other.mTevAlphaAB;
+ mTevSwapModeInfo = other.mTevSwapModeInfo;
+ return *this;
+ }
+
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 mTevColorOp;
/* 0x2 */ u8 mTevColorAB;
@@ -183,6 +200,10 @@ struct J3DIndTevStage {
void setLod(u8 lod) { mInfo = (mInfo & ~0x80000) | (lod << 19); }
void setAlphaSel(u8 alphaSel) { mInfo = (mInfo & ~0x180) | (alphaSel << 7); }
+ void load(u32 param_1) {
+ J3DGDWriteBPCmd(mInfo | (param_1 + 0x10) * 0x1000000);
+ }
+
/* 0x0 */ u32 mInfo;
};
@@ -195,9 +216,9 @@ struct J3DTevOrderInfo {
*(u32*) this = *(u32*)&other;
}
- /* 0x0 */ u8 field_0x0;
+ /* 0x0 */ u8 mTexCoord;
/* 0x1 */ u8 mTexMap;
- /* 0x2 */ u8 field_0x2;
+ /* 0x2 */ u8 mColorChan;
/* 0x3 */ u8 field_0x3; // Maybe padding
};
@@ -210,10 +231,13 @@ extern const J3DTevOrderInfo j3dDefaultTevOrderInfoNull;
struct J3DTevOrder : public J3DTevOrderInfo {
/* 8000E140 */ J3DTevOrder() : J3DTevOrderInfo(j3dDefaultTevOrderInfoNull) {}
J3DTevOrder(const J3DTevOrderInfo& info) : J3DTevOrderInfo(info) {}
+ J3DTevOrderInfo& getTevOrderInfo() { return *this; }
u8 getTexMap() { return mTexMap; }
};
+extern u8 j3dTevSwapTableTable[1024];
+
/**
* @ingroup jsystem-j3d
*
@@ -221,18 +245,33 @@ struct J3DTevOrder : public J3DTevOrderInfo {
struct J3DTevSwapModeTable {
/* 8000E134 */ J3DTevSwapModeTable();
J3DTevSwapModeTable(J3DTevSwapModeTableInfo const& info) {
- field_0x0 = calcTevSwapTableID(info.field_0x0, info.field_0x1, info.field_0x2, info.field_0x3);
+ mIdx = calcTevSwapTableID(info.field_0x0, info.field_0x1, info.field_0x2, info.field_0x3);
}
u8 calcTevSwapTableID(u8 param_0, u8 param_1, u8 param_2, u8 param_3) {
return 0x40 * param_0 + 0x10 * param_1 + 4 * param_2 + param_3;
}
- /* 0x0 */ u8 field_0x0;
+ u8 getR() { return j3dTevSwapTableTable[mIdx * 4]; }
+ u8 getG() { return j3dTevSwapTableTable[mIdx * 4 + 1]; }
+ u8 getB() { return j3dTevSwapTableTable[mIdx * 4 + 2]; }
+ u8 getA() { return j3dTevSwapTableTable[mIdx * 4 + 3]; }
+
+ /* 0x0 */ u8 mIdx;
}; // Size: 0x1
+extern const GXColor j3dDefaultColInfo;
+extern const GXColor j3dDefaultAmbInfo;
+extern const GXColorS10 j3dDefaultTevColor;
+extern const GXColor j3dDefaultTevKColor;
+extern u8 j3dAlphaCmpTable[768];
+
struct J3DNBTScale;
struct J3DTexCoord;
void loadNBTScale(J3DNBTScale& param_0);
void loadTexCoordGens(u32 param_0, J3DTexCoord* param_1);
+void loadTexNo(u32 param_0, u16 const& param_1);
+void patchTexNo_PtrToIdx(u32 texID, u16 const& idx);
+bool isTexNoReg(void* param_0);
+u16 getTexNoReg(void* param_0);
#endif /* J3DTEVS_H */