only update aabb of active objects, thanks Peter Tchernev for reporting (http://bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1764 )
move debug aabb rendering from updateAabb to debugDrawWorld
This commit is contained in:
@@ -217,6 +217,9 @@ void BspDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|||||||
@@ -246,6 +246,9 @@ void CcdPhysicsDemo::clientMoveAndDisplay()
|
|||||||
int numSimSteps = 0;
|
int numSimSteps = 0;
|
||||||
numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
|
numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
#ifdef VERBOSE_TIMESTEPPING_CONSOLEOUTPUT
|
#ifdef VERBOSE_TIMESTEPPING_CONSOLEOUTPUT
|
||||||
if (!numSimSteps)
|
if (!numSimSteps)
|
||||||
printf("Interpolated transforms\n");
|
printf("Interpolated transforms\n");
|
||||||
|
|||||||
@@ -212,6 +212,9 @@ void ColladaDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
@@ -226,7 +229,8 @@ void ColladaDemo::displayCallback(void) {
|
|||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
|
||||||
m_dynamicsWorld->updateAabbs();
|
if (m_dynamicsWorld)
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
|
|||||||
@@ -377,6 +377,9 @@ void ConcaveConvexcastDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
convexcastBatch.move (dt);
|
convexcastBatch.move (dt);
|
||||||
convexcastBatch.cast (m_dynamicsWorld);
|
convexcastBatch.cast (m_dynamicsWorld);
|
||||||
renderme();
|
renderme();
|
||||||
|
|||||||
@@ -326,6 +326,9 @@ void ConcaveDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|||||||
@@ -351,6 +351,9 @@ void ConcaveRaycastDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
raycastBar.move (dt);
|
raycastBar.move (dt);
|
||||||
raycastBar.cast (m_dynamicsWorld);
|
raycastBar.cast (m_dynamicsWorld);
|
||||||
renderme();
|
renderme();
|
||||||
|
|||||||
@@ -208,6 +208,10 @@ void ConstraintDemo::clientMoveAndDisplay()
|
|||||||
dt = 1.0/420.f;
|
dt = 1.0/420.f;
|
||||||
|
|
||||||
int numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
|
int numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@@ -241,8 +245,8 @@ void ConstraintDemo::displayCallback(void) {
|
|||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
if (m_dynamicsWorld)
|
||||||
m_dynamicsWorld->updateAabbs();
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
drawLimit();
|
drawLimit();
|
||||||
|
|
||||||
|
|||||||
@@ -372,6 +372,9 @@ void ConvexDecompositionDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
@@ -386,7 +389,8 @@ void ConvexDecompositionDemo::displayCallback(void) {
|
|||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
|
||||||
m_dynamicsWorld->updateAabbs();
|
if (m_dynamicsWorld)
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,11 @@ void GenericJointDemo::clientMoveAndDisplay()
|
|||||||
ms = minFPS;
|
ms = minFPS;
|
||||||
|
|
||||||
if (m_dynamicsWorld)
|
if (m_dynamicsWorld)
|
||||||
|
{
|
||||||
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
}
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
@@ -130,7 +134,7 @@ void GenericJointDemo::displayCallback()
|
|||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
if (m_dynamicsWorld)
|
if (m_dynamicsWorld)
|
||||||
m_dynamicsWorld->updateAabbs();
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
|
|||||||
@@ -598,6 +598,10 @@ void GimpactConcaveDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
m_clock.reset();
|
m_clock.reset();
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
m_steps_done++;
|
m_steps_done++;
|
||||||
|
|
||||||
//m_dynamicsWorld->stepSimulation(dts);
|
//m_dynamicsWorld->stepSimulation(dts);
|
||||||
|
|||||||
@@ -1890,6 +1890,9 @@ void ConcaveDemo::clientMoveAndDisplay()
|
|||||||
m_clock.reset();
|
m_clock.reset();
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|||||||
@@ -369,7 +369,12 @@ void RagdollDemo::clientMoveAndDisplay()
|
|||||||
ms = minFPS;
|
ms = minFPS;
|
||||||
|
|
||||||
if (m_dynamicsWorld)
|
if (m_dynamicsWorld)
|
||||||
|
{
|
||||||
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ void UserCollisionAlgorithm::clientMoveAndDisplay()
|
|||||||
|
|
||||||
m_dynamicsWorld->stepSimulation(dt);
|
m_dynamicsWorld->stepSimulation(dt);
|
||||||
|
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|||||||
@@ -453,6 +453,9 @@ void VehicleDemo::clientMoveAndDisplay()
|
|||||||
dt = 1.0/420.f;
|
dt = 1.0/420.f;
|
||||||
|
|
||||||
int numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
|
int numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
|
||||||
|
//optional but useful: debug drawing
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
|
|
||||||
//#define VERBOSE_FEEDBACK
|
//#define VERBOSE_FEEDBACK
|
||||||
#ifdef VERBOSE_FEEDBACK
|
#ifdef VERBOSE_FEEDBACK
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ void btDiscreteDynamicsWorld::saveKinematicState(btScalar timeStep)
|
|||||||
|
|
||||||
void btDiscreteDynamicsWorld::debugDrawWorld()
|
void btDiscreteDynamicsWorld::debugDrawWorld()
|
||||||
{
|
{
|
||||||
if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawWireframe)
|
if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & (btIDebugDraw::DBG_DrawWireframe | btIDebugDraw::DBG_DrawAabb))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -156,6 +156,14 @@ void btDiscreteDynamicsWorld::debugDrawWorld()
|
|||||||
|
|
||||||
debugDrawObject(colObj->getWorldTransform(),colObj->getCollisionShape(),color);
|
debugDrawObject(colObj->getWorldTransform(),colObj->getCollisionShape(),color);
|
||||||
}
|
}
|
||||||
|
if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawAabb))
|
||||||
|
{
|
||||||
|
btPoint3 minAabb,maxAabb;
|
||||||
|
btVector3 colorvec(1,0,0);
|
||||||
|
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
|
||||||
|
m_debugDrawer->drawAabb(minAabb,maxAabb,colorvec);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i=0;i<this->m_vehicles.size();i++)
|
for ( i=0;i<this->m_vehicles.size();i++)
|
||||||
@@ -636,8 +644,6 @@ void btDiscreteDynamicsWorld::updateAabbs()
|
|||||||
{
|
{
|
||||||
PROFILE("updateAabbs");
|
PROFILE("updateAabbs");
|
||||||
|
|
||||||
|
|
||||||
btVector3 colorvec(1,0,0);
|
|
||||||
btTransform predictedTrans;
|
btTransform predictedTrans;
|
||||||
for ( int i=0;i<m_collisionObjects.size();i++)
|
for ( int i=0;i<m_collisionObjects.size();i++)
|
||||||
{
|
{
|
||||||
@@ -646,7 +652,8 @@ void btDiscreteDynamicsWorld::updateAabbs()
|
|||||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||||
if (body)
|
if (body)
|
||||||
{
|
{
|
||||||
// if (body->IsActive() && (!body->IsStatic()))
|
//only update aabb of active objects
|
||||||
|
if (body->isActive())
|
||||||
{
|
{
|
||||||
btPoint3 minAabb,maxAabb;
|
btPoint3 minAabb,maxAabb;
|
||||||
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
|
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
|
||||||
@@ -674,10 +681,6 @@ void btDiscreteDynamicsWorld::updateAabbs()
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawAabb))
|
|
||||||
{
|
|
||||||
m_debugDrawer->drawAabb(minAabb,maxAabb,colorvec);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user