diff --git a/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h b/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h index 5600da0f5..a53814bb4 100644 --- a/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h +++ b/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h @@ -187,7 +187,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR(); { //keep them sorted, so the std::set operations work - if (&proxy0 < &proxy1) + if (proxy0.m_uniqueId < proxy1.m_uniqueId) { m_pProxy0 = &proxy0; m_pProxy1 = &proxy1; @@ -228,8 +228,8 @@ class btBroadphasePairSortPredicate bool operator() ( const btBroadphasePair& a, const btBroadphasePair& b ) { - return a.m_pProxy0 > b.m_pProxy0 || - (a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 > b.m_pProxy1) || + return a.m_pProxy0->m_uniqueId > b.m_pProxy0->m_uniqueId || + (a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1->m_uniqueId > b.m_pProxy1->m_uniqueId) || (a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 == b.m_pProxy1 && a.m_algorithm > b.m_algorithm); } }; diff --git a/src/BulletCollision/BroadphaseCollision/btDbvt.h b/src/BulletCollision/BroadphaseCollision/btDbvt.h index 0b66f8a7a..a5763ce4d 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvt.h +++ b/src/BulletCollision/BroadphaseCollision/btDbvt.h @@ -146,9 +146,7 @@ struct btDbvtAabbMm DBVT_INLINE btScalar ProjectMinimum(const btVector3& v,unsigned signs) const; DBVT_INLINE friend bool Intersect( const btDbvtAabbMm& a, const btDbvtAabbMm& b); - DBVT_INLINE friend bool Intersect( const btDbvtAabbMm& a, - const btDbvtAabbMm& b, - const btTransform& xform); + DBVT_INLINE friend bool Intersect( const btDbvtAabbMm& a, const btVector3& b); @@ -530,21 +528,7 @@ DBVT_INLINE bool Intersect( const btDbvtAabbMm& a, #endif } -// -DBVT_INLINE bool Intersect( const btDbvtAabbMm& a, - const btDbvtAabbMm& b, - const btTransform& xform) -{ - const btVector3 d0=xform*b.Center()-a.Center(); - const btVector3 d1=d0*xform.getBasis(); - btScalar s0[2]={0,0}; - btScalar s1[2]={dot(xform.getOrigin(),d0),s1[0]}; - a.AddSpan(d0,s0[0],s0[1]); - b.AddSpan(d1,s1[0],s1[1]); - if(s0[0]>(s1[1])) return(false); - if(s0[1]<(s1[0])) return(false); - return(true); -} + // DBVT_INLINE bool Intersect( const btDbvtAabbMm& a, diff --git a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp index 063358047..be9169ec8 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp +++ b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp @@ -100,7 +100,8 @@ struct btDbvtTreeCollider : btDbvt::ICollide btDbvtProxy* pa=(btDbvtProxy*)na->data; btDbvtProxy* pb=(btDbvtProxy*)nb->data; #if DBVT_BP_SORTPAIRS - if(pa>pb) btSwap(pa,pb); + if(pa->m_uniqueId>pb->m_uniqueId) + btSwap(pa,pb); #endif pbp->m_paircache->addOverlappingPair(pa,pb); ++pbp->m_newpairs; @@ -411,7 +412,8 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher) if(!Intersect(pa->leaf->volume,pb->leaf->volume)) { #if DBVT_BP_SORTPAIRS - if(pa>pb) btSwap(pa,pb); + if(pa->m_uniqueId>pb->m_uniqueId) + btSwap(pa,pb); #endif m_paircache->removeOverlappingPair(pa,pb,dispatcher); --ni;--i; diff --git a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h index a1f61fdee..5564839a2 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h +++ b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h @@ -24,7 +24,7 @@ subject to the following restrictions: // #define DBVT_BP_PROFILE 0 -#define DBVT_BP_SORTPAIRS 1 +//#define DBVT_BP_SORTPAIRS 1 #define DBVT_BP_PREVENTFALSEUPDATE 0 #define DBVT_BP_ACCURATESLEEPING 0 #define DBVT_BP_ENABLE_BENCHMARK 0 diff --git a/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp b/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp index b3416f630..6dbeecda0 100644 --- a/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp +++ b/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp @@ -135,7 +135,8 @@ void btHashedOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroad btBroadphasePair* btHashedOverlappingPairCache::findPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1) { gFindPairs++; - if(proxy0>proxy1) btSwap(proxy0,proxy1); + if(proxy0->m_uniqueId>proxy1->m_uniqueId) + btSwap(proxy0,proxy1); int proxyId1 = proxy0->getUid(); int proxyId2 = proxy1->getUid(); @@ -211,7 +212,8 @@ void btHashedOverlappingPairCache::growTables() btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1) { - if(proxy0>proxy1) btSwap(proxy0,proxy1); + if(proxy0->m_uniqueId>proxy1->m_uniqueId) + btSwap(proxy0,proxy1); int proxyId1 = proxy0->getUid(); int proxyId2 = proxy1->getUid(); @@ -270,7 +272,8 @@ btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProx void* btHashedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1,btDispatcher* dispatcher) { gRemovePairs++; - if(proxy0>proxy1) btSwap(proxy0,proxy1); + if(proxy0->m_uniqueId>proxy1->m_uniqueId) + btSwap(proxy0,proxy1); int proxyId1 = proxy0->getUid(); int proxyId2 = proxy1->getUid();