From 452b8fe3f38187915831129a57aa511870dd9124 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 5 Oct 2009 20:03:14 +0000 Subject: [PATCH] moved Engine::Object::draw() into .cc file as it got bigger git-svn-id: svn://anubis/anaglym/trunk@50 99a6e188-d820-4881-8870-2d33a10e2619 --- anaglym.cc | 32 ++++++++++++++++++++++---------- anaglym.h | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/anaglym.cc b/anaglym.cc index 6997bba..c516129 100644 --- a/anaglym.cc +++ b/anaglym.cc @@ -314,6 +314,21 @@ void Engine::update() 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) { 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; - 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; + if (body != 0) + OdeWorld::pushTransform(dBodyGetPosition(body), + dBodyGetRotation(body)); + glCallList(display_list); + if (body != 0) + glPopMatrix(); } diff --git a/anaglym.h b/anaglym.h index 7809c5e..fe5617d 100644 --- a/anaglym.h +++ b/anaglym.h @@ -23,7 +23,7 @@ class Engine std::vector geoms; dBodyID body; - void draw() { glCallList(display_list); } + void draw(); void loadPhy(const std::string & path, bool static_data = false); void setPosition(double x, double y, double z);