renamed Object::addRel{Force,Torque} to add{Force,Torque}Rel

git-svn-id: svn://anubis/anaglym/trunk@192 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-11-24 23:39:33 +00:00
parent 6b62b9d00f
commit 3dd1cb8305
3 changed files with 16 additions and 28 deletions

View File

@ -43,17 +43,17 @@ class Engine
{ {
m_ode_object->addForce(fx, fy, fz); m_ode_object->addForce(fx, fy, fz);
} }
void addRelForce(dReal fx, dReal fy, dReal fz) void addForceRel(dReal fx, dReal fy, dReal fz)
{ {
m_ode_object->addRelForce(fx, fy, fz); m_ode_object->addForceRel(fx, fy, fz);
} }
void addTorque(dReal fx, dReal fy, dReal fz) void addTorque(dReal fx, dReal fy, dReal fz)
{ {
m_ode_object->addTorque(fx, fy, fz); m_ode_object->addTorque(fx, fy, fz);
} }
void addRelTorque(dReal fx, dReal fy, dReal fz) void addTorqueRel(dReal fx, dReal fy, dReal fz)
{ {
m_ode_object->addRelTorque(fx, fy, fz); m_ode_object->addTorqueRel(fx, fy, fz);
} }
void setRotation(dReal x, dReal y, dReal z) void setRotation(dReal x, dReal y, dReal z)
{ {

31
ag.cc
View File

@ -53,7 +53,6 @@ namespace ag
{ "createCylinder", createCylinder }, { "createCylinder", createCylinder },
{ "createCylinderStatic", createCylinderStatic }, { "createCylinderStatic", createCylinderStatic },
{ "createPlane", createPlane }, { "createPlane", createPlane },
{ "createPlaneStatic", createPlaneStatic },
{ "createSphere", createSphere }, { "createSphere", createSphere },
{ "createSphereStatic", createSphereStatic }, { "createSphereStatic", createSphereStatic },
@ -147,12 +146,12 @@ namespace ag
lua_setfield(L, -2, "setVisible"); lua_setfield(L, -2, "setVisible");
lua_pushcfunction(L, object::addForce); lua_pushcfunction(L, object::addForce);
lua_setfield(L, -2, "addForce"); lua_setfield(L, -2, "addForce");
lua_pushcfunction(L, object::addRelForce); lua_pushcfunction(L, object::addForceRel);
lua_setfield(L, -2, "addRelForce"); lua_setfield(L, -2, "addForceRel");
lua_pushcfunction(L, object::addTorque); lua_pushcfunction(L, object::addTorque);
lua_setfield(L, -2, "addTorque"); lua_setfield(L, -2, "addTorque");
lua_pushcfunction(L, object::addRelTorque); lua_pushcfunction(L, object::addTorqueRel);
lua_setfield(L, -2, "addRelTorque"); lua_setfield(L, -2, "addTorqueRel");
lua_pushcfunction(L, object::setColor); lua_pushcfunction(L, object::setColor);
lua_setfield(L, -2, "setColor"); lua_setfield(L, -2, "setColor");
lua_pushcfunction(L, object::setTexture); lua_pushcfunction(L, object::setTexture);
@ -567,7 +566,7 @@ namespace ag
return createSphereSpecify(L, true); return createSphereSpecify(L, true);
} }
static int createPlaneSpecify(lua_State * L, bool is_static) int createPlane(lua_State * L)
{ {
int argc = lua_gettop(L); int argc = lua_gettop(L);
if (argc == 4 || argc == 6) if (argc == 4 || argc == 6)
@ -586,7 +585,7 @@ namespace ag
refptr< vector<float> > args = new vector<float>(); refptr< vector<float> > args = new vector<float>();
for (int i = 1; i <= argc; i++) for (int i = 1; i <= argc; i++)
args->push_back(lua_tonumber(L, i)); args->push_back(lua_tonumber(L, i));
addManagedObject(L, is_static, OdeWorld::PLANE, args); addManagedObject(L, true, OdeWorld::PLANE, args);
return 1; return 1;
} }
} }
@ -594,16 +593,6 @@ namespace ag
return 1; return 1;
} }
int createPlane(lua_State * L)
{
return createPlaneSpecify(L, false);
}
int createPlaneStatic(lua_State * L)
{
return createPlaneSpecify(L, true);
}
static int createCylinderSpecify(lua_State * L, bool is_static) static int createCylinderSpecify(lua_State * L, bool is_static)
{ {
int argc = lua_gettop(L); int argc = lua_gettop(L);
@ -833,7 +822,7 @@ namespace ag
return 0; return 0;
} }
int addRelForce(lua_State * L) int addForceRel(lua_State * L)
{ {
int argc = lua_gettop(L); int argc = lua_gettop(L);
if (argc == 4) if (argc == 4)
@ -844,7 +833,7 @@ namespace ag
lua_isnumber(L, 3) && lua_isnumber(L, 3) &&
lua_isnumber(L, 4)) lua_isnumber(L, 4))
{ {
obj->addRelForce(lua_tonumber(L, 2), obj->addForceRel(lua_tonumber(L, 2),
lua_tonumber(L, 3), lua_tonumber(L, 3),
lua_tonumber(L, 4)); lua_tonumber(L, 4));
} }
@ -871,7 +860,7 @@ namespace ag
return 0; return 0;
} }
int addRelTorque(lua_State * L) int addTorqueRel(lua_State * L)
{ {
int argc = lua_gettop(L); int argc = lua_gettop(L);
if (argc == 4) if (argc == 4)
@ -882,7 +871,7 @@ namespace ag
lua_isnumber(L, 3) && lua_isnumber(L, 3) &&
lua_isnumber(L, 4)) lua_isnumber(L, 4))
{ {
obj->addRelTorque(lua_tonumber(L, 2), obj->addTorqueRel(lua_tonumber(L, 2),
lua_tonumber(L, 3), lua_tonumber(L, 3),
lua_tonumber(L, 4)); lua_tonumber(L, 4));
} }

5
ag.h
View File

@ -49,7 +49,6 @@ namespace ag
int createCylinder(lua_State * L); int createCylinder(lua_State * L);
int createCylinderStatic(lua_State * L); int createCylinderStatic(lua_State * L);
int createPlane(lua_State * L); int createPlane(lua_State * L);
int createPlaneStatic(lua_State * L);
int createSphere(lua_State * L); int createSphere(lua_State * L);
int createSphereStatic(lua_State * L); int createSphereStatic(lua_State * L);
@ -63,9 +62,9 @@ namespace ag
int destroy(lua_State * L); int destroy(lua_State * L);
int setVisible(lua_State * L); int setVisible(lua_State * L);
int addForce(lua_State * L); int addForce(lua_State * L);
int addRelForce(lua_State * L); int addForceRel(lua_State * L);
int addTorque(lua_State * L); int addTorque(lua_State * L);
int addRelTorque(lua_State * L); int addTorqueRel(lua_State * L);
int setColor(lua_State * L); int setColor(lua_State * L);
int setTexture(lua_State * L); int setTexture(lua_State * L);
int getMass(lua_State * L); int getMass(lua_State * L);