Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 20, 2008, 5:40:38 PM (16 years ago)
Author:
rgrieder
Message:

Downgraded Bullet to latest tagged version: 2.72
That should give us more stability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h

    r1963 r1972  
    2626#include "btBroadphaseProxy.h"
    2727#include "btOverlappingPairCallback.h"
    28 #include "btDbvtBroadphase.h"
    2928
    3029//#define DEBUG_BROADPHASE 1
     
    6362                BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3];            // 6 * 2 = 12
    6463//              BP_FP_INT_TYPE m_uniqueId;
    65                 btBroadphaseProxy*      m_dbvtProxy;//for faster raycast
     64                BP_FP_INT_TYPE m_pad;
     65               
    6666                //void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject
    6767       
     
    9595        int     m_invalidPair;
    9696
    97         ///additional dynamic aabb structure, used to accelerate ray cast queries.
    98         ///can be disabled using a optional argument in the constructor
    99         btDbvtBroadphase*       m_raycastAccelerator;
    100 
    101 
    10297        // allocation/deallocation
    10398        BP_FP_INT_TYPE allocHandle();
     
    114109        //void RemoveOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB);
    115110
    116        
     111        void quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const;
    117112
    118113        void sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps );
     
    123118public:
    124119
    125         btAxisSweep3Internal(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache=0,bool disableRaycastAccelerator = false);
     120        btAxisSweep3Internal(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache=0);
    126121
    127122        virtual ~btAxisSweep3Internal();
     
    145140        virtual void    destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
    146141        virtual void    setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
    147         virtual void  getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
    148        
    149         virtual void    rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback);
    150 
    151         void quantize(BP_FP_INT_TYPE* out, const btPoint3& point, int isMax) const;
    152         ///unQuantize should be conservative: aabbMin/aabbMax should be larger then 'getAabb' result
    153         void unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
    154142       
    155143        bool    testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
     
    230218               
    231219                Handle* handle = getHandle(handleId);
    232                
    233                 if (m_raycastAccelerator)
    234                 {
    235                         btBroadphaseProxy* rayProxy = m_raycastAccelerator->createProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,dispatcher,0);
    236                         handle->m_dbvtProxy = rayProxy;
    237                 }
     220                               
    238221                return handle;
    239222}
     
    245228{
    246229        Handle* handle = static_cast<Handle*>(proxy);
    247         if (m_raycastAccelerator)
    248                 m_raycastAccelerator->destroyProxy(handle->m_dbvtProxy,dispatcher);
    249230        removeHandle(static_cast<BP_FP_INT_TYPE>(handle->m_uniqueId), dispatcher);
    250231}
     
    254235{
    255236        Handle* handle = static_cast<Handle*>(proxy);
    256         handle->m_aabbMin = aabbMin;
    257         handle->m_aabbMax = aabbMax;
    258237        updateHandle(static_cast<BP_FP_INT_TYPE>(handle->m_uniqueId), aabbMin, aabbMax,dispatcher);
    259         if (m_raycastAccelerator)
    260                 m_raycastAccelerator->setAabb(handle->m_dbvtProxy,aabbMin,aabbMax,dispatcher);
    261 
    262 }
    263 
    264 template <typename BP_FP_INT_TYPE>
    265 
    266 void    btAxisSweep3Internal<BP_FP_INT_TYPE>::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback)
    267 {
    268         if (m_raycastAccelerator)
    269         {
    270                 m_raycastAccelerator->rayTest(rayFrom,rayTo,rayCallback);
    271         } else
    272         {
    273                 //choose axis?
    274                 BP_FP_INT_TYPE axis = 0;
    275                 //for each proxy
    276                 for (BP_FP_INT_TYPE i=1;i<m_numHandles*2+1;i++)
    277                 {
    278                         if (m_pEdges[axis][i].IsMax())
    279                         {
    280                                 rayCallback.process(getHandle(m_pEdges[axis][i].m_handle));
    281                         }
    282                 }
    283         }
    284 }
    285 
    286 
    287 template <typename BP_FP_INT_TYPE>
    288 void btAxisSweep3Internal<BP_FP_INT_TYPE>::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const
    289 {
    290         Handle* pHandle = static_cast<Handle*>(proxy);
    291         aabbMin = pHandle->m_aabbMin;
    292         aabbMax = pHandle->m_aabbMax;
    293 }
    294 
    295 
    296 template <typename BP_FP_INT_TYPE>
    297 void btAxisSweep3Internal<BP_FP_INT_TYPE>::unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const
    298 {
    299         Handle* pHandle = static_cast<Handle*>(proxy);
    300 
    301         unsigned short vecInMin[3];
    302         unsigned short vecInMax[3];
    303 
    304         vecInMin[0] = m_pEdges[0][pHandle->m_minEdges[0]].m_pos ;
    305         vecInMax[0] = m_pEdges[0][pHandle->m_maxEdges[0]].m_pos +1 ;
    306         vecInMin[1] = m_pEdges[1][pHandle->m_minEdges[1]].m_pos ;
    307         vecInMax[1] = m_pEdges[1][pHandle->m_maxEdges[1]].m_pos +1 ;
    308         vecInMin[2] = m_pEdges[2][pHandle->m_minEdges[2]].m_pos ;
    309         vecInMax[2] = m_pEdges[2][pHandle->m_maxEdges[2]].m_pos +1 ;
    310        
    311         aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.getX()),(btScalar)(vecInMin[1]) / (m_quantize.getY()),(btScalar)(vecInMin[2]) / (m_quantize.getZ()));
    312         aabbMin += m_worldAabbMin;
    313        
    314         aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.getX()),(btScalar)(vecInMax[1]) / (m_quantize.getY()),(btScalar)(vecInMax[2]) / (m_quantize.getZ()));
    315         aabbMax += m_worldAabbMin;
    316 }
    317 
    318 
    319 
    320 
    321 template <typename BP_FP_INT_TYPE>
    322 btAxisSweep3Internal<BP_FP_INT_TYPE>::btAxisSweep3Internal(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache , bool disableRaycastAccelerator)
     238
     239}
     240
     241
     242
     243
     244
     245template <typename BP_FP_INT_TYPE>
     246btAxisSweep3Internal<BP_FP_INT_TYPE>::btAxisSweep3Internal(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache )
    323247:m_bpHandleMask(handleMask),
    324248m_handleSentinel(handleSentinel),
     
    326250m_userPairCallback(0),
    327251m_ownsPairCache(false),
    328 m_invalidPair(0),
    329 m_raycastAccelerator(0)
     252m_invalidPair(0)
    330253{
    331254        BP_FP_INT_TYPE maxHandles = static_cast<BP_FP_INT_TYPE>(userMaxHandles+1);//need to add one sentinel handle
     
    336259                m_pairCache = new(ptr) btHashedOverlappingPairCache();
    337260                m_ownsPairCache = true;
    338         }
    339 
    340         if (!disableRaycastAccelerator)
    341         {
    342                 m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroadphase),16)) btDbvtBroadphase();//m_pairCache);
    343                 m_raycastAccelerator->m_deferedcollide = true;//don't add/remove pairs
    344261        }
    345262
     
    404321btAxisSweep3Internal<BP_FP_INT_TYPE>::~btAxisSweep3Internal()
    405322{
    406         if (m_raycastAccelerator)
    407                 btAlignedFree (m_raycastAccelerator);
    408 
     323       
    409324        for (int i = 2; i >= 0; i--)
    410325        {
     
    985900public:
    986901
    987         btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned short int maxHandles = 16384, btOverlappingPairCache* pairCache = 0, bool disableRaycastAccelerator = false);
     902        btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned short int maxHandles = 16384, btOverlappingPairCache* pairCache = 0);
    988903
    989904};
     
    996911public:
    997912
    998         bt32BitAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned int maxHandles = 1500000, btOverlappingPairCache* pairCache = 0, bool disableRaycastAccelerator = false);
     913        bt32BitAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, unsigned int maxHandles = 1500000, btOverlappingPairCache* pairCache = 0);
    999914
    1000915};
Note: See TracChangeset for help on using the changeset viewer.