mirror of https://github.com/bjornbytes/lovr.git
Use better default for identity quat;
This commit is contained in:
parent
9e42fe295a
commit
f8f6d98df4
|
@ -44,7 +44,7 @@ static int l_lovrQuatUnpack(lua_State* L) {
|
||||||
int l_lovrQuatSet(lua_State* L) {
|
int l_lovrQuatSet(lua_State* L) {
|
||||||
quat q = luax_checkmathtype(L, 1, MATH_QUAT, NULL);
|
quat q = luax_checkmathtype(L, 1, MATH_QUAT, NULL);
|
||||||
if (lua_isnoneornil(L, 2)) {
|
if (lua_isnoneornil(L, 2)) {
|
||||||
quat_set(q, 0.f, 0.f, 0.f, 0.f);
|
quat_set(q, 0.f, 0.f, 0.f, 1.f);
|
||||||
} else if (lua_type(L, 2) == LUA_TNUMBER) {
|
} else if (lua_type(L, 2) == LUA_TNUMBER) {
|
||||||
float x = lua_tonumber(L, 2);
|
float x = lua_tonumber(L, 2);
|
||||||
if (lua_type(L, 3) == LUA_TNUMBER) {
|
if (lua_type(L, 3) == LUA_TNUMBER) {
|
||||||
|
|
|
@ -284,7 +284,10 @@ local quat = {
|
||||||
|
|
||||||
set = function(q, x, y, z, w, raw)
|
set = function(q, x, y, z, w, raw)
|
||||||
checkquat(q)
|
checkquat(q)
|
||||||
if type(x) == 'number' then
|
if x == nil then
|
||||||
|
q.x, q.y, q.z = 0, 0, 0
|
||||||
|
q.w = 1
|
||||||
|
elseif type(x) == 'number' then
|
||||||
if type(y) == 'number' then
|
if type(y) == 'number' then
|
||||||
if raw then
|
if raw then
|
||||||
q.x, q.y, q.z, q.w = x, y, z, w
|
q.x, q.y, q.z, q.w = x, y, z, w
|
||||||
|
|
Loading…
Reference in New Issue