SSBM Decomp
Loading...
Searching...
No Matches
mtx.h
Go to the documentation of this file.
1#ifndef _mtx_h_
2#define _mtx_h_
3
4#include <platform.h>
5
6#include "baselib/objalloc.h"
7
8#include <dolphin/mtx.h>
9#include <MSL/math.h>
10#include <MSL/math_ppc.h>
11
12#define VEC2_SQ_LEN(v) ((SQ((v).x) + SQ((v).y)))
13#define VEC3_SQ_LEN(v) ((SQ((v).x) + SQ((v).y) + SQ((v).z)))
14
15typedef Vec3 VecMtx[4];
16typedef Vec3* VecMtxPtr;
17
18void HSD_MtxInverse(Mtx src, Mtx dest);
19void HSD_MtxInverseConcat(Mtx inv, Mtx src, Mtx dest);
20void HSD_MtxInverseTranspose(Mtx src, Mtx dest);
21void HSD_MtxGetRotation(Mtx m, Vec3* vec);
22void HSD_MtxGetTranslate(Mtx mat, Vec3* vec);
23void HSD_MtxGetScale(Mtx arg0, Vec3* arg1);
24void HSD_MkRotationMtx(Mtx arg0, Vec3* arg1);
25void HSD_Mtx_8037A230(Mtx arg0, Quaternion* arg1);
26void HSD_MtxSRT(Mtx m, Vec3* vec1, Vec3* vec2, Vec3* vec3, Vec3* vec4);
27void HSD_MtxSRTQuat(Mtx arg0, Vec3* arg1, Quaternion* arg2, Vec3* arg3,
28 Vec3* arg4);
29void HSD_MtxScaledAdd(Mtx arg0, Mtx arg1, Mtx arg2, f32 arg3);
30void* HSD_VecAlloc(void);
31void HSD_VecFree(void* arg0);
32void* HSD_MtxAlloc(void);
33void HSD_MtxFree(void* arg0);
35void HSD_VecInitAllocData(void);
37void HSD_MtxInitAllocData(void);
38
39static inline f32 fabsf_bitwise(f32 v)
40{
41 *(u32*) &v &= ~0x80000000;
42 return v;
43}
44
45static inline void HSD_MtxColVec(MtxPtr mtx, int col, Vec3* vec)
46{
47 vec->x = mtx[0][col];
48 vec->y = mtx[1][col];
49 vec->z = mtx[2][col];
50}
51
52static inline void HSD_MtxSetColVec(MtxPtr mtx, int col, Vec3* vec)
53{
54 mtx[0][col] = vec->x;
55 mtx[1][col] = vec->y;
56 mtx[2][col] = vec->z;
57}
58
59static inline f32 HSD_MtxColMag(MtxPtr mtx, int col)
60{
61 return sqrtf__Ff((mtx[0][col] * mtx[0][col]) +
62 (mtx[1][col] * mtx[1][col]) +
63 (mtx[2][col] * mtx[2][col]));
64}
65
66static inline f32 HSD_MtxColMagFloat(MtxPtr mtx, int col)
67{
68 return sqrtf((mtx[0][col] * mtx[0][col]) + (mtx[1][col] * mtx[1][col]) +
69 (mtx[2][col] * mtx[2][col]));
70}
71
72#endif
Mtx mtx
Definition ftparts.c:62
float sqrtf__Ff(float)
float sqrtf(float x)
Definition math_ppc.h:11
void * HSD_MtxAlloc(void)
Definition mtx.c:478
void HSD_MtxInverse(Mtx src, Mtx dest)
Definition mtx.c:22
void HSD_MtxGetScale(Mtx arg0, Vec3 *arg1)
Definition mtx.c:277
void HSD_MtxGetTranslate(Mtx mat, Vec3 *vec)
Definition mtx.c:270
Vec3 * VecMtxPtr
Definition mtx.h:16
void HSD_VecInitAllocData(void)
Definition mtx.c:501
void HSD_MtxInitAllocData(void)
Definition mtx.c:511
static f32 HSD_MtxColMag(MtxPtr mtx, int col)
Definition mtx.h:59
void HSD_MtxScaledAdd(Mtx arg0, Mtx arg1, Mtx arg2, f32 arg3)
Definition mtx.c:438
void * HSD_VecAlloc(void)
Definition mtx.c:460
void HSD_MtxSRT(Mtx m, Vec3 *vec1, Vec3 *vec2, Vec3 *vec3, Vec3 *vec4)
Definition mtx.c:363
void HSD_Mtx_8037A230(Mtx arg0, Quaternion *arg1)
Definition mtx.c:358
void HSD_MtxSRTQuat(Mtx arg0, Vec3 *arg1, Quaternion *arg2, Vec3 *arg3, Vec3 *arg4)
Definition mtx.c:413
void HSD_MtxFree(void *arg0)
Definition mtx.c:489
void HSD_MtxGetRotation(Mtx m, Vec3 *vec)
Definition mtx.c:219
void HSD_MtxInverseTranspose(Mtx src, Mtx dest)
Definition mtx.c:160
HSD_ObjAllocData * HSD_MtxGetAllocData(void)
Definition mtx.c:506
static void HSD_MtxSetColVec(MtxPtr mtx, int col, Vec3 *vec)
Definition mtx.h:52
static f32 HSD_MtxColMagFloat(MtxPtr mtx, int col)
Definition mtx.h:66
HSD_ObjAllocData * HSD_VecGetAllocData(void)
Definition mtx.c:496
void HSD_MkRotationMtx(Mtx arg0, Vec3 *arg1)
Definition mtx.c:324
Vec3 VecMtx[4]
Definition mtx.h:15
void HSD_VecFree(void *arg0)
Definition mtx.c:471
static void HSD_MtxColVec(MtxPtr mtx, int col, Vec3 *vec)
Definition mtx.h:45
static f32 fabsf_bitwise(f32 v)
Definition mtx.h:39
void HSD_MtxInverseConcat(Mtx inv, Mtx src, Mtx dest)
Definition mtx.c:61
Definition objalloc.h:21