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

Bullet Collision Detection & Physics Library

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