NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_restev.h
1#ifndef NW4R_G3D_RES_RES_TEV_H
2#define NW4R_G3D_RES_RES_TEV_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/res/g3d_rescommon.h>
6
7#include <revolution/GX.h>
8
9namespace nw4r {
10namespace g3d {
11
12// TODO: Why?
13static const int TEV_STAGES_PER_DL = 2;
14
16 union {
17 struct {
18 u8 swapModeTable[GX_MAX_TEVSWAP][GX_BP_CMD_SZ * 4]; // at 0x0
19 u8 indTexOrder[1][GX_BP_CMD_SZ]; // at 0x50
20 u8 PADDING_0x55[0x60 - 0x55]; // at 0x55
21 } dl;
22
23 u8 data[0x60]; // at 0x0
24 };
25};
26
28 union {
29 struct {
30 u8 tevKonstantSel[GX_BP_CMD_SZ * 2]; // at 0x0
31 u8 tevOrder[GX_BP_CMD_SZ]; // at 0xA
32 u8 tevColorCalc[TEV_STAGES_PER_DL][GX_BP_CMD_SZ]; // at 0xF
33 u8 alphaCalcAndSwap[TEV_STAGES_PER_DL][GX_BP_CMD_SZ]; // at 0x19
34 u8 tevIndirect[TEV_STAGES_PER_DL][GX_BP_CMD_SZ]; // at 0x23
35 u8 PADDING_0x2D[0x30 - 0x2D]; // at 0x2D
36 } dl;
37
38 u8 data[0x30]; // at 0x0
39 };
40};
41
42struct ResTevDL {
43 union {
44 struct {
45 ResTevCommonDL common; // at 0x0
47 var[GX_MAX_TEVSTAGE / TEV_STAGES_PER_DL]; // at 0x60
48 } dl;
49
50 u8 data[0x1E0]; // at 0x0
51 };
52};
53
54struct ResTevData {
55 ulong size; // at 0x0
56 s32 toResMdlData; // at 0x4
57 ulong id; // at 0x8
58 u8 nStages; // at 0xC
59 u8 PADDING_0xD[0x10 - 0xD]; // at 0xD
60 u8 texCoordToTexMapID[GX_MAX_TEXCOORD]; // at 0x10
61 u8 PADDING_0x18[0x20 - 0x18]; // at 0x18
62 ResTevDL dl; // at 0x20
63};
64
65class ResTev : public ResCommon<ResTevData> {
66public:
67 NW4R_G3D_RESOURCE_FUNC_DEF(ResTev);
68
69 bool GXGetTevSwapModeTable(GXTevSwapSel swap, GXTevColorChan* pR,
70 GXTevColorChan* pG, GXTevColorChan* pB,
71 GXTevColorChan* pA) const;
72 void GXSetTevSwapModeTable(GXTevSwapSel swap, GXTevColorChan r,
73 GXTevColorChan g, GXTevColorChan b,
74 GXTevColorChan a);
75
76 bool GXGetTevOrder(GXTevStageID stage, GXTexCoordID* pCoord,
77 GXTexMapID* pMap, GXChannelID* pChannel) const;
78
79 void GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b,
80 GXTevColorArg c, GXTevColorArg d);
81
82 void CallDisplayList(bool sync) const;
83
84 ResTev CopyTo(void* pDst);
85
86 void DCStore(bool sync);
87
88 u8 GetNumTevStages() const {
89 return ref().nStages;
90 }
91
92 void EndEdit() {
93 DCStore(false);
94 }
95};
96
97} // namespace g3d
98} // namespace nw4r
99
100#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10