diff --git a/stepmania/src/RageMath.cpp b/stepmania/src/RageMath.cpp index b6bb6f239b..988b7f7d4c 100644 --- a/stepmania/src/RageMath.cpp +++ b/stepmania/src/RageMath.cpp @@ -40,6 +40,23 @@ void RageVec3TransformCoord( RageVector3* pOut, const RageVector3* pV, const Rag *pOut = RageVector3( temp.x/temp.w, temp.y/temp.w, temp.z/temp.w ); } +#define m00 m[0][0] +#define m01 m[0][1] +#define m02 m[0][2] +#define m03 m[0][3] +#define m10 m[1][0] +#define m11 m[1][1] +#define m12 m[1][2] +#define m13 m[1][3] +#define m20 m[2][0] +#define m21 m[2][1] +#define m22 m[2][2] +#define m23 m[2][3] +#define m30 m[3][0] +#define m31 m[3][1] +#define m32 m[3][2] +#define m33 m[3][3] + void RageVec4TransformCoord( RageVector4* pOut, const RageVector4* pV, const RageMatrix* pM ) { const RageMatrix &a = *pM; @@ -51,6 +68,17 @@ void RageVec4TransformCoord( RageVector4* pOut, const RageVector4* pV, const Rag a.m03*v.x+a.m13*v.y+a.m23*v.z+a.m33*v.w ); } +RageMatrix::RageMatrix( float v00, float v01, float v02, float v03, + float v10, float v11, float v12, float v13, + float v20, float v21, float v22, float v23, + float v30, float v31, float v32, float v33 ) +{ + m00=v00; m01=v01; m02=v02; m03=v03; + m10=v10; m11=v11; m12=v12; m13=v13; + m20=v20; m21=v21; m22=v22; m23=v23; + m30=v30; m31=v31; m32=v32; m33=v33; +} + void RageMatrixIdentity( RageMatrix* pOut ) { *pOut = RageMatrix( @@ -60,6 +88,11 @@ void RageMatrixIdentity( RageMatrix* pOut ) 0,0,0,1 ); } +RageMatrix RageMatrix::GetTranspose() const +{ + return RageMatrix(m00,m10,m20,m30,m01,m11,m21,m31,m02,m12,m22,m32,m03,m13,m23,m33); +} + void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatrix* pB ) { const RageMatrix &a = *pA; diff --git a/stepmania/src/RageTypes.h b/stepmania/src/RageTypes.h index c792ce9e9f..cb5d4da2f3 100644 --- a/stepmania/src/RageTypes.h +++ b/stepmania/src/RageTypes.h @@ -202,13 +202,7 @@ public: RageMatrix( float v00, float v01, float v02, float v03, float v10, float v11, float v12, float v13, float v20, float v21, float v22, float v23, - float v30, float v31, float v32, float v33 ) - { - m00=v00; m01=v01; m02=v02; m03=v03; - m10=v10; m11=v11; m12=v12; m13=v13; - m20=v20; m21=v21; m22=v22; m23=v23; - m30=v30; m31=v31; m32=v32; m33=v33; - } + float v30, float v31, float v32, float v33 ); // access grants float& operator () ( int iRow, int iCol ) { return m[iCol][iRow]; } @@ -218,7 +212,7 @@ public: operator float* () { return m[0]; } operator const float* () const { return m[0]; } - RageMatrix GetTranspose() const { return RageMatrix(m00,m10,m20,m30,m01,m11,m21,m31,m02,m12,m22,m32,m03,m13,m23,m33); } + RageMatrix GetTranspose() const; // ---These are not used. Maybe I'll implement them later...--- // // assignment operators @@ -244,17 +238,7 @@ public: // bool operator == ( const RageMatrix& ) const; // bool operator != ( const RageMatrix& ) const; - union - { - float m[4][4]; - struct - { - float m00, m01, m02, m03; - float m10, m11, m12, m13; - float m20, m21, m22, m23; - float m30, m31, m32, m33; - }; - }; + float m[4][4]; }; #if defined(_MSC_VER)