fixed the physics debug rendering now activates/deactivates properly

actorid
scrawl 13 years ago
parent 8d7bf34348
commit a4576f043d

@ -27,11 +27,7 @@ bool Debugging::toggleRenderMode (int mode){
switch (mode) switch (mode)
{ {
case MWWorld::World::Render_CollisionDebug: case MWWorld::World::Render_CollisionDebug:
return eng->toggleDebugRendering();
// TODO use a proper function instead of accessing the member variable
// directly.
eng->setDebugRenderingMode (!eng->isDebugCreated);
return eng->isDebugCreated;
} }
return false; return false;

@ -151,7 +151,8 @@ namespace Physic
PhysicEngine::PhysicEngine(BulletShapeLoader* shapeLoader) PhysicEngine::PhysicEngine(BulletShapeLoader* shapeLoader) :
mDebugActive(0)
{ {
// Set up the collision configuration and dispatcher // Set up the collision configuration and dispatcher
collisionConfiguration = new btDefaultCollisionConfiguration(); collisionConfiguration = new btDefaultCollisionConfiguration();
@ -203,6 +204,13 @@ namespace Physic
createDebugRendering(); createDebugRendering();
} }
mDebugDrawer->setDebugMode(mode); mDebugDrawer->setDebugMode(mode);
mDebugActive = mode;
}
bool PhysicEngine::toggleDebugRendering()
{
setDebugRenderingMode(!mDebugActive);
return mDebugActive;
} }
PhysicEngine::~PhysicEngine() PhysicEngine::~PhysicEngine()

@ -199,6 +199,8 @@ namespace Physic
*/ */
void setDebugRenderingMode(int mode); void setDebugRenderingMode(int mode);
bool toggleDebugRendering();
/** /**
* Return the closest object hit by a ray. If there are no objects, it will return ("",-1). * Return the closest object hit by a ray. If there are no objects, it will return ("",-1).
*/ */
@ -230,6 +232,7 @@ namespace Physic
//debug rendering //debug rendering
BtOgre::DebugDrawer* mDebugDrawer; BtOgre::DebugDrawer* mDebugDrawer;
bool isDebugCreated; bool isDebugCreated;
bool mDebugActive;
}; };
}} }}

Loading…
Cancel
Save