First commit of 2008, Happy New Year!
Add option to compile without btClock and without profiling: comment out USE_BT_CLOCK, and #define BT_NO_PROFILE Fixed typo/case in #include "LinearMath/btQuickProf.h", in SpuParallelSolver.cpp Removed unnecessary files from libxml CMakeLists.txt
This commit is contained in:
@@ -83,7 +83,9 @@ DemoApplication* CreatDemo(btDemoEntry* entry)
|
||||
demo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||
}
|
||||
|
||||
#ifndef BT_NO_PROFILE
|
||||
CProfileManager::Reset();
|
||||
#endif //BT_NO_PROFILE
|
||||
|
||||
return demo;
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ void BasicDemo::clientMoveAndDisplay()
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
//simple dynamics world doesn't handle fixed-time-stepping
|
||||
float ms = m_clock.getTimeMicroseconds();
|
||||
m_clock.reset();
|
||||
float ms = getDeltaTimeMicroseconds();
|
||||
|
||||
///step the simulation
|
||||
if (m_dynamicsWorld)
|
||||
|
||||
@@ -212,9 +212,8 @@ void BspDemo::initPhysics(char* bspfilename)
|
||||
void BspDemo::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
m_dynamicsWorld->stepSimulation(dt);
|
||||
|
||||
//optional but useful: debug drawing
|
||||
|
||||
@@ -226,8 +226,8 @@ void CcdPhysicsDemo::clientMoveAndDisplay()
|
||||
#endif //USE_KINEMATIC_GROUND
|
||||
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
// printf("dt = %f: ",dt);
|
||||
|
||||
if (m_dynamicsWorld)
|
||||
|
||||
@@ -208,8 +208,7 @@ void ColladaDemo::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
m_dynamicsWorld->stepSimulation(dt);
|
||||
|
||||
|
||||
@@ -50,7 +50,9 @@ public:
|
||||
int min_ms;
|
||||
int max_ms;
|
||||
|
||||
#ifdef USE_BT_CLOCK
|
||||
btClock frame_timer;
|
||||
#endif //USE_BT_CLOCK
|
||||
|
||||
btScalar dx;
|
||||
btScalar min_x;
|
||||
@@ -146,7 +148,9 @@ public:
|
||||
|
||||
void cast (btCollisionWorld* cw)
|
||||
{
|
||||
#ifdef USE_BT_CLOCK
|
||||
frame_timer.reset ();
|
||||
#endif //USE_BT_CLOCK
|
||||
for (int i = 0; i < NUMRAYS_IN_BAR; i++)
|
||||
{
|
||||
btCollisionWorld::ClosestConvexResultCallback cb(source[i], dest[i]);
|
||||
@@ -165,7 +169,9 @@ public:
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef USE_BT_CLOCK
|
||||
ms += frame_timer.getTimeMilliseconds ();
|
||||
#endif //USE_BT_CLOCK
|
||||
frame_counter++;
|
||||
if (frame_counter > 50)
|
||||
{
|
||||
@@ -359,8 +365,7 @@ void ConcaveConvexcastDemo::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
if (m_animatedMesh)
|
||||
{
|
||||
|
||||
@@ -308,8 +308,7 @@ void ConcaveDemo::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
if (m_animatedMesh)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,9 @@ public:
|
||||
int min_ms;
|
||||
int max_ms;
|
||||
|
||||
#ifdef USE_BT_CLOCK
|
||||
btClock frame_timer;
|
||||
#endif //USE_BT_CLOCK
|
||||
|
||||
btScalar dx;
|
||||
btScalar min_x;
|
||||
@@ -137,7 +139,10 @@ public:
|
||||
|
||||
void cast (btCollisionWorld* cw)
|
||||
{
|
||||
#ifdef USE_BT_CLOCK
|
||||
frame_timer.reset ();
|
||||
#endif //USE_BT_CLOCK
|
||||
|
||||
for (int i = 0; i < NUMRAYS_IN_BAR; i++)
|
||||
{
|
||||
btCollisionWorld::ClosestRayResultCallback cb(source[i], dest[i]);
|
||||
@@ -154,7 +159,9 @@ public:
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef USE_BT_CLOCK
|
||||
ms += frame_timer.getTimeMilliseconds ();
|
||||
#endif //USE_BT_CLOCK
|
||||
frame_counter++;
|
||||
if (frame_counter > 50)
|
||||
{
|
||||
@@ -333,8 +340,7 @@ void ConcaveRaycastDemo::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
if (m_animatedMesh)
|
||||
{
|
||||
|
||||
@@ -209,8 +209,7 @@ void ConstraintDemo::clientMoveAndDisplay()
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = float(m_clock.getTimeMicroseconds()) * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = float(getDeltaTimeMicroseconds()) * 0.000001f;
|
||||
//printf("dt = %f: ",dt);
|
||||
|
||||
{
|
||||
|
||||
@@ -367,8 +367,7 @@ void ConvexDecompositionDemo::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
m_dynamicsWorld->stepSimulation(dt);
|
||||
|
||||
|
||||
@@ -300,8 +300,7 @@ void MotorDemo::clientMoveAndDisplay()
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
//simple dynamics world doesn't handle fixed-time-stepping
|
||||
float ms = m_clock.getTimeMicroseconds();
|
||||
m_clock.reset();
|
||||
float ms = getDeltaTimeMicroseconds();
|
||||
float minFPS = 1000000.f/60.f;
|
||||
if (ms > minFPS)
|
||||
ms = minFPS;
|
||||
|
||||
@@ -109,8 +109,8 @@ void GenericJointDemo::clientMoveAndDisplay()
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
//simple dynamics world doesn't handle fixed-time-stepping
|
||||
float ms = m_clock.getTimeMicroseconds();
|
||||
m_clock.reset();
|
||||
float ms = getDeltaTimeMicroseconds();
|
||||
|
||||
float minFPS = 1000000.f/60.f;
|
||||
if (ms > minFPS)
|
||||
ms = minFPS;
|
||||
|
||||
@@ -582,7 +582,7 @@ void GimpactConcaveDemo::clientMoveAndDisplay()
|
||||
#endif //USE_KINEMATIC_GROUND
|
||||
|
||||
|
||||
unsigned long int time = m_clock.getTimeMilliseconds();
|
||||
unsigned long int time = getDeltaTimeMicroseconds()/btScalar(1000);
|
||||
printf("%i time %i ms \n",m_steps_done,time);
|
||||
|
||||
//#ifdef BULLET_GIMPACT
|
||||
@@ -596,7 +596,6 @@ void GimpactConcaveDemo::clientMoveAndDisplay()
|
||||
|
||||
|
||||
|
||||
m_clock.reset();
|
||||
m_dynamicsWorld->stepSimulation(dt);
|
||||
|
||||
//optional but useful: debug drawing
|
||||
|
||||
@@ -1886,8 +1886,8 @@ void ConcaveDemo::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = float(m_clock.getTimeMicroseconds()) * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = float(getDeltaTimeMicroseconds()) * 0.000001f;
|
||||
|
||||
m_dynamicsWorld->stepSimulation(dt);
|
||||
|
||||
//optional but useful: debug drawing
|
||||
|
||||
@@ -137,8 +137,8 @@ void MultiThreadedDemo::clientMoveAndDisplay()
|
||||
|
||||
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
// printf("dt = %f: ",dt);
|
||||
|
||||
if (m_dynamicsWorld)
|
||||
|
||||
@@ -72,15 +72,19 @@ m_shootBoxShape(0),
|
||||
m_singleStep(false),
|
||||
m_idle(false)
|
||||
{
|
||||
#ifndef BT_NO_PROFILE
|
||||
m_profileIterator = CProfileManager::Get_Iterator();
|
||||
#endif //BT_NO_PROFILE
|
||||
}
|
||||
|
||||
|
||||
|
||||
DemoApplication::~DemoApplication()
|
||||
{
|
||||
|
||||
#ifndef BT_NO_PROFILE
|
||||
CProfileManager::Release_Iterator(m_profileIterator);
|
||||
#endif //BT_NO_PROFILE
|
||||
|
||||
if (m_shootBoxShape)
|
||||
delete m_shootBoxShape;
|
||||
|
||||
@@ -242,6 +246,7 @@ void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
|
||||
|
||||
m_lastKey = 0;
|
||||
|
||||
#ifndef BT_NO_PROFILE
|
||||
if (key >= 0x31 && key < 0x37)
|
||||
{
|
||||
int child = key-0x31;
|
||||
@@ -251,7 +256,7 @@ void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
|
||||
{
|
||||
m_profileIterator->Enter_Parent();
|
||||
}
|
||||
|
||||
#endif //BT_NO_PROFILE
|
||||
|
||||
switch (key)
|
||||
{
|
||||
@@ -789,6 +794,7 @@ void DemoApplication::displayProfileString(int xOffset,int yStart,char* message)
|
||||
|
||||
void DemoApplication::showProfileInfo(float& xOffset,float& yStart, float yIncr)
|
||||
{
|
||||
#ifndef BT_NO_PROFILE
|
||||
|
||||
static double time_since_reset = 0.f;
|
||||
if (!m_idle)
|
||||
@@ -851,6 +857,7 @@ void DemoApplication::showProfileInfo(float& xOffset,float& yStart, float yIncr)
|
||||
yStart += yIncr;
|
||||
|
||||
}
|
||||
#endif//BT_NO_PROFILE
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,8 +44,9 @@ class DemoApplication
|
||||
class CProfileIterator* m_profileIterator;
|
||||
|
||||
protected:
|
||||
|
||||
#ifdef USE_BT_CLOCK
|
||||
btClock m_clock;
|
||||
#endif //USE_BT_CLOCK
|
||||
|
||||
///this is the most important class
|
||||
btDynamicsWorld* m_dynamicsWorld;
|
||||
@@ -127,6 +128,16 @@ public:
|
||||
return m_cameraTargetPosition;
|
||||
}
|
||||
|
||||
btScalar getDeltaTimeMicroseconds()
|
||||
{
|
||||
#ifdef USE_BT_CLOCK
|
||||
btScalar dt = m_clock.getTimeMicroseconds();
|
||||
m_clock.reset();
|
||||
return dt;
|
||||
#else
|
||||
return btScalar(16666.);
|
||||
#endif
|
||||
}
|
||||
|
||||
///glut callbacks
|
||||
|
||||
|
||||
@@ -364,8 +364,8 @@ void RagdollDemo::clientMoveAndDisplay()
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
//simple dynamics world doesn't handle fixed-time-stepping
|
||||
float ms = m_clock.getTimeMicroseconds();
|
||||
m_clock.reset();
|
||||
float ms = getDeltaTimeMicroseconds();
|
||||
|
||||
float minFPS = 1000000.f/60.f;
|
||||
if (ms > minFPS)
|
||||
ms = minFPS;
|
||||
|
||||
@@ -142,8 +142,8 @@ void UserCollisionAlgorithm::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
|
||||
m_dynamicsWorld->stepSimulation(dt);
|
||||
|
||||
|
||||
@@ -440,8 +440,8 @@ void VehicleDemo::clientMoveAndDisplay()
|
||||
}
|
||||
|
||||
|
||||
float dt = m_clock.getTimeMicroseconds() * 0.000001f;
|
||||
m_clock.reset();
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
if (m_dynamicsWorld)
|
||||
{
|
||||
//during idle mode, just run 1 simulation step maximum
|
||||
|
||||
Reference in New Issue
Block a user