diff options
author | sanine <sanine.not@pm.me> | 2022-08-23 13:38:27 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-08-23 13:38:27 -0500 |
commit | 3afbf2a13b2dada445fb667bf25600407fea480a (patch) | |
tree | 551329e6f74fc9f177616de0d6739e8b5331ae96 /src/glm/transform.c | |
parent | 261e3f991221fbad6bbf262f5e65b773e4b6c73e (diff) | |
parent | 25ed7eb9f84e9a822f698ad803901fbb2a5354cf (diff) |
:wMerge branch 'gl-window' into main
Diffstat (limited to 'src/glm/transform.c')
-rw-r--r-- | src/glm/transform.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/glm/transform.c b/src/glm/transform.c new file mode 100644 index 0000000..4dce595 --- /dev/null +++ b/src/glm/transform.c @@ -0,0 +1,31 @@ +#include <lua.h> +#include <honeysuckle.h> +#include <cglm/cglm.h> +#include "util/util.h" + + +int rotate_z(lua_State *L); + + +void setup_transform(lua_State *L, int glm_tbl) +{ + int tbl = hs_create_table(L, + hs_str_cfunc("rotate_z", rotate_z), + ); + + append_table(L, glm_tbl, tbl); + lua_pop(L, 1); +} + + +int rotate_z(lua_State *L) +{ + void *src_ptr, *dest_ptr; + lua_Number angle; + hs_parse_args(L, hs_user(src_ptr), hs_num(angle), hs_user(dest_ptr)); + mat4 *source = src_ptr; + mat4 *dest = dest_ptr; + + glm_rotate_z(*source, angle, *dest); + return 0; +} |