24 #include <sys/cdefs.h>
100 #define mat_trans_single(x, y, z) { \
101 register float __x __asm__("fr0") = (x); \
102 register float __y __asm__("fr1") = (y); \
103 register float __z __asm__("fr2") = (z); \
104 __asm__ __volatile__( \
111 : "=f" (__x), "=f" (__y), "=f" (__z) \
112 : "0" (__x), "1" (__y), "2" (__z) \
114 x = __x; y = __y; z = __z; \
130 #define mat_trans_single4(x, y, z, w) { \
131 register float __x __asm__("fr0") = (x); \
132 register float __y __asm__("fr1") = (y); \
133 register float __z __asm__("fr2") = (z); \
134 register float __w __asm__("fr3") = (w); \
135 __asm__ __volatile__( \
143 : "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w) \
144 : "0" (__x), "1" (__y), "2" (__z), "3" (__w) \
146 x = __x; y = __y; z = __z; w = __w; \
161 #define mat_trans_single3(x, y, z) { \
162 register float __x __asm__("fr0") = (x); \
163 register float __y __asm__("fr1") = (y); \
164 register float __z __asm__("fr2") = (z); \
165 __asm__ __volatile__( \
171 : "=f" (__x), "=f" (__y), "=f" (__z) \
172 : "0" (__x), "1" (__y), "2" (__z) \
174 x = __x; y = __y; z = __z; \
190 #define mat_trans_nodiv(x, y, z, w) { \
191 register float __x __asm__("fr0") = (x); \
192 register float __y __asm__("fr1") = (y); \
193 register float __z __asm__("fr2") = (z); \
194 register float __w __asm__("fr3") = (w); \
195 __asm__ __volatile__( \
197 : "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w) \
198 : "0" (__x), "1" (__y), "2" (__z), "3" (__w) ); \
199 x = __x; y = __y; z = __z; w = __w; \
215 #define mat_trans_single3_nodiv(x, y, z) { \
216 register float __x __asm__("fr12") = (x); \
217 register float __y __asm__("fr13") = (y); \
218 register float __z __asm__("fr14") = (z); \
219 __asm__ __volatile__( \
221 "ftrv xmtrx, fv12\n" \
222 : "=f" (__x), "=f" (__y), "=f" (__z) \
223 : "0" (__x), "1" (__y), "2" (__z) ); \
224 x = __x; y = __y; z = __z; \
243 #define mat_trans_single3_nomod(x, y, z, x2, y2, z2) { \
244 register float __x __asm__("fr12") = (x); \
245 register float __y __asm__("fr13") = (y); \
246 register float __z __asm__("fr14") = (z); \
247 __asm__ __volatile__( \
249 "ftrv xmtrx, fv12\n" \
251 "fdiv fr15, fr14\n" \
252 "fmul fr14, fr12\n" \
253 "fmul fr14, fr13\n" \
254 : "=f" (__x), "=f" (__y), "=f" (__z) \
255 : "0" (__x), "1" (__y), "2" (__z) \
257 x2 = __x; y2 = __y; z2 = __z; \
276 #define mat_trans_single3_nodiv_nomod(x, y, z, x2, y2, z2) { \
277 register float __x __asm__("fr12") = (x); \
278 register float __y __asm__("fr13") = (y); \
279 register float __z __asm__("fr14") = (z); \
280 __asm__ __volatile__( \
282 "ftrv xmtrx, fv12\n" \
283 : "=f" (__x), "=f" (__y), "=f" (__z) \
284 : "0" (__x), "1" (__y), "2" (__z) ); \
285 x2 = __x; y2 = __y; z2 = __z; \
302 #define mat_trans_single3_nodivw(x, y, z, w) { \
303 register float __x __asm__("fr12") = (x); \
304 register float __y __asm__("fr13") = (y); \
305 register float __z __asm__("fr14") = (z); \
306 register float __w __asm__("fr15"); \
307 __asm__ __volatile__( \
309 "ftrv xmtrx, fv12\n" \
310 : "=f" (__x), "=f" (__y), "=f" (__z) \
311 : "0" (__x), "1" (__y), "2" (__z) ); \
312 x = __x; y = __y; z = __z; w = __w; \
337 #define mat_trans_single3_nodiv_div(x, y, z, xd, yd, zd) { \
338 register float __x __asm__("fr0") = (x); \
339 register float __y __asm__("fr1") = (y); \
340 register float __z __asm__("fr2") = (z); \
341 register float __xd __asm__("fr4"); \
342 register float __yd __asm__("fr5"); \
343 register float __zd __asm__("fr6"); \
344 __asm__ __volatile__( \
346 "ftrv xmtrx, fv0\n" \
354 : "=f" (__x), "=f" (__y), "=f" (__z) \
355 : "0" (__x), "1" (__y), "2" (__z) ); \
356 x = __x; y = __y; z = __z; xd = __xd; yd = __yd; zd = __zd; \
371 #define mat_trans_normal3(x, y, z) { \
372 register float __x __asm__("fr8") = (x); \
373 register float __y __asm__("fr9") = (y); \
374 register float __z __asm__("fr10") = (z); \
375 __asm__ __volatile__( \
377 "ftrv xmtrx, fv8\n" \
378 : "=f" (__x), "=f" (__y), "=f" (__z) \
379 : "0" (__x), "1" (__y), "2" (__z) ); \
380 x = __x; y = __y; z = __z; \
398 #define mat_trans_normal3_nomod(x, y, z, x2, y2, z2) { \
399 register float __x __asm__("fr8") = (x); \
400 register float __y __asm__("fr9") = (y); \
401 register float __z __asm__("fr10") = (z); \
402 __asm__ __volatile__( \
404 "ftrv xmtrx, fv8\n" \
405 : "=f" (__x), "=f" (__y), "=f" (__z) \
406 : "0" (__x), "1" (__y), "2" (__z) ); \
407 x2 = __x; y2 = __y; z2 = __z; \
void mat_transform(vector_t *invecs, vector_t *outvecs, int veccnt, int vecskip)
Transform vectors by the internal matrix.
void mat_identity()
Clear the internal matrix to identity.
void mat_transform_sq(void *input, void *output, int veccnt)
Transform vectors by the internal matrix into the store queues.
4-part vector type.
Definition: vector.h:34
void mat_store(matrix_t *out)
Copy the internal matrix to a memory one.
Primitive matrix, vector, and point types.
float matrix_t[4][4]
Basic 4x4 matrix type.
Definition: vector.h:29
void mat_load(matrix_t *out)
Copy a memory matrix into the internal one.
void mat_apply(matrix_t *src)
Apply a matrix.