From: <axl...@us...> - 2010-05-03 03:10:31
|
Revision: 719 http://hgengine.svn.sourceforge.net/hgengine/?rev=719&view=rev Author: axlecrusher Date: 2010-05-03 02:22:28 +0000 (Mon, 03 May 2010) Log Message: ----------- Take advantage of the source and destination matrices being able to be the same address. Modified Paths: -------------- Mercury2/src/MercuryMatrix.cpp Mercury2/src/MercuryMatrix.h Modified: Mercury2/src/MercuryMatrix.cpp =================================================================== --- Mercury2/src/MercuryMatrix.cpp 2010-05-03 02:11:54 UTC (rev 718) +++ Mercury2/src/MercuryMatrix.cpp 2010-05-03 02:22:28 UTC (rev 719) @@ -129,10 +129,12 @@ void MercuryMatrix::Translate(float x, float y, float z) { MercuryMatrix m; + m[0][3] = x; m[1][3] = y; m[2][3] = z; - *this *= m; + + MatrixMultiply4f(m_matrix,m.m_matrix,m_matrix); } void MercuryMatrix::RotateXYZ(float x, float y, float z) @@ -172,7 +174,7 @@ matrix[2][3] = 0; matrix[3][3] = 1; - *this *= matrix; + MatrixMultiply4f(m_matrix,matrix.m_matrix,m_matrix); } void MercuryMatrix::RotateAngAxis( float fAngle, float ix, float iy, float iz ) @@ -249,7 +251,7 @@ matrix[2][3] = tZ; matrix[3][3] = 1; - *this *= matrix; + MatrixMultiply4f(m_matrix,matrix.m_matrix,m_matrix); } @@ -271,12 +273,6 @@ return r; } -MercuryMatrix& MercuryMatrix::operator*=(const MercuryMatrix& m) -{ - MatrixMultiply4f ( m_matrix, m.m_matrix, m_matrix); - return *this; -} - void MercuryMatrix::Print() const { for (int i = 0; i < 4; ++i) Modified: Mercury2/src/MercuryMatrix.h =================================================================== --- Mercury2/src/MercuryMatrix.h 2010-05-03 02:11:54 UTC (rev 718) +++ Mercury2/src/MercuryMatrix.h 2010-05-03 02:22:28 UTC (rev 719) @@ -52,8 +52,10 @@ inline const float* Ptr() const { return (const float*)m_matrix; } MercuryMatrix operator*(const MercuryMatrix& m) const; - MercuryMatrix& operator*=(const MercuryMatrix& m); + inline MercuryMatrix& operator*=(const MercuryMatrix& m) + { MatrixMultiply4f ( m_matrix, m.m_matrix, m_matrix); return *this; } + MercuryVector operator*(const MercuryVertex& v) const; void Translate(float x, float y, float z); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |