mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-21 18:09:46 +00:00
ObjParser and small libvecn refactor
This commit is contained in:
parent
7536ac2736
commit
859935f3b5
2 changed files with 90 additions and 93 deletions
|
|
@ -211,59 +211,36 @@ static int l_tostring(lua::State* L) {
|
|||
return lua::pushstring(L, ss.str());
|
||||
}
|
||||
|
||||
#define VECLIB_BASE(dimension) \
|
||||
{"add", lua::wrap<l_binop<dimension, std::plus>>}, \
|
||||
{"sub", lua::wrap<l_binop<dimension, std::minus>>}, \
|
||||
{"mul", lua::wrap<l_binop<dimension, std::multiplies>>}, \
|
||||
{"div", lua::wrap<l_binop<dimension, std::divides>>}, \
|
||||
{"distance", lua::wrap<l_distance<dimension>>}, \
|
||||
{"normalize", lua::wrap<l_unaryop<dimension, glm::normalize>>}, \
|
||||
{"length", lua::wrap<l_scalar_op<dimension, glm::length>>}, \
|
||||
{"tostring", lua::wrap<l_tostring<dimension>>}, \
|
||||
{"abs", lua::wrap<l_unaryop<dimension, glm::abs>>}, \
|
||||
{"round", lua::wrap<l_unaryop<dimension, glm::round>>}, \
|
||||
{"inverse", lua::wrap<l_inverse<dimension>>}, \
|
||||
{"pow", lua::wrap<l_pow<dimension>>}, \
|
||||
{"dot", lua::wrap<l_dot<dimension>>}, \
|
||||
{"mix", lua::wrap<l_mix<dimension>>},
|
||||
|
||||
const luaL_Reg vec2lib[] = {
|
||||
{"add", lua::wrap<l_binop<2, std::plus>>},
|
||||
{"sub", lua::wrap<l_binop<2, std::minus>>},
|
||||
{"mul", lua::wrap<l_binop<2, std::multiplies>>},
|
||||
{"div", lua::wrap<l_binop<2, std::divides>>},
|
||||
{"distance", lua::wrap<l_distance<2>>},
|
||||
{"normalize", lua::wrap<l_unaryop<2, glm::normalize>>},
|
||||
{"length", lua::wrap<l_scalar_op<2, glm::length>>},
|
||||
{"tostring", lua::wrap<l_tostring<2>>},
|
||||
{"abs", lua::wrap<l_unaryop<2, glm::abs>>},
|
||||
{"round", lua::wrap<l_unaryop<2, glm::round>>},
|
||||
{"inverse", lua::wrap<l_inverse<2>>},
|
||||
{"pow", lua::wrap<l_pow<2>>},
|
||||
{"dot", lua::wrap<l_dot<2>>},
|
||||
VECLIB_BASE(2)
|
||||
{"angle", lua::wrap<l_vec2_angle>},
|
||||
{"mix", lua::wrap<l_mix<2>>},
|
||||
{"rotate", lua::wrap<l_vec2_rotate>},
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
const luaL_Reg vec3lib[] = {
|
||||
{"add", lua::wrap<l_binop<3, std::plus>>},
|
||||
{"sub", lua::wrap<l_binop<3, std::minus>>},
|
||||
{"mul", lua::wrap<l_binop<3, std::multiplies>>},
|
||||
{"div", lua::wrap<l_binop<3, std::divides>>},
|
||||
{"distance", lua::wrap<l_distance<3>>},
|
||||
{"normalize", lua::wrap<l_unaryop<3, glm::normalize>>},
|
||||
{"length", lua::wrap<l_scalar_op<3, glm::length>>},
|
||||
{"tostring", lua::wrap<l_tostring<3>>},
|
||||
{"abs", lua::wrap<l_unaryop<3, glm::abs>>},
|
||||
{"round", lua::wrap<l_unaryop<3, glm::round>>},
|
||||
{"inverse", lua::wrap<l_inverse<3>>},
|
||||
{"pow", lua::wrap<l_pow<3>>},
|
||||
{"dot", lua::wrap<l_dot<3>>},
|
||||
VECLIB_BASE(3)
|
||||
{"spherical_rand", lua::wrap<l_spherical_rand>},
|
||||
{"mix", lua::wrap<l_mix<3>>},
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
const luaL_Reg vec4lib[] = {
|
||||
{"add", lua::wrap<l_binop<4, std::plus>>},
|
||||
{"sub", lua::wrap<l_binop<4, std::minus>>},
|
||||
{"mul", lua::wrap<l_binop<4, std::multiplies>>},
|
||||
{"div", lua::wrap<l_binop<4, std::divides>>},
|
||||
{"distance", lua::wrap<l_distance<4>>},
|
||||
{"normalize", lua::wrap<l_unaryop<4, glm::normalize>>},
|
||||
{"length", lua::wrap<l_scalar_op<4, glm::length>>},
|
||||
{"tostring", lua::wrap<l_tostring<4>>},
|
||||
{"abs", lua::wrap<l_unaryop<4, glm::abs>>},
|
||||
{"round", lua::wrap<l_unaryop<4, glm::round>>},
|
||||
{"inverse", lua::wrap<l_inverse<4>>},
|
||||
{"pow", lua::wrap<l_pow<4>>},
|
||||
{"dot", lua::wrap<l_dot<4>>},
|
||||
{"mix", lua::wrap<l_mix<4>>},
|
||||
VECLIB_BASE(4)
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue