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
13void HSD_MtxInverse(Mtx src, Mtx dest);
14void HSD_MtxInverseConcat(Mtx inv, Mtx src, Mtx dest);
15void HSD_MtxInverseTranspose(Mtx src, Mtx dest);
16void HSD_MtxGetRotation(Mtx m, Vec3* vec);
17void HSD_MtxGetTranslate(Mtx mat, Vec3* vec);
18void HSD_MtxGetScale(Mtx arg0, Vec3* arg1);
19void HSD_MkRotationMtx(Mtx arg0, Vec3* arg1);
20void HSD_Mtx_8037A230(Mtx arg0, Quaternion* arg1);
21void HSD_MtxSRT(Mtx m, Vec3* vec1, Vec3* vec2, Vec3* vec3, Vec3* vec4);
22void HSD_MtxSRTQuat(Mtx arg0, Vec3* arg1, Quaternion* arg2, Vec3* arg3,
23 Vec3* arg4);
24void HSD_MtxScaledAdd(Mtx arg0, Mtx arg1, Mtx arg2, f32 arg3);
25void* HSD_VecAlloc(void);
26void HSD_VecFree(void* arg0);
27void* HSD_MtxAlloc(void);
28void HSD_MtxFree(void* arg0);
30void HSD_VecInitAllocData(void);
32void HSD_MtxInitAllocData(void);
33
34static inline f32 fabsf_bitwise(f32 v)
35{
36 *(u32*) &v &= ~0x80000000;
37 return v;
38}
39
40static inline void HSD_MtxColVec(MtxPtr mtx, int col, Vec3* vec)
41{
42 vec->x = mtx[0][col];
43 vec->y = mtx[1][col];
44 vec->z = mtx[2][col];
45}
46
47static inline void HSD_MtxSetColVec(MtxPtr mtx, int col, Vec3* vec)
48{
49 mtx[0][col] = vec->x;
50 mtx[1][col] = vec->y;
51 mtx[2][col] = vec->z;
52}
53
54static inline f32 HSD_MtxColMag(MtxPtr mtx, int col)
55{
56 return sqrtf__Ff((mtx[0][col] * mtx[0][col]) +
57 (mtx[1][col] * mtx[1][col]) +
58 (mtx[2][col] * mtx[2][col]));
59}
60
61static inline f32 HSD_MtxColMagFloat(MtxPtr mtx, int col)
62{
63 return sqrtf((mtx[0][col] * mtx[0][col]) + (mtx[1][col] * mtx[1][col]) +
64 (mtx[2][col] * mtx[2][col]));
65}
66
67#endif
f32(* MtxPtr)[4]
Definition forward.h:7
f32 Mtx[3][4]
Definition forward.h:6
Mtx mtx
Definition ftparts.c:61
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
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:54
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:47
static f32 HSD_MtxColMagFloat(MtxPtr mtx, int col)
Definition mtx.h:61
HSD_ObjAllocData * HSD_VecGetAllocData(void)
Definition mtx.c:498
void HSD_MkRotationMtx(Mtx arg0, Vec3 *arg1)
Definition mtx.c:326
void HSD_VecFree(void *arg0)
Definition mtx.c:473
static void HSD_MtxColVec(MtxPtr mtx, int col, Vec3 *vec)
Definition mtx.h:40
static f32 fabsf_bitwise(f32 v)
Definition mtx.h:34
void HSD_MtxInverseConcat(Mtx inv, Mtx src, Mtx dest)
Definition mtx.c:63