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

14
ag.cc
View File

@ -223,10 +223,8 @@ 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;
} }
@ -235,6 +233,9 @@ namespace ag
int argc = lua_gettop(L); int argc = lua_gettop(L);
if (argc == 4) if (argc == 4)
{
Engine::Object * obj = getObject(L, 1);
if (obj != NULL)
{ {
double position[3]; double position[3];
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
@ -246,12 +247,21 @@ namespace ag
} }
} }
} }
}
return 0; return 0;
} }
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,