mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
added quat.from_euler lua function
This commit is contained in:
parent
4f42d30f91
commit
6644c505f0
1 changed files with 10 additions and 0 deletions
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue