Commit f7eb2e9a authored by lukeph's avatar lukeph

added identity check on getInverse() in CMatrix4

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1018 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 2780743d
...@@ -765,6 +765,7 @@ namespace core ...@@ -765,6 +765,7 @@ namespace core
if (j != i) if (j != i)
if (!iszero((*this)(i,j))) if (!iszero((*this)(i,j)))
return false; return false;
return true; return true;
} }
...@@ -1025,6 +1026,12 @@ namespace core ...@@ -1025,6 +1026,12 @@ namespace core
/// The inverse is calculated using Cramers rule. /// The inverse is calculated using Cramers rule.
/// If no inverse exists then 'false' is returned. /// If no inverse exists then 'false' is returned.
if ( this->isIdentity() )
{
out=*this;
return true;
}
const CMatrix4<T> &m = *this; const CMatrix4<T> &m = *this;
f32 d = (m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0)) * (m(2, 2) * m(3, 3) - m(2, 3) * m(3, 2)) - f32 d = (m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0)) * (m(2, 2) * m(3, 3) - m(2, 3) * m(3, 2)) -
......
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