| 1 | #ifndef _3DMATH_H |
| 2 | #define _3DMATH_H |
| 3 | |
| 4 | #include <string.h> |
| 5 | |
| 6 | extern void (*MultMatrix)(float m0[4][4], float m1[4][4], float dest[4][4]); |
| 7 | extern void (*TransformVectorNormalize)(float vec[3], float mtx[4][4]); |
| 8 | extern void (*Normalize)(float v[3]); |
| 9 | extern float (*DotProduct)(float v0[3], float v1[3]); |
| 10 | |
| 11 | inline void CopyMatrix( float m0[4][4], float m1[4][4] ) |
| 12 | { |
| 13 | memcpy( m0, m1, 16 * sizeof( float ) ); |
| 14 | } |
| 15 | |
| 16 | inline void MultMatrix2( float m0[4][4], float m1[4][4] ) |
| 17 | { |
| 18 | float dst[4][4]; |
| 19 | MultMatrix(m0, m1, dst); |
| 20 | memcpy( m0, dst, sizeof(float) * 16 ); |
| 21 | } |
| 22 | |
| 23 | inline void Transpose3x3Matrix( float mtx[4][4] ) |
| 24 | { |
| 25 | float tmp; |
| 26 | |
| 27 | tmp = mtx[0][1]; |
| 28 | mtx[0][1] = mtx[1][0]; |
| 29 | mtx[1][0] = tmp; |
| 30 | |
| 31 | tmp = mtx[0][2]; |
| 32 | mtx[0][2] = mtx[2][0]; |
| 33 | mtx[2][0] = tmp; |
| 34 | |
| 35 | tmp = mtx[1][2]; |
| 36 | mtx[1][2] = mtx[2][1]; |
| 37 | mtx[2][1] = tmp; |
| 38 | } |
| 39 | |
| 40 | #ifdef __NEON_OPT |
| 41 | void MathInitNeon(); |
| 42 | #endif |
| 43 | |
| 44 | #endif |
| 45 | |