28 #define USE_LOCAL_STACK 1
45 m_compoundShapeRevision0 = compoundShape0->getUpdateRevision();
48 m_compoundShapeRevision1 = compoundShape1->getUpdateRevision();
53 removeChildAlgorithms();
62 for (i = 0; i < pairs.
size(); i++)
71 void btCompoundCompoundCollisionAlgorithm::removeChildAlgorithms()
75 int numChildren = pairs.
size();
77 for (i = 0; i < numChildren; i++)
116 BT_PROFILE(
"btCompoundCompoundLeafCallback::Process");
131 const btCollisionShape* childShape0 = compoundShape0->getChildShape(childIndex0);
132 const btCollisionShape* childShape1 = compoundShape1->getChildShape(childIndex1);
136 const btTransform& childTrans0 = compoundShape0->getChildTransform(childIndex0);
137 btTransform newChildWorldTrans0 = orgTrans0 * childTrans0;
140 const btTransform& childTrans1 = compoundShape1->getChildTransform(childIndex1);
141 btTransform newChildWorldTrans1 = orgTrans1 * childTrans1;
144 btVector3 aabbMin0, aabbMax0, aabbMin1, aabbMax1;
145 childShape0->getAabb(newChildWorldTrans0, aabbMin0, aabbMax0);
146 childShape1->getAabb(newChildWorldTrans1, aabbMin1, aabbMax1);
150 aabbMin0 -= thresholdVec;
151 aabbMax0 += thresholdVec;
165 bool removePair =
false;
220 newmin -=
btVector3(distanceThreshold, distanceThreshold, distanceThreshold);
221 newmax +=
btVector3(distanceThreshold, distanceThreshold, distanceThreshold);
236 #ifdef USE_LOCAL_STACK
248 if (depth > treshold)
251 treshold = stkStack.
size() - 4;
295 const btDbvt* tree0 = compoundShape0->getDynamicAabbTree();
296 const btDbvt* tree1 = compoundShape1->getDynamicAabbTree();
297 if (!tree0 || !tree1)
303 if ((compoundShape0->getUpdateRevision() != m_compoundShapeRevision0) || (compoundShape1->getUpdateRevision() != m_compoundShapeRevision1))
306 removeChildAlgorithms();
307 m_compoundShapeRevision0 = compoundShape0->getUpdateRevision();
308 m_compoundShapeRevision1 = compoundShape1->getUpdateRevision();
317 #ifdef USE_LOCAL_STACK
322 for (i = 0; i < pairs.
size(); i++)
328 for (
int m = 0; m < manifoldArray.
size(); m++)
360 btVector3 aabbMin0, aabbMax0, aabbMin1, aabbMax1;
362 for (i = 0; i < pairs.
size(); i++)
372 childShape0 = compoundShape0->getChildShape(pairs[i].m_indexA);
373 const btTransform& childTrans0 = compoundShape0->getChildTransform(pairs[i].m_indexA);
375 childShape0->getAabb(newChildWorldTrans0, aabbMin0, aabbMax0);
378 aabbMin0 -= thresholdVec;
379 aabbMax0 += thresholdVec;
384 childShape1 = compoundShape1->getChildShape(pairs[i].m_indexB);
385 const btTransform& childTrans1 = compoundShape1->getChildTransform(pairs[i].m_indexB);
387 childShape1->getAabb(newChildWorldTrans1, aabbMin1, aabbMax1);
390 aabbMin1 -= thresholdVec;
391 aabbMax1 += thresholdVec;
401 for (
int i = 0; i < m_removePairs.
size(); i++)
403 m_childCollisionAlgorithmCache->
removeOverlappingPair(m_removePairs[i].m_indexA, m_removePairs[i].m_indexB);
405 m_removePairs.
clear();
SIMD_FORCE_INLINE bool TestAabbAgainstAabb2(const btVector3 &aabbMin1, const btVector3 &aabbMax1, const btVector3 &aabbMin2, const btVector3 &aabbMax2)
conservative test for overlap between two aabbs
SIMD_FORCE_INLINE void btTransformAabb(const btVector3 &halfExtents, btScalar margin, const btTransform &t, btVector3 &aabbMinOut, btVector3 &aabbMaxOut)
#define btAlignedFree(ptr)
#define btAlignedAlloc(size, alignment)
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
bool(* btShapePairCallback)(const btCollisionShape *pShape0, const btCollisionShape *pShape1)
btShapePairCallback gCompoundCompoundChildShapePairCallback
static DBVT_INLINE bool MyIntersect(const btDbvtAabbMm &a, const btDbvtAabbMm &b, const btTransform &xform, btScalar distanceThreshold)
static void MycollideTT(const btDbvtNode *root0, const btDbvtNode *root1, const btTransform &xform, btCompoundCompoundLeafCallback *callback, btScalar distanceThreshold)
btCompoundShape(bool enableDynamicAabbTree=true, const int initialChildCapacity=0)
int getNumChildShapes() const
DBVT_INLINE bool Intersect(const btDbvtAabbMm &a, const btDbvtAabbMm &b)
@ BT_CLOSEST_POINT_ALGORITHMS
@ BT_CONTACT_POINT_ALGORITHMS
SIMD_FORCE_INLINE int getNumContacts() const
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define ATTRIBUTE_ALIGNED16(a)
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
SIMD_FORCE_INLINE void resize(int newsize, const T &fillData=T())
void initializeFromBuffer(void *buffer, int size, int capacity)
SIMD_FORCE_INLINE void push_back(const T &_Val)
btDispatcher * m_dispatcher
virtual void getAllContactManifolds(btManifoldArray &manifoldArray)=0
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)=0
virtual ~btCollisionAlgorithm()
btCompoundCollisionAlgorithm supports collision between CompoundCollisionShapes and other collision s...
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
class btPersistentManifold * m_sharedManifold
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
btCompoundCompoundCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped)
virtual ~btCompoundCompoundCollisionAlgorithm()
virtual void getAllContactManifolds(btManifoldArray &manifoldArray)
virtual void freeCollisionAlgorithm(void *ptr)=0
virtual btCollisionAlgorithm * findAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, btPersistentManifold *sharedManifold, ebtDispatcherQueryType queryType)=0
virtual ~btHashedSimplePairCache()
btSimplePairArray & getOverlappingPairArray()
btSimplePair * findPair(int indexA, int indexB)
virtual btSimplePair * addOverlappingPair(int indexA, int indexB)
virtual void * removeOverlappingPair(int indexA, int indexB)
btManifoldResult is a helper class to manage contact results.
virtual void setShapeIdentifiersA(int partId0, int index0)
setShapeIdentifiersA/B provides experimental support for per-triangle material / custom material comb...
void setBody0Wrap(const btCollisionObjectWrapper *obj0Wrap)
const btCollisionObjectWrapper * getBody1Wrap() const
const btCollisionObjectWrapper * getBody0Wrap() const
void setBody1Wrap(const btCollisionObjectWrapper *obj1Wrap)
void setPersistentManifold(btPersistentManifold *manifoldPtr)
virtual void setShapeIdentifiersB(int partId1, int index1)
btScalar m_closestPointDistanceThreshold
SIMD_FORCE_INLINE void refreshContactPoints()
DEGForeachIDComponentCallback callback
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
SIMD_FORCE_INLINE const btCollisionShape * getCollisionShape() const
SIMD_FORCE_INLINE const btTransform & getWorldTransform() const
SIMD_FORCE_INLINE const btCollisionObject * getCollisionObject() const
btPersistentManifold * m_sharedManifold
void Process(const btDbvtNode *leaf0, const btDbvtNode *leaf1)
btDispatcher * m_dispatcher
const btCollisionObjectWrapper * m_compound0ColObjWrap
btCompoundCompoundLeafCallback(const btCollisionObjectWrapper *compound1ObjWrap, const btCollisionObjectWrapper *compound0ObjWrap, btDispatcher *dispatcher, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut, btHashedSimplePairCache *childAlgorithmsCache, btPersistentManifold *sharedManifold)
const btCollisionObjectWrapper * m_compound1ColObjWrap
class btHashedSimplePairCache * m_childCollisionAlgorithmCache
const btDispatcherInfo & m_dispatchInfo
btManifoldResult * m_resultOut
static btDbvtAabbMm FromMM(const btVector3 &mi, const btVector3 &mx)
DBVT_INLINE bool isinternal() const