summaryrefslogtreecommitdiff
path: root/src/glm/mat4.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-23 13:38:27 -0500
committersanine <sanine.not@pm.me>2022-08-23 13:38:27 -0500
commit3afbf2a13b2dada445fb667bf25600407fea480a (patch)
tree551329e6f74fc9f177616de0d6739e8b5331ae96 /src/glm/mat4.c
parent261e3f991221fbad6bbf262f5e65b773e4b6c73e (diff)
parent25ed7eb9f84e9a822f698ad803901fbb2a5354cf (diff)
:wMerge branch 'gl-window' into main
Diffstat (limited to 'src/glm/mat4.c')
-rw-r--r--src/glm/mat4.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/glm/mat4.c b/src/glm/mat4.c
new file mode 100644
index 0000000..f98cdfb
--- /dev/null
+++ b/src/glm/mat4.c
@@ -0,0 +1,36 @@
+#include <lua.h>
+#include <honeysuckle.h>
+#include <cglm/cglm.h>
+#include "util/util.h"
+
+int mat4_create(lua_State *L);
+int mat4_identity(lua_State *L);
+
+void setup_mat4(lua_State *L, int glm_tbl)
+{
+ int tbl = hs_create_table(L,
+ hs_str_cfunc("mat4", mat4_create),
+ hs_str_cfunc("mat4_identity", mat4_identity),
+ );
+
+ append_table(L, glm_tbl, tbl);
+ lua_pop(L, 1);
+}
+
+
+int mat4_create(lua_State *L)
+{
+ lua_newuserdata(L, 16*sizeof(float));
+ return 1;
+}
+
+
+int mat4_identity(lua_State *L)
+{
+ void *ptr;
+ hs_parse_args(L, hs_user(ptr));
+ mat4 *m = ptr;
+
+ glm_mat4_identity(*m);
+ return 0;
+}