added body parameter to Engine::Object

git-svn-id: svn://anubis/anaglym/trunk@43 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-10-01 03:24:06 +00:00
parent 99a8835954
commit 0753f243c5
3 changed files with 21 additions and 9 deletions

24
ag.cc
View File

@ -223,9 +223,7 @@ namespace ag
{ {
Engine::Object * obj = getObject(L, -1); Engine::Object * obj = getObject(L, -1);
if (obj != NULL) if (obj != NULL)
{
obj->draw(); obj->draw();
}
} }
return 0; return 0;
} }
@ -236,13 +234,17 @@ namespace ag
if (argc == 4) if (argc == 4)
{ {
double position[3]; Engine::Object * obj = getObject(L, 1);
for (int i = 0; i < 3; i++) if (obj != NULL)
{ {
int type = lua_type(L, i); double position[3];
if (type == LUA_TNUMBER || type == LUA_TSTRING) for (int i = 0; i < 3; i++)
{ {
position[i] = lua_tonumber(L, i + 2); int type = lua_type(L, i);
if (type == LUA_TNUMBER || type == LUA_TSTRING)
{
position[i] = lua_tonumber(L, i + 2);
}
} }
} }
} }
@ -252,6 +254,14 @@ namespace ag
int getPosition(lua_State * L) int getPosition(lua_State * L)
{ {
int argc = lua_gettop(L);
if (argc == 1)
{
Engine::Object * obj = getObject(L, 1);
if (obj != NULL)
{
}
}
return 3; return 3;
} }
} }

View File

@ -237,5 +237,5 @@ void Engine::run()
void Engine::Object::loadPhy(const std::string & path, bool static_data) void Engine::Object::loadPhy(const std::string & path, bool static_data)
{ {
m_geoms = g_engine->m_world.loadPhy(path, static_data); geoms = g_engine->m_world.loadPhy(path, &body, static_data);
} }

View File

@ -17,9 +17,11 @@ class Engine
class Object class Object
{ {
public: public:
Object() { body = 0; }
WFObj * wfobj; WFObj * wfobj;
GLuint display_list; GLuint display_list;
std::vector<dGeomID> m_geoms; std::vector<dGeomID> geoms;
dBodyID body;
void draw() { glCallList(display_list); } void draw() { glCallList(display_list); }
void loadPhy(const std::string & path, void loadPhy(const std::string & path,