Changeset 2907 for code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp
- Timestamp:
- Apr 8, 2009, 12:36:08 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp
r2662 r2907 20 20 #include "btDispatcher.h" 21 21 #include "btCollisionAlgorithm.h" 22 #include "LinearMath/btAabbUtil2.h" 22 23 23 24 #include <stdio.h> … … 136 137 { 137 138 gFindPairs++; 138 if(proxy0>proxy1) btSwap(proxy0,proxy1); 139 if(proxy0->m_uniqueId>proxy1->m_uniqueId) 140 btSwap(proxy0,proxy1); 139 141 int proxyId1 = proxy0->getUid(); 140 142 int proxyId2 = proxy1->getUid(); … … 212 214 btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1) 213 215 { 214 if(proxy0>proxy1) btSwap(proxy0,proxy1); 216 if(proxy0->m_uniqueId>proxy1->m_uniqueId) 217 btSwap(proxy0,proxy1); 215 218 int proxyId1 = proxy0->getUid(); 216 219 int proxyId2 = proxy1->getUid(); … … 271 274 { 272 275 gRemovePairs++; 273 if(proxy0>proxy1) btSwap(proxy0,proxy1); 276 if(proxy0->m_uniqueId>proxy1->m_uniqueId) 277 btSwap(proxy0,proxy1); 274 278 int proxyId1 = proxy0->getUid(); 275 279 int proxyId2 = proxy1->getUid(); … … 393 397 } 394 398 399 void btHashedOverlappingPairCache::sortOverlappingPairs(btDispatcher* dispatcher) 400 { 401 ///need to keep hashmap in sync with pair address, so rebuild all 402 btBroadphasePairArray tmpPairs; 403 int i; 404 for (i=0;i<m_overlappingPairArray.size();i++) 405 { 406 tmpPairs.push_back(m_overlappingPairArray[i]); 407 } 408 409 for (i=0;i<tmpPairs.size();i++) 410 { 411 removeOverlappingPair(tmpPairs[i].m_pProxy0,tmpPairs[i].m_pProxy1,dispatcher); 412 } 413 414 for (i = 0; i < m_next.size(); i++) 415 { 416 m_next[i] = BT_NULL_PAIR; 417 } 418 419 tmpPairs.quickSort(btBroadphasePairSortPredicate()); 420 421 for (i=0;i<tmpPairs.size();i++) 422 { 423 addOverlappingPair(tmpPairs[i].m_pProxy0,tmpPairs[i].m_pProxy1); 424 } 425 426 427 } 395 428 396 429 … … 430 463 { 431 464 //don't add overlap with own 432 assert(proxy0 != proxy1);465 btAssert(proxy0 != proxy1); 433 466 434 467 if (!needsBroadphaseCollision(proxy0,proxy1)) … … 461 494 if (findIndex < m_overlappingPairArray.size()) 462 495 { 463 // assert(it != m_overlappingPairSet.end());496 //btAssert(it != m_overlappingPairSet.end()); 464 497 btBroadphasePair* pair = &m_overlappingPairArray[findIndex]; 465 498 return pair; … … 491 524 { 492 525 cleanOverlappingPair(*pair,dispatcher); 493 494 m_overlappingPairArray.swap(i,m_overlappingPairArray.capacity()-1); 526 pair->m_pProxy0 = 0; 527 pair->m_pProxy1 = 0; 528 m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1); 495 529 m_overlappingPairArray.pop_back(); 496 530 gOverlappingPairs--; … … 592 626 processAllOverlappingPairs(&removeCallback,dispatcher); 593 627 } 628 629 void btSortedOverlappingPairCache::sortOverlappingPairs(btDispatcher* dispatcher) 630 { 631 //should already be sorted 632 } 633
Note: See TracChangeset
for help on using the changeset viewer.