Mat4:set uses TRS order when scale is present;

This commit is contained in:
bjorn 2022-11-14 19:19:23 -08:00
parent c61d6b059b
commit d5ebb796b3
1 changed files with 11 additions and 6 deletions

View File

@ -1762,20 +1762,25 @@ int l_lovrMat4Set(lua_State* L) {
float az = luax_checkfloat(L, index++);
mat4_rotate(m, angle, ax, ay, az);
} else {
float sx, sy, sz;
if (vectorType == V_VEC3) {
m[0] = v[0];
m[5] = v[1];
m[10] = v[2];
sx = v[0];
sy = v[1];
sz = v[2];
index++;
} else if (lua_type(L, index) == LUA_TNUMBER) {
m[0] = luax_checkfloat(L, index++);
m[5] = luax_checkfloat(L, index++);
m[10] = luax_checkfloat(L, index++);
sx = luax_checkfloat(L, index++);
sy = luax_checkfloat(L, index++);
sz = luax_checkfloat(L, index++);
} else {
sx = sy = sz = 1.f;
}
float rotation[4];
luax_readquat(L, index, rotation, NULL);
mat4_rotateQuat(m, rotation);
mat4_scale(m, sx, sy, sz);
}
}
}