Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 31, 2009, 8:05:51 PM (15 years ago)
Author:
rgrieder
Message:

Update from Bullet 2.73 to 2.74.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp

    r2662 r2882  
    2525#include "LinearMath/btQuickprof.h"
    2626
    27 btSimulationIslandManager::btSimulationIslandManager()
     27btSimulationIslandManager::btSimulationIslandManager():
     28m_splitIslands(true)
    2829{
    2930}
     
    4445       
    4546        {
    46                 btBroadphasePair* pairPtr = colWorld->getPairCache()->getOverlappingPairArrayPtr();
    47 
     47               
    4848                for (int i=0;i<colWorld->getPairCache()->getNumOverlappingPairs();i++)
    4949                {
     50                        btBroadphasePair* pairPtr = colWorld->getPairCache()->getOverlappingPairArrayPtr();
    5051                        const btBroadphasePair& collisionPair = pairPtr[i];
    5152                        btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject;
     
    186187                        }
    187188
    188                         assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
     189                        btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
    189190                        if (colObj0->getIslandTag() == islandId)
    190191                        {
     
    213214                                }
    214215
    215                                 assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
     216                                btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
    216217
    217218                                if (colObj0->getIslandTag() == islandId)
     
    234235                                }
    235236
    236                                 assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
     237                                btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
    237238
    238239                                if (colObj0->getIslandTag() == islandId)
     
    252253        int maxNumManifolds = dispatcher->getNumManifolds();
    253254
    254 #define SPLIT_ISLANDS 1
    255 #ifdef SPLIT_ISLANDS
    256 
    257        
    258 #endif //SPLIT_ISLANDS
     255//#define SPLIT_ISLANDS 1
     256//#ifdef SPLIT_ISLANDS
     257
     258       
     259//#endif //SPLIT_ISLANDS
    259260
    260261       
     
    280281                                colObj0->activate();
    281282                        }
    282 #ifdef SPLIT_ISLANDS
    283         //              //filtering for response
    284                         if (dispatcher->needsResponse(colObj0,colObj1))
    285                                 m_islandmanifold.push_back(manifold);
    286 #endif //SPLIT_ISLANDS
     283                        if(m_splitIslands)
     284                        {
     285                                //filtering for response
     286                                if (dispatcher->needsResponse(colObj0,colObj1))
     287                                        m_islandmanifold.push_back(manifold);
     288                        }
    287289                }
    288290        }
     
    304306        BT_PROFILE("processIslands");
    305307
    306 #ifndef SPLIT_ISLANDS
    307         btPersistentManifold** manifold = dispatcher->getInternalManifoldPointer();
    308        
    309         callback->ProcessIsland(&collisionObjects[0],collisionObjects.size(),manifold,maxNumManifolds, -1);
    310 #else
    311         // Sort manifolds, based on islands
    312         // Sort the vector using predicate and std::sort
    313         //std::sort(islandmanifold.begin(), islandmanifold.end(), btPersistentManifoldSortPredicate);
    314 
    315         int numManifolds = int (m_islandmanifold.size());
    316 
    317         //we should do radix sort, it it much faster (O(n) instead of O (n log2(n))
    318         m_islandmanifold.quickSort(btPersistentManifoldSortPredicate());
    319 
    320         //now process all active islands (sets of manifolds for now)
    321 
    322         int startManifoldIndex = 0;
    323         int endManifoldIndex = 1;
    324 
    325         //int islandId;
    326 
    327        
    328 
    329 //      printf("Start Islands\n");
    330 
    331         //traverse the simulation islands, and call the solver, unless all objects are sleeping/deactivated
    332         for ( startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
    333         {
    334                 int islandId = getUnionFind().getElement(startIslandIndex).m_id;
    335 
    336 
    337                bool islandSleeping = false;
    338                
    339                 for (endIslandIndex = startIslandIndex;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
    340                 {
    341                         int i = getUnionFind().getElement(endIslandIndex).m_sz;
    342                         btCollisionObject* colObj0 = collisionObjects[i];
    343                                                 m_islandBodies.push_back(colObj0);
    344                         if (!colObj0->isActive())
    345                                 islandSleeping = true;
    346                 }
    347                
    348 
    349                 //find the accompanying contact manifold for this islandId
    350                 int numIslandManifolds = 0;
    351                 btPersistentManifold** startManifold = 0;
    352 
    353                 if (startManifoldIndex<numManifolds)
    354                 {
    355                         int curIslandId = getIslandId(m_islandmanifold[startManifoldIndex]);
    356                         if (curIslandId == islandId)
    357                         {
    358                                 startManifold = &m_islandmanifold[startManifoldIndex];
     308        if(!m_splitIslands)
     309        {
     310                btPersistentManifold** manifold = dispatcher->getInternalManifoldPointer();
     311                int maxNumManifolds = dispatcher->getNumManifolds();
     312                callback->ProcessIsland(&collisionObjects[0],collisionObjects.size(),manifold,maxNumManifolds, -1);
     313        }
     314        else
     315        {
     316                // Sort manifolds, based on islands
     317                // Sort the vector using predicate and std::sort
     318                //std::sort(islandmanifold.begin(), islandmanifold.end(), btPersistentManifoldSortPredicate);
     319
     320                int numManifolds = int (m_islandmanifold.size());
     321
     322                //we should do radix sort, it it much faster (O(n) instead of O (n log2(n))
     323                m_islandmanifold.quickSort(btPersistentManifoldSortPredicate());
     324
     325                //now process all active islands (sets of manifolds for now)
     326
     327                int startManifoldIndex = 0;
     328                int endManifoldIndex = 1;
     329
     330                //int islandId;
     331
     332               
     333
     334        //      printf("Start Islands\n");
     335
     336                //traverse the simulation islands, and call the solver, unless all objects are sleeping/deactivated
     337                for ( startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
     338                {
     339                        int islandId = getUnionFind().getElement(startIslandIndex).m_id;
     340
     341
     342                           bool islandSleeping = false;
     343                       
     344                                        for (endIslandIndex = startIslandIndex;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
     345                                        {
     346                                                        int i = getUnionFind().getElement(endIslandIndex).m_sz;
     347                                                        btCollisionObject* colObj0 = collisionObjects[i];
     348                                                        m_islandBodies.push_back(colObj0);
     349                                                        if (!colObj0->isActive())
     350                                                                        islandSleeping = true;
     351                                        }
     352                       
     353
     354                        //find the accompanying contact manifold for this islandId
     355                        int numIslandManifolds = 0;
     356                        btPersistentManifold** startManifold = 0;
     357
     358                        if (startManifoldIndex<numManifolds)
     359                        {
     360                                int curIslandId = getIslandId(m_islandmanifold[startManifoldIndex]);
     361                                if (curIslandId == islandId)
     362                                {
     363                                        startManifold = &m_islandmanifold[startManifoldIndex];
     364                               
     365                                        for (endManifoldIndex = startManifoldIndex+1;(endManifoldIndex<numManifolds) && (islandId == getIslandId(m_islandmanifold[endManifoldIndex]));endManifoldIndex++)
     366                                        {
     367
     368                                        }
     369                                        /// Process the actual simulation, only if not sleeping/deactivated
     370                                        numIslandManifolds = endManifoldIndex-startManifoldIndex;
     371                                }
     372
     373                        }
     374
     375                        if (!islandSleeping)
     376                        {
     377                                callback->ProcessIsland(&m_islandBodies[0],m_islandBodies.size(),startManifold,numIslandManifolds, islandId);
     378        //                      printf("Island callback of size:%d bodies, %d manifolds\n",islandBodies.size(),numIslandManifolds);
     379                        }
    359380                       
    360                                 for (endManifoldIndex = startManifoldIndex+1;(endManifoldIndex<numManifolds) && (islandId == getIslandId(m_islandmanifold[endManifoldIndex]));endManifoldIndex++)
    361                                 {
    362 
    363                                 }
    364                                 /// Process the actual simulation, only if not sleeping/deactivated
    365                                 numIslandManifolds = endManifoldIndex-startManifoldIndex;
    366                         }
    367 
    368                 }
    369 
    370                 if (!islandSleeping)
    371                 {
    372                         callback->ProcessIsland(&m_islandBodies[0],m_islandBodies.size(),startManifold,numIslandManifolds, islandId);
    373 //                      printf("Island callback of size:%d bodies, %d manifolds\n",islandBodies.size(),numIslandManifolds);
    374                 }
    375                
    376                 if (numIslandManifolds)
    377                 {
    378                         startManifoldIndex = endManifoldIndex;
    379                 }
    380 
    381                 m_islandBodies.resize(0);
    382         }
    383 #endif //SPLIT_ISLANDS
    384 
    385 
    386 }
     381                        if (numIslandManifolds)
     382                        {
     383                                startManifoldIndex = endManifoldIndex;
     384                        }
     385
     386                        m_islandBodies.resize(0);
     387                }
     388        } // else if(!splitIslands)
     389
     390}
Note: See TracChangeset for help on using the changeset viewer.