summaryrefslogtreecommitdiff
path: root/src/glm/camera.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-10-04 14:53:08 -0500
committersanine <sanine.not@pm.me>2022-10-04 14:53:08 -0500
commit6d96b0e7ea1d98e44647d0bbbba232701a7d557e (patch)
tree15fa9d310f1db5767b662fb0bb4cad8a560d3650 /src/glm/camera.c
parent0c55c0e1b48de55fea401ea1b2b3f2280ef0f93c (diff)
add first person demo
Diffstat (limited to 'src/glm/camera.c')
-rw-r--r--src/glm/camera.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/glm/camera.c b/src/glm/camera.c
index 7180b77..11d309d 100644
--- a/src/glm/camera.c
+++ b/src/glm/camera.c
@@ -2,15 +2,18 @@
#include <honeysuckle.h>
#include <cglm/cglm.h>
#include "util/util.h"
+#include "glm.h"
int perspective(lua_State *L);
+int look(lua_State *L);
void setup_camera(lua_State *L, int glm_tbl)
{
int tbl = hs_create_table(L,
hs_str_cfunc("perspective", perspective),
+ hs_str_cfunc("look", look),
);
append_table(L, glm_tbl, tbl);
@@ -28,3 +31,15 @@ int perspective(lua_State *L)
glm_perspective(fov, aspect, near, far, *dest);
return 0;
}
+
+
+int look(lua_State *L)
+{
+ float *eye = luaL_checkudata(L, 1, vec3_tname);
+ float *dir = luaL_checkudata(L, 2, vec3_tname);
+ float *up = luaL_checkudata(L, 3, vec3_tname);
+ void *dest = luaL_checkudata(L, 4, mat4_tname);
+
+ glm_look(eye, dir, up, dest);
+ return 0;
+}