Bullet Collision Detection & Physics Library: btCompoundCompoundCollisionAlgorithm.cpp Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btCompoundCompoundCollisionAlgorithm.cpp
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2013 Erwin Coumans http://bulletphysics.org
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 */
16
17 #include "btCompoundCompoundCollisionAlgorithm.h"
18 #include "BulletCollision/CollisionDispatch/btCollisionObject.h"
19 #include "BulletCollision/CollisionShapes/btCompoundShape.h"
20 #include "BulletCollision/BroadphaseCollision/btDbvt.h"
21 #include "LinearMath/btIDebugDraw.h"
22 #include "LinearMath/btAabbUtil2.h"
23 #include "BulletCollision/CollisionDispatch/btManifoldResult.h"
24 #include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h"
25
26
27 btShapePairCallback gCompoundCompoundChildShapePairCallback = 0;
28
29 btCompoundCompoundCollisionAlgorithm::btCompoundCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,bool isSwapped)
30 :btCompoundCollisionAlgorithm(ci,body0Wrap,body1Wrap,isSwapped)
31 {
32
33 void* ptr = btAlignedAlloc(sizeof(btHashedSimplePairCache),16);
34 m_childCollisionAlgorithmCache= new(ptr) btHashedSimplePairCache();
35
36 const btCollisionObjectWrapper* col0ObjWrap = body0Wrap;
37 btAssert (col0ObjWrap->getCollisionShape()->isCompound());
38
39 const btCollisionObjectWrapper* col1ObjWrap = body1Wrap;
40 btAssert (col1ObjWrap->getCollisionShape()->isCompound());
41
42 const btCompoundShape* compoundShape0 = static_cast<const btCompoundShape*>(col0ObjWrap->getCollisionShape());
43 m_compoundShapeRevision0 = compoundShape0->getUpdateRevision();
44
45 const btCompoundShape* compoundShape1 = static_cast<const btCompoundShape*>(col1ObjWrap->getCollisionShape());
46 m_compoundShapeRevision1 = compoundShape1->getUpdateRevision();
47
48
49 }
50
51
52 btCompoundCompoundCollisionAlgorithm::~btCompoundCompoundCollisionAlgorithm()
53 {
54 removeChildAlgorithms();
55 m_childCollisionAlgorithmCache->~btHashedSimplePairCache();
56 btAlignedFree(m_childCollisionAlgorithmCache);
57 }
58
59 void btCompoundCompoundCollisionAlgorithm::getAllContactManifolds(btManifoldArray& manifoldArray)
60 {
61 int i;
62 btSimplePairArray& pairs = m_childCollisionAlgorithmCache->getOverlappingPairArray();
63 for (i=0;i<pairs.size();i++)
64 {
65 if (pairs[i].m_userPointer)
66 {
67
68 ((btCollisionAlgorithm*)pairs[i].m_userPointer)->getAllContactManifolds(manifoldArray);
69 }
70 }
71 }
72
73
74 void btCompoundCompoundCollisionAlgorithm::removeChildAlgorithms()
75 {
76 btSimplePairArray& pairs = m_childCollisionAlgorithmCache->getOverlappingPairArray();
77
78 int numChildren = pairs.size();
79 int i;
80 for (i=0;i<numChildren;i++)
81 {
82 if (pairs[i].m_userPointer)
83 {
84 btCollisionAlgorithm* algo = (btCollisionAlgorithm*) pairs[i].m_userPointer;
85 algo->~btCollisionAlgorithm();
86 m_dispatcher->freeCollisionAlgorithm(algo);
87 }
88 }
89 m_childCollisionAlgorithmCache->removeAllPairs();
90 }
91
92 struct btCompoundCompoundLeafCallback : btDbvt::ICollide
93 {
94 int m_numOverlapPairs;
95
96
97 const btCollisionObjectWrapper* m_compound0ColObjWrap;
98 const btCollisionObjectWrapper* m_compound1ColObjWrap;
99 btDispatcher* m_dispatcher;
100 const btDispatcherInfo& m_dispatchInfo;
101 btManifoldResult* m_resultOut;
102
103
104 class btHashedSimplePairCache* m_childCollisionAlgorithmCache;
105
106 btPersistentManifold* m_sharedManifold;
107
108 btCompoundCompoundLeafCallback (const btCollisionObjectWrapper* compound1ObjWrap,
109 const btCollisionObjectWrapper* compound0ObjWrap,
110 btDispatcher* dispatcher,
111 const btDispatcherInfo& dispatchInfo,
112 btManifoldResult* resultOut,
113 btHashedSimplePairCache* childAlgorithmsCache,
114 btPersistentManifold* sharedManifold)
115 :m_numOverlapPairs(0),m_compound0ColObjWrap(compound1ObjWrap),m_compound1ColObjWrap(compound0ObjWrap),m_dispatcher(dispatcher),m_dispatchInfo(dispatchInfo),m_resultOut(resultOut),
116 m_childCollisionAlgorithmCache(childAlgorithmsCache),
117 m_sharedManifold(sharedManifold)
118 {
119
120 }
121
122
123
124
125 void Process(const btDbvtNode* leaf0,const btDbvtNode* leaf1)
126 {
127 m_numOverlapPairs++;
128
129
130 int childIndex0 = leaf0->dataAsInt;
131 int childIndex1 = leaf1->dataAsInt;
132
133
134 btAssert(childIndex0>=0);
135 btAssert(childIndex1>=0);
136
137
138 const btCompoundShape* compoundShape0 = static_cast<const btCompoundShape*>(m_compound0ColObjWrap->getCollisionShape());
139 btAssert(childIndex0<compoundShape0->getNumChildShapes());
140
141 const btCompoundShape* compoundShape1 = static_cast<const btCompoundShape*>(m_compound1ColObjWrap->getCollisionShape());
142 btAssert(childIndex1<compoundShape1->getNumChildShapes());
143
144 const btCollisionShape* childShape0 = compoundShape0->getChildShape(childIndex0);
145 const btCollisionShape* childShape1 = compoundShape1->getChildShape(childIndex1);
146
147 //backup
148 btTransform orgTrans0 = m_compound0ColObjWrap->getWorldTransform();
149 const btTransform& childTrans0 = compoundShape0->getChildTransform(childIndex0);
150 btTransform newChildWorldTrans0 = orgTrans0*childTrans0 ;
151
152 btTransform orgTrans1 = m_compound1ColObjWrap->getWorldTransform();
153 const btTransform& childTrans1 = compoundShape1->getChildTransform(childIndex1);
154 btTransform newChildWorldTrans1 = orgTrans1*childTrans1 ;
155
156
157 //perform an AABB check first
158 btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1;
159 childShape0->getAabb(newChildWorldTrans0,aabbMin0,aabbMax0);
160 childShape1->getAabb(newChildWorldTrans1,aabbMin1,aabbMax1);
161
162 if (gCompoundCompoundChildShapePairCallback)
163 {
164 if (!gCompoundCompoundChildShapePairCallback(childShape0,childShape1))
165 return;
166 }
167
168 if (TestAabbAgainstAabb2(aabbMin0,aabbMax0,aabbMin1,aabbMax1))
169 {
170 btCollisionObjectWrapper compoundWrap0(this->m_compound0ColObjWrap,childShape0, m_compound0ColObjWrap->getCollisionObject(),newChildWorldTrans0,-1,childIndex0);
171 btCollisionObjectWrapper compoundWrap1(this->m_compound1ColObjWrap,childShape1,m_compound1ColObjWrap->getCollisionObject(),newChildWorldTrans1,-1,childIndex1);
172
173
174 btSimplePair* pair = m_childCollisionAlgorithmCache->findPair(childIndex0,childIndex1);
175
176 btCollisionAlgorithm* colAlgo = 0;
177
178 if (pair)
179 {
180 colAlgo = (btCollisionAlgorithm*)pair->m_userPointer;
181
182 } else
183 {
184 colAlgo = m_dispatcher->findAlgorithm(&compoundWrap0,&compoundWrap1,m_sharedManifold);
185 pair = m_childCollisionAlgorithmCache->addOverlappingPair(childIndex0,childIndex1);
186 btAssert(pair);
187 pair->m_userPointer = colAlgo;
188 }
189
190 btAssert(colAlgo);
191
192 const btCollisionObjectWrapper* tmpWrap0 = 0;
193 const btCollisionObjectWrapper* tmpWrap1 = 0;
194
195 tmpWrap0 = m_resultOut->getBody0Wrap();
196 tmpWrap1 = m_resultOut->getBody1Wrap();
197
198 m_resultOut->setBody0Wrap(&compoundWrap0);
199 m_resultOut->setBody1Wrap(&compoundWrap1);
200
201 m_resultOut->setShapeIdentifiersA(-1,childIndex0);
202 m_resultOut->setShapeIdentifiersB(-1,childIndex1);
203
204
205 colAlgo->processCollision(&compoundWrap0,&compoundWrap1,m_dispatchInfo,m_resultOut);
206
207 m_resultOut->setBody0Wrap(tmpWrap0);
208 m_resultOut->setBody1Wrap(tmpWrap1);
209
210
211
212 }
213 }
214 };
215
216
217 static DBVT_INLINE bool MyIntersect( const btDbvtAabbMm& a,
218 const btDbvtAabbMm& b, const btTransform& xform)
219 {
220 btVector3 newmin,newmax;
221 btTransformAabb(b.Mins(),b.Maxs(),0.f,xform,newmin,newmax);
222 btDbvtAabbMm newb = btDbvtAabbMm::FromMM(newmin,newmax);
223 return Intersect(a,newb);
224 }
225
226
227 static inline void MycollideTT( const btDbvtNode* root0,
228 const btDbvtNode* root1,
229 const btTransform& xform,
230 btCompoundCompoundLeafCallback* callback)
231 {
232
233 if(root0&&root1)
234 {
235 int depth=1;
236 int treshold=btDbvt::DOUBLE_STACKSIZE-4;
237 btAlignedObjectArray<btDbvt::sStkNN> stkStack;
238 stkStack.resize(btDbvt::DOUBLE_STACKSIZE);
239 stkStack[0]=btDbvt::sStkNN(root0,root1);
240 do {
241 btDbvt::sStkNN p=stkStack[--depth];
242 if(MyIntersect(p.a->volume,p.b->volume,xform))
243 {
244 if(depth>treshold)
245 {
246 stkStack.resize(stkStack.size()*2);
247 treshold=stkStack.size()-4;
248 }
249 if(p.a->isinternal())
250 {
251 if(p.b->isinternal())
252 {
253 stkStack[depth++]=btDbvt::sStkNN(p.a->childs[0],p.b->childs[0]);
254 stkStack[depth++]=btDbvt::sStkNN(p.a->childs[1],p.b->childs[0]);
255 stkStack[depth++]=btDbvt::sStkNN(p.a->childs[0],p.b->childs[1]);
256 stkStack[depth++]=btDbvt::sStkNN(p.a->childs[1],p.b->childs[1]);
257 }
258 else
259 {
260 stkStack[depth++]=btDbvt::sStkNN(p.a->childs[0],p.b);
261 stkStack[depth++]=btDbvt::sStkNN(p.a->childs[1],p.b);
262 }
263 }
264 else
265 {
266 if(p.b->isinternal())
267 {
268 stkStack[depth++]=btDbvt::sStkNN(p.a,p.b->childs[0]);
269 stkStack[depth++]=btDbvt::sStkNN(p.a,p.b->childs[1]);
270 }
271 else
272 {
273 callback->Process(p.a,p.b);
274 }
275 }
276 }
277 } while(depth);
278 }
279 }
280
281 void btCompoundCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
282 {
283
284 const btCollisionObjectWrapper* col0ObjWrap = body0Wrap;
285 const btCollisionObjectWrapper* col1ObjWrap= body1Wrap;
286
287 btAssert (col0ObjWrap->getCollisionShape()->isCompound());
288 btAssert (col1ObjWrap->getCollisionShape()->isCompound());
289 const btCompoundShape* compoundShape0 = static_cast<const btCompoundShape*>(col0ObjWrap->getCollisionShape());
290 const btCompoundShape* compoundShape1 = static_cast<const btCompoundShape*>(col1ObjWrap->getCollisionShape());
291
292 const btDbvt* tree0 = compoundShape0->getDynamicAabbTree();
293 const btDbvt* tree1 = compoundShape1->getDynamicAabbTree();
294 if (!tree0 || !tree1)
295 {
296 return btCompoundCollisionAlgorithm::processCollision(body0Wrap,body1Wrap,dispatchInfo,resultOut);
297 }
300 if ((compoundShape0->getUpdateRevision() != m_compoundShapeRevision0) || (compoundShape1->getUpdateRevision() != m_compoundShapeRevision1))
301 {
303 removeChildAlgorithms();
304 m_compoundShapeRevision0 = compoundShape0->getUpdateRevision();
305 m_compoundShapeRevision1 = compoundShape1->getUpdateRevision();
306
307 }
308
309
313 {
314 int i;
315 btManifoldArray manifoldArray;
316 btSimplePairArray& pairs = m_childCollisionAlgorithmCache->getOverlappingPairArray();
317 for (i=0;i<pairs.size();i++)
318 {
319 if (pairs[i].m_userPointer)
320 {
321 btCollisionAlgorithm* algo = (btCollisionAlgorithm*) pairs[i].m_userPointer;
322 algo->getAllContactManifolds(manifoldArray);
323 for (int m=0;m<manifoldArray.size();m++)
324 {
325 if (manifoldArray[m]->getNumContacts())
326 {
327 resultOut->setPersistentManifold(manifoldArray[m]);
328 resultOut->refreshContactPoints();
329 resultOut->setPersistentManifold(0);
330 }
331 }
332 manifoldArray.resize(0);
333 }
334 }
335 }
336
337
338
339
340 btCompoundCompoundLeafCallback callback(col0ObjWrap,col1ObjWrap,this->m_dispatcher,dispatchInfo,resultOut,this->m_childCollisionAlgorithmCache,m_sharedManifold);
341
342
343 const btTransform xform=col0ObjWrap->getWorldTransform().inverse()*col1ObjWrap->getWorldTransform();
344 MycollideTT(tree0->m_root,tree1->m_root,xform,&callback);
345
346 //printf("#compound-compound child/leaf overlap =%d \r",callback.m_numOverlapPairs);
347
348 //remove non-overlapping child pairs
349
350 {
351 btAssert(m_removePairs.size()==0);
352
353 //iterate over all children, perform an AABB check inside ProcessChildShape
354 btSimplePairArray& pairs = m_childCollisionAlgorithmCache->getOverlappingPairArray();
355
356 int i;
357 btManifoldArray manifoldArray;
358
359
360
361
362
363 btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1;
364
365 for (i=0;i<pairs.size();i++)
366 {
367 if (pairs[i].m_userPointer)
368 {
369 btCollisionAlgorithm* algo = (btCollisionAlgorithm*)pairs[i].m_userPointer;
370
371 {
372 btTransform orgTrans0;
373 const btCollisionShape* childShape0 = 0;
374
375 btTransform newChildWorldTrans0;
376 btTransform orgInterpolationTrans0;
377 childShape0 = compoundShape0->getChildShape(pairs[i].m_indexA);
378 orgTrans0 = col0ObjWrap->getWorldTransform();
379 orgInterpolationTrans0 = col0ObjWrap->getWorldTransform();
380 const btTransform& childTrans0 = compoundShape0->getChildTransform(pairs[i].m_indexA);
381 newChildWorldTrans0 = orgTrans0*childTrans0 ;
382 childShape0->getAabb(newChildWorldTrans0,aabbMin0,aabbMax0);
383 }
384
385 {
386 btTransform orgInterpolationTrans1;
387 const btCollisionShape* childShape1 = 0;
388 btTransform orgTrans1;
389 btTransform newChildWorldTrans1;
390
391 childShape1 = compoundShape1->getChildShape(pairs[i].m_indexB);
392 orgTrans1 = col1ObjWrap->getWorldTransform();
393 orgInterpolationTrans1 = col1ObjWrap->getWorldTransform();
394 const btTransform& childTrans1 = compoundShape1->getChildTransform(pairs[i].m_indexB);
395 newChildWorldTrans1 = orgTrans1*childTrans1 ;
396 childShape1->getAabb(newChildWorldTrans1,aabbMin1,aabbMax1);
397 }
398
399
400
401 if (!TestAabbAgainstAabb2(aabbMin0,aabbMax0,aabbMin1,aabbMax1))
402 {
403 algo->~btCollisionAlgorithm();
404 m_dispatcher->freeCollisionAlgorithm(algo);
405 m_removePairs.push_back(btSimplePair(pairs[i].m_indexA,pairs[i].m_indexB));
406 }
407 }
408 }
409 for (int i=0;i<m_removePairs.size();i++)
410 {
411 m_childCollisionAlgorithmCache->removeOverlappingPair(m_removePairs[i].m_indexA,m_removePairs[i].m_indexB);
412 }
413 m_removePairs.clear();
414 }
415
416 }
417
418 btScalar btCompoundCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
419 {
420 btAssert(0);
421 return 0.f;
422
423 }
424
425
426
btCompoundCompoundLeafCallback::Process
void Process(const btDbvtNode *leaf0, const btDbvtNode *leaf1)
Definition: btCompoundCompoundCollisionAlgorithm.cpp:125
btCompoundCompoundLeafCallback::m_dispatcher
btDispatcher * m_dispatcher
Definition: btCompoundCompoundCollisionAlgorithm.cpp:99
btPersistentManifold
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
Definition: btPersistentManifold.h:54
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:274
btCompoundCompoundCollisionAlgorithm::calculateTimeOfImpact
btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
Definition: btCompoundCompoundCollisionAlgorithm.cpp:418
btDispatcher::findAlgorithm
virtual btCollisionAlgorithm * findAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, btPersistentManifold *sharedManifold=0)=0
btCompoundCompoundCollisionAlgorithm::getAllContactManifolds
virtual void getAllContactManifolds(btManifoldArray &manifoldArray)
Definition: btCompoundCompoundCollisionAlgorithm.cpp:59
btHashedSimplePairCache::addOverlappingPair
virtual btSimplePair * addOverlappingPair(int indexA, int indexB)
Definition: btHashedSimplePairCache.h:76
btAlignedObjectArray< btPersistentManifold * >
btCollisionAlgorithm::processCollision
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)=0
btDbvtAabbMm
Definition: btDbvt.h:130
btManifoldResult.h
btCompoundCollisionAlgorithm::m_sharedManifold
class btPersistentManifold * m_sharedManifold
Definition: btCompoundCollisionAlgorithm.h:43
btCompoundShape::getUpdateRevision
int getUpdateRevision() const
Definition: btCompoundShape.h:165
btHashedSimplePairCache
Definition: btHashedSimplePairCache.h:55
btCompoundCompoundCollisionAlgorithm::m_compoundShapeRevision0
int m_compoundShapeRevision0
Definition: btCompoundCompoundCollisionAlgorithm.h:47
btCompoundCompoundCollisionAlgorithm::btCompoundCompoundCollisionAlgorithm
btCompoundCompoundCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped)
Definition: btCompoundCompoundCollisionAlgorithm.cpp:29
btManifoldResult::setPersistentManifold
void setPersistentManifold(btPersistentManifold *manifoldPtr)
Definition: btManifoldResult.h:70
btCompoundCompoundLeafCallback::m_compound0ColObjWrap
const btCollisionObjectWrapper * m_compound0ColObjWrap
Definition: btCompoundCompoundCollisionAlgorithm.cpp:97
btCompoundCompoundLeafCallback::m_sharedManifold
btPersistentManifold * m_sharedManifold
Definition: btCompoundCompoundCollisionAlgorithm.cpp:106
btAssert
#define btAssert(x)
Definition: btScalar.h:113
btDbvt::DOUBLE_STACKSIZE
Definition: btDbvt.h:254
btCompoundCompoundCollisionAlgorithm::~btCompoundCompoundCollisionAlgorithm
virtual ~btCompoundCompoundCollisionAlgorithm()
Definition: btCompoundCompoundCollisionAlgorithm.cpp:52
btDbvt
The btDbvt class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes ...
Definition: btDbvt.h:194
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:27
MycollideTT
static void MycollideTT(const btDbvtNode *root0, const btDbvtNode *root1, const btTransform &xform, btCompoundCompoundLeafCallback *callback)
Definition: btCompoundCompoundCollisionAlgorithm.cpp:227
btManifoldResult::refreshContactPoints
void refreshContactPoints()
Definition: btManifoldResult.h:99
btDbvt::sStkNN::b
const btDbvtNode * b
Definition: btDbvt.h:200
btDbvt::m_root
btDbvtNode * m_root
Definition: btDbvt.h:258
btManifoldResult
btManifoldResult is a helper class to manage contact results.
Definition: btManifoldResult.h:39
btCollisionAlgorithm::~btCollisionAlgorithm
virtual ~btCollisionAlgorithm()
Definition: btCollisionAlgorithm.h:71
btManifoldResult::getBody1Wrap
const btCollisionObjectWrapper * getBody1Wrap() const
Definition: btManifoldResult.h:120
btCompoundShape::getDynamicAabbTree
const btDbvt * getDynamicAabbTree() const
Definition: btCompoundShape.h:146
btCompoundCompoundLeafCallback::btCompoundCompoundLeafCallback
btCompoundCompoundLeafCallback(const btCollisionObjectWrapper *compound1ObjWrap, const btCollisionObjectWrapper *compound0ObjWrap, btDispatcher *dispatcher, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut, btHashedSimplePairCache *childAlgorithmsCache, btPersistentManifold *sharedManifold)
Definition: btCompoundCompoundCollisionAlgorithm.cpp:108
TestAabbAgainstAabb2
bool TestAabbAgainstAabb2(const btVector3 &aabbMin1, const btVector3 &aabbMax1, const btVector3 &aabbMin2, const btVector3 &aabbMax2)
conservative test for overlap between two aabbs
Definition: btAabbUtil2.h:48
btHashedSimplePairCache::getOverlappingPairArray
btSimplePairArray & getOverlappingPairArray()
Definition: btHashedSimplePairCache.h:94
btDbvtNode::isinternal
DBVT_INLINE bool isinternal() const
Definition: btDbvt.h:182
btCollisionShape::getAabb
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t...
btCollisionAlgorithm::m_dispatcher
btDispatcher * m_dispatcher
Definition: btCollisionAlgorithm.h:60
btCompoundCompoundLeafCallback::m_dispatchInfo
const btDispatcherInfo & m_dispatchInfo
Definition: btCompoundCompoundCollisionAlgorithm.cpp:100
btAlignedObjectArray::clear
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations.
Definition: btAlignedObjectArray.h:190
btManifoldResult::setShapeIdentifiersA
virtual void setShapeIdentifiersA(int partId0, int index0)
setShapeIdentifiersA/B provides experimental support for per-triangle material / custom material comb...
Definition: btManifoldResult.h:84
btCompoundCollisionAlgorithm::processCollision
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
Definition: btCompoundCollisionAlgorithm.cpp:216
btCompoundCompoundLeafCallback::m_resultOut
btManifoldResult * m_resultOut
Definition: btCompoundCompoundCollisionAlgorithm.cpp:101
btCompoundCompoundCollisionAlgorithm::processCollision
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
Definition: btCompoundCompoundCollisionAlgorithm.cpp:281
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:155
btAabbUtil2.h
btDbvtNode::childs
btDbvtNode * childs[2]
Definition: btDbvt.h:185
btManifoldResult::getBody0Wrap
const btCollisionObjectWrapper * getBody0Wrap() const
Definition: btManifoldResult.h:116
btCompoundShape::getChildTransform
btTransform & getChildTransform(int index)
Definition: btCompoundShape.h:99
btSimplePair
Definition: btHashedSimplePairCache.h:25
btDbvtAabbMm::FromMM
static btDbvtAabbMm FromMM(const btVector3 &mi, const btVector3 &mx)
Definition: btDbvt.h:411
btDbvt::sStkNN::a
const btDbvtNode * a
Definition: btDbvt.h:199
btHashedSimplePairCache::removeAllPairs
void removeAllPairs()
Definition: btHashedSimplePairCache.cpp:49
btCompoundCompoundCollisionAlgorithm::m_childCollisionAlgorithmCache
class btHashedSimplePairCache * m_childCollisionAlgorithmCache
Definition: btCompoundCompoundCollisionAlgorithm.h:43
btCollisionObjectWrapper::getWorldTransform
const btTransform & getWorldTransform() const
Definition: btCollisionObjectWrapper.h:38
btAlignedFree
#define btAlignedFree(ptr)
Definition: btAlignedAllocator.h:42
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:49
btCompoundCompoundCollisionAlgorithm::removeChildAlgorithms
void removeChildAlgorithms()
Definition: btCompoundCompoundCollisionAlgorithm.cpp:74
btShapePairCallback
bool(* btShapePairCallback)(const btCollisionShape *pShape0, const btCollisionShape *pShape1)
Definition: btCompoundCollisionAlgorithm.h:33
MyIntersect
static DBVT_INLINE bool MyIntersect(const btDbvtAabbMm &a, const btDbvtAabbMm &b, const btTransform &xform)
Definition: btCompoundCompoundCollisionAlgorithm.cpp:217
btDispatcher::freeCollisionAlgorithm
virtual void freeCollisionAlgorithm(void *ptr)=0
btTransform::inverse
btTransform inverse() const
Return the inverse of this transform.
Definition: btTransform.h:188
btCollisionObjectWrapper.h
btManifoldResult::setShapeIdentifiersB
virtual void setShapeIdentifiersB(int partId1, int index1)
Definition: btManifoldResult.h:90
btDbvt::sStkNN
Definition: btDbvt.h:197
btCollisionObjectWrapper::getCollisionShape
const btCollisionShape * getCollisionShape() const
Definition: btCollisionObjectWrapper.h:40
btCompoundCompoundCollisionAlgorithm::m_compoundShapeRevision1
int m_compoundShapeRevision1
Definition: btCompoundCompoundCollisionAlgorithm.h:48
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
btCollisionAlgorithm::getAllContactManifolds
virtual void getAllContactManifolds(btManifoldArray &manifoldArray)=0
btDbvtAabbMm::Maxs
DBVT_INLINE const btVector3 & Maxs() const
Definition: btDbvt.h:136
btDbvt::ICollide
Definition: btDbvt.h:227
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btCollisionShape::isCompound
bool isCompound() const
Definition: btCollisionShape.h:85
btIDebugDraw.h
btAlignedObjectArray::resize
void resize(int newsize, const T &fillData=T())
Definition: btAlignedObjectArray.h:218
btDbvtNode::volume
btDbvtVolume volume
Definition: btDbvt.h:179
btManifoldResult::setBody1Wrap
void setBody1Wrap(const btCollisionObjectWrapper *obj1Wrap)
Definition: btManifoldResult.h:130
btCollisionObject.h
btCompoundCollisionAlgorithm
btCompoundCollisionAlgorithm supports collision between CompoundCollisionShapes and other collision s...
Definition: btCompoundCollisionAlgorithm.h:37
btCompoundCompoundLeafCallback
Definition: btCompoundCompoundCollisionAlgorithm.cpp:92
btHashedSimplePairCache::findPair
btSimplePair * findPair(int indexA, int indexB)
Definition: btHashedSimplePairCache.cpp:62
btCompoundCompoundLeafCallback::m_compound1ColObjWrap
const btCollisionObjectWrapper * m_compound1ColObjWrap
Definition: btCompoundCompoundCollisionAlgorithm.cpp:98
btDbvtNode::dataAsInt
int dataAsInt
Definition: btDbvt.h:187
DBVT_INLINE
#define DBVT_INLINE
Definition: btDbvt.h:55
Intersect
DBVT_INLINE bool Intersect(const btDbvtAabbMm &a, const btDbvtAabbMm &b)
Definition: btDbvt.h:520
btAlignedAlloc
#define btAlignedAlloc(size, alignment)
Definition: btAlignedAllocator.h:41
btCompoundCompoundLeafCallback::m_numOverlapPairs
int m_numOverlapPairs
Definition: btCompoundCompoundCollisionAlgorithm.cpp:94
btHashedSimplePairCache::~btHashedSimplePairCache
virtual ~btHashedSimplePairCache()
Definition: btHashedSimplePairCache.cpp:40
btTransformAabb
void btTransformAabb(const btVector3 &halfExtents, btScalar margin, const btTransform &t, btVector3 &aabbMinOut, btVector3 &aabbMaxOut)
Definition: btAabbUtil2.h:182
btCompoundShape
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
Definition: btCompoundShape.h:54
btManifoldResult::setBody0Wrap
void setBody0Wrap(const btCollisionObjectWrapper *obj0Wrap)
Definition: btManifoldResult.h:125
btCompoundShape.h
btDbvt.h
btDispatcherInfo
Definition: btDispatcher.h:30
btCompoundCompoundCollisionAlgorithm::m_removePairs
btSimplePairArray m_removePairs
Definition: btCompoundCompoundCollisionAlgorithm.h:44
btDbvtNode
Definition: btDbvt.h:177
btDbvtAabbMm::Mins
DBVT_INLINE const btVector3 & Mins() const
Definition: btDbvt.h:135
btCollisionAlgorithmConstructionInfo
Definition: btCollisionAlgorithm.h:32
btCompoundShape::getChildShape
btCollisionShape * getChildShape(int index)
Definition: btCompoundShape.h:90
btDispatcher
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:69
btCollisionAlgorithm
btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatche...
Definition: btCollisionAlgorithm.h:55
btCollisionObjectWrapper
Definition: btCollisionObjectWrapper.h:17
btHashedSimplePairCache::removeOverlappingPair
virtual void * removeOverlappingPair(int indexA, int indexB)
Definition: btHashedSimplePairCache.cpp:173
btCompoundCompoundLeafCallback::m_childCollisionAlgorithmCache
class btHashedSimplePairCache * m_childCollisionAlgorithmCache
Definition: btCompoundCompoundCollisionAlgorithm.cpp:104
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:278
gCompoundCompoundChildShapePairCallback
btShapePairCallback gCompoundCompoundChildShapePairCallback
Definition: btCompoundCompoundCollisionAlgorithm.cpp:27
btCollisionObjectWrapper::getCollisionObject
const btCollisionObject * getCollisionObject() const
Definition: btCollisionObjectWrapper.h:39
btCompoundCompoundCollisionAlgorithm.h