BulletMultiThreaded needs to refreshContactPoint for contact manifold (this has been moved to the collision detector, instead of constraint solver)

BulletMultiThreaded support function for box shouldn't compensate for the collision margin anymore
This commit is contained in:
ejcoumans 2007-10-14 01:51:07 +00:00
parent 43b0ecd71a
commit ffcdb0f93d
7 changed files with 26 additions and 14 deletions

View File

@ -366,7 +366,7 @@ void CcdPhysicsDemo::initPhysics()
#endif //DO_BENCHMARK_PYRAMIDS #endif //DO_BENCHMARK_PYRAMIDS
btCollisionDispatcher* dispatcher=0; btCollisionDispatcher* dispatcher=0;
btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
#ifdef USE_PARALLEL_DISPATCHER #ifdef USE_PARALLEL_DISPATCHER
@ -387,10 +387,10 @@ int maxNumOutstandingTasks = 4;//number of maximum outstanding tasks
#endif #endif
dispatcher = new SpuGatheringCollisionDispatcher(threadSupportCollision,maxNumOutstandingTasks); dispatcher = new SpuGatheringCollisionDispatcher(threadSupportCollision,maxNumOutstandingTasks,collisionConfiguration);
// dispatcher = new btCollisionDispatcher(); // dispatcher = new btCollisionDispatcher(collisionConfiguration);
#else #else
btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration); dispatcher = new btCollisionDispatcher(collisionConfiguration);
#endif //USE_PARALLEL_DISPATCHER #endif //USE_PARALLEL_DISPATCHER
@ -450,7 +450,11 @@ int maxNumOutstandingTasks = 4;//number of maximum outstanding tasks
btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver); btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver);
m_dynamicsWorld = world; m_dynamicsWorld = world;
// world->getSolverInfo().m_numIterations = 4;
#ifdef DO_BENCHMARK_PYRAMIDS
world->getSolverInfo().m_numIterations = 4;
#endif //DO_BENCHMARK_PYRAMIDS
m_dynamicsWorld->getDispatchInfo().m_enableSPU = true; m_dynamicsWorld->getDispatchInfo().m_enableSPU = true;
m_dynamicsWorld->setGravity(btVector3(0,-10,0)); m_dynamicsWorld->setGravity(btVector3(0,-10,0));

View File

@ -252,7 +252,7 @@ void GimpactConcaveDemo::renderme()
//bool useBulletLCP = !(getDebugMode() & btIDebugDraw::DBG_DisableBulletLCP); //bool useBulletLCP = !(getDebugMode() & btIDebugDraw::DBG_DisableBulletLCP);
bool useCCD = (getDebugMode() & btIDebugDraw::DBG_EnableCCD); bool useCCD = ((getDebugMode() & btIDebugDraw::DBG_EnableCCD) != 0);
glRasterPos3f(xOffset,yStart,0); glRasterPos3f(xOffset,yStart,0);
sprintf(buf,"1 CCD mode (adhoc) = %i",useCCD); sprintf(buf,"1 CCD mode (adhoc) = %i",useCCD);

View File

@ -1600,7 +1600,7 @@ void ConcaveDemo::renderme()
//bool useBulletLCP = !(getDebugMode() & btIDebugDraw::DBG_DisableBulletLCP); //bool useBulletLCP = !(getDebugMode() & btIDebugDraw::DBG_DisableBulletLCP);
bool useCCD = (getDebugMode() & btIDebugDraw::DBG_EnableCCD); bool useCCD = ((getDebugMode() & btIDebugDraw::DBG_EnableCCD) != 0);
glRasterPos3f(xOffset,yStart,0); glRasterPos3f(xOffset,yStart,0);
sprintf(buf,"1 CCD mode (adhoc) = %i",useCCD); sprintf(buf,"1 CCD mode (adhoc) = %i",useCCD);
@ -1643,7 +1643,7 @@ void ConcaveDemo::initGImpactCollision()
void ConcaveDemo::initPhysics() void ConcaveDemo::initPhysics()
{ {
btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration(); btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
//btConstraintSolver* solver = new btSequentialImpulseConstraintSolver; //btConstraintSolver* solver = new btSequentialImpulseConstraintSolver;

View File

@ -170,6 +170,14 @@ void SpuContactResult::addContactPoint(const btVector3& normalOnBInWorld,const b
void SpuContactResult::flush() void SpuContactResult::flush()
{ {
if (m_spuManifold && m_spuManifold->getNumContacts())
{
m_spuManifold->refreshContactPoints(m_rootWorldTransform0,m_rootWorldTransform1);
m_RequiresWriteBack = true;
}
if (m_RequiresWriteBack) if (m_RequiresWriteBack)
{ {
#ifdef DEBUG_SPU_COLLISION_DETECTION #ifdef DEBUG_SPU_COLLISION_DETECTION

View File

@ -48,9 +48,8 @@ inline btPoint3 localGetSupportingVertexWithoutMargin(int shapeType, void* shape
{ {
// spu_printf("SPU: getSupport BOX_SHAPE_PROXYTYPE\n"); // spu_printf("SPU: getSupport BOX_SHAPE_PROXYTYPE\n");
btConvexInternalShape* convexShape = (btConvexInternalShape*)shape; btConvexInternalShape* convexShape = (btConvexInternalShape*)shape;
btVector3 halfExtents = convexShape->getImplicitShapeDimensions(); const btVector3& halfExtents = convexShape->getImplicitShapeDimensions();
float margin = convexShape->getMarginNV();
halfExtents -= btVector3(margin,margin,margin);
return btPoint3( return btPoint3(
localDir.getX() < 0.0f ? -halfExtents.x() : halfExtents.x(), localDir.getX() < 0.0f ? -halfExtents.x() : halfExtents.x(),
localDir.getY() < 0.0f ? -halfExtents.y() : halfExtents.y(), localDir.getY() < 0.0f ? -halfExtents.y() : halfExtents.y(),

View File

@ -64,8 +64,8 @@ CONCAVE_SHAPES_END_HERE,
///btBroadphaseProxy ///btBroadphaseProxy
ATTRIBUTE_ALIGNED16(struct) btBroadphaseProxy //ATTRIBUTE_ALIGNED16(struct) btBroadphaseProxy
//struct btBroadphaseProxy struct btBroadphaseProxy
{ {
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();

View File

@ -33,8 +33,9 @@ btOverlappingPairCache::btOverlappingPairCache():
{ {
int initialAllocatedSize= 2; int initialAllocatedSize= 2;
m_overlappingPairArray.reserve(initialAllocatedSize); m_overlappingPairArray.reserve(initialAllocatedSize);
#ifdef USE_HASH_PAIRCACHE
growTables(); growTables();
#endif //USE_HASH_PAIRCACHE
} }