Fix zero scale;

This commit is contained in:
bjorn 2017-06-20 22:56:11 -07:00
parent dfd6c91dec
commit 3744706ade
1 changed files with 5 additions and 1 deletions

View File

@ -210,7 +210,11 @@ void lovrShaderBind(Shader* shader, mat4 transform, mat4 projection, unsigned in
mat4_set(normalMatrix, transform);
normalMatrix[12] = normalMatrix[13] = normalMatrix[14] = 0;
normalMatrix[15] = 1;
mat4_transpose(mat4_invert(normalMatrix));
if (mat4_invert(normalMatrix)) {
mat4_transpose(normalMatrix);
} else {
mat4_identity(normalMatrix);
}
float normalMatrix3x3[9] = {
normalMatrix[0], normalMatrix[1], normalMatrix[2],
normalMatrix[4], normalMatrix[5], normalMatrix[6],