Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 12:36:08 AM (16 years ago)
Author:
dafrick
Message:

Merging of the current QuestSystem branch.

Location:
code/branches/questsystem5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5

  • code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp

    r2662 r2907  
    2020#include "btDispatcher.h"
    2121#include "btCollisionAlgorithm.h"
     22#include "LinearMath/btAabbUtil2.h"
    2223
    2324#include <stdio.h>
     
    136137{
    137138        gFindPairs++;
    138         if(proxy0>proxy1) btSwap(proxy0,proxy1);
     139        if(proxy0->m_uniqueId>proxy1->m_uniqueId)
     140                btSwap(proxy0,proxy1);
    139141        int proxyId1 = proxy0->getUid();
    140142        int proxyId2 = proxy1->getUid();
     
    212214btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
    213215{
    214         if(proxy0>proxy1) btSwap(proxy0,proxy1);
     216        if(proxy0->m_uniqueId>proxy1->m_uniqueId)
     217                btSwap(proxy0,proxy1);
    215218        int proxyId1 = proxy0->getUid();
    216219        int proxyId2 = proxy1->getUid();
     
    271274{
    272275        gRemovePairs++;
    273         if(proxy0>proxy1) btSwap(proxy0,proxy1);
     276        if(proxy0->m_uniqueId>proxy1->m_uniqueId)
     277                btSwap(proxy0,proxy1);
    274278        int proxyId1 = proxy0->getUid();
    275279        int proxyId2 = proxy1->getUid();
     
    393397}
    394398
     399void    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}
    395428
    396429
     
    430463{
    431464        //don't add overlap with own
    432         assert(proxy0 != proxy1);
     465        btAssert(proxy0 != proxy1);
    433466
    434467        if (!needsBroadphaseCollision(proxy0,proxy1))
     
    461494        if (findIndex < m_overlappingPairArray.size())
    462495        {
    463                 //assert(it != m_overlappingPairSet.end());
     496                //btAssert(it != m_overlappingPairSet.end());
    464497                 btBroadphasePair* pair = &m_overlappingPairArray[findIndex];
    465498                return pair;
     
    491524                {
    492525                        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);
    495529                        m_overlappingPairArray.pop_back();
    496530                        gOverlappingPairs--;
     
    592626        processAllOverlappingPairs(&removeCallback,dispatcher);
    593627}
     628
     629void    btSortedOverlappingPairCache::sortOverlappingPairs(btDispatcher* dispatcher)
     630{
     631        //should already be sorted
     632}
     633
Note: See TracChangeset for help on using the changeset viewer.