Fixed indentation, tidied up the code so the if... statement is flipped around, and added <float.h> to c3d/maths.h.
This commit is contained in:
parent
ef913eb9a4
commit
6e2c97c43f
@ -2,6 +2,7 @@
|
||||
#include "types.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
// See http://tauday.com/tau-manifesto
|
||||
//#define M_TAU 6.28318530717958647693
|
||||
|
@ -34,7 +34,8 @@ bool Mtx_Inverse(C3D_Mtx* out)
|
||||
out->m[12] * out->m[6] * out->m[9];
|
||||
|
||||
det = out->m[0] * inv[0] + out->m[1] * inv[4] + out->m[2] * inv[8] + out->m[3] * inv[12];
|
||||
if (det != 0.0f){
|
||||
if (fabsf(det) < FLT_EPSILON)
|
||||
return false;
|
||||
|
||||
inv[1] = -out->m[1] * out->m[10] * out->m[15] +
|
||||
out->m[1] * out->m[11] * out->m[14] +
|
||||
@ -121,13 +122,7 @@ bool Mtx_Inverse(C3D_Mtx* out)
|
||||
out->m[8] * out->m[2] * out->m[5];
|
||||
|
||||
det = 1.0 / det;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
out->m[i] = inv[i] * det;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user