From 52e163c30e6506d940ff2bcadc5ce01dee81f1dc Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 17 Sep 2011 04:52:44 +0200 Subject: added mMtx class and a few methods to m3d::mdl_c --- include/g3dhax.h | 3 +++ include/game.h | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/g3dhax.h b/include/g3dhax.h index ac5ba80..d816a24 100644 --- a/include/g3dhax.h +++ b/include/g3dhax.h @@ -202,6 +202,9 @@ namespace m3d { void sub_80064BF0(); void setDrawMatrix(const Mtx matrix); + void setScale(float x, float y, float z); + void setScale(Vec *scale); + void calcWorld(bool unk); char data[0x3C]; }; diff --git a/include/game.h b/include/game.h index 7382c34..93d8ae1 100755 --- a/include/game.h +++ b/include/game.h @@ -77,7 +77,6 @@ bool IsWideScreen(); #define GAMEMGR_GET_AFC(gmgr) (*((bool*)(((u32)(gmgr))+0xAFC))) - #define COND_COIN1 1 #define COND_COIN2 2 #define COND_COIN3 4 @@ -331,6 +330,48 @@ public: }; + +class mMtx { + Mtx data; + + public: + mMtx(float _00, float _01, float _02, float _03, + float _10, float _11, float _12, float _13, + float _20, float _21, float _22, float _23); + + float* operator[](int row) { return data[row]; } + + operator MtxPtr() const { return (MtxPtr)this; } + + /* Create New Ones */ + void identity(); + + void translation(float x, float y, float z) { MTXTrans(data, x, y, z); } + void scale(float x, float y, float z) { MTXScale(data, x, y, z); } + + void rotationX(s16 *amount); + void rotationY(s16 *amount); + void rotationZ(s16 *amount); + + /* Applied Manipulations */ + void applyTranslation(float x, float y, float z) { MTXTransApply(data, data, x, y, z); } + void applyScale(float x, float y, float z) { MTXScaleApply(data, data, x, y, z); } + + void applyRotationX(s16 *amount); + void applyRotationY(s16 *amount); + void applyRotationZ(s16 *amount); + + void applyRotationYXZ(s16 *x, s16 *y, s16 *z); + void applyRotationZYX(s16 *x, s16 *y, s16 *z); + + /* Get Stuff */ + void getTranslation(Vec *target); + + void getUnknown(S16Vec *target); +}; + + + namespace nw4r { namespace ut { @@ -1271,7 +1312,7 @@ public: class dActor_c : public dBase_c { public: LinkListEntry link_actor; - Mtx matrix; + mMtx matrix; Vec pos; Vec last_pos; Vec pos_delta; -- cgit v1.2.3