added quat.from_euler lua function

This commit is contained in:
RomanDonw 2026-03-04 15:58:45 +10:00
parent 4f42d30f91
commit 6644c505f0

View file

@ -44,8 +44,18 @@ static int l_tostring(lua::State* L) {
return lua::pushstring(L, ss.str());
}
static int l_from_euler(lua::State *L)
{
uint argc = lua::check_argc(L, 1, 2);
glm::vec3 euler = lua::tovec3(L, 1);
if (argc == 1) return lua::pushquat(L, glm::quat(euler));
return lua::setquat(L, 2, glm::quat(euler));
}
const luaL_Reg quatlib[] = {
{"from_mat4", lua::wrap<l_from_mat4>},
{"from_euler", lua::wrap<l_from_euler>},
{"slerp", lua::wrap<l_slerp>},
{"tostring", lua::wrap<l_tostring>},
{nullptr, nullptr}