mirror of https://github.com/PrimeDecomp/prime.git
146 lines
5.2 KiB
C
146 lines
5.2 KiB
C
#ifndef _DOLPHIN_MTX
|
|
#define _DOLPHIN_MTX
|
|
|
|
#include <dolphin/types.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef f32 Mtx[3][4];
|
|
typedef f32 (*MtxPtr)[4];
|
|
typedef f32 ROMtx[4][3];
|
|
typedef f32 (*ROMtxPtr)[3];
|
|
typedef f32 Mtx44[4][4];
|
|
typedef f32 (*Mtx44Ptr)[4];
|
|
|
|
typedef struct {
|
|
f32 x, y, z;
|
|
} Vec, *VecPtr;
|
|
|
|
typedef struct {
|
|
s16 x, y, z;
|
|
} S16Vec, *S16VecPtr;
|
|
|
|
typedef struct {
|
|
f32 x, y, z, w;
|
|
} Quaternion, *QuaternionPtr;
|
|
|
|
void C_MTXIdentity(Mtx m);
|
|
void C_MTXCopy(const Mtx src, Mtx dst);
|
|
void C_MTXConcat(const Mtx a, const Mtx b, Mtx ab);
|
|
void C_MTXConcatArray(const Mtx a, const Mtx* srcBase, Mtx* dstBase, u32 count);
|
|
void C_MTXTranspose(const Mtx src, Mtx xPose);
|
|
u32 C_MTXInverse(const Mtx src, Mtx inv);
|
|
u32 C_MTXInvXpose(const Mtx src, Mtx invX);
|
|
void C_MTXMultVec(const Mtx m, const Vec* src, Vec* dst);
|
|
void C_MTXMultVecArray(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
|
|
void C_MTXMultVecSR(const Mtx m, const Vec* src, Vec* dst);
|
|
void C_MTXMultVecArraySR(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
|
|
void C_MTXQuat(Mtx m, const Quaternion* q);
|
|
void C_MTXReflect(Mtx m, const Vec* p, const Vec* n);
|
|
void C_MTXTrans(Mtx m, f32 xT, f32 yT, f32 zT);
|
|
void C_MTXTransApply(const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT);
|
|
void C_MTXScale(Mtx m, f32 xS, f32 yS, f32 zS);
|
|
void C_MTXScaleApply(const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS);
|
|
void C_MTXRotRad(Mtx m, char axis, f32 rad);
|
|
void C_MTXRotTrig(Mtx m, char axis, f32 sinA, f32 cosA);
|
|
void C_MTXRotAxisRad(Mtx m, const Vec* axis, f32 rad);
|
|
void C_MTXLookAt(Mtx m, const Vec* camPos, const Vec* camUp, const Vec* target);
|
|
void C_MTXFrustum(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f);
|
|
void C_MTXPerspective(Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f);
|
|
void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f);
|
|
void C_MTXLightFrustum(Mtx m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 scaleS, f32 scaleT, f32 transS,
|
|
f32 transT);
|
|
|
|
void C_MTXLightPerspective(Mtx m, f32 fovY, f32 aspect, f32 scaleS, f32 scaleT, f32 transS,
|
|
f32 transT);
|
|
|
|
void C_MTXLightOrtho(Mtx m, f32 t, f32 b, f32 l, f32 r, f32 scaleS, f32 scaleT, f32 transS,
|
|
f32 transT);
|
|
|
|
#ifdef __MWERKS__
|
|
void PSMTXIdentity(Mtx m);
|
|
void PSMTXCopy(const Mtx src, Mtx dst);
|
|
void PSMTXConcat(const Mtx a, const Mtx b, Mtx ab);
|
|
void PSMTXConcatArray(const Mtx a, const Mtx* srcBase, Mtx* dstBase, u32 count);
|
|
void PSMTXTranspose(const Mtx src, Mtx xPose);
|
|
u32 PSMTXInverse(const Mtx src, Mtx inv);
|
|
u32 PSMTXInvXpose(const Mtx src, Mtx invX);
|
|
void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dst);
|
|
void PSMTXMultVecArray(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
|
|
void PSMTXMultVecSR(const Mtx m, const Vec* src, Vec* dst);
|
|
void PSMTXMultVecArraySR(const Mtx m, const Vec* srcBase, Vec* dstBase, u32 count);
|
|
void PSMTXQuat(Mtx m, const Quaternion* q);
|
|
void PSMTXReflect(Mtx m, const Vec* p, const Vec* n);
|
|
void PSMTXTrans(Mtx m, f32 xT, f32 yT, f32 zT);
|
|
void PSMTXTransApply(const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT);
|
|
void PSMTXScale(Mtx m, f32 xS, f32 yS, f32 zS);
|
|
void PSMTXScaleApply(const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS);
|
|
void PSMTXRotRad(Mtx m, char axis, f32 rad);
|
|
void PSMTXRotTrig(Mtx m, char axis, f32 sinA, f32 cosA);
|
|
void PSMTXRotAxisRad(Mtx m, const Vec* axis, f32 rad);
|
|
#endif
|
|
|
|
#ifdef __MWERKS__
|
|
#define MTXIdentity PSMTXIdentity
|
|
#define MTXCopy PSMTXCopy
|
|
#define MTXConcat PSMTXConcat
|
|
#define MTXConcatArray PSMTXConcatArray
|
|
#define MTXTranspose PSMTXTranspose
|
|
#define MTXInverse PSMTXInverse
|
|
#define MTXInvXpose PSMTXInvXpose
|
|
#define MTXMultVec PSMTXMultVec
|
|
#define MTXMultVecArray PSMTXMultVecArray
|
|
#define MTXMultVecSR PSMTXMultVecSR
|
|
#define MTXMultVecArraySR PSMTXMultVecArraySR
|
|
#define MTXQuat PSMTXQuat
|
|
#define MTXReflect PSMTXReflect
|
|
#define MTXTrans PSMTXTrans
|
|
#define MTXTransApply PSMTXTransApply
|
|
#define MTXScale PSMTXScale
|
|
#define MTXScaleApply PSMTXScaleApply
|
|
#define MTXRotRad PSMTXRotRad
|
|
#define MTXRotTrig PSMTXRotTrig
|
|
#define MTXRotAxisRad PSMTXRotAxisRad
|
|
#define MTXRotDeg(m, axis, deg) PSMTXRotRad(m, axis, MTXDegToRad(deg))
|
|
#define MTXRotAxisDeg(m, axis, deg) PSMTXRotAxisRad(m, axis, MTXDegToRad(deg))
|
|
#else
|
|
#define MTXIdentity C_MTXIdentity
|
|
#define MTXCopy C_MTXCopy
|
|
#define MTXConcat C_MTXConcat
|
|
#define MTXConcatArray C_MTXConcatArray
|
|
#define MTXTranspose C_MTXTranspose
|
|
#define MTXInverse C_MTXInverse
|
|
#define MTXInvXpose C_MTXInvXpose
|
|
#define MTXMultVec C_MTXMultVec
|
|
#define MTXMultVecArray C_MTXMultVecArray
|
|
#define MTXMultVecSR C_MTXMultVecSR
|
|
#define MTXMultVecArraySR C_MTXMultVecArraySR
|
|
#define MTXQuat C_MTXQuat
|
|
#define MTXReflect C_MTXReflect
|
|
#define MTXTrans C_MTXTrans
|
|
#define MTXTransApply C_MTXTransApply
|
|
#define MTXScale C_MTXScale
|
|
#define MTXScaleApply C_MTXScaleApply
|
|
#define MTXRotRad C_MTXRotRad
|
|
#define MTXRotTrig C_MTXRotTrig
|
|
#define MTXRotAxisRad C_MTXRotAxisRad
|
|
#define MTXRotDeg(m, axis, deg) C_MTXRotRad(m, axis, MTXDegToRad(deg))
|
|
#define MTXRotAxisDeg(m, axis, deg) C_MTXRotAxisRad(m, axis, MTXDegToRad(deg))
|
|
#endif
|
|
|
|
#define MTXLookAt C_MTXLookAt
|
|
#define MTXFrustum C_MTXFrustum
|
|
#define MTXPerspective C_MTXPerspective
|
|
#define MTXOrtho C_MTXOrtho
|
|
#define MTXLightFrustum C_MTXLightFrustum
|
|
#define MTXLightPerspective C_MTXLightPerspective
|
|
#define MTXLightOrtho C_MTXLightOrtho
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // _DOLPHIN_MTX
|