summaryrefslogtreecommitdiff
path: root/src/glm/affine2d.c
blob: 34601df7529216ed117faa2f2bdf3e96c1417276 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <lua.h>
#include <lauxlib.h>
#include <cglm/cglm.h>
#include "glm.h"


int glm_translate2d_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	vec2 *v = luaL_checkudata(L, 2, glm_vec2_tname);
	glm_translate2d(*m, *v);
	return 0;
}


int glm_translate2d_to_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	vec2 *v = luaL_checkudata(L, 2, glm_vec2_tname);
	mat3 *dest = luaL_checkudata(L, 1, glm_mat3_tname);
	glm_translate2d_to(*m, *v, *dest);
	return 0;
}


int glm_translate2d_x_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	float x = luaL_checknumber(L, 2);
	glm_translate2d_x(*m, x);
	return 0;
}


int glm_translate2d_y_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	float y = luaL_checknumber(L, 2);
	glm_translate2d_y(*m, y);
	return 0;
}


int glm_translate2d_make_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	vec2 *v = luaL_checkudata(L, 2, glm_vec2_tname);
	glm_translate2d_make(*m, *v);
	return 0;
}


int glm_scale2d_to_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	vec2 *v = luaL_checkudata(L, 2, glm_vec2_tname);
	mat3 *dest = luaL_checkudata(L, 1, glm_mat3_tname);
	glm_scale2d_to(*m, *v, *dest);
	return 0;
}


int glm_scale2d_make_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	vec2 *v = luaL_checkudata(L, 2, glm_vec2_tname);
	glm_scale2d_make(*m, *v);
	return 0;
}


int glm_scale2d_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	vec2 *v = luaL_checkudata(L, 2, glm_vec2_tname);
	glm_scale2d(*m, *v);
	return 0;
}


int glm_scale2d_uni_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	float s = luaL_checknumber(L, 2);
	glm_scale2d_uni(*m, s);
	return 0;
}


int glm_rotate2d_make_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	float angle = luaL_checknumber(L, 2);
	glm_rotate2d_make(*m, angle);
	return 0;
}


int glm_rotate2d_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	float angle = luaL_checknumber(L, 2);
	glm_rotate2d(*m, angle);
	return 0;
}


int glm_rotate2d_to_bind(lua_State *L)
{
	mat3 *m = luaL_checkudata(L, 1, glm_mat3_tname);
	float angle = luaL_checknumber(L, 2);
	mat3 *dest = luaL_checkudata(L, 1, glm_mat3_tname);
	glm_rotate2d_to(*m, angle, *dest);
	return 0;
}