From 99c171e3f46f0993b79fbae58186e44f9529796a Mon Sep 17 00:00:00 2001 From: hikerstk Date: Sun, 3 May 2009 12:33:26 +0000 Subject: [PATCH] Fixed kart rotation in bullet debug view (reason was actually incorrect culling). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3455 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/irr_driver.cpp | 7 ++++--- src/karts/kart.cpp | 2 +- src/physics/physics.cpp | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 276babdc8..3206706dd 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -502,7 +502,7 @@ void IrrDriver::update(float dt) if(!m_device->run()) return; m_device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140)); #ifdef HAVE_GLUT - if(user_config->m_bullet_debug) + if(user_config->m_bullet_debug && race_manager->raceIsActive()) { // Use bullets debug drawer GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; @@ -532,6 +532,7 @@ void IrrDriver::update(float dt) glClearColor(0.8f,0.8f,0.8f,0); + glCullFace(GL_BACK); glMatrixMode(GL_PROJECTION); glLoadIdentity(); float f=2.0f; @@ -539,8 +540,8 @@ void IrrDriver::update(float dt) Vec3 xyz = RaceManager::getKart(race_manager->getNumKarts()-1)->getXYZ(); gluLookAt(xyz.getX(), xyz.getY()-5.f, xyz.getZ()+4, - xyz.getX(), xyz.getY(), xyz.getZ(), - 0.0f, 0.0f, 1.0f); + xyz.getX(), xyz.getY(), xyz.getZ(), + 0.0f, 0.0f, 1.0f); glMatrixMode(GL_MODELVIEW); for (unsigned int i = 0 ; i < race_manager->getNumKarts(); ++i) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 8fe4176c9..b58c4083a 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -705,7 +705,7 @@ void Kart::draw() btCylinderShapeX wheelShape( btVector3(0.1f, m_kart_properties->getWheelRadius(), m_kart_properties->getWheelRadius())); - btVector3 wheelColor(1,0,0); + btVector3 wheelColor(0,0,1); for(int i=0; igetNumWheels(); i++) { m_vehicle->updateWheelTransform(i, true); diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index 1cabf7683..8f2def033 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -307,6 +307,11 @@ void Physics::draw() if(myMotion) { myMotion->m_graphicsWorldTrans.getOpenGLMatrix(m); + // Karts need culling GL_FRONT (not sure why), otherwise they appear to + // rotate incorrectly due to incorrect culling + UserPointer *up = (UserPointer*)body->getUserPointer(); + if(up->is(UserPointer::UP_KART)) + glCullFace(GL_FRONT); debugDraw(m, obj->getCollisionShape(), wireColor); } } // for i