From fc81e8d7ccf8d155045e19de13a461a45a9b600e Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 12 Nov 2020 11:17:50 -0500 Subject: add math.h header, and fix one regswap in func_801DEA3C --- include/SDK/mtx.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) (limited to 'include/SDK') diff --git a/include/SDK/mtx.h b/include/SDK/mtx.h index 07840fc..9bff30f 100644 --- a/include/SDK/mtx.h +++ b/include/SDK/mtx.h @@ -8,8 +8,65 @@ extern "C" { typedef float Mtx[3][4]; typedef float Mtx44[4][4]; -typedef float (*MtxPtr)[4]; -#define MTX_PTR_OFFSET 3 +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); +#define MTXTranspose PSMTXTranspose + +void PSMTXCopy(const Mtx src, Mtx dest); +#define MTXCopy PSMTXCopy + +void C_MTXLookAt(Mtx m, const Point3d* camPos, const Vec* camUp, const Point3d* target); +#define MTXLookAt C_MTXLookAt + +void PSVECAdd(const Vec* a, const Vec* b, Vec* ab); +#define VECAdd PSVECAdd + +void PSMTXMultVecSR(const Mtx m, const Vec* src, Vec* dest); +#define MTXMultVecSR PSMTXMultVecSR + +void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dest); +#define MTXMultVec PSMTXMultVec + +u32 PSMTXInverse(const Mtx src, Mtx inv); +#define MTXInverse PSMTXInverse + +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 MTXConcat PSMTXConcat +void PSMTXConcat(const Mtx a, const Mtx b, Mtx ab); + +#define MTXQuat PSMTXQuat +void PSMTXQuat(Mtx m, const Quaternion* q); + +#define QUATRotAxisRad C_QUATRotAxisRad +void C_QUATRotAxisRad(Quaternion* r, const Vec* axis, float rad); + +void PSMTXScale(Mtx m, float xS, float yS, float zS); + + + +#define VECSubtract PSVECSubtract +#define VECCrossProduct PSVECCrossProduct +#define VECNormalize PSVECNormalize #define MTXIdentity PSMTXIdentity -- cgit v1.2.3