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
7
8#include "baselib/objalloc.h"
9
10#include <MSL/math.h>
11#include <MSL/math_ppc.h>
12
13typedef Vec3 VecMtx[4];
14typedef Vec3* VecMtxPtr;
15
16void HSD_MtxInverse(Mtx src, Mtx dest);
17void HSD_MtxInverseConcat(Mtx inv, Mtx src, Mtx dest);
18void HSD_MtxInverseTranspose(Mtx src, Mtx dest);
19void HSD_MtxGetRotation(Mtx m, Vec3* vec);
20void HSD_MtxGetTranslate(Mtx mat, Vec3* vec);
21void HSD_MtxGetScale(Mtx arg0, Vec3* arg1);
22void HSD_MkRotationMtx(Mtx arg0, Vec3* arg1);
23void HSD_Mtx_8037A230(Mtx arg0, Quaternion* arg1);
24void HSD_MtxSRT(Mtx m, Vec3* vec1, Vec3* vec2, Vec3* vec3, Vec3* vec4);
25void HSD_MtxSRTQuat(Mtx arg0, Vec3* arg1, Quaternion* arg2, Vec3* arg3,
26 Vec3* arg4);
27void HSD_MtxScaledAdd(Mtx arg0, Mtx arg1, Mtx arg2, f32 arg3);
28void* HSD_VecAlloc(void);
29void HSD_VecFree(void* arg0);
30void* HSD_MtxAlloc(void);
31void HSD_MtxFree(void* arg0);
33void HSD_VecInitAllocData(void);
35void HSD_MtxInitAllocData(void);
36
37static inline f32 fabsf_bitwise(f32 v)
38{
39 *(u32*) &v &= ~0x80000000;
40 return v;
41}
42
43static inline void HSD_MtxColVec(MtxPtr mtx, int col, Vec3* vec)
44{
45 vec->x = mtx[0][col];
46 vec->y = mtx[1][col];
47 vec->z = mtx[2][col];
48}
49
50static inline void HSD_MtxSetColVec(MtxPtr mtx, int col, Vec3* vec)
51{
52 mtx[0][col] = vec->x;
53 mtx[1][col] = vec->y;
54 mtx[2][col] = vec->z;
55}
56
57static inline f32 HSD_MtxColMag(MtxPtr mtx, int col)
58{
59 return sqrtf__Ff((mtx[0][col] * mtx[0][col]) +
60 (mtx[1][col] * mtx[1][col]) +
61 (mtx[2][col] * mtx[2][col]));
62}
63
64static inline f32 HSD_MtxColMagFloat(MtxPtr mtx, int col)
65{
66 return sqrtf((mtx[0][col] * mtx[0][col]) + (mtx[1][col] * mtx[1][col]) +
67 (mtx[2][col] * mtx[2][col]));
68}
69
70#endif
f32(* MtxPtr)[4]
Definition forward.h:7
f32 Mtx[3][4]
Definition forward.h:6
Mtx mtx
Definition ftparts.c:62
float sqrtf__Ff(float)
float sqrtf(float x)
Definition math_ppc.h:11
unsigned long u32
An unsigned 32-bit integer.
Definition platform.h:26
float f32
A 32-bit floating-point number.
Definition platform.h:62
Definition objalloc.h:21
Definition types.h:13
f32 x
The x component.
Definition types.h:14
f32 z
The z component.
Definition types.h:14
f32 y
The y component.
Definition types.h:14
void * HSD_MtxAlloc(void)
Definition mtx.c:480
void HSD_MtxInverse(Mtx src, Mtx dest)
Definition mtx.c:24
void HSD_MtxGetScale(Mtx arg0, Vec3 *arg1)
Definition mtx.c:279
void HSD_MtxGetTranslate(Mtx mat, Vec3 *vec)
Definition mtx.c:272
Vec3 * VecMtxPtr
Definition mtx.h:14
void HSD_VecInitAllocData(void)
Definition mtx.c:503
void HSD_MtxInitAllocData(void)
Definition mtx.c:513
static f32 HSD_MtxColMag(MtxPtr mtx, int col)
Definition mtx.h:57
void HSD_MtxScaledAdd(Mtx arg0, Mtx arg1, Mtx arg2, f32 arg3)
Definition mtx.c:440
void * HSD_VecAlloc(void)
Definition mtx.c:462
void HSD_MtxSRT(Mtx m, Vec3 *vec1, Vec3 *vec2, Vec3 *vec3, Vec3 *vec4)
Definition mtx.c:365
void HSD_Mtx_8037A230(Mtx arg0, Quaternion *arg1)
Definition mtx.c:360
void HSD_MtxSRTQuat(Mtx arg0, Vec3 *arg1, Quaternion *arg2, Vec3 *arg3, Vec3 *arg4)
Definition mtx.c:415
void HSD_MtxFree(void *arg0)
Definition mtx.c:491
void HSD_MtxGetRotation(Mtx m, Vec3 *vec)
Definition mtx.c:221
void HSD_MtxInverseTranspose(Mtx src, Mtx dest)
Definition mtx.c:162
HSD_ObjAllocData * HSD_MtxGetAllocData(void)
Definition mtx.c:508
static void HSD_MtxSetColVec(MtxPtr mtx, int col, Vec3 *vec)
Definition mtx.h:50
static f32 HSD_MtxColMagFloat(MtxPtr mtx, int col)
Definition mtx.h:64
HSD_ObjAllocData * HSD_VecGetAllocData(void)
Definition mtx.c:498
void HSD_MkRotationMtx(Mtx arg0, Vec3 *arg1)
Definition mtx.c:326
Vec3 VecMtx[4]
Definition mtx.h:13
void HSD_VecFree(void *arg0)
Definition mtx.c:473
static void HSD_MtxColVec(MtxPtr mtx, int col, Vec3 *vec)
Definition mtx.h:43
static f32 fabsf_bitwise(f32 v)
Definition mtx.h:37
void HSD_MtxInverseConcat(Mtx inv, Mtx src, Mtx dest)
Definition mtx.c:63