Commit ce4453fb authored by hybrid's avatar hybrid

More matrix enhancements.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1019 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f7eb2e9a
...@@ -276,7 +276,7 @@ namespace core ...@@ -276,7 +276,7 @@ namespace core
private: private:
//! Matrix data, stored in row-major order //! Matrix data, stored in row-major order
T M[16]; T M[16];
bool definitelyIdentityMatrix; mutable bool definitelyIdentityMatrix;
}; };
template <class T> template <class T>
...@@ -766,6 +766,7 @@ namespace core ...@@ -766,6 +766,7 @@ namespace core
if (!iszero((*this)(i,j))) if (!iszero((*this)(i,j)))
return false; return false;
definitelyIdentityMatrix=true;
return true; return true;
} }
...@@ -799,6 +800,7 @@ namespace core ...@@ -799,6 +800,7 @@ namespace core
if(IR(M[13])!=0) return false; if(IR(M[13])!=0) return false;
if(IR(M[13])!=0) return false; if(IR(M[13])!=0) return false;
if(IR(M[15])!=F32_VALUE_1) return false; if(IR(M[15])!=F32_VALUE_1) return false;
definitelyIdentityMatrix=true;
return true; return true;
} }
...@@ -1100,6 +1102,9 @@ namespace core ...@@ -1100,6 +1102,9 @@ namespace core
template <class T> template <class T>
inline bool CMatrix4<T>::makeInverse() inline bool CMatrix4<T>::makeInverse()
{ {
if (definitelyIdentityMatrix)
return true;
CMatrix4<T> temp ( EM4CONST_NOTHING ); CMatrix4<T> temp ( EM4CONST_NOTHING );
if (getInverse(temp)) if (getInverse(temp))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment