summaryrefslogtreecommitdiff
path: root/include/JSystem/J3DGraphBase/J3DGD.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/JSystem/J3DGraphBase/J3DGD.h')
-rw-r--r--include/JSystem/J3DGraphBase/J3DGD.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DGD.h b/include/JSystem/J3DGraphBase/J3DGD.h
index 53e63508c4..eef2b7b223 100644
--- a/include/JSystem/J3DGraphBase/J3DGD.h
+++ b/include/JSystem/J3DGraphBase/J3DGD.h
@@ -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 */