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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
#include <lua.h>
#include <lauxlib.h>
#include <ode/ode.h>
#include "ode_bindings.h"
void ode_push_world(lua_State *L, dWorldID w)
{
dWorldID *wu = lua_newuserdata(L, sizeof(dWorldID));
*wu = w;
luaL_getmetatable(L, ode_world_tname);
lua_setmetatable(L, -2);
}
int dWorldCreate_bind(lua_State *L)
{
dWorldID w = lua_newuserdata(L, sizeof(dWorldID));
ode_push_world(L, w);
return 1;
}
int dWorldDestroy_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dWorldDestroy(*w);
return 0;
}
int dWorldSetGravity_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal x = luaL_checkinteger(L, 2);
dReal y = luaL_checkinteger(L, 3);
dReal z = luaL_checkinteger(L, 4);
dWorldSetGravity(*w, x, y, z);
return 0;
}
int dWorldGetGravity_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dVector3 gravity;
dWorldGetGravity(*w, gravity);
lua_pushnumber(L, gravity[0]);
lua_pushnumber(L, gravity[1]);
lua_pushnumber(L, gravity[2]);
return 3;
}
int dWorldSetERP_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal erp = luaL_checkinteger(L, 2);
dWorldSetERP(*w, erp);
return 0;
}
int dWorldGetERP_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal bind_result = dWorldGetERP(*w);
lua_pushinteger(L, bind_result);
return 1;
}
int dWorldSetCFM_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal cfm = luaL_checkinteger(L, 2);
dWorldSetCFM(*w, cfm);
return 0;
}
int dWorldGetCFM_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal bind_result = dWorldGetCFM(*w);
lua_pushinteger(L, bind_result);
return 1;
}
int dWorldSetAutoDisableFlag_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
int do_auto_disable = luaL_checkinteger(L, 2);
dWorldSetAutoDisableFlag(*w, do_auto_disable);
return 0;
}
int dWorldGetAutoDisableFlag_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
int bind_result = dWorldGetAutoDisableFlag(*w);
lua_pushinteger(L, bind_result);
return 1;
}
int dWorldSetAutoDisableLinearThreshold_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal linear_threshold = luaL_checkinteger(L, 2);
dWorldSetAutoDisableLinearThreshold(*w, linear_threshold);
return 0;
}
int dWorldGetAutoDisableLinearThreshold_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal bind_result = dWorldGetAutoDisableLinearThreshold(*w);
lua_pushinteger(L, bind_result);
return 1;
}
int dWorldSetAutoDisableAngularThreshold_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal angular_threshold = luaL_checkinteger(L, 2);
dWorldSetAutoDisableAngularThreshold(*w, angular_threshold);
return 0;
}
int dWorldGetAutoDisableAngularThreshold_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal bind_result = dWorldGetAutoDisableAngularThreshold(*w);
lua_pushinteger(L, bind_result);
return 1;
}
int dWorldSetAutoDisableSteps_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
int steps = luaL_checkinteger(L, 2);
dWorldSetAutoDisableSteps(*w, steps);
return 0;
}
int dWorldGetAutoDisableSteps_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
int bind_result = dWorldGetAutoDisableSteps(*w);
lua_pushinteger(L, bind_result);
return 1;
}
int dWorldSetAutoDisableTime_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal time = luaL_checkinteger(L, 2);
dWorldSetAutoDisableTime(*w, time);
return 0;
}
int dWorldGetAutoDisableTime_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal bind_result = dWorldGetAutoDisableTime(*w);
lua_pushinteger(L, bind_result);
return 1;
}
int dWorldImpulseToForce_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal stepsize = luaL_checkinteger(L, 2);
dReal ix = luaL_checkinteger(L, 3);
dReal iy = luaL_checkinteger(L, 4);
dReal iz = luaL_checkinteger(L, 5);
dVector3 force;
dWorldImpulseToForce(*w, stepsize, ix, iy, iz, force);
lua_pushnumber(L, force[0]);
lua_pushnumber(L, force[1]);
lua_pushnumber(L, force[2]);
return 3;
}
int dWorldStep_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal stepsize = luaL_checkinteger(L, 2);
dWorldStep(*w, stepsize);
return 0;
}
int dWorldQuickStep_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal stepsize = luaL_checkinteger(L, 2);
dWorldQuickStep(*w, stepsize);
return 0;
}
int dWorldSetQuickStepNumIterations_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
int num = luaL_checkinteger(L, 2);
dWorldSetQuickStepNumIterations(*w, num);
return 0;
}
int dWorldGetQuickStepNumIterations_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
int bind_result = dWorldGetQuickStepNumIterations(*w);
lua_pushinteger(L, bind_result);
return 1;
}
int dWorldSetQuickStepW_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal over_relaxation = luaL_checkinteger(L, 2);
dWorldSetQuickStepW(*w, over_relaxation);
return 0;
}
int dWorldGetQuickStepW_bind(lua_State *L)
{
dWorldID *w = luaL_checkudata(L, 1, ode_world_tname);
dReal bind_result = dWorldGetQuickStepW(*w);
lua_pushinteger(L, bind_result);
return 1;
}
|