blob: f98cdfb8fd2d0cf351b1db072a0cd16910776d12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}
|