Make BenchmarkDemo a console application, without OpenGL/Glut dependency.

Fix potential division by zero when enabling convex distance utility.
Thanks to linzner http://code.google.com/p/bullet/issues/detail?id=264
This commit is contained in:
erwin.coumans
2009-08-12 08:18:57 +00:00
parent ae3255f5e9
commit e89fe1cbfa
17 changed files with 152 additions and 90 deletions

View File

@@ -27,7 +27,6 @@ ADD_EXECUTABLE(AppAllBulletDemos
DemoEntries.cpp DemoEntries.cpp
../CcdPhysicsDemo/CcdPhysicsDemo.cpp ../CcdPhysicsDemo/CcdPhysicsDemo.cpp
../BasicDemo/BasicDemo.cpp ../BasicDemo/BasicDemo.cpp
../Benchmarks/BenchmarkDemo.cpp
../BspDemo/BspDemo.cpp ../BspDemo/BspDemo.cpp
../BspDemo/BspConverter.cpp ../BspDemo/BspConverter.cpp
../BspDemo/BspLoader.cpp ../BspDemo/BspLoader.cpp

View File

@@ -30,7 +30,7 @@ subject to the following restrictions:
#include "../GjkConvexCastDemo/LinearConvexCastDemo.h" #include "../GjkConvexCastDemo/LinearConvexCastDemo.h"
#include "../ForkLiftDemo/ForkLiftDemo.h" #include "../ForkLiftDemo/ForkLiftDemo.h"
#include "../ConstraintDemo/ConstraintDemo.h" #include "../ConstraintDemo/ConstraintDemo.h"
#include "../Benchmarks/BenchmarkDemo.h" //#include "../Benchmarks/BenchmarkDemo.h"
#include "../SoftDemo/SoftDemo.h" #include "../SoftDemo/SoftDemo.h"
#include "GLDebugFont.h" #include "GLDebugFont.h"
@@ -109,12 +109,13 @@ btDemoEntry g_demoEntries[] =
{"ForkLift Demo",ForkLiftDemo::Create}, {"ForkLift Demo",ForkLiftDemo::Create},
{"Ragdoll Demo",RagdollDemo::Create}, {"Ragdoll Demo",RagdollDemo::Create},
{"Basic Demo", BasicDemo::Create}, {"Basic Demo", BasicDemo::Create},
{"CcdPhysicsDemo", CcdPhysicsDemo::Create},
{"Convex Decomposition",ConvexDecompositionDemo::Create}, {"Convex Decomposition",ConvexDecompositionDemo::Create},
{"Concave Moving", GimpactConcaveDemo::Create}, {"Concave Moving", GimpactConcaveDemo::Create},
{"Dynamic Control Demo",MotorDemo::Create}, {"Dynamic Control Demo",MotorDemo::Create},
//{"ConcaveDemo",ConcaveDemo::Create}, {"ConcaveDemo",ConcaveDemo::Create},
{"Concave Convexcast Demo",ConcaveConvexcastDemo::Create}, {"Concave Convexcast Demo",ConcaveConvexcastDemo::Create},
// {"SoftBody Cloth",SoftDemo0::Create}, {"SoftBody Cloth",SoftDemo0::Create},
{"SoftBody Ropes Attach",SoftDemo4::Create}, {"SoftBody Ropes Attach",SoftDemo4::Create},
{"SoftBody Cloth Attach",SoftDemo5::Create}, {"SoftBody Cloth Attach",SoftDemo5::Create},
@@ -125,12 +126,12 @@ btDemoEntry g_demoEntries[] =
{"SoftBody Cluster Robot",SoftDemo25::Create}, {"SoftBody Cluster Robot",SoftDemo25::Create},
// {"SoftBody Ropes",SoftDemo3::Create}, // {"SoftBody Ropes",SoftDemo3::Create},
{"SoftBody Sticks",SoftDemo6::Create}, {"SoftBody Sticks",SoftDemo6::Create},
// {"SoftBody Collide",SoftDemo7::Create}, {"SoftBody Collide",SoftDemo7::Create},
// {"SoftBody Collide2",SoftDemo8::Create}, {"SoftBody Collide2",SoftDemo8::Create},
// {"SoftBody Collide3",SoftDemo9::Create}, // {"SoftBody Collide3",SoftDemo9::Create},
// {"SoftBody Impact",SoftDemo10::Create}, // {"SoftBody Impact",SoftDemo10::Create},
{"SoftBody Aero",SoftDemo11::Create}, {"SoftBody Aero",SoftDemo11::Create},
// {"SoftBody Friction",SoftDemo12::Create}, {"SoftBody Friction",SoftDemo12::Create},
// {"SoftBody Torus",SoftDemo13::Create}, // {"SoftBody Torus",SoftDemo13::Create},
// {"SoftBody Torus Match",SoftDemo14::Create}, // {"SoftBody Torus Match",SoftDemo14::Create},
// {"SoftBody Bunny",SoftDemo15::Create}, // {"SoftBody Bunny",SoftDemo15::Create},
@@ -140,24 +141,24 @@ btDemoEntry g_demoEntries[] =
// {"SoftBody Cluster Collide2",SoftDemo20::Create}, // {"SoftBody Cluster Collide2",SoftDemo20::Create},
// {"SoftBody Cluster Socket",SoftDemo21::Create}, // {"SoftBody Cluster Socket",SoftDemo21::Create},
// {"SoftBody Cluster Hinge",SoftDemo22::Create}, {"SoftBody Cluster Hinge",SoftDemo22::Create},
// {"SoftBody Cluster Combine",SoftDemo23::Create}, {"SoftBody Cluster Combine",SoftDemo23::Create},
// {"SoftBody Cluster Stack Soft",SoftDemo26::Create}, // {"SoftBody Cluster Stack Soft",SoftDemo26::Create},
{"SoftBody Cluster Stack Mixed",SoftDemo27::Create}, {"SoftBody Cluster Stack Mixed",SoftDemo27::Create},
// {"SliderConstraint",SliderConstraintDemo::Create}, // {"SliderConstraint",SliderConstraintDemo::Create},
{"CcdPhysicsDemo", CcdPhysicsDemo::Create},
// {"ConcaveRaycastDemo",ConcaveRaycastDemo::Create}, // {"ConcaveRaycastDemo",ConcaveRaycastDemo::Create},
//{"BspDemo", BspDemo::Create}, //{"BspDemo", BspDemo::Create},
// {"Raytracer Test",Raytracer::Create}, // {"Raytracer Test",Raytracer::Create},
// {"GjkConvexCast",LinearConvexCastDemo::Create}, // {"GjkConvexCast",LinearConvexCastDemo::Create},
{"Benchmark 3000 FALL",BenchmarkDemo1::Create}, // {"Benchmark 3000 FALL",BenchmarkDemo1::Create},
{"Benchmark 1000 STACK",BenchmarkDemo2::Create}, // {"Benchmark 1000 STACK",BenchmarkDemo2::Create},
{"Benchmark 136 RAGDOLLS",BenchmarkDemo3::Create}, // {"Benchmark 136 RAGDOLLS",BenchmarkDemo3::Create},
{"Benchmark 1000 CONVEX",BenchmarkDemo4::Create}, // {"Benchmark 1000 CONVEX",BenchmarkDemo4::Create},
{"Benchmark Mesh-Prim",BenchmarkDemo5::Create}, // {"Benchmark Mesh-Prim",BenchmarkDemo5::Create},
{"Benchmark Mesh-Convex",BenchmarkDemo6::Create}, // {"Benchmark Mesh-Convex",BenchmarkDemo6::Create},
{"Benchmark Raycast",BenchmarkDemo7::Create}, // {"Benchmark Raycast",BenchmarkDemo7::Create},
{"MemoryLeak Checker",btEmptyDebugDemo::Create}, {"MemoryLeak Checker",btEmptyDebugDemo::Create},
{0, 0} {0, 0}

View File

@@ -4,7 +4,6 @@ FrameWorkDemo AllBulletDemos :
[ Wildcard *.h *.cpp ] [ Wildcard *.h *.cpp ]
../CcdPhysicsDemo/CcdPhysicsDemo.cpp ../CcdPhysicsDemo/CcdPhysicsDemo.cpp
../BasicDemo/BasicDemo.cpp ../BasicDemo/BasicDemo.cpp
../Benchmarks/BenchmarkDemo.cpp
../BspDemo/BspDemo.cpp ../BspDemo/BspDemo.cpp
../BspDemo/BspConverter.cpp ../BspDemo/BspConverter.cpp
../BspDemo/BspLoader.cpp ../BspDemo/BspLoader.cpp

View File

@@ -2,7 +2,6 @@ noinst_PROGRAMS=AllBulletDemo
AllBulletDemo_SOURCES=\ AllBulletDemo_SOURCES=\
../SoftDemo/SoftDemo.cpp \ ../SoftDemo/SoftDemo.cpp \
../Benchmarks/BenchmarkDemo.cpp \
../ConstraintDemo/ConstraintDemo.cpp \ ../ConstraintDemo/ConstraintDemo.cpp \
../ForkLiftDemo/ForkLiftDemo.cpp \ ../ForkLiftDemo/ForkLiftDemo.cpp \
../RagdollDemo/RagdollDemo.cpp \ ../RagdollDemo/RagdollDemo.cpp \
@@ -30,6 +29,5 @@ AllBulletDemo_CXXFLAGS=\
-I@top_builddir@/Extras \ -I@top_builddir@/Extras \
-I@top_builddir@/Demos/OpenGL \ -I@top_builddir@/Demos/OpenGL \
-I@top_builddir@/Demos/SoftDemo \ -I@top_builddir@/Demos/SoftDemo \
-I@top_builddir@/Demos/Benchmarks \
$(CXXFLAGS) $(CXXFLAGS)
AllBulletDemo_LDADD=-L../OpenGL -lbulletopenglsupport -L../../src -L../../Extras -lgimpactutils -lconvexdecomposition -lbulletsoftbody -lbulletdynamics -lbulletcollision -lbulletmath -lglui @opengl_LIBS@ AllBulletDemo_LDADD=-L../OpenGL -lbulletopenglsupport -L../../src -L../../Extras -lgimpactutils -lconvexdecomposition -lbulletsoftbody -lbulletdynamics -lbulletcollision -lbulletmath -lglui @opengl_LIBS@

View File

@@ -16,10 +16,11 @@ subject to the following restrictions:
// Collision Radius // Collision Radius
#define COLLISION_RADIUS 0.0f #define COLLISION_RADIUS 0.0f
#include "BenchmarkDemo.h" #include "BenchmarkDemo.h"
#ifdef USE_GLUT_DEMO_APPLICATION
#include "GlutStuff.h" #include "GlutStuff.h"
#endif //USE_GLUT_DEMO_APPLICATION
///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files. ///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
#include "btBulletDynamicsCommon.h" #include "btBulletDynamicsCommon.h"
#include <stdio.h> //printf debugging #include <stdio.h> //printf debugging
@@ -177,6 +178,7 @@ public:
void draw () void draw ()
{ {
#ifdef USE_GLUT_DEMO_APPLICATION
glDisable (GL_LIGHTING); glDisable (GL_LIGHTING);
glColor3f (0.0, 1.0, 0.0); glColor3f (0.0, 1.0, 0.0);
glBegin (GL_LINES); glBegin (GL_LINES);
@@ -204,6 +206,8 @@ public:
} }
glEnd (); glEnd ();
glEnable (GL_LIGHTING); glEnable (GL_LIGHTING);
#endif //USE_GLUT_DEMO_APPLICATION
} }
}; };
@@ -213,7 +217,9 @@ static btRaycastBar2 raycastBar;
void BenchmarkDemo::clientMoveAndDisplay() void BenchmarkDemo::clientMoveAndDisplay()
{ {
#ifdef USE_GLUT_DEMO_APPLICATION
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#endif //USE_GLUT_DEMO_APPLICATION
//simple dynamics world doesn't handle fixed-time-stepping //simple dynamics world doesn't handle fixed-time-stepping
float ms = getDeltaTimeMicroseconds(); float ms = getDeltaTimeMicroseconds();
@@ -236,16 +242,20 @@ void BenchmarkDemo::clientMoveAndDisplay()
renderme(); renderme();
#ifdef USE_GLUT_DEMO_APPLICATION
glFlush(); glFlush();
glutSwapBuffers(); glutSwapBuffers();
#endif //USE_GLUT_DEMO_APPLICATION
} }
void BenchmarkDemo::displayCallback(void) { void BenchmarkDemo::displayCallback(void)
{
#ifdef USE_GLUT_DEMO_APPLICATION
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
renderme(); renderme();
@@ -256,6 +266,7 @@ void BenchmarkDemo::displayCallback(void) {
glFlush(); glFlush();
glutSwapBuffers(); glutSwapBuffers();
#endif //USE_GLUT_DEMO_APPLICATION
} }
@@ -1213,5 +1224,26 @@ void BenchmarkDemo::exitPhysics()
#ifndef USE_GLUT_DEMO_APPLICATION
btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape)
{
btAssert((!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE));
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
if (isDynamic)
shape->calculateLocalInertia(mass,localInertia);
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btRigidBody* body = new btRigidBody(mass,0,shape,localInertia);
body->setWorldTransform(startTransform);
m_dynamicsWorld->addRigidBody(body);
return body;
}
#endif //USE_GLUT_DEMO_APPLICATION

View File

@@ -15,10 +15,15 @@ subject to the following restrictions:
#ifndef BENCHMARK_DEMO_H #ifndef BENCHMARK_DEMO_H
#define BENCHMARK_DEMO_H #define BENCHMARK_DEMO_H
#include "GlutDemoApplication.h"
#include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btTransform.h"
class btDynamicsWorld;
#define NUMRAYS 500 #define NUMRAYS 500
class btRigidBody;
class btBroadphaseInterface; class btBroadphaseInterface;
class btCollisionShape; class btCollisionShape;
class btOverlappingPairCache; class btOverlappingPairCache;
@@ -27,8 +32,39 @@ class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc; struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration; class btDefaultCollisionConfiguration;
#ifndef USE_GLUT_DEMO_APPLICATION
///empty placeholder
class DemoApplication
{
protected:
btDynamicsWorld* m_dynamicsWorld;
public:
virtual void myinit() {}
virtual btDynamicsWorld* getDynamicsWorld()
{
return m_dynamicsWorld;
}
btScalar getDeltaTimeMicroseconds()
{
return 1.f;
}
void renderme() {}
void setCameraDistance(btScalar dist){}
void clientResetScene(){}
btRigidBody* localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape);
};
///BenchmarkDemo is provides several performance tests ///BenchmarkDemo is provides several performance tests
class BenchmarkDemo : public DemoApplication
#else
#include "GlutDemoApplication.h"
class BenchmarkDemo : public GlutDemoApplication class BenchmarkDemo : public GlutDemoApplication
#endif
{ {
//keep the collision shapes, for deletion/cleanup //keep the collision shapes, for deletion/cleanup

View File

@@ -15,7 +15,7 @@ ${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL }
) )
LINK_LIBRARIES( LINK_LIBRARIES(
OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} BulletDynamics BulletCollision LinearMath
) )
ADD_EXECUTABLE(AppBenchmarks ADD_EXECUTABLE(AppBenchmarks

View File

@@ -1,3 +1,3 @@
SubDir TOP Demos Benchmarks ; SubDir TOP Demos Benchmarks ;
BulletDemo Benchmarks : [ Wildcard *.h *.cpp ] ; BulletBasicDemo Benchmarks : [ Wildcard *.h *.cpp ] ;

View File

@@ -14,32 +14,70 @@ subject to the following restrictions:
*/ */
#include "BenchmarkDemo.h" #include "BenchmarkDemo.h"
#include "GlutStuff.h"
#include "GLDebugDrawer.h"
#include "btBulletDynamicsCommon.h" #include "btBulletDynamicsCommon.h"
#include "LinearMath/btHashMap.h" #include "LinearMath/btHashMap.h"
#include <stdio.h>
#ifdef USE_GLUT_DEMO_APPLICATION
#include "GlutStuff.h"
#include "GLDebugDrawer.h"
GLDebugDrawer gDebugDrawer;
#endif //USE_GLUT_DEMO_APPLICATION
#define NUM_DEMOS 7
#define NUM_TESTS 650
extern bool gDisableDeactivation;
int main(int argc,char** argv) int main(int argc,char** argv)
{ {
GLDebugDrawer gDebugDrawer; gDisableDeactivation = true;
// BenchmarkDemo1 benchmarkDemo; BenchmarkDemo1 benchmarkDemo1;
// BenchmarkDemo2 benchmarkDemo; BenchmarkDemo2 benchmarkDemo2;
// BenchmarkDemo3 benchmarkDemo; BenchmarkDemo3 benchmarkDemo3;
BenchmarkDemo4 benchmarkDemo; BenchmarkDemo4 benchmarkDemo4;
// BenchmarkDemo5 benchmarkDemo; BenchmarkDemo5 benchmarkDemo5;
// BenchmarkDemo6 benchmarkDemo; BenchmarkDemo6 benchmarkDemo6;
// BenchmarkDemo7 benchmarkDemo; BenchmarkDemo7 benchmarkDemo7;
BenchmarkDemo* demoArray[NUM_DEMOS] = {&benchmarkDemo1,&benchmarkDemo2,&benchmarkDemo3,&benchmarkDemo4,&benchmarkDemo5,&benchmarkDemo6,&benchmarkDemo7};
char* demoNames[NUM_DEMOS] = {"3000 fall", "1000 stack", "136 ragdolls","1000 convex", "prim-trimesh", "convex-trimesh","raytests"};
float totalTime[NUM_DEMOS] = {0.f,0.f,0.f,0.f,0.f,0.f,0.f};
benchmarkDemo.initPhysics(); #ifdef USE_GLUT_DEMO_APPLICATION
benchmarkDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer); benchmarkDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&benchmarkDemo); return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&benchmarkDemo);
#else
//default glut doesn't return from mainloop int d;
for (d=0;d<NUM_DEMOS;d++)
{
demoArray[d]->initPhysics();
for (int i=0;i<NUM_TESTS;i++)
{
demoArray[d]->clientMoveAndDisplay();
float frameTime = CProfileManager::Get_Time_Since_Reset();
if ((i % 25)==0)
{
printf("BenchmarkDemo: %s, Frame %d, Duration (ms): %f\n",demoNames[d],i,frameTime);
}
totalTime[d] += frameTime;
if (i==NUM_TESTS-1)
CProfileManager::dumpAll();
}
}
for (d=0;d<NUM_DEMOS;d++)
{
printf("\nResults for %s: %f",demoNames[d],totalTime[d]*(1.f/NUM_TESTS));
}
#endif
return 0; return 0;
} }

View File

@@ -345,6 +345,7 @@ void ConstraintDemo::initPhysics()
btVector3 parentAxis(1.f, 0.f, 0.f); btVector3 parentAxis(1.f, 0.f, 0.f);
btVector3 childAxis(0.f, 0.f, 1.f); btVector3 childAxis(0.f, 0.f, 1.f);
btVector3 anchor(20.f, 2.f, 0.f); btVector3 anchor(20.f, 2.f, 0.f);
btUniversalConstraint* pUniv = new btUniversalConstraint(*pBodyA, *pBodyB, anchor, parentAxis, childAxis); btUniversalConstraint* pUniv = new btUniversalConstraint(*pBodyA, *pBodyB, anchor, parentAxis, childAxis);
pUniv->setLowerLimit(-SIMD_HALF_PI * 0.5f, -SIMD_HALF_PI * 0.5f); pUniv->setLowerLimit(-SIMD_HALF_PI * 0.5f, -SIMD_HALF_PI * 0.5f);
pUniv->setUpperLimit(SIMD_HALF_PI * 0.5f, SIMD_HALF_PI * 0.5f); pUniv->setUpperLimit(SIMD_HALF_PI * 0.5f, SIMD_HALF_PI * 0.5f);

View File

@@ -18,13 +18,8 @@ subject to the following restrictions:
///ContinuousConvexCollisionDemo shows the working of the continuous collision detection, including linear and angular motion ///ContinuousConvexCollisionDemo shows the working of the continuous collision detection, including linear and angular motion
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
class btContinuousConvexCollisionDemo : public Win32DemoApplication
#else
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
class btContinuousConvexCollisionDemo : public GlutDemoApplication class btContinuousConvexCollisionDemo : public GlutDemoApplication
#endif
{ {
public: public:

View File

@@ -63,7 +63,7 @@ btTransform toTrans[maxNumObjects];
int screenWidth = 640; int screenWidth = 640;
int screenHeight = 480; int screenHeight = 480;
#ifndef _WINDOWS
int main(int argc,char** argv) int main(int argc,char** argv)
{ {
btContinuousConvexCollisionDemo* ccdDemo = new btContinuousConvexCollisionDemo(); btContinuousConvexCollisionDemo* ccdDemo = new btContinuousConvexCollisionDemo();
@@ -74,16 +74,6 @@ int main(int argc,char** argv)
return glutmain(argc, argv,screenWidth,screenHeight,"Continuous Convex Collision Demo",ccdDemo); return glutmain(argc, argv,screenWidth,screenHeight,"Continuous Convex Collision Demo",ccdDemo);
} }
#else
DemoApplication* createDemo()
{
btContinuousConvexCollisionDemo* ccdDemo = new btContinuousConvexCollisionDemo();
ccdDemo->setCameraDistance(40.f);
return ccdDemo;
}
#endif //_WINDOWS
void btContinuousConvexCollisionDemo::initPhysics() void btContinuousConvexCollisionDemo::initPhysics()

View File

@@ -5,7 +5,6 @@
#include "GLDebugDrawer.h" #include "GLDebugDrawer.h"
#include "btBulletDynamicsCommon.h" #include "btBulletDynamicsCommon.h"
#ifndef _WINDOWS
GLDebugDrawer gDebugDrawer; GLDebugDrawer gDebugDrawer;
@@ -31,10 +30,3 @@ int main(int argc,char** argv)
return 0; return 0;
} }
#else
DemoApplication* createDemo()
{
ConvexDecompositionDemo* convexDecompDemo = new ConvexDecompositionDemo();
return convexDecompDemo;
}
#endif _WINDOWS

View File

@@ -1,5 +1,5 @@
#ifndef _WINDOWS
#include "GlutDemoApplication.h" #include "GlutDemoApplication.h"
#include "GlutStuff.h" #include "GlutStuff.h"
@@ -81,5 +81,5 @@ void GlutDemoApplication::swapBuffers()
} }
#endif //_WINDOWS

View File

@@ -70,7 +70,7 @@ static void glutDisplayCallback(void)
gDemoApplication->displayCallback(); gDemoApplication->displayCallback();
} }
#ifndef _WINDOWS
int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp) { int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp) {
gDemoApplication = demoApp; gDemoApplication = demoApp;
@@ -104,4 +104,4 @@ int glutmain(int argc, char **argv,int width,int height,const char* title,DemoAp
return 0; return 0;
} }
#endif //_WINDOWS

View File

@@ -34,26 +34,7 @@ subject to the following restrictions:
#endif #endif
#endif #endif
#ifdef _WINDOWS
#define BT_KEY_K 'K'
#define BT_KEY_LEFT VK_LEFT
#define BT_KEY_RIGHT VK_RIGHT
#define BT_KEY_UP VK_UP
#define BT_KEY_DOWN VK_DOWN
#define BT_KEY_F1 VK_F1
#define BT_KEY_F2 VK_F2
#define BT_KEY_F3 VK_F3
#define BT_KEY_F4 VK_F4
#define BT_KEY_F5 VK_F5
#define BT_KEY_PAGEUP VK_PRIOR
#define BT_KEY_PAGEDOWN VK_NEXT
#define BT_KEY_END VK_END
#define BT_KEY_HOME VK_HOME
#define BT_ACTIVE_ALT VK_LMENU
#else
#define BT_KEY_K 'k' #define BT_KEY_K 'k'
#define BT_KEY_LEFT GLUT_KEY_LEFT #define BT_KEY_LEFT GLUT_KEY_LEFT
#define BT_KEY_RIGHT GLUT_KEY_RIGHT #define BT_KEY_RIGHT GLUT_KEY_RIGHT
@@ -72,7 +53,6 @@ subject to the following restrictions:
#define BT_ACTIVE_CTRL GLUT_ACTIVE_ALT #define BT_ACTIVE_CTRL GLUT_ACTIVE_ALT
#define BT_ACTIVE_SHIFT GLUT_ACTIVE_SHIFT #define BT_ACTIVE_SHIFT GLUT_ACTIVE_SHIFT
#endif
#if BT_USE_FREEGLUT #if BT_USE_FREEGLUT

View File

@@ -215,9 +215,10 @@ void btConvexConvexAlgorithm ::processCollision (btCollisionObject* body0,btColl
#ifdef USE_SEPDISTANCE_UTIL2 #ifdef USE_SEPDISTANCE_UTIL2
if (dispatchInfo.m_useConvexConservativeDistanceUtil) if (dispatchInfo.m_useConvexConservativeDistanceUtil)
{ {
sepDist = gjkPairDetector.getCachedSeparatingDistance()+dispatchInfo.m_convexConservativeDistanceThreshold; sepDist = gjkPairDetector.getCachedSeparatingDistance();
if (sepDist>SIMD_EPSILON) if (sepDist>SIMD_EPSILON)
{ {
sepDist += dispatchInfo.m_convexConservativeDistanceThreshold;
//now perturbe directions to get multiple contact points //now perturbe directions to get multiple contact points
sepNormalWorldSpace = gjkPairDetector.getCachedSeparatingAxis().normalized(); sepNormalWorldSpace = gjkPairDetector.getCachedSeparatingAxis().normalized();
btPlaneSpace1(sepNormalWorldSpace,v0,v1); btPlaneSpace1(sepNormalWorldSpace,v0,v1);