Added method to collect all persistent contact manifolds, given a btBroadphasePair (collision algorithm)

virtual	void	getAllContactManifolds(btManifoldArray&	manifoldArray)
See Demos/CharacterDemo/CharacterDemo.cpp for example usage of getAllContactManifolds
Added btDbvtBroadphase to btBulletCollisionCommon.h headerfile
Enable soft body vs concave (albeit slow)
Improved contact point debug rendering (moved from constraint solver into debugDrawWorld)
This commit is contained in:
erwin.coumans
2008-05-24 04:23:00 +00:00
parent 6141a55f09
commit f8e5481612
37 changed files with 889 additions and 633 deletions

View File

@@ -50,7 +50,7 @@ namespace
float viewY = 0.0f;
int tx, ty, tw, th;
int gDrawAabb=0;
int gDebugDraw=0;
int gWireFrame=0;
int gDebugContacts=0;
int gDebugNoDeactivation = 0;
}
@@ -120,7 +120,7 @@ void SimulationLoop()
{
demo->setDebugMode(demo->getDebugMode() & (~btIDebugDraw::DBG_DrawAabb));
}
if (gDebugDraw)
if (gWireFrame)
{
demo->setDebugMode(demo->getDebugMode() |btIDebugDraw::DBG_DrawWireframe);
} else
@@ -284,7 +284,7 @@ int main(int argc, char** argv)
GLUI_Panel* drawPanel = glui->add_panel("Draw");
glui->add_checkbox_to_panel(drawPanel, "AABBs", &gDrawAabb);
glui->add_checkbox_to_panel(drawPanel, "DebugDrawer", &gDebugDraw);
glui->add_checkbox_to_panel(drawPanel, "Wireframe", &gWireFrame);
glui->add_checkbox_to_panel(drawPanel, "Contacts", &gDebugContacts);
// glui->add_checkbox_to_panel(drawPanel, "Impulses", &settings.drawImpulses);

View File

@@ -274,7 +274,6 @@ void BenchmarkDemo::initPhysics()
btVector3 worldAabbMax(10000,10000,10000);
m_overlappingPairCache = new btAxisSweep3(worldAabbMin,worldAabbMax,3500);
//m_overlappingPairCache = new btDbvtBroadphase();
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver;

View File

@@ -147,7 +147,8 @@ void BspDemo::initPhysics(char* bspfilename)
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldMin(-1000,-1000,-1000);
btVector3 worldMax(1000,1000,1000);
m_broadphase = new btAxisSweep3(worldMin,worldMax);
m_broadphase = new btDbvtBroadphase();
//m_broadphase = new btAxisSweep3(worldMin,worldMax);
//btOverlappingPairCache* broadphase = new btSimpleBroadphase();
m_solver = new btSequentialImpulseConstraintSolver();
//ConstraintSolver* solver = new OdeConstraintSolver;
@@ -235,6 +236,9 @@ void BspDemo::displayCallback(void) {
renderme();
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
glFlush();
glutSwapBuffers();

View File

@@ -240,7 +240,7 @@ void CcdPhysicsDemo::clientMoveAndDisplay()
//optional but useful: debug drawing
m_dynamicsWorld->debugDrawWorld();
#ifdef VERBOSE_TIMESTEPPING_CONSOLEOUTPUT
if (!numSimSteps)
printf("Interpolated transforms\n");
@@ -295,9 +295,12 @@ void CcdPhysicsDemo::displayCallback(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
renderme();
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
glFlush();
glutSwapBuffers();
}

File diff suppressed because it is too large Load Diff

View File

@@ -41,6 +41,8 @@ class CharacterDemo : public DemoApplication
class btTriangleIndexVertexArray* m_indexVertexArrays;
class MyCustomOverlappingPairCallback* m_customPairCallback;
btVector3* m_vertices;

View File

@@ -1,7 +1,10 @@
#include "CharacterDemo.h"
#include "GlutStuff.h"
#include "GLDebugDrawer.h"
#include "btBulletDynamicsCommon.h"
GLDebugDrawer gDebugDrawer;
int main(int argc,char** argv)
{
@@ -9,6 +12,7 @@ int main(int argc,char** argv)
CharacterDemo* characterDemo = new CharacterDemo;
characterDemo->initPhysics();
characterDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
return glutmain(argc, argv,640,480,"Bullet Character Demo. http://www.continuousphysics.com/Bullet/phpBB2/", characterDemo);
}

View File

@@ -351,6 +351,7 @@ void ConcaveDemo::clientMoveAndDisplay()
//optional but useful: debug drawing
m_dynamicsWorld->debugDrawWorld();
renderme();
@@ -368,6 +369,11 @@ void ConcaveDemo::displayCallback(void) {
renderme();
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
glFlush();
glutSwapBuffers();
}

View File

@@ -628,6 +628,10 @@ void GimpactConcaveDemo::displayCallback(void) {
renderme();
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
glFlush();
glutSwapBuffers();
}

View File

@@ -1909,6 +1909,10 @@ void ConcaveDemo::displayCallback(void) {
renderme();
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
glFlush();
glutSwapBuffers();
}

View File

@@ -212,6 +212,10 @@ void MultiThreadedDemo::displayCallback(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
renderme();

View File

@@ -68,7 +68,7 @@ void GLDebugDrawer::reportErrorWarning(const char* warningString)
void GLDebugDrawer::drawContactPoint(const btVector3& pointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)
{
if (m_debugMode & btIDebugDraw::DBG_DrawContactPoints)
{
btVector3 to=pointOnB+normalOnB*distance;
const btVector3&from = pointOnB;

View File

@@ -373,9 +373,11 @@ void RagdollDemo::clientMoveAndDisplay()
if (m_dynamicsWorld)
{
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
//optional but useful: debug drawing
m_dynamicsWorld->debugDrawWorld();
}
renderme();
@@ -391,6 +393,10 @@ void RagdollDemo::displayCallback()
renderme();
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
glFlush();
glutSwapBuffers();
}

View File

@@ -1,13 +1,17 @@
#include "RagdollDemo.h"
#include "GlutStuff.h"
#include "GLDebugDrawer.h"
#include "btBulletDynamicsCommon.h"
GLDebugDrawer gDebugDrawer;
int main(int argc,char* argv[])
{
RagdollDemo demoApp;
demoApp.initPhysics();
demoApp.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",&demoApp);
}

View File

@@ -1182,7 +1182,7 @@ void SoftDemo::initPhysics()
btCollisionShape* groundShape = 0;
bool useConcaveMesh = false;//not ready yet true;
bool useConcaveMesh = true;//not ready yet true;
if (useConcaveMesh)
{

View File

@@ -450,9 +450,7 @@ void VehicleDemo::clientMoveAndDisplay()
dt = 1.0/420.f;
int numSimSteps = m_dynamicsWorld->stepSimulation(dt,maxSimSubSteps);
//optional but useful: debug drawing
m_dynamicsWorld->debugDrawWorld();
//#define VERBOSE_FEEDBACK
#ifdef VERBOSE_FEEDBACK
@@ -486,6 +484,10 @@ void VehicleDemo::clientMoveAndDisplay()
renderme();
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
#ifdef USE_QUICKPROF
btProfiler::endBlock("render");
#endif
@@ -504,6 +506,9 @@ void VehicleDemo::displayCallback(void)
renderme();
//optional but useful: debug drawing
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
glFlush();
glutSwapBuffers();