Commit 6766f9c1 authored by Gerald Pfeifer's avatar Gerald Pfeifer Committed by Alexandre Julliard

d3dx8: Simplify D3DXMatrixInverse().

parent 3ed963dc
......@@ -114,7 +114,7 @@ D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONS
{
int a, i, j;
D3DXVECTOR4 v, vec[3];
FLOAT cofactor, det;
FLOAT det;
det = D3DXMatrixfDeterminant(pm);
if ( !det ) return NULL;
......@@ -134,17 +134,10 @@ D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONS
}
}
D3DXVec4Cross(&v, &vec[0], &vec[1], &vec[2]);
for (j=0; j<4; j++)
{
switch(j)
{
case 0: cofactor = v.x; break;
case 1: cofactor = v.y; break;
case 2: cofactor = v.z; break;
case 3: cofactor = v.w; break;
}
pout->u.m[j][i] = pow(-1.0f, i) * cofactor / det;
}
pout->u.m[0][i] = pow(-1.0f, i) * v.x / det;
pout->u.m[1][i] = pow(-1.0f, i) * v.y / det;
pout->u.m[2][i] = pow(-1.0f, i) * v.z / det;
pout->u.m[3][i] = pow(-1.0f, i) * v.w / det;
}
return pout;
}
......
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