add vec2, vec3, vec4 libraries

This commit is contained in:
MihailRis
2024-06-25 17:25:42 +03:00
parent 6f618ae3ff
commit 5ede84edc7
5 changed files with 54 additions and 14 deletions
+3 -12
View File
@@ -221,19 +221,10 @@ namespace lua {
}
return 1;
}
/// @brief pushes vector table to the stack and updates it with glm vec4
inline int setvec4(lua::State* L, int idx, glm::vec4 vec) {
template<int n>
inline int setvec(lua::State* L, int idx, glm::vec<n, float> vec) {
pushvalue(L, idx);
for (uint i = 0; i < 4; i++) {
pushnumber(L, vec[i]);
rawseti(L, i+1);
}
return 1;
}
/// @brief pushes vector table to the stack and updates it with glm vec3
inline int setvec3(lua::State* L, int idx, glm::vec3 vec) {
pushvalue(L, idx);
for (uint i = 0; i < 3; i++) {
for (int i = 0; i < n; i++) {
pushnumber(L, vec[i]);
rawseti(L, i+1);
}