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
This commit is contained in:
hikerstk 2009-05-03 12:33:26 +00:00
parent 199725ca20
commit 99c171e3f4
3 changed files with 10 additions and 4 deletions

View File

@ -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)

View File

@ -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; i<m_vehicle->getNumWheels(); i++)
{
m_vehicle->updateWheelTransform(i, true);

View File

@ -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