diff options
Diffstat (limited to 'src/glm/glm.c')
-rw-r--r-- | src/glm/glm.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/glm/glm.c b/src/glm/glm.c index 786fcf0..525a029 100644 --- a/src/glm/glm.c +++ b/src/glm/glm.c @@ -5,9 +5,29 @@ void setup_glm(lua_State *L, int honey_index) { lua_createtable(L, 0, 1); - int glm_index = lua_gettop(L); + int glm_tbl = lua_gettop(L); + + setup_vec3(L, glm_tbl); + setup_mat4(L, glm_tbl); + + setup_transform(L, glm_tbl); + setup_camera(L, glm_tbl); - setup_mat4(L, glm_index); - setup_transform(L, glm_index); lua_setfield(L, honey_index, "glm"); } + + +void array_get(lua_State *L, int max, float *array, int index) +{ + if (index < 0 || index >= max) + hs_throw_error(L, "index %d is out of range [0-%d]", index, max-1); + lua_pushnumber(L, array[index]); +} + + +void array_set(lua_State *L, int max, float *array, int index, float value) +{ + if (index < 0 || index >= max) + hs_throw_error(L, "index %d is out of range [0-%d]", index, max-1); + array[index] = value; +} |