Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
J3DTransform.h
Go to the documentation of this file.
1#ifndef J3DTRANSFORM_H
2#define J3DTRANSFORM_H
3
4#include "JSystem/JGeometry.h"
5#include "dolphin/mtx.h"
6
8
14struct J3DTransformInfo {
15 /* 0x00 */ Vec mScale;
16 /* 0x0C */ SVec mRotation;
17 /* 0x14 */ Vec mTranslate;
18
19 /* inline J3DTransformInfo& operator=(const J3DTransformInfo& b) {
20 mScale = b.mScale;
21 mRotation = b.mRotation;
22 mTranslate = b.mTranslate;
23 return *this;
24 } */
25
26#ifdef __MWERKS__
27 inline J3DTransformInfo& operator=(const register J3DTransformInfo& b) {
28 register const J3DTransformInfo& var_r31 = b;
29 register J3DTransformInfo& var_r30 = *this;
30
31 register f32 var_f31;
32 register f32 var_f0;
33 register int var_r0;
34 asm {
35 psq_l var_f31, 0x0(var_r31), 0, 0
36 psq_st var_f31, 0x0(var_r30), 0, 0
37 lfs var_f0, 0x8(var_r31)
38 stfs var_f0, 0x8(var_r30)
39 lwz var_r0, 0xc(var_r31)
40 stw var_r0, 0xc(var_r30)
41 lha var_r0, 0x10(var_r31)
42 sth var_r0, 0x10(var_r30)
43 psq_l var_f31, 0x14(var_r31), 0, 0
44 psq_st var_f31, 0x14(var_r30), 0, 0
45 lfs var_f0, 0x1c(var_r31)
46 stfs var_f0, 0x1c(var_r30)
47 }
48 return *this;
49 }
50#endif
51}; // Size: 0x20
52
54extern Vec const j3dDefaultScale;
55extern Mtx const j3dDefaultMtx;
56extern f32 PSMulUnit01[2];
57
59void J3DCalcBBoardMtx(f32 (*)[4]);
60void J3DCalcYBBoardMtx(f32 (*)[4]);
64void J3DGetTextureMtx(const J3DTextureSRTInfo&, const Vec&, f32 (*)[4]);
65void J3DGetTextureMtxOld(const J3DTextureSRTInfo&, const Vec&, f32 (*)[4]);
68void J3DScaleNrmMtx(f32 (*)[4], const Vec&);
69void J3DScaleNrmMtx33(f32 (*)[3], const Vec&);
70void J3DMtxProjConcat(f32 (*)[4], f32 (*)[4], f32 (*)[4]);
71void J3DPSMtxArrayConcat(f32 (*)[4], f32 (*)[4], f32 (*)[4], u32);
72
73inline void J3DPSMtx33Copy(register Mtx3P src, register Mtx3P dst) {
74 register f32 fr4;
75 register f32 fr3;
76 register f32 fr2;
77 register f32 fr1;
78 register f32 fr0;
79 asm {
80 psq_l fr4, 0(src), 0, 0
81 psq_l fr3, 8(src), 0, 0
82 psq_l fr2, 0x10(src), 0, 0
83 psq_l fr1, 0x18(src), 0, 0
84 lfs fr0, 0x20(src)
85 psq_st fr4, 0(dst), 0, 0
86 psq_st fr3, 8(dst), 0, 0
87 psq_st fr2, 0x10(dst), 0, 0
88 psq_st fr1, 0x18(dst), 0, 0
89 stfs fr0, 0x20(dst)
90 }
91}
92
93inline void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst) {
94 register f32 x_y1;
95 register f32 z1;
96 register f32 x_y2;
97 register f32 z2;
98 register f32 x_y3;
99 register f32 z3;
100 asm {
101 psq_l x_y1, 0(src), 0, 0
102 lfs z1, 8(src)
103 psq_l x_y2, 16(src), 0, 0
104 lfs z2, 0x18(src)
105 psq_l x_y3, 32(src), 0, 0
106 lfs z3, 0x28(src)
107 psq_st x_y1, 0(dst), 0, 0
108 stfs z1, 8(dst)
109 psq_st x_y2, 12(dst), 0, 0
110 stfs z2, 0x14(dst)
111 psq_st x_y3, 24(dst), 0, 0
112 stfs z3, 0x20(dst)
113 }
114}
115
116// regalloc issues
117inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* dst) {
118 register f32 fr12;
119 register f32 fr11;
120 register f32 fr10;
121 register f32 fr9;
122 register f32 fr8;
123 register f32 fr6;
124 register f32 fra6;
125 register f32 fr5;
126 register f32 fra5;
127 register f32 fra4;
128 register f32 fr4;
129 register f32 fr3;
130 register f32 fr2;
131 register f32 fra2;
132 register f32 fr01;
133 register f32 fr00;
134 asm {
135 psq_l fr00, 0(vec), 0, 0
136 psq_l fr2, 0(mtx), 0, 0
137 psq_l fr01, 8(vec), 1, 0
139 psq_l fr3, 8(mtx), 0, 0
141 psq_l fr8, 16(mtx), 0, 0
143 psq_l fr9, 24(mtx), 0, 0
145 psq_st fr6, 0(dst), 1, 0
147 psq_l fra2, 32(mtx), 0, 0
149 psq_l fr3, 40(mtx), 0, 0
151 psq_st fr12, 4(dst), 1, 0
154 psq_st fra6, 8(dst), 1, 0
155 }
156}
157
158// regalloc issues
159inline void J3DPSMulMtxVec(register MtxP mtx, register SVec* vec, register SVec* dst) {
160 register f32 fr12;
161 register f32 fr11;
162 register f32 fr10;
163 register f32 fr9;
164 register f32 fr8;
165 register f32 fr6;
166 register f32 fra6;
167 register f32 fr5;
168 register f32 fra5;
169 register f32 fra4;
170 register f32 fr4;
171 register f32 fr3;
172 register f32 fr2;
173 register f32 fra2;
174 register f32 fr01;
175 register f32 fr00;
176 asm {
177 psq_l fr00, 0(vec), 0, 7
178 psq_l fr2, 0(mtx), 0, 0
179 psq_l fr01, 4(vec), 1, 7
181 psq_l fr3, 8(mtx), 0, 0
183 psq_l fr8, 16(mtx), 0, 0
185 psq_l fr9, 24(mtx), 0, 0
187 psq_st fr6, 0(dst), 1, 7
189 psq_l fra2, 32(mtx), 0, 0
191 psq_l fr3, 40(mtx), 0, 0
193 psq_st fr12, 2(dst), 1, 7
196 psq_st fra6, 4(dst), 1, 7
197 }
198}
199
200// regalloc issues
201inline void J3DPSMulMtxVec(register Mtx3P mtx, register Vec* vec, register Vec* dst) {
202 register f32* punit;
203 register f32 unit;
204 register f32 fr12;
205 register f32 fr11;
206 register f32 fr10;
207 register f32 fr9;
208 register f32 fr8;
209 register f32 fr6;
210 register f32 fr5;
211 register f32 fr4;
212 register f32 fr3;
213 register f32 fr2;
214 register f32 fr01;
215 register f32 fr00;
216 asm {
218 psq_l fr00, 0(vec), 0, 0
220 psq_l fr2, 0(mtx), 0, 0
221 psq_l unit, 0(punit), 0, 0
222 psq_l fr01, 8(vec), 1, 0
224 psq_l fr3, 8(mtx), 1, 0
226 psq_l fr8, 12(mtx), 0, 0
229 psq_l fr9, 20(mtx), 1, 0
231 psq_st fr6, 0(dst), 1, 0
233 psq_l fr2, 24(mtx), 0, 0
235 psq_l fr3, 32(mtx), 1, 0
237 psq_st fr12, 4(dst), 1, 0
240 psq_st fr6, 8(dst), 1, 0
241 }
242}
243
244// regalloc issues
245inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec* dst) {
246 register f32* punit;
247 register f32 unit;
248 register f32 fr6;
249 register f32 fr5;
250 register f32 fr4;
251 register f32 fr3;
252 register f32 fr2;
253 register f32 fr01;
254 register f32 fr00;
255 asm {
257 psq_l fr00, 0(vec), 0, 7
259 psq_l fr2, 0(mtx), 0, 0
260 psq_l unit, 0(punit), 0, 0
261 psq_l fr01, 4(vec), 1, 7
263 psq_l fr3, 8(mtx), 1, 0
265 psq_l fr2, 12(mtx), 0, 0
268 psq_l fr3, 20(mtx), 1, 0
270 psq_st fr6, 0(dst), 1, 7
272 psq_l fr2, 24(mtx), 0, 0
274 psq_l fr3, 32(mtx), 1, 0
276 psq_st fr6, 2(dst), 1, 7
279 psq_st fr6, 4(dst), 1, 7
280 }
281}
282
283#endif /* J3DTRANSFORM_H */
void J3DGQRSetup7(u32 param_0, u32 param_1, u32 param_2, u32 param_3)
Definition J3DTransform.cpp:21
void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo &param_0, f32(*)[4])
void J3DPSMulMtxVec(register MtxP mtx, register Vec *vec, register Vec *dst)
Definition J3DTransform.h:117
void J3DGetTextureMtxMaya(const J3DTextureSRTInfo &, f32(*)[4])
void J3DGetTranslateRotateMtx(const J3DTransformInfo &, Mtx)
Definition J3DTransform.cpp:87
f32 PSMulUnit01[2]
void J3DCalcYBBoardMtx(f32(*)[4])
Definition J3DTransform.cpp:76
void J3DMtxProjConcat(f32(*)[4], f32(*)[4], f32(*)[4])
Definition J3DTransform.cpp:291
void J3DGetTextureMtx(const J3DTextureSRTInfo &, const Vec &, f32(*)[4])
void J3DGetTextureMtxOld(const J3DTextureSRTInfo &, const Vec &, f32(*)[4])
Mtx const j3dDefaultMtx
void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst)
Definition J3DTransform.h:93
Vec const j3dDefaultScale
void J3DPSCalcInverseTranspose(f32(*param_0)[4], f32(*param_1)[3])
Definition J3DTransform.cpp:81
void J3DPSMtxArrayConcat(f32(*)[4], f32(*)[4], f32(*)[4], u32)
Definition J3DTransform.cpp:302
void J3DScaleNrmMtx33(f32(*)[3], const Vec &)
Definition J3DTransform.cpp:285
void J3DCalcBBoardMtx(f32(*)[4])
void J3DPSMtx33Copy(register Mtx3P src, register Mtx3P dst)
Definition J3DTransform.h:73
J3DTransformInfo const j3dDefaultTransformInfo
void J3DScaleNrmMtx(f32(*)[4], const Vec &)
Definition J3DTransform.cpp:279
static Mtx mtx[10]
Definition c_lib.cpp:347
T cLib_calcTimer(T *value)
Definition c_lib.h:74
f32(* MtxP)[4]
Definition mtx.h:18
f32(* Mtx3P)[3]
Definition mtx.h:19
f32 Mtx[3][4]
Definition mtx.h:15
Definition J3DStruct.h:48
Definition d_a_hozelda.cpp:169
Vec mScale
Definition J3DTransform.h:15
Vec mTranslate
Definition J3DTransform.h:17
J3DTransformInfo & operator=(const register J3DTransformInfo &b)
Definition J3DTransform.h:27
SVec mRotation
Definition J3DTransform.h:16
Definition vec.h:18
Definition d_a_hozelda.cpp:18
unsigned long u32
Definition types.h:10
float f32
Definition types.h:22
signed short s16
Definition types.h:5