moved Engine::Object::draw() into .cc file as it got bigger
git-svn-id: svn://anubis/anaglym/trunk@50 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
4b34a2e565
commit
452b8fe3f3
32
anaglym.cc
32
anaglym.cc
@ -314,6 +314,21 @@ void Engine::update()
|
|||||||
m_drawing = false;
|
m_drawing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::doPhysics()
|
||||||
|
{
|
||||||
|
static Uint32 last_updated = 0;
|
||||||
|
Uint32 current_ticks = SDL_GetTicks();
|
||||||
|
if (last_updated > 0)
|
||||||
|
{
|
||||||
|
Uint32 msec_steps = current_ticks - last_updated;
|
||||||
|
for (int i = 0; i < msec_steps; i++)
|
||||||
|
m_world.step();
|
||||||
|
}
|
||||||
|
last_updated = current_ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Engine::Object::loadPhy(const std::string & path, bool static_data)
|
void Engine::Object::loadPhy(const std::string & path, bool static_data)
|
||||||
{
|
{
|
||||||
geoms = g_engine->m_world.loadPhy(path, &body, static_data);
|
geoms = g_engine->m_world.loadPhy(path, &body, static_data);
|
||||||
@ -338,15 +353,12 @@ void Engine::Object::getPosition(double * x, double * y, double * z)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::doPhysics()
|
void Engine::Object::draw()
|
||||||
{
|
{
|
||||||
static Uint32 last_updated = 0;
|
if (body != 0)
|
||||||
Uint32 current_ticks = SDL_GetTicks();
|
OdeWorld::pushTransform(dBodyGetPosition(body),
|
||||||
if (last_updated > 0)
|
dBodyGetRotation(body));
|
||||||
{
|
glCallList(display_list);
|
||||||
Uint32 msec_steps = current_ticks - last_updated;
|
if (body != 0)
|
||||||
for (int i = 0; i < msec_steps; i++)
|
glPopMatrix();
|
||||||
m_world.step();
|
|
||||||
}
|
|
||||||
last_updated = current_ticks;
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ class Engine
|
|||||||
std::vector<dGeomID> geoms;
|
std::vector<dGeomID> geoms;
|
||||||
dBodyID body;
|
dBodyID body;
|
||||||
|
|
||||||
void draw() { glCallList(display_list); }
|
void draw();
|
||||||
void loadPhy(const std::string & path,
|
void loadPhy(const std::string & path,
|
||||||
bool static_data = false);
|
bool static_data = false);
|
||||||
void setPosition(double x, double y, double z);
|
void setPosition(double x, double y, double z);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user