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
11#define VEC2_SQ_LEN(v) ((SQ((v).x) + SQ((v).y)))
12#define VEC3_SQ_LEN(v) ((SQ((v).x) + SQ((v).y) + SQ((v).z)))
13
14typedef Vec3 VecMtx[4];
15typedef Vec3* VecMtxPtr;
16
17void HSD_MtxInverse(Mtx src, Mtx dest);
18void HSD_MtxInverseConcat(Mtx inv, Mtx src, Mtx dest);
19void HSD_MtxInverseTranspose(Mtx src, Mtx dest);
20void HSD_MtxGetRotation(Mtx m, Vec3* vec);
21void HSD_MtxGetTranslate(Mtx mat, Vec3* vec);
22void HSD_MtxGetScale(Mtx arg0, Vec3* arg1);
23void HSD_MkRotationMtx(Mtx arg0, Vec3* arg1);
24void HSD_MtxQuat(Mtx arg0, Quaternion* arg1);
25void HSD_MtxSRT(Mtx m, Vec3* vec1, Vec3* vec2, Vec3* vec3, Vec3* vec4);
26void HSD_MtxSRTQuat(Mtx arg0, Vec3* arg1, Quaternion* arg2, Vec3* arg3,
27 Vec3* arg4);
28void HSD_MtxScaledAdd(Mtx arg0, Mtx arg1, Mtx arg2, f32 arg3);
29void* HSD_VecAlloc(void);
30void HSD_VecFree(void* arg0);
31void* HSD_MtxAlloc(void);
32void HSD_MtxFree(void* arg0);
34void HSD_VecInitAllocData(void);
36void HSD_MtxInitAllocData(void);
37
38static inline f32 fabsf_bitwise(f32 v)
39{
40 *(u32*) &v &= ~0x80000000;
41 return v;
42}
43
44static inline void HSD_MtxColVec(MtxPtr mtx, int col, Vec3* vec)
45{
46 vec->x = mtx[0][col];
47 vec->y = mtx[1][col];
48 vec->z = mtx[2][col];
49}
50
51static inline void HSD_MtxSetColVec(MtxPtr mtx, int col, Vec3* vec)
52{
53 mtx[0][col] = vec->x;
54 mtx[1][col] = vec->y;
55 mtx[2][col] = vec->z;
56}
57
58static inline f32 HSD_MtxColMag(MtxPtr mtx, int col)
59{
60 return sqrtf__Ff((mtx[0][col] * mtx[0][col]) +
61 (mtx[1][col] * mtx[1][col]) +
62 (mtx[2][col] * mtx[2][col]));
63}
64
65#endif
Mtx mtx
Definition ftparts.static.h:5
static GXColor col
Definition gm_18A5.c:1196
float sqrtf__Ff(float)
void * HSD_MtxAlloc(void)
Definition mtx.c:479
void HSD_MtxInverse(Mtx src, Mtx dest)
Definition mtx.c:23
void HSD_MtxGetScale(Mtx arg0, Vec3 *arg1)
Definition mtx.c:278
void HSD_MtxGetTranslate(Mtx mat, Vec3 *vec)
These parameters may not be right.
Definition mtx.c:271
Vec3 * VecMtxPtr
Definition mtx.h:15
void HSD_VecInitAllocData(void)
Definition mtx.c:502
void HSD_MtxInitAllocData(void)
Definition mtx.c:512
static f32 HSD_MtxColMag(MtxPtr mtx, int col)
Definition mtx.h:58
void HSD_MtxScaledAdd(Mtx arg0, Mtx arg1, Mtx arg2, f32 arg3)
might be a fakematch?
Definition mtx.c:439
void * HSD_VecAlloc(void)
Definition mtx.c:461
void HSD_MtxSRT(Mtx m, Vec3 *vec1, Vec3 *vec2, Vec3 *vec3, Vec3 *vec4)
Definition mtx.c:364
void HSD_MtxSRTQuat(Mtx arg0, Vec3 *arg1, Quaternion *arg2, Vec3 *arg3, Vec3 *arg4)
Definition mtx.c:414
void HSD_MtxFree(void *arg0)
Definition mtx.c:490
void HSD_MtxGetRotation(Mtx m, Vec3 *vec)
Definition mtx.c:220
void HSD_MtxInverseTranspose(Mtx src, Mtx dest)
Definition mtx.c:161
HSD_ObjAllocData * HSD_MtxGetAllocData(void)
Definition mtx.c:507
static void HSD_MtxSetColVec(MtxPtr mtx, int col, Vec3 *vec)
Definition mtx.h:51
HSD_ObjAllocData * HSD_VecGetAllocData(void)
Definition mtx.c:497
void HSD_MtxQuat(Mtx arg0, Quaternion *arg1)
Definition mtx.c:359
void HSD_MkRotationMtx(Mtx arg0, Vec3 *arg1)
Definition mtx.c:325
Vec3 VecMtx[4]
Definition mtx.h:14
void HSD_VecFree(void *arg0)
Definition mtx.c:472
static void HSD_MtxColVec(MtxPtr mtx, int col, Vec3 *vec)
Definition mtx.h:44
static f32 fabsf_bitwise(f32 v)
Definition mtx.h:38
void HSD_MtxInverseConcat(Mtx inv, Mtx src, Mtx dest)
https://decomp.me/scratch/kalJY
Definition mtx.c:62
Definition objalloc.h:21