J3DMatBlock (#85)

This commit is contained in:
Jcw87
2023-09-26 22:00:39 -07:00
committed by GitHub
parent 31857a4976
commit 4ed4bf3bff
9 changed files with 350 additions and 78 deletions
+30
View File
@@ -25,6 +25,11 @@ inline void J3DGDWrite_f32(f32 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);
@@ -40,7 +45,28 @@ inline void J3DGDWriteXFCmdHdr(u16 cmd, u8 len) {
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;
@@ -56,4 +82,8 @@ inline void J3DGDSetNumTexGens(u8 numTexGens) {
J3DGDWriteXFCmd(0x103f, numTexGens);
}
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 */
+8 -1
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,
@@ -100,7 +107,7 @@ public:
static Mtx mCurrentMtx;
static Vec mCurrentS;
static Vec mParentS;
static u16 sTexCoordScaleTable[32];
static J3DTexCoordScaleInfo sTexCoordScaleTable[8];
/* 0x000 */ Mtx mViewMtx;
/* 0x030 */ J3DMtxCalc* mCurrentMtxCalc;
+20 -1
View File
@@ -1,7 +1,9 @@
#ifndef J3DTEVS_H
#define J3DTEVS_H
#include "dolphin/types.h"
#include "JSystem/J3DGraphBase/J3DGD.h"
extern u8 j3dTevSwapTableTable[1024];
struct J3DTevStageInfo {
/* 0x0 */ u8 field_0x0;
@@ -57,6 +59,11 @@ struct J3DTevStage {
void setTevStageInfo(const J3DTevStageInfo&);
void load(u32) const {
J3DGDWriteBPCmd(*(u32*)&field_0x0);
J3DGDWriteBPCmd(*(u32*)&field_0x4);
}
/* 0x0 */ u8 field_0x0;
/* 0x1 */ u8 field_0x1;
/* 0x1 */ u8 field_0x2;
@@ -82,6 +89,10 @@ struct J3DIndTevStageInfo {
struct J3DIndTevStage {
J3DIndTevStage();
void load(u32 param_1) {
J3DGDWriteBPCmd(mInfo | (param_1 + 16) << 24);
}
/* 0x0 */ u32 mInfo;
};
@@ -94,12 +105,18 @@ struct J3DTevOrderInfo {
struct J3DTevOrder : public J3DTevOrderInfo {
J3DTevOrder();
J3DTevOrderInfo* getTevOrderInfo() { return this; }
u8 getTexMap() { return mTexMap; }
};
struct J3DTevSwapModeTable {
J3DTevSwapModeTable();
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
@@ -108,6 +125,8 @@ struct J3DTevSwapModeInfo {
};
struct J3DNBTScale;
class J3DTexCoord;
void loadTexCoordGens(u32, J3DTexCoord*);
void loadNBTScale(J3DNBTScale& param_0);
#endif /* J3DTEVS_H */