Bullet Collision Detection & Physics Library
btMultiSapBroadphase.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 #ifndef BT_MULTI_SAP_BROADPHASE
16 #define BT_MULTI_SAP_BROADPHASE
17 
18 #include "btBroadphaseInterface.h"
20 #include "btOverlappingPairCache.h"
21 
22 
25 
26 
28 
36 {
38 
40 
42 
44 
45 
47 
49 
51 
53  {
56  };
57 
58 
59 public:
60 
62  {
63 
68 
70 
71 /* void* m_userPtr;
72  short int m_collisionFilterGroup;
73  short int m_collisionFilterMask;
74 */
75  btMultiSapProxy(const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask)
76  :btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask),
77  m_aabbMin(aabbMin),
78  m_aabbMax(aabbMax),
79  m_shapeType(shapeType)
80  {
82  }
83 
84 
85  };
86 
87 protected:
88 
89 
91 
92 public:
93 
94  btMultiSapBroadphase(int maxProxies = 16384,btOverlappingPairCache* pairCache=0);
95 
96 
98  {
99  return m_sapBroadphases;
100  }
101 
103  {
104  return m_sapBroadphases;
105  }
106 
107  virtual ~btMultiSapBroadphase();
108 
109  virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy);
110  virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
111  virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher);
112  virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
113 
114  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));
115 
116  void addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase);
117 
119  virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
120 
122 
124  {
125  return m_overlappingPairs;
126  }
128  {
129  return m_overlappingPairs;
130  }
131 
134  virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const
135  {
138  }
139 
140  void buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax);
141 
142  virtual void printStats();
143 
144  void quicksort (btBroadphasePairArray& a, int lo, int hi);
145 
147  virtual void resetPool(btDispatcher* dispatcher);
148 
149 };
150 
151 #endif //BT_MULTI_SAP_BROADPHASE
btMultiSapProxy(const btVector3 &aabbMin, const btVector3 &aabbMax, int shapeType, void *userPtr, short int collisionFilterGroup, short int collisionFilterMask)
#define BT_LARGE_FLOAT
Definition: btScalar.h:268
class btQuantizedBvh * m_optimizedAabbTree
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
Definition: btVector3.h:640
btOverlappingPairCache * m_overlappingPairs
The btMultiSapBroadphase is a research project, not recommended to use in production.
virtual void getBroadphaseAabb(btVector3 &aabbMin, btVector3 &aabbMax) const
getAabb returns the axis aligned bounding box in the 'global' coordinate frame will add some transfor...
The btOverlappingPairCache provides an interface for overlapping pair management (add, remove, storage), used by the btBroadphaseInterface broadphases.
const btSapBroadphaseArray & getBroadphaseArray() const
virtual void resetPool(btDispatcher *dispatcher)
reset broadphase internal structures, to ensure determinism/reproducability
btOverlapFilterCallback * m_filterCallback
bool testAabbOverlap(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1)
void addToChildBroadphase(btMultiSapProxy *parentMultiSapProxy, btBroadphaseProxy *childProxy, btBroadphaseInterface *childBroadphase)
btSapBroadphaseArray & getBroadphaseArray()
virtual btOverlappingPairCache * getOverlappingPairCache()
virtual btBroadphaseProxy * createProxy(const btVector3 &aabbMin, const btVector3 &aabbMax, int shapeType, void *userPtr, short int collisionFilterGroup, short int collisionFilterMask, btDispatcher *dispatcher, void *multiSapProxy)
btMultiSapBroadphase(int maxProxies=16384, btOverlappingPairCache *pairCache=0)
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs...
void quicksort(btBroadphasePairArray &a, int lo, int hi)
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
btSapBroadphaseArray m_sapBroadphases
btAlignedObjectArray< btMultiSapProxy * > m_multiSapProxies
The SimpleBroadphase is just a unit-test for btAxisSweep3, bt32BitAxisSweep3, or btDbvtBroadphase, so use those classes instead.
btBroadphaseInterface * m_childBroadphase
btAlignedObjectArray< btBridgeProxy * > m_bridgeProxies
array with all the entries that this proxy belongs to
virtual void getAabb(btBroadphaseProxy *proxy, btVector3 &aabbMin, btVector3 &aabbMax) const
The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU...
virtual void setAabb(btBroadphaseProxy *proxy, const btVector3 &aabbMin, const btVector3 &aabbMax, btDispatcher *dispatcher)
btAlignedObjectArray< btBroadphaseInterface * > btSapBroadphaseArray
btSimpleBroadphase * m_simpleBroadphase
virtual void destroyProxy(btBroadphaseProxy *proxy, btDispatcher *dispatcher)
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))
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:69
void buildTree(const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax)
virtual const btOverlappingPairCache * getOverlappingPairCache() const
virtual void calculateOverlappingPairs(btDispatcher *dispatcher)
calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during th...