btMultiSapBroadphase.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 #ifndef BT_MULTI_SAP_BROADPHASE
00016 #define BT_MULTI_SAP_BROADPHASE
00017 
00018 #include "btBroadphaseInterface.h"
00019 #include "LinearMath/btAlignedObjectArray.h"
00020 #include "btOverlappingPairCache.h"
00021 
00022 
00023 class btBroadphaseInterface;
00024 class btSimpleBroadphase;
00025 
00026 
00027 typedef btAlignedObjectArray<btBroadphaseInterface*> btSapBroadphaseArray;
00028 
00035 class btMultiSapBroadphase :public btBroadphaseInterface
00036 {
00037         btSapBroadphaseArray    m_sapBroadphases;
00038         
00039         btSimpleBroadphase*             m_simpleBroadphase;
00040 
00041         btOverlappingPairCache* m_overlappingPairs;
00042 
00043         class btQuantizedBvh*                   m_optimizedAabbTree;
00044 
00045 
00046         bool                                    m_ownsPairCache;
00047         
00048         btOverlapFilterCallback*        m_filterCallback;
00049 
00050         int                     m_invalidPair;
00051 
00052         struct  btBridgeProxy
00053         {
00054                 btBroadphaseProxy*              m_childProxy;
00055                 btBroadphaseInterface*  m_childBroadphase;
00056         };
00057 
00058 
00059 public:
00060 
00061         struct  btMultiSapProxy : public btBroadphaseProxy
00062         {
00063 
00065                 btAlignedObjectArray<btBridgeProxy*> m_bridgeProxies;
00066                 btVector3       m_aabbMin;
00067                 btVector3       m_aabbMax;
00068 
00069                 int     m_shapeType;
00070 
00071 /*              void*   m_userPtr;
00072                 short int       m_collisionFilterGroup;
00073                 short int       m_collisionFilterMask;
00074 */
00075                 btMultiSapProxy(const btVector3& aabbMin,  const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask)
00076                         :btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask),
00077                         m_aabbMin(aabbMin),
00078                         m_aabbMax(aabbMax),
00079                         m_shapeType(shapeType)
00080                 {
00081                         m_multiSapParentProxy =this;
00082                 }
00083 
00084                 
00085         };
00086 
00087 protected:
00088 
00089 
00090         btAlignedObjectArray<btMultiSapProxy*> m_multiSapProxies;
00091 
00092 public:
00093 
00094         btMultiSapBroadphase(int maxProxies = 16384,btOverlappingPairCache* pairCache=0);
00095 
00096 
00097         btSapBroadphaseArray&   getBroadphaseArray()
00098         {
00099                 return m_sapBroadphases;
00100         }
00101 
00102         const btSapBroadphaseArray&     getBroadphaseArray() const
00103         {
00104                 return m_sapBroadphases;
00105         }
00106 
00107         virtual ~btMultiSapBroadphase();
00108 
00109         virtual btBroadphaseProxy*      createProxy(  const btVector3& aabbMin,  const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy);
00110         virtual void    destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
00111         virtual void    setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher);
00112         virtual void    getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
00113 
00114         virtual void    rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin=btVector3(0,0,0),const btVector3& aabbMax=btVector3(0,0,0));
00115 
00116         void    addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface*        childBroadphase);
00117 
00119         virtual void    calculateOverlappingPairs(btDispatcher* dispatcher);
00120 
00121         bool    testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
00122 
00123         virtual btOverlappingPairCache* getOverlappingPairCache()
00124         {
00125                 return m_overlappingPairs;
00126         }
00127         virtual const btOverlappingPairCache*   getOverlappingPairCache() const
00128         {
00129                 return m_overlappingPairs;
00130         }
00131 
00134         virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const
00135         {
00136                 aabbMin.setValue(-BT_LARGE_FLOAT,-BT_LARGE_FLOAT,-BT_LARGE_FLOAT);
00137                 aabbMax.setValue(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT);
00138         }
00139 
00140         void    buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax);
00141 
00142         virtual void    printStats();
00143 
00144         void quicksort (btBroadphasePairArray& a, int lo, int hi);
00145 
00147         virtual void resetPool(btDispatcher* dispatcher);
00148 
00149 };
00150 
00151 #endif //BT_MULTI_SAP_BROADPHASE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


bullet
Author(s): Erwin Coumans, ROS package maintained by Tully Foote
autogenerated on Wed Oct 31 2012 07:54:31