fixing mat4 inverse again
This commit is contained in:
parent
84afc68e05
commit
e8bc38cec5
|
@ -5,7 +5,7 @@ gb single-file public domain libraries for C & C++
|
||||||
library | latest version | category | description
|
library | latest version | category | description
|
||||||
----------------|----------------|----------|-------------
|
----------------|----------------|----------|-------------
|
||||||
**gb.h** | 0.26d | misc | Helper library (Standard library _improvement_)
|
**gb.h** | 0.26d | misc | Helper library (Standard library _improvement_)
|
||||||
**gb_math.h** | 0.07c | math | Vector math library geared towards game development
|
**gb_math.h** | 0.07d | math | Vector math library geared towards game development
|
||||||
**gb_gl.h** | 0.05 | graphics | OpenGL Helper Library
|
**gb_gl.h** | 0.05 | graphics | OpenGL Helper Library
|
||||||
**gb_string.h** | 0.95a | strings | A better string library (this is built into gb.h too with custom allocator support!)
|
**gb_string.h** | 0.95a | strings | A better string library (this is built into gb.h too with custom allocator support!)
|
||||||
**gb_ini.h** | 0.93 | misc | Simple ini file loader library
|
**gb_ini.h** | 0.93 | misc | Simple ini file loader library
|
||||||
|
|
15
gb_math.h
15
gb_math.h
|
@ -3,6 +3,7 @@
|
||||||
use '#define GB_MATH_IMPLEMENTATION' before including to create the implementation in _ONE_ file
|
use '#define GB_MATH_IMPLEMENTATION' before including to create the implementation in _ONE_ file
|
||||||
|
|
||||||
Version History:
|
Version History:
|
||||||
|
0.07d - Fix mat4_inverse
|
||||||
0.07c - Add gb_random01
|
0.07c - Add gb_random01
|
||||||
0.07b - Fix mat4_inverse
|
0.07b - Fix mat4_inverse
|
||||||
0.07a - Fix Mat2
|
0.07a - Fix Mat2
|
||||||
|
@ -1565,9 +1566,9 @@ void gb_mat4_inverse(gbMat4 *out, gbMat4 *in) {
|
||||||
o[3][3] = +(m[0][0] * sf15 - m[0][1] * sf17 + m[0][2] * sf18);
|
o[3][3] = +(m[0][0] * sf15 - m[0][1] * sf17 + m[0][2] * sf18);
|
||||||
|
|
||||||
ood = 1.0f / (m[0][0] * o[0][0] +
|
ood = 1.0f / (m[0][0] * o[0][0] +
|
||||||
m[1][0] * o[1][0] +
|
m[0][1] * o[1][0] +
|
||||||
m[2][0] * o[2][0] +
|
m[0][2] * o[2][0] +
|
||||||
m[3][0] * o[3][0]);
|
m[0][3] * o[3][0]);
|
||||||
|
|
||||||
o[0][0] *= ood;
|
o[0][0] *= ood;
|
||||||
o[0][1] *= ood;
|
o[0][1] *= ood;
|
||||||
|
@ -1585,14 +1586,6 @@ void gb_mat4_inverse(gbMat4 *out, gbMat4 *in) {
|
||||||
o[3][1] *= ood;
|
o[3][1] *= ood;
|
||||||
o[3][2] *= ood;
|
o[3][2] *= ood;
|
||||||
o[3][3] *= ood;
|
o[3][3] *= ood;
|
||||||
|
|
||||||
/* Transpose */
|
|
||||||
tmp = o[1][0]; o[1][0] = o[0][1]; o[0][1] = tmp;
|
|
||||||
tmp = o[2][0]; o[2][0] = o[0][2]; o[0][2] = tmp;
|
|
||||||
tmp = o[3][0]; o[3][0] = o[0][3]; o[0][3] = tmp;
|
|
||||||
tmp = o[2][1]; o[2][1] = o[1][2]; o[1][2] = tmp;
|
|
||||||
tmp = o[3][1]; o[3][1] = o[1][3]; o[1][3] = tmp;
|
|
||||||
tmp = o[3][2]; o[3][2] = o[2][3]; o[2][3] = tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue