Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
mtx.h
Go to the documentation of this file.
1#ifndef MTX_H
2#define MTX_H
3
4#include "dolphin/mtx/mtx44.h"
5#include "dolphin/mtx/quat.h"
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11// ====== MATRIX ====== //
12
13#define MTXDegToRad(a) ((a)*0.01745329252f)
14
15typedef f32 Mtx[3][4];
16typedef f32 Mtx33[3][3];
17typedef f32 Mtx23[2][3];
18typedef f32 (*MtxP)[4];
19typedef f32 (*Mtx3P)[3];
20typedef const f32 (*CMtxP)[4]; // Change name later?
21
23void PSMTXCopy(const Mtx src, Mtx dst);
24void PSMTXConcat(const Mtx a, const Mtx b, Mtx ab);
26void PSMTXRotRad(Mtx m, char axis, f32 rad);
28void PSMTXRotAxisRad(Mtx m, const Vec* axis, f32 rad);
30void PSMTXTransApply(const Mtx src, Mtx dst, f32 x, f32 y, f32 z);
32void PSMTXScaleApply(const Mtx src, Mtx dst, f32 x, f32 y, f32 z);
34
35void C_MTXLookAt(Mtx m, const Vec* camPos, const Vec* camUp, const Vec* target);
37 f32 trans_t);
40
41inline void C_MTXRotAxisRad(Mtx m, const Vec* axis, f32 rad) {
43}
44
45/* When compiling in debug mode, use C implementations */
46#ifdef DEBUG
47// TODO: Add debug rom C implementations
48/* #define MTXIdentity C_MTXIdentity
49#define MTXCopy C_MTXCopy
50#define MTXConcat C_MTXConcat
51#define MTXInverse C_MTXInverse
52#define MTXRotRad C_MTXRotRad
53#define MTXRotTrig C_MTXRotTrig
54#define MTXRotAxisRad C_MTXRotAxisRad
55#define MTXTrans C_MTXTrans
56#define MTXTransApply C_MTXTransApply
57#define MTXScale C_MTXScale
58#define MTXScaleApply C_MTXScaleApply
59#define MTXQuat C_MTXQuat */
60
61#define MTXIdentity PSMTXIdentity
62#define MTXCopy PSMTXCopy
63#define MTXConcat PSMTXConcat
64#define MTXInverse PSMTXInverse
65#define MTXRotRad PSMTXRotRad
66#define MTXRotTrig PSMTXRotTrig
67#define MTXRotAxisRad PSMTXRotAxisRad
68#define MTXTrans PSMTXTrans
69#define MTXTransApply PSMTXTransApply
70#define MTXScale PSMTXScale
71#define MTXScaleApply PSMTXScaleApply
72#define MTXQuat PSMTXQuat
73#else
74#define MTXIdentity PSMTXIdentity
75#define MTXCopy PSMTXCopy
76#define MTXConcat PSMTXConcat
77#define MTXInverse PSMTXInverse
78#define MTXRotRad PSMTXRotRad
79#define MTXRotTrig PSMTXRotTrig
80#define MTXRotAxisRad PSMTXRotAxisRad
81#define MTXTrans PSMTXTrans
82#define MTXTransApply PSMTXTransApply
83#define MTXScale PSMTXScale
84#define MTXScaleApply PSMTXScaleApply
85#define MTXQuat PSMTXQuat
86#endif
87
88// ====== MATRIX VECTOR ====== //
89
90void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dst);
91void PSMTXMultVecSR(const Mtx m, const Vec* src, Vec* dst);
92void PSMTXMultVecArray(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
93void PSMTXMultVecArraySR(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
94
95/* When compiling in debug mode, use C implementations */
96#ifdef DEBUG
97// TODO: Add debug rom C implementations
98/* #define MTXMultVec C_MTXMultVec
99#define MTXMultVecSR C_MTXMultVecSR
100#define MTXMultVecArray C_MTXMultVecArray
101#define MTXMultVecArraySR C_MTXMultVecArraySR */
102
103#define MTXMultVec PSMTXMultVec
104#define MTXMultVecSR PSMTXMultVecSR
105#define MTXMultVecArray PSMTXMultVecArray
106#define MTXMultVecArraySR PSMTXMultVecArraySR
107#else
108#define MTXMultVec PSMTXMultVec
109#define MTXMultVecSR PSMTXMultVecSR
110#define MTXMultVecArray PSMTXMultVecArray
111#define MTXMultVecArraySR PSMTXMultVecArraySR
112#endif
113
114#ifdef __cplusplus
115};
116#endif
117
118#endif /* MTX_H */
T cLib_calcTimer(T *value)
Definition c_lib.h:74
void PSMTXInverse()
void PSMTXQuat()
void PSMTXTrans()
void PSMTXMultVec()
void PSMTXConcat()
void PSMTXCopy()
static void * target
Definition d_a_npc_cd2.cpp:1908
q
Definition e_acos.c:99
double x double x
Definition e_atan2.c:58
int m
Definition e_atan2.c:62
double x double y
Definition e_atan2.c:58
z
Definition e_pow.c:390
a
Definition k_cos.c:89
double cos(double)
double sin(double)
const f32(* CMtxP)[4]
Definition mtx.h:20
void C_MTXRotAxisRad(Mtx m, const Vec *axis, f32 rad)
Definition mtx.h:41
f32 Mtx33[3][3]
Definition mtx.h:16
void PSMTXScaleApply(const Mtx src, Mtx dst, f32 x, f32 y, f32 z)
void PSMTXTransApply(const Mtx src, Mtx dst, f32 x, f32 y, f32 z)
f32(* MtxP)[4]
Definition mtx.h:18
void PSMTXMultVecArray(const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count)
void PSMTXIdentity(Mtx m)
void PSMTXRotRad(Mtx m, char axis, f32 rad)
Definition mtx.c:232
void PSMTXScale(Mtx m, f32 x, f32 y, f32 z)
void C_MTXLightOrtho(Mtx m, f32 top, f32 bottom, f32 left, f32 right, f32 scale_s, f32 scale_t, f32 trans_s, f32 trans_t)
Definition mtx.c:598
void PSMTXRotAxisRad(Mtx m, const Vec *axis, f32 rad)
Definition mtx.c:366
void C_MTXLightPerspective(Mtx m, f32 fovY, f32 aspect, f32 scale_s, f32 scale_t, f32 trans_s, f32 trans_t)
Definition mtx.c:571
void PSMTXMultVecArraySR(const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count)
f32 Mtx23[2][3]
Definition mtx.h:17
void PSMTXRotTrig(Mtx m, char axis, f32 sin, f32 cos)
f32(* Mtx3P)[3]
Definition mtx.h:19
void C_MTXLookAt(Mtx m, const Vec *camPos, const Vec *camUp, const Vec *target)
Definition mtx.c:523
f32 Mtx[3][4]
Definition mtx.h:15
void PSMTXMultVecSR(const Mtx m, const Vec *src, Vec *dst)
f32 PSQuaternion[4]
Definition quat.h:14
Definition d_a_hozelda.cpp:18
unsigned long u32
Definition types.h:10
float f32
Definition types.h:22