Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
J3DTevs.h
Go to the documentation of this file.
1#ifndef J3DTEVS_H
2#define J3DTEVS_H
3
4#include "dolphin/types.h"
5#include <dolphin/gx.h>
7
13 /* 0x0 */ u8 field_0x0;
14 /* 0x1 */ u8 mTevColorOp;
15 /* 0x2 */ u8 mTevColorAB;
16 /* 0x3 */ u8 mTevColorCD;
17 /* 0x4 */ u8 field_0x4;
18 /* 0x5 */ u8 mTevAlphaOp;
19 /* 0x6 */ u8 mTevAlphaAB;
21 /* 0x8 */ u8 field_0x8;
22 /* 0x8 */ u8 field_0x9;
23 /* 0x8 */ u8 field_0xa;
24 /* 0x8 */ u8 field_0xb;
25 /* 0x8 */ u8 field_0xc;
26 /* 0x8 */ u8 field_0xd;
27 /* 0x8 */ u8 field_0xe;
28 /* 0x8 */ u8 field_0xf;
29 /* 0x8 */ u8 field_0x10;
30 /* 0x8 */ u8 field_0x11;
31 /* 0x8 */ u8 field_0x12;
32 /* 0x8 */ u8 field_0x13;
33};
34
36
42 /* 0x0 */ u8 field_0x0;
43 /* 0x1 */ u8 field_0x1;
44 /* 0x2 */ u8 field_0x2;
45 /* 0x3 */ u8 field_0x3;
46}; // Size: 0x4
47
49
55 /* 0x0 */ u8 mRasSel;
56 /* 0x1 */ u8 mTexSel;
57 /* 0x2 */ u8 field_0x2;
58 /* 0x3 */ u8 field_0x3;
59}; // Size: 0x4
60
62
72
73 void setTevColorOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5) {
74 mTevColorOp = mTevColorOp & ~(0x01 << 2) | param_1 << 2;
75 if (param_1 <= 1) {
76 mTevColorOp = mTevColorOp & ~(0x03 << 4) | param_3 << 4;
77 mTevColorOp = mTevColorOp & ~0x03 | param_2;
78 } else {
79 mTevColorOp = mTevColorOp & ~(0x03 << 4) | (param_1 >> 1 & 3) << 4;
80 mTevColorOp = mTevColorOp & ~0x03 | 3;
81 }
82 mTevColorOp = mTevColorOp & ~(0x01 << 3) | param_4 << 3;
83 mTevColorOp = mTevColorOp & ~(0x03 << 6) | param_5 << 6;
84 }
85
86 void setTevColorAB(u8 a, u8 b) { mTevColorAB = a << 4 | b; }
87 void setTevColorCD(u8 c, u8 d) { mTevColorCD = c << 4 | d; }
88 void setAlphaA(u8 a) { mTevAlphaAB = mTevAlphaAB & ~(0x07 << 5) | a << 5; }
89 void setAlphaB(u8 b) { mTevAlphaAB = mTevAlphaAB & ~(0x07 << 2) | b << 2; }
90 void setAlphaC(u8 c) {
91 mTevAlphaAB = mTevAlphaAB & ~0x03 | c >> 1;
92 mTevSwapModeInfo = mTevSwapModeInfo & ~(0x01 << 7) | c << 7;
93 }
94 void setAlphaD(u8 d) { mTevSwapModeInfo = mTevSwapModeInfo & ~(0x07 << 4) | d << 4; }
95 void setAlphaABCD(u8 a, u8 b, u8 c, u8 d) {
96 setAlphaA(a);
97 setAlphaB(b);
98 setAlphaC(c);
99 setAlphaD(d);
100 }
101
102 void setTevAlphaOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5) {
103 mTevAlphaOp = mTevAlphaOp & ~(0x01 << 2) | param_1 << 2;
104 if (param_1 <= 1) {
105 mTevAlphaOp = mTevAlphaOp & ~0x03 | param_2;
106 mTevAlphaOp = mTevAlphaOp & ~(0x03 << 4) | param_3 << 4;
107 } else {
108 mTevAlphaOp = mTevAlphaOp & ~(0x03 << 4) | (param_1 >> 1 & 3) << 4;
109 mTevAlphaOp = mTevAlphaOp & ~0x03 | 3;
110 }
111 mTevAlphaOp = mTevAlphaOp & ~(0x01 << 3) | param_4 << 3;
112 mTevAlphaOp = mTevAlphaOp & ~(0x03 << 6) | param_5 << 6;
113 }
114
122
127
129 setTexSel(param_0.mTexSel);
130 setRasSel(param_0.mRasSel);
131 }
132
133 void setStageNo(u32 param_0) {
134 field_0x0 = 0xC0 + param_0 * 2;
135 field_0x4 = 0xC1 + param_0 * 2;
136 }
137
138 void setRasSel(u8 ras_sel) { mTevSwapModeInfo = (mTevSwapModeInfo & ~3) | ras_sel; }
139 void setTexSel(u8 tex_sel) { mTevSwapModeInfo = (mTevSwapModeInfo & ~0xc) | (tex_sel << 2); }
140
141 void load(u32 param_1) const {
144 }
145
147 mTevColorOp = other.mTevColorOp;
148 mTevColorAB = other.mTevColorAB;
149 mTevColorCD = other.mTevColorCD;
150 mTevAlphaOp = other.mTevAlphaOp;
151 mTevAlphaAB = other.mTevAlphaAB;
153 return *this;
154 }
155
157 mTevColorOp = other.mTevColorOp;
158 mTevColorAB = other.mTevColorAB;
159 mTevColorCD = other.mTevColorCD;
160 mTevAlphaOp = other.mTevAlphaOp;
161 mTevAlphaAB = other.mTevAlphaAB;
163 return *this;
164 }
165
166 /* 0x0 */ u8 field_0x0;
167 /* 0x1 */ u8 mTevColorOp;
168 /* 0x2 */ u8 mTevColorAB;
169 /* 0x3 */ u8 mTevColorCD;
170 /* 0x4 */ u8 field_0x4;
171 /* 0x5 */ u8 mTevAlphaOp;
172 /* 0x6 */ u8 mTevAlphaAB;
174};
175
181 /* 0x0 */ u8 mIndStage;
182 /* 0x1 */ u8 mIndFormat;
183 /* 0x2 */ u8 mBiasSel;
184 /* 0x3 */ u8 mMtxSel;
185 /* 0x4 */ u8 mWrapS;
186 /* 0x5 */ u8 mWrapT;
187 /* 0x6 */ u8 mPrev;
188 /* 0x7 */ u8 mLod;
189 /* 0x8 */ u8 mAlphaSel;
190 /* 0x9 */ u8 pad[3];
191};
192
194
205 setBiasSel(info.mBiasSel);
206 setMtxSel(info.mMtxSel);
207 setWrapS(info.mWrapS);
208 setWrapT(info.mWrapT);
209 setPrev(info.mPrev);
210 setLod(info.mLod);
212 }
213 void setIndStage(u8 indStage) { mInfo = (mInfo & ~3) | indStage; }
214 void setIndFormat(u8 indFormat) { mInfo = (mInfo & ~0xc) | (indFormat << 2); }
215 void setBiasSel(u8 biasSel) { mInfo = (mInfo & ~0x70) | (biasSel << 4); }
216 void setMtxSel(u8 mtxSel) { mInfo = (mInfo & ~0x1e00) | (mtxSel << 9); }
217 void setWrapS(u8 wrapS) { mInfo = (mInfo & ~0xe000) | (wrapS << 13); }
218 void setWrapT(u8 wrapT) { mInfo = (mInfo & ~0x70000) | (wrapT << 16); }
219 void setPrev(u8 prev) { mInfo = (mInfo & ~0x100000) | (prev << 20); }
220 void setLod(u8 lod) { mInfo = (mInfo & ~0x80000) | (lod << 19); }
221 void setAlphaSel(u8 alphaSel) { mInfo = (mInfo & ~0x180) | (alphaSel << 7); }
222
223 void load(u32 param_1) const {
224 J3DGDWriteBPCmd(mInfo | (param_1 + 0x10) * 0x1000000);
225 }
226
228 mInfo = other.mInfo;
229 return *this;
230 }
231
233 mInfo = other.mInfo;
234 return *this;
235 }
236
237 /* 0x0 */ u32 mInfo;
238};
239
245 void operator=(const J3DTevOrderInfo& other) {
246 *(u32*) this = *(u32*)&other;
247 }
248
249 /* 0x0 */ u8 mTexCoord;
250 /* 0x1 */ u8 mTexMap;
251 /* 0x2 */ u8 mColorChan;
252 /* 0x3 */ u8 field_0x3; // Maybe padding
253};
254
256
270
271extern u8 j3dTevSwapTableTable[1024];
272extern u8 const j3dDefaultTevSwapTableID;
273
274inline u8 calcTevSwapTableID(u8 param_0, u8 param_1, u8 param_2, u8 param_3) {
275 return 0x40 * (u8)param_0 + 0x10 * (u8)param_1 + 4 * (u8)param_2 + param_3;
276}
277
287
289 mIdx = rhs.mIdx;
290 return *this;
291 }
292
294 mIdx = other.mIdx;
295 return *this;
296 }
297
298 u8 getR() const { return *(&j3dTevSwapTableTable[mIdx * 4] + 0); }
299 u8 getG() const { return *(&j3dTevSwapTableTable[mIdx * 4] + 1); }
300 u8 getB() const { return *(&j3dTevSwapTableTable[mIdx * 4] + 2); }
301 u8 getA() const { return *(&j3dTevSwapTableTable[mIdx * 4] + 3); }
302
303 /* 0x0 */ u8 mIdx;
304}; // Size: 0x1
305
306extern const GXColor j3dDefaultColInfo;
307extern const GXColor j3dDefaultAmbInfo;
308extern const GXColorS10 j3dDefaultTevColor;
309extern const GXColor j3dDefaultTevKColor;
310extern u8 j3dAlphaCmpTable[768];
311extern const u8 j3dDefaultNumChans;
312
313struct J3DNBTScale;
314struct J3DTexCoord;
315void loadNBTScale(J3DNBTScale& param_0);
316void loadTexCoordGens(u32 param_0, J3DTexCoord* param_1);
317void loadTexNo(u32 param_0, u16 const& param_1);
318void patchTexNo_PtrToIdx(u32 texID, u16 const& idx);
319bool isTexNoReg(void* param_0);
320u16 getTexNoReg(void* param_0);
321void makeTexCoordTable();
322void makeAlphaCmpTable();
323void makeZModeTable();
324void makeTevSwapTable();
325
326#endif /* J3DTEVS_H */
void J3DGDWriteBPCmd(u32 regval)
Definition J3DGD.h:32
const GXColor j3dDefaultAmbInfo
void loadTexNo(u32 param_0, u16 const &param_1)
Definition J3DTevs.cpp:283
const J3DTevSwapModeTableInfo j3dDefaultTevSwapModeTable
void makeAlphaCmpTable()
Definition J3DTevs.cpp:402
const GXColor j3dDefaultColInfo
J3DTevSwapModeInfo const j3dDefaultTevSwapMode
void patchTexNo_PtrToIdx(u32 texID, u16 const &idx)
Definition J3DTevs.cpp:303
u16 getTexNoReg(void *param_0)
Definition J3DTevs.cpp:278
void loadNBTScale(J3DNBTScale &param_0)
Definition J3DTevs.cpp:310
void makeTevSwapTable()
Definition J3DTevs.cpp:433
void makeZModeTable()
Definition J3DTevs.cpp:419
void loadTexCoordGens(u32 param_0, J3DTexCoord *param_1)
Definition J3DTevs.cpp:25
u8 calcTevSwapTableID(u8 param_0, u8 param_1, u8 param_2, u8 param_3)
Definition J3DTevs.h:274
u8 j3dTevSwapTableTable[1024]
Definition J3DTevs.cpp:398
bool isTexNoReg(void *param_0)
Definition J3DTevs.cpp:270
void makeTexCoordTable()
Definition J3DTevs.cpp:370
const J3DTevOrderInfo j3dDefaultTevOrderInfoNull
const GXColorS10 j3dDefaultTevColor
u8 j3dAlphaCmpTable[768]
Definition J3DTevs.cpp:400
const u8 j3dDefaultNumChans
J3DTevStageInfo const j3dDefaultTevStageInfo
u8 const j3dDefaultTevSwapTableID
J3DIndTevStageInfo const j3dDefaultIndTevStageInfo
const GXColor j3dDefaultTevKColor
Ordon Goat.
DVDCommandBlock * prev
Definition dvdqueue.c:8
unsigned long u32
Definition types.h:12
unsigned short int u16
Definition types.h:10
unsigned char u8
Definition types.h:8
a
Definition k_cos.c:89
Definition J3DTevs.h:180
u8 pad[3]
Definition J3DTevs.h:190
u8 mAlphaSel
Definition J3DTevs.h:189
u8 mBiasSel
Definition J3DTevs.h:183
u8 mPrev
Definition J3DTevs.h:187
u8 mWrapS
Definition J3DTevs.h:185
u8 mWrapT
Definition J3DTevs.h:186
u8 mLod
Definition J3DTevs.h:188
u8 mMtxSel
Definition J3DTevs.h:184
u8 mIndFormat
Definition J3DTevs.h:182
u8 mIndStage
Definition J3DTevs.h:181
Definition J3DTevs.h:199
void setWrapT(u8 wrapT)
Definition J3DTevs.h:218
void setPrev(u8 prev)
Definition J3DTevs.h:219
void setIndTevStageInfo(J3DIndTevStageInfo const &info)
Definition J3DTevs.h:202
void setBiasSel(u8 biasSel)
Definition J3DTevs.h:215
J3DIndTevStage & operator=(const J3DIndTevStage &other)
Definition J3DTevs.h:227
void setLod(u8 lod)
Definition J3DTevs.h:220
J3DIndTevStage(J3DIndTevStageInfo const &info)
Definition J3DTevs.h:201
J3DIndTevStage & operator=(J3DIndTevStage &other)
Definition J3DTevs.h:232
void setIndFormat(u8 indFormat)
Definition J3DTevs.h:214
void setWrapS(u8 wrapS)
Definition J3DTevs.h:217
u32 mInfo
Definition J3DTevs.h:237
void setMtxSel(u8 mtxSel)
Definition J3DTevs.h:216
void setIndStage(u8 indStage)
Definition J3DTevs.h:213
void setAlphaSel(u8 alphaSel)
Definition J3DTevs.h:221
void load(u32 param_1) const
Definition J3DTevs.h:223
J3DIndTevStage()
Definition J3DTevs.h:200
Definition J3DMatBlock.h:72
Definition J3DTevs.h:244
u8 mColorChan
Definition J3DTevs.h:251
u8 mTexMap
Definition J3DTevs.h:250
void operator=(const J3DTevOrderInfo &other)
Definition J3DTevs.h:245
u8 field_0x3
Definition J3DTevs.h:252
u8 mTexCoord
Definition J3DTevs.h:249
Definition J3DTevs.h:261
J3DTevOrder(const J3DTevOrderInfo &info)
Definition J3DTevs.h:265
J3DTevOrderInfo & getTevOrderInfo()
Definition J3DTevs.h:266
u8 getTexMap()
Definition J3DTevs.h:268
J3DTevOrder()
Definition J3DTevs.h:262
Definition J3DTevs.h:12
u8 mTevColorAB
Definition J3DTevs.h:15
u8 field_0x0
Definition J3DTevs.h:13
u8 field_0xd
Definition J3DTevs.h:26
u8 field_0x13
Definition J3DTevs.h:32
u8 field_0x10
Definition J3DTevs.h:29
u8 field_0x8
Definition J3DTevs.h:21
u8 mTevColorCD
Definition J3DTevs.h:16
u8 field_0x9
Definition J3DTevs.h:22
u8 mTevSwapModeInfo
Definition J3DTevs.h:20
u8 mTevColorOp
Definition J3DTevs.h:14
u8 field_0xb
Definition J3DTevs.h:24
u8 field_0xe
Definition J3DTevs.h:27
u8 field_0x4
Definition J3DTevs.h:17
u8 mTevAlphaOp
Definition J3DTevs.h:18
u8 mTevAlphaAB
Definition J3DTevs.h:19
u8 field_0xa
Definition J3DTevs.h:23
u8 field_0x11
Definition J3DTevs.h:30
u8 field_0x12
Definition J3DTevs.h:31
u8 field_0xf
Definition J3DTevs.h:28
u8 field_0xc
Definition J3DTevs.h:25
Definition J3DTevs.h:67
J3DTevStage & operator=(const J3DTevStage &other)
Definition J3DTevs.h:146
void setTevColorCD(u8 c, u8 d)
Definition J3DTevs.h:87
void setRasSel(u8 ras_sel)
Definition J3DTevs.h:138
u8 mTevSwapModeInfo
Definition J3DTevs.h:173
u8 field_0x0
Definition J3DTevs.h:166
void setTevSwapModeInfo(J3DTevSwapModeInfo const &param_0)
Definition J3DTevs.h:128
void setStageNo(u32 param_0)
Definition J3DTevs.h:133
J3DTevStage()
Definition J3DTevs.h:68
u8 mTevColorCD
Definition J3DTevs.h:169
u8 mTevAlphaAB
Definition J3DTevs.h:172
u8 mTevAlphaOp
Definition J3DTevs.h:171
u8 mTevColorAB
Definition J3DTevs.h:168
u8 field_0x4
Definition J3DTevs.h:170
void setAlphaB(u8 b)
Definition J3DTevs.h:89
void setTevColorAB(u8 a, u8 b)
Definition J3DTevs.h:86
void setAlphaC(u8 c)
Definition J3DTevs.h:90
void setTevAlphaOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5)
Definition J3DTevs.h:102
void load(u32 param_1) const
Definition J3DTevs.h:141
u8 mTevColorOp
Definition J3DTevs.h:167
void setTevColorOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5)
Definition J3DTevs.h:73
void setTexSel(u8 tex_sel)
Definition J3DTevs.h:139
void setAlphaA(u8 a)
Definition J3DTevs.h:88
void setAlphaABCD(u8 a, u8 b, u8 c, u8 d)
Definition J3DTevs.h:95
void setAlphaD(u8 d)
Definition J3DTevs.h:94
void setTevStageInfo(const J3DTevStageInfo &info)
Definition J3DTevs.h:115
J3DTevStage(J3DTevStageInfo const &param_0)
Definition J3DTevs.h:123
J3DTevStage & operator=(J3DTevStage &other)
Definition J3DTevs.h:156
Definition J3DTevs.h:54
u8 mTexSel
Definition J3DTevs.h:56
u8 field_0x2
Definition J3DTevs.h:57
u8 mRasSel
Definition J3DTevs.h:55
u8 field_0x3
Definition J3DTevs.h:58
Definition J3DTevs.h:41
u8 field_0x3
Definition J3DTevs.h:45
u8 field_0x1
Definition J3DTevs.h:43
u8 field_0x0
Definition J3DTevs.h:42
u8 field_0x2
Definition J3DTevs.h:44
Definition J3DTevs.h:282
u8 mIdx
Definition J3DTevs.h:303
J3DTevSwapModeTable(J3DTevSwapModeTableInfo const &info)
Definition J3DTevs.h:284
J3DTevSwapModeTable()
Definition J3DTevs.h:283
u8 getB() const
Definition J3DTevs.h:300
u8 getG() const
Definition J3DTevs.h:299
u8 getR() const
Definition J3DTevs.h:298
J3DTevSwapModeTable & operator=(J3DTevSwapModeTable &other)
Definition J3DTevs.h:293
u8 getA() const
Definition J3DTevs.h:301
J3DTevSwapModeTable & operator=(const J3DTevSwapModeTable &rhs)
Definition J3DTevs.h:288
Definition J3DTexture.h:96
Definition GXStruct.h:34
Definition GXStruct.h:30