#include #include #include #include "ode_bindings.h" int MassCreate_bind(lua_State *L) { dMass *m = lua_newuserdata(L, sizeof(dMass)); luaL_getmetatable(L, ode_mass_tname); lua_setmetatable(L, -2); return 1; } int dMassSetZero_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dMassSetZero(m); return 0; } int dMassSetParameters_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal themass = luaL_checknumber(L, 2); dReal cgx = luaL_checknumber(L, 3); dReal cgy = luaL_checknumber(L, 4); dReal cgz = luaL_checknumber(L, 5); dReal I11 = luaL_checknumber(L, 6); dReal I22 = luaL_checknumber(L, 7); dReal I33 = luaL_checknumber(L, 8); dReal I12 = luaL_checknumber(L, 9); dReal I13 = luaL_checknumber(L, 10); dReal I23 = luaL_checknumber(L, 11); dMassSetParameters(m, themass, cgx, cgy, cgz, I11, I22, I33, I12, I13, I23); return 0; } int dMassSetSphere_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal density = luaL_checknumber(L, 2); dReal radius = luaL_checknumber(L, 3); dMassSetSphere(m, density, radius); return 0; } int dMassSetSphereTotal_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal total_mass = luaL_checknumber(L, 2); dReal radius = luaL_checknumber(L, 3); dMassSetSphereTotal(m, total_mass, radius); return 0; } int dMassSetCapsule_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal density = luaL_checknumber(L, 2); int direction = luaL_checkinteger(L, 3); dReal radius = luaL_checknumber(L, 4); dReal length = luaL_checknumber(L, 5); dMassSetCapsule(m, density, direction, radius, length); return 0; } int dMassSetCapsuleTotal_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal total_mass = luaL_checknumber(L, 2); int direction = luaL_checkinteger(L, 3); dReal radius = luaL_checknumber(L, 4); dReal length = luaL_checknumber(L, 5); dMassSetCapsuleTotal(m, total_mass, direction, radius, length); return 0; } int dMassSetCylinder_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal density = luaL_checknumber(L, 2); int direction = luaL_checkinteger(L, 3); dReal radius = luaL_checknumber(L, 4); dReal length = luaL_checknumber(L, 5); dMassSetCylinder(m, density, direction, radius, length); return 0; } int dMassSetCylinderTotal_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal total_mass = luaL_checknumber(L, 2); int direction = luaL_checkinteger(L, 3); dReal radius = luaL_checknumber(L, 4); dReal length = luaL_checknumber(L, 5); dMassSetCylinderTotal(m, total_mass, direction, radius, length); return 0; } int dMassSetBox_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal density = luaL_checknumber(L, 2); dReal lx = luaL_checknumber(L, 3); dReal ly = luaL_checknumber(L, 4); dReal lz = luaL_checknumber(L, 5); dMassSetBox(m, density, lx, ly, lz); return 0; } int dMassSetBoxTotal_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal total_mass = luaL_checknumber(L, 2); dReal lx = luaL_checknumber(L, 3); dReal ly = luaL_checknumber(L, 4); dReal lz = luaL_checknumber(L, 5); dMassSetBoxTotal(m, total_mass, lx, ly, lz); return 0; } int dMassSetTrimesh_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal density = luaL_checknumber(L, 2); dGeomID g = luaL_checkudata(L, 3, ode_geom_tname); dMassSetTrimesh(m, density, g); return 0; } int dMassAdjust_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal newmass = luaL_checknumber(L, 2); dMassAdjust(m, newmass); return 0; } int dMassTranslate_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dReal x = luaL_checknumber(L, 2); dReal y = luaL_checknumber(L, 3); dReal z = luaL_checknumber(L, 4); dMassTranslate(m, x, y, z); return 0; } int dMassRotate_bind(lua_State *L) { dMass * m = luaL_checkudata(L, 1, ode_mass_tname); dMatrix3 R; R[0] = luaL_checknumber(L, 2); R[1] = luaL_checknumber(L, 3); R[2] = luaL_checknumber(L, 4); R[4] = luaL_checknumber(L, 5); R[5] = luaL_checknumber(L, 6); R[6] = luaL_checknumber(L, 7); R[8] = luaL_checknumber(L, 8); R[9] = luaL_checknumber(L, 9); R[10] = luaL_checknumber(L, 10); dMassRotate(m, R); return 0; } int dMassAdd_bind(lua_State *L) { dMass * ma = luaL_checkudata(L, 1, ode_mass_tname); const dMass * mb = luaL_checkudata(L, 2, ode_mass_tname); dMassAdd(ma, mb); return 0; }