From 05eebf49d3c3af47bf157207b82cf559ac1fe274 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Thu, 26 Dec 2013 12:41:52 +0100 Subject: Bullet: Update to svn r2719 Fixes part of T37905, fixed constraint didn't work correctly. --- .../CollisionDispatch/btCollisionWorld.cpp | 2 +- .../CollisionDispatch/btCompoundCollisionAlgorithm.cpp | 1 + .../CollisionDispatch/btCompoundCollisionAlgorithm.h | 1 + .../btCompoundCompoundCollisionAlgorithm.cpp | 16 +++++++++++----- .../btCompoundCompoundCollisionAlgorithm.h | 7 +++---- 5 files changed, 17 insertions(+), 10 deletions(-) (limited to 'extern/bullet2/src/BulletCollision') diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp index 093c6f9b200..d739a2a08d7 100644 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp @@ -770,7 +770,7 @@ void btCollisionWorld::objectQuerySingleInternal(const btConvexShape* castShape, hitPointLocal, hitFraction); - bool normalInWorldSpace = false; + bool normalInWorldSpace = true; return m_resultCallback->addSingleResult(convexResult,normalInWorldSpace); } diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp index 991841ee20b..286e6c31f2f 100644 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp @@ -229,6 +229,7 @@ void btCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrap removeChildAlgorithms(); preallocateChildAlgorithms(body0Wrap,body1Wrap); + m_compoundShapeRevision = compoundShape->getUpdateRevision(); } diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h index 53675145637..7d792c18d34 100644 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h @@ -36,6 +36,7 @@ extern btShapePairCallback gCompoundChildShapePairCallback; /// btCompoundCollisionAlgorithm supports collision between CompoundCollisionShapes and other collision shapes class btCompoundCollisionAlgorithm : public btActivatingCollisionAlgorithm { +protected: btAlignedObjectArray m_childCollisionAlgorithms; bool m_isSwapped; diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp index a52dd34fe91..95780fb2d27 100644 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp @@ -27,10 +27,8 @@ subject to the following restrictions: btShapePairCallback gCompoundCompoundChildShapePairCallback = 0; btCompoundCompoundCollisionAlgorithm::btCompoundCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,bool isSwapped) -:btActivatingCollisionAlgorithm(ci,body0Wrap,body1Wrap), -m_sharedManifold(ci.m_manifold) +:btCompoundCollisionAlgorithm(ci,body0Wrap,body1Wrap,isSwapped) { - m_ownsManifold = false; void* ptr = btAlignedAlloc(sizeof(btHashedSimplePairCache),16); m_childCollisionAlgorithmCache= new(ptr) btHashedSimplePairCache(); @@ -292,12 +290,21 @@ void btCompoundCompoundCollisionAlgorithm::processCollision (const btCollisionOb const btCompoundShape* compoundShape0 = static_cast(col0ObjWrap->getCollisionShape()); const btCompoundShape* compoundShape1 = static_cast(col1ObjWrap->getCollisionShape()); + const btDbvt* tree0 = compoundShape0->getDynamicAabbTree(); + const btDbvt* tree1 = compoundShape1->getDynamicAabbTree(); + if (!tree0 || !tree1) + { + return btCompoundCollisionAlgorithm::processCollision(body0Wrap,body1Wrap,dispatchInfo,resultOut); + } ///btCompoundShape might have changed: ////make sure the internal child collision algorithm caches are still valid if ((compoundShape0->getUpdateRevision() != m_compoundShapeRevision0) || (compoundShape1->getUpdateRevision() != m_compoundShapeRevision1)) { ///clear all removeChildAlgorithms(); + m_compoundShapeRevision0 = compoundShape0->getUpdateRevision(); + m_compoundShapeRevision1 = compoundShape1->getUpdateRevision(); + } @@ -329,8 +336,7 @@ void btCompoundCompoundCollisionAlgorithm::processCollision (const btCollisionOb } - const btDbvt* tree0 = compoundShape0->getDynamicAabbTree(); - const btDbvt* tree1 = compoundShape1->getDynamicAabbTree(); + btCompoundCompoundLeafCallback callback(col0ObjWrap,col1ObjWrap,this->m_dispatcher,dispatchInfo,resultOut,this->m_childCollisionAlgorithmCache,m_sharedManifold); diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.h index 7e2d7ad7085..06a762f209d 100644 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.h +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.h @@ -17,6 +17,8 @@ subject to the following restrictions: #ifndef BT_COMPOUND_COMPOUND_COLLISION_ALGORITHM_H #define BT_COMPOUND_COMPOUND_COLLISION_ALGORITHM_H +#include "btCompoundCollisionAlgorithm.h" + #include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h" #include "BulletCollision/BroadphaseCollision/btDispatcher.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" @@ -35,15 +37,12 @@ typedef bool (*btShapePairCallback)(const btCollisionShape* pShape0, const btCol extern btShapePairCallback gCompoundCompoundChildShapePairCallback; /// btCompoundCompoundCollisionAlgorithm supports collision between two btCompoundCollisionShape shapes -class btCompoundCompoundCollisionAlgorithm : public btActivatingCollisionAlgorithm +class btCompoundCompoundCollisionAlgorithm : public btCompoundCollisionAlgorithm { class btHashedSimplePairCache* m_childCollisionAlgorithmCache; btSimplePairArray m_removePairs; - class btPersistentManifold* m_sharedManifold; - bool m_ownsManifold; - int m_compoundShapeRevision0;//to keep track of changes, so that childAlgorithm array can be updated int m_compoundShapeRevision1; -- cgit v1.2.3