summaryrefslogtreecommitdiff
path: root/src/glm/mat4.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-23 22:16:24 -0500
committersanine <sanine.not@pm.me>2022-08-23 22:16:24 -0500
commit709e1b6e1ce86f8da4fc136747fcefbc6c6057bd (patch)
tree8f4da8c27526fb056a340a9d2948fdace8341ece /src/glm/mat4.c
parent3afbf2a13b2dada445fb667bf25600407fea480a (diff)
add basic 3d perspective
Diffstat (limited to 'src/glm/mat4.c')
-rw-r--r--src/glm/mat4.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/glm/mat4.c b/src/glm/mat4.c
index f98cdfb..02ef047 100644
--- a/src/glm/mat4.c
+++ b/src/glm/mat4.c
@@ -2,14 +2,19 @@
#include <honeysuckle.h>
#include <cglm/cglm.h>
#include "util/util.h"
+#include "glm.h"
int mat4_create(lua_State *L);
+int mat4_set(lua_State *L);
+int mat4_get(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_set", mat4_set),
+ hs_str_cfunc("mat4_get", mat4_get),
hs_str_cfunc("mat4_identity", mat4_identity),
);
@@ -25,6 +30,27 @@ int mat4_create(lua_State *L)
}
+int mat4_set(lua_State *L)
+{
+ void *ptr;
+ lua_Integer index;
+ lua_Number value;
+ hs_parse_args(L, hs_user(ptr), hs_int(index), hs_num(value));
+ array_set(L, 16, ptr, index, value);
+ return 0;
+}
+
+
+int mat4_get(lua_State *L)
+{
+ void *ptr;
+ lua_Integer index;
+ hs_parse_args(L, hs_user(ptr), hs_int(index));
+ array_get(L, 16, ptr, index);
+ return 1;
+}
+
+
int mat4_identity(lua_State *L)
{
void *ptr;