Work on J3DMatBlock (#2164)

This commit is contained in:
hatal175
2024-06-04 23:25:37 +03:00
committed by GitHub
parent 59175a46fd
commit 1c1e65bc4b
156 changed files with 1842 additions and 7315 deletions
+43
View File
@@ -116,4 +116,47 @@ inline void J3DGDSetNumTexGens(u8 numTexGens) {
J3DGDWriteXFCmd(0x103f, numTexGens);
}
inline void J3DGDSetTevKonstantSel_SwapModeTable(GXTevStageID stage, GXTevKColorSel colorSel1, GXTevKAlphaSel alphaSel1, GXTevKColorSel colorSel2, GXTevKAlphaSel alphaSel2, GXTevColor chan1, GXTevColor chan2) {
J3DGDWriteBPCmd((stage / 2 + 0xf6) << 24 | (chan1 | chan2 << 2 | colorSel1 << 4 | alphaSel1 << 9 | colorSel2 << 14 | alphaSel2 << 19) & 0x00FFFFFF);
}
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(0xFE00FFE3);
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(0xFE00FFE7);
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);
}
#endif /* J3DGD_H */