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>
8
9extern u8 j3dTevSwapTableTable[1024];
10
17extern const J3DFogInfo j3dDefaultFogInfo;
19
20extern const GXColor j3dDefaultColInfo;
21extern const GXColor j3dDefaultAmbInfo;
22extern const u8 j3dDefaultColorChanNum;
27extern const GXColor j3dDefaultTevKColor;
32extern const u8 j3dDefaultTevSwapTableID;
33extern const u16 j3dDefaultAlphaCmpID;
34extern const u16 j3dDefaultZModeID;
35
45
46 void setTevColorOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5) {
47 mTevColorOp = mTevColorOp & ~(0x01 << 2) | param_1 << 2;
48 if (param_1 <= 1) {
49 mTevColorOp = mTevColorOp & ~(0x03 << 4) | param_3 << 4;
50 mTevColorOp = mTevColorOp & ~0x03 | param_2;
51 } else {
52 mTevColorOp = mTevColorOp & ~(0x03 << 4) | (param_1 >> 1 & 3) << 4;
53 mTevColorOp = mTevColorOp & ~0x03 | 3;
54 }
55 mTevColorOp = mTevColorOp & ~(0x01 << 3) | param_4 << 3;
56 mTevColorOp = mTevColorOp & ~(0x03 << 6) | param_5 << 6;
57 }
58
59 void setTevColorAB(u8 a, u8 b) { mTevColorAB = a << 4 | b; }
60 void setTevColorCD(u8 c, u8 d) { mTevColorCD = c << 4 | d; }
61 void setAlphaA(u8 a) { mTevAlphaAB = mTevAlphaAB & ~(0x07 << 5) | a << 5; }
62 void setAlphaB(u8 b) { mTevAlphaAB = mTevAlphaAB & ~(0x07 << 2) | b << 2; }
63 void setAlphaC(u8 c) {
64 mTevAlphaAB = mTevAlphaAB & ~0x03 | c >> 1;
65 mTevSwapModeInfo = mTevSwapModeInfo & ~(0x01 << 7) | c << 7;
66 }
67 void setAlphaD(u8 d) { mTevSwapModeInfo = mTevSwapModeInfo & ~(0x07 << 4) | d << 4; }
68 void setAlphaABCD(u8 a, u8 b, u8 c, u8 d) {
69 setAlphaA(a);
70 setAlphaB(b);
71 setAlphaC(c);
72 setAlphaD(d);
73 }
74
75 void setTevAlphaOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5) {
76 mTevAlphaOp = mTevAlphaOp & ~(0x01 << 2) | param_1 << 2;
77 if (param_1 <= 1) {
78 mTevAlphaOp = mTevAlphaOp & ~0x03 | param_2;
79 mTevAlphaOp = mTevAlphaOp & ~(0x03 << 4) | param_3 << 4;
80 } else {
81 mTevAlphaOp = mTevAlphaOp & ~(0x03 << 4) | (param_1 >> 1 & 3) << 4;
82 mTevAlphaOp = mTevAlphaOp & ~0x03 | 3;
83 }
84 mTevAlphaOp = mTevAlphaOp & ~(0x01 << 3) | param_4 << 3;
85 mTevAlphaOp = mTevAlphaOp & ~(0x03 << 6) | param_5 << 6;
86 }
87
95
100
102 setTexSel(param_0.mTexSel);
103 setRasSel(param_0.mRasSel);
104 }
105
106 void setStageNo(u32 param_0) {
107 field_0x0 = 0xC0 + param_0 * 2;
108 field_0x4 = 0xC1 + param_0 * 2;
109 }
110
111 void setRasSel(u8 ras_sel) { mTevSwapModeInfo = (mTevSwapModeInfo & ~3) | ras_sel; }
112 void setTexSel(u8 tex_sel) { mTevSwapModeInfo = (mTevSwapModeInfo & ~0xc) | (tex_sel << 2); }
113
114 void load(u32 param_1) const {
117 }
118
120 mTevColorOp = other.mTevColorOp;
121 mTevColorAB = other.mTevColorAB;
122 mTevColorCD = other.mTevColorCD;
123 mTevAlphaOp = other.mTevAlphaOp;
124 mTevAlphaAB = other.mTevAlphaAB;
126 return *this;
127 }
128
130 mTevColorOp = other.mTevColorOp;
131 mTevColorAB = other.mTevColorAB;
132 mTevColorCD = other.mTevColorCD;
133 mTevAlphaOp = other.mTevAlphaOp;
134 mTevAlphaAB = other.mTevAlphaAB;
136 return *this;
137 }
138
139 /* 0x0 */ u8 field_0x0;
140 /* 0x1 */ u8 mTevColorOp;
141 /* 0x2 */ u8 mTevColorAB;
142 /* 0x3 */ u8 mTevColorCD;
143 /* 0x4 */ u8 field_0x4;
144 /* 0x5 */ u8 mTevAlphaOp;
145 /* 0x6 */ u8 mTevAlphaAB;
147};
148
159 setBiasSel(info.mBiasSel);
160 setMtxSel(info.mMtxSel);
161 setWrapS(info.mWrapS);
162 setWrapT(info.mWrapT);
163 setPrev(info.mPrev);
164 setLod(info.mLod);
166 }
167 void setIndStage(u8 indStage) { mInfo = (mInfo & ~3) | indStage; }
168 void setIndFormat(u8 indFormat) { mInfo = (mInfo & ~0xc) | (indFormat << 2); }
169 void setBiasSel(u8 biasSel) { mInfo = (mInfo & ~0x70) | (biasSel << 4); }
170 void setMtxSel(u8 mtxSel) { mInfo = (mInfo & ~0x1e00) | (mtxSel << 9); }
171 void setWrapS(u8 wrapS) { mInfo = (mInfo & ~0xe000) | (wrapS << 13); }
172 void setWrapT(u8 wrapT) { mInfo = (mInfo & ~0x70000) | (wrapT << 16); }
173 void setPrev(u8 prev) { mInfo = (mInfo & ~0x100000) | (prev << 20); }
174 void setLod(u8 lod) { mInfo = (mInfo & ~0x80000) | (lod << 19); }
175 void setAlphaSel(u8 alphaSel) { mInfo = (mInfo & ~0x180) | (alphaSel << 7); }
176
177 void load(u32 param_1) const {
178 J3DGDWriteBPCmd(mInfo | (param_1 + 0x10) * 0x1000000);
179 }
180
182 mInfo = other.mInfo;
183 return *this;
184 }
185
187 mInfo = other.mInfo;
188 return *this;
189 }
190
191 /* 0x0 */ u32 mInfo;
192};
193
195
211
214
215inline u8 calcTevSwapTableID(u8 param_0, u8 param_1, u8 param_2, u8 param_3) {
216 return 0x40 * (u8)param_0 + 0x10 * (u8)param_1 + 4 * (u8)param_2 + param_3;
217}
218
228
230 mIdx = rhs.mIdx;
231 return *this;
232 }
233
235 mIdx = other.mIdx;
236 return *this;
237 }
238
239 u8 getR() const { return *(&j3dTevSwapTableTable[mIdx * 4] + 0); }
240 u8 getG() const { return *(&j3dTevSwapTableTable[mIdx * 4] + 1); }
241 u8 getB() const { return *(&j3dTevSwapTableTable[mIdx * 4] + 2); }
242 u8 getA() const { return *(&j3dTevSwapTableTable[mIdx * 4] + 3); }
243
244 /* 0x0 */ u8 mIdx;
245}; // Size: 0x1
246
252public:
254 void load(u32) const;
255
258 mInfo = other.mInfo;
259 return *this;
260 }
261
262 /* 0x00 */ J3DLightInfo mInfo;
264}; // Size = 0x74
265
267
289
294extern u8 j3dAlphaCmpTable[768];
295extern const u8 j3dDefaultNumChans;
296
297struct J3DNBTScale;
298struct J3DTexCoord;
299void loadNBTScale(J3DNBTScale& param_0);
300void loadTexCoordGens(u32 param_0, J3DTexCoord* param_1);
301void loadTexNo(u32 param_0, u16 const& param_1);
302void patchTexNo_PtrToIdx(u32 texID, u16 const& idx);
303bool isTexNoReg(void* param_0);
304u16 getTexNoReg(void* param_0);
305void makeTexCoordTable();
306void makeAlphaCmpTable();
307void makeZModeTable();
308void makeTevSwapTable();
309
310#endif /* J3DTEVS_H */
void J3DGDWriteBPCmd(u32 regval)
Definition J3DGD.h:32
const GXColor j3dDefaultAmbInfo
Definition J3DTevs.h:291
const J3DLightInfo j3dDefaultLightInfo
Definition J3DTevs.cpp:318
void loadTexNo(u32 param_0, u16 const &param_1)
Definition J3DTevs.cpp:283
const J3DTevSwapModeTableInfo j3dDefaultTevSwapModeTable
Definition J3DTevs.cpp:522
void makeAlphaCmpTable()
Definition J3DTevs.cpp:402
const J3DIndTexMtxInfo j3dDefaultIndTexMtxInfo
Definition J3DTevs.cpp:344
const GXColor j3dDefaultColInfo
Definition J3DTevs.h:290
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
const J3DIndTexOrderInfo j3dDefaultIndTexOrderNull
Definition J3DTevs.cpp:502
const J3DNBTScaleInfo j3dDefaultNBTScaleInfo
Definition J3DTevs.h:266
void makeTevSwapTable()
Definition J3DTevs.cpp:432
void makeZModeTable()
Definition J3DTevs.cpp:418
void loadTexCoordGens(u32 param_0, J3DTexCoord *param_1)
Definition J3DTevs.cpp:25
const J3DTevSwapModeInfo j3dDefaultTevSwapMode
Definition J3DTevs.cpp:515
const u8 j3dDefaultColorChanNum
const J3DFogInfo j3dDefaultFogInfo
Definition J3DTevs.cpp:359
u8 calcTevSwapTableID(u8 param_0, u8 param_1, u8 param_2, u8 param_3)
Definition J3DTevs.h:215
const J3DTexMtxInfo j3dDefaultTexMtxInfo
Definition J3DTevs.cpp:333
const J3DBlendInfo j3dDefaultBlendInfo
Definition J3DTevs.cpp:524
u8 j3dTevSwapTableTable[1024]
Definition J3DTevs.h:212
bool isTexNoReg(void *param_0)
Definition J3DTevs.cpp:270
const J3DColorChanInfo j3dDefaultColorChanInfo
Definition J3DTevs.cpp:526
const u16 j3dDefaultAlphaCmpID
Definition J3DTevs.cpp:532
void makeTexCoordTable()
Definition J3DTevs.cpp:370
const J3DTevOrderInfo j3dDefaultTevOrderInfoNull
Definition J3DTevs.h:194
const J3DTexCoordInfo j3dDefaultTexCoordInfo[8]
Definition J3DTevs.cpp:326
const J3DIndTexCoordScaleInfo j3dDefaultIndTexCoordScaleInfo
Definition J3DTevs.cpp:506
const GXColorS10 j3dDefaultTevColor
Definition J3DTevs.h:292
u8 j3dAlphaCmpTable[768]
Definition J3DTevs.cpp:400
const u8 j3dDefaultNumChans
Definition J3DTevs.cpp:498
const u16 j3dDefaultZModeID
Definition J3DTevs.cpp:534
const u8 j3dDefaultTevSwapTableID
Definition J3DTevs.h:213
const J3DTevStageInfo j3dDefaultTevStageInfo
Definition J3DTevs.cpp:350
const J3DIndTevStageInfo j3dDefaultIndTevStageInfo
Definition J3DTevs.cpp:355
const GXColor j3dDefaultTevKColor
Definition J3DTevs.h:293
Definition J3DTevs.h:251
J3DLightObj()
Definition J3DTevs.h:253
J3DLightInfo mInfo
Definition J3DTevs.h:262
void load(u32) const
Definition J3DTevs.cpp:17
GXLightObj mLightObj
Definition J3DTevs.h:263
J3DLightObj & operator=(J3DLightObj const &other)
Definition J3DTevs.h:257
J3DLightInfo * getLightInfo()
Definition J3DTevs.h:256
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 J3DStruct.h:250
Definition J3DStruct.h:279
Definition J3DStruct.h:106
Definition J3DStruct.h:201
u8 mAlphaSel
Definition J3DStruct.h:210
u8 mBiasSel
Definition J3DStruct.h:204
u8 mPrev
Definition J3DStruct.h:208
u8 mWrapS
Definition J3DStruct.h:206
u8 mWrapT
Definition J3DStruct.h:207
u8 mLod
Definition J3DStruct.h:209
u8 mMtxSel
Definition J3DStruct.h:205
u8 mIndFormat
Definition J3DStruct.h:203
u8 mIndStage
Definition J3DStruct.h:202
Definition J3DTevs.h:153
void setWrapT(u8 wrapT)
Definition J3DTevs.h:172
void setPrev(u8 prev)
Definition J3DTevs.h:173
void setIndTevStageInfo(J3DIndTevStageInfo const &info)
Definition J3DTevs.h:156
void setBiasSel(u8 biasSel)
Definition J3DTevs.h:169
J3DIndTevStage & operator=(const J3DIndTevStage &other)
Definition J3DTevs.h:181
void setLod(u8 lod)
Definition J3DTevs.h:174
J3DIndTevStage(J3DIndTevStageInfo const &info)
Definition J3DTevs.h:155
J3DIndTevStage & operator=(J3DIndTevStage &other)
Definition J3DTevs.h:186
void setIndFormat(u8 indFormat)
Definition J3DTevs.h:168
void setWrapS(u8 wrapS)
Definition J3DTevs.h:171
u32 mInfo
Definition J3DTevs.h:191
void setMtxSel(u8 mtxSel)
Definition J3DTevs.h:170
void setIndStage(u8 indStage)
Definition J3DTevs.h:167
void setAlphaSel(u8 alphaSel)
Definition J3DTevs.h:175
void load(u32 param_1) const
Definition J3DTevs.h:177
J3DIndTevStage()
Definition J3DTevs.h:154
Definition J3DStruct.h:234
Definition J3DStruct.h:96
Definition J3DStruct.h:137
Definition J3DStruct.h:13
Definition J3DStruct.h:125
u8 mbHasScale
Definition J3DStruct.h:129
Vec mScale
Definition J3DStruct.h:130
Definition J3DTevs.h:272
Vec * getScale()
Definition J3DTevs.h:287
J3DNBTScale(J3DNBTScaleInfo const &info)
Definition J3DTevs.h:280
J3DNBTScale()
Definition J3DTevs.h:273
Definition J3DStruct.h:264
u8 mTexMap
Definition J3DStruct.h:270
void operator=(const J3DTevOrderInfo &other)
Definition J3DStruct.h:265
Definition J3DTevs.h:200
J3DTevOrder(const J3DTevOrderInfo &info)
Definition J3DTevs.h:204
J3DTevOrderInfo & getTevOrderInfo()
Definition J3DTevs.h:207
u8 getTexMap() const
Definition J3DTevs.h:209
J3DTevOrder()
Definition J3DTevs.h:201
Definition J3DStruct.h:174
u8 mTevColorAB
Definition J3DStruct.h:177
u8 field_0xd
Definition J3DStruct.h:188
u8 field_0x10
Definition J3DStruct.h:191
u8 field_0x8
Definition J3DStruct.h:183
u8 mTevColorCD
Definition J3DStruct.h:178
u8 field_0x9
Definition J3DStruct.h:184
u8 mTevSwapModeInfo
Definition J3DStruct.h:182
u8 mTevColorOp
Definition J3DStruct.h:176
u8 field_0xb
Definition J3DStruct.h:186
u8 field_0xe
Definition J3DStruct.h:189
u8 field_0x4
Definition J3DStruct.h:179
u8 mTevAlphaOp
Definition J3DStruct.h:180
u8 mTevAlphaAB
Definition J3DStruct.h:181
u8 field_0xa
Definition J3DStruct.h:185
u8 field_0x11
Definition J3DStruct.h:192
u8 field_0x12
Definition J3DStruct.h:193
u8 field_0xf
Definition J3DStruct.h:190
u8 field_0xc
Definition J3DStruct.h:187
Definition J3DTevs.h:40
J3DTevStage & operator=(const J3DTevStage &other)
Definition J3DTevs.h:119
void setTevColorCD(u8 c, u8 d)
Definition J3DTevs.h:60
void setRasSel(u8 ras_sel)
Definition J3DTevs.h:111
u8 mTevSwapModeInfo
Definition J3DTevs.h:146
u8 field_0x0
Definition J3DTevs.h:139
void setTevSwapModeInfo(J3DTevSwapModeInfo const &param_0)
Definition J3DTevs.h:101
void setStageNo(u32 param_0)
Definition J3DTevs.h:106
J3DTevStage()
Definition J3DTevs.h:41
u8 mTevColorCD
Definition J3DTevs.h:142
u8 mTevAlphaAB
Definition J3DTevs.h:145
u8 mTevAlphaOp
Definition J3DTevs.h:144
u8 mTevColorAB
Definition J3DTevs.h:141
u8 field_0x4
Definition J3DTevs.h:143
void setAlphaB(u8 b)
Definition J3DTevs.h:62
void setTevColorAB(u8 a, u8 b)
Definition J3DTevs.h:59
void setAlphaC(u8 c)
Definition J3DTevs.h:63
void setTevAlphaOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5)
Definition J3DTevs.h:75
void load(u32 param_1) const
Definition J3DTevs.h:114
u8 mTevColorOp
Definition J3DTevs.h:140
void setTevColorOp(u8 param_1, u8 param_2, u8 param_3, u8 param_4, u8 param_5)
Definition J3DTevs.h:46
void setTexSel(u8 tex_sel)
Definition J3DTevs.h:112
void setAlphaA(u8 a)
Definition J3DTevs.h:61
void setAlphaABCD(u8 a, u8 b, u8 c, u8 d)
Definition J3DTevs.h:68
void setAlphaD(u8 d)
Definition J3DTevs.h:67
void setTevStageInfo(const J3DTevStageInfo &info)
Definition J3DTevs.h:88
J3DTevStage(J3DTevStageInfo const &param_0)
Definition J3DTevs.h:96
J3DTevStage & operator=(J3DTevStage &other)
Definition J3DTevs.h:129
Definition J3DStruct.h:152
u8 mTexSel
Definition J3DStruct.h:154
u8 mRasSel
Definition J3DStruct.h:153
Definition J3DStruct.h:163
u8 field_0x3
Definition J3DStruct.h:167
u8 field_0x1
Definition J3DStruct.h:165
u8 field_0x0
Definition J3DStruct.h:164
u8 field_0x2
Definition J3DStruct.h:166
Definition J3DTevs.h:223
u8 mIdx
Definition J3DTevs.h:244
J3DTevSwapModeTable(J3DTevSwapModeTableInfo const &info)
Definition J3DTevs.h:225
J3DTevSwapModeTable()
Definition J3DTevs.h:224
u8 getB() const
Definition J3DTevs.h:241
u8 getG() const
Definition J3DTevs.h:240
u8 getR() const
Definition J3DTevs.h:239
J3DTevSwapModeTable & operator=(J3DTevSwapModeTable &other)
Definition J3DTevs.h:234
u8 getA() const
Definition J3DTevs.h:242
J3DTevSwapModeTable & operator=(const J3DTevSwapModeTable &rhs)
Definition J3DTevs.h:229
Definition J3DStruct.h:218
Definition J3DTexture.h:83
Definition J3DStruct.h:78
Definition mtx.h:13
f32 z
Definition mtx.h:14
f32 x
Definition mtx.h:14
f32 y
Definition mtx.h:14
Definition GXStruct.h:34
Definition GXStruct.h:30
Definition GXStruct.h:42