summaryrefslogtreecommitdiff
path: root/include/SDK/mtx.h
blob: 2a0845e14ca8b67ed0424528536e67a492d99bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef POKEREVO_MTX_H
#define POKEREVO_MTX_H

#ifdef __cplusplus
extern "C" {
#endif

typedef float Mtx[3][4];
typedef float Mtx44[4][4];

typedef struct
{
    float x;
    float y;
    float z;
} Vec, Point3d;

typedef struct Quaternion
{
    float x;
    float y;
    float z;
    float w;
} Quaternion;

void PSMTXTranspose(const Mtx src, Mtx xPose);
void PSMTXCopy(const Mtx src, Mtx dest);
void C_MTXLookAt(Mtx m, const Point3d* camPos, const Vec* camUp, const Point3d* target);
void PSMTXMultVecSR(const Mtx m, const Vec* src, Vec* dest);
void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dest);
u32 PSMTXInverse(const Mtx src, Mtx inv);
void PSMTXConcat(const Mtx a, const Mtx b, Mtx ab);
void PSMTXQuat(Mtx m, const Quaternion* q);
void C_QUATRotAxisRad(Quaternion* r, const Vec* axis, float rad);
void PSMTXScale(Mtx m, float xS, float yS, float zS);
void PSMTXIdentity(Mtx m);
void PSVECAdd(const Vec* a, const Vec* b, Vec* ab);
void PSVECCrossProduct(const Vec* a, const Vec* b, Vec* axb);
void PSVECNormalize(const Vec* src, Vec* unit);
void PSVECSubtract(const Vec* a, const Vec* b, Vec* a_b);

#define MTXTranspose PSMTXTranspose
#define MTXCopy PSMTXCopy
#define MTXLookAt C_MTXLookAt
#define VECAdd PSVECAdd
#define MTXMultVecSR PSMTXMultVecSR
#define MTXMultVec PSMTXMultVec
#define MTXInverse PSMTXInverse
#define MTXConcat PSMTXConcat  
#define MTXQuat PSMTXQuat
#define QUATRotAxisRad C_QUATRotAxisRad
#define VECSubtract PSVECSubtract
#define VECCrossProduct PSVECCrossProduct
#define VECNormalize PSVECNormalize
#define MTXIdentity PSMTXIdentity
#define MTXScale PSMTXScale
#define MTXCopy PSMTXCopy

#ifdef __cplusplus
}
#endif

#endif //POKEREVO_MTX_H