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