diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-01-17 23:35:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-01-26 00:14:46 +0300 |
commit | b64d5809e7e3b832e2a011869db68e70b4b4e6fc (patch) | |
tree | aa4f6714da9f546eeee7dffed9236f9c8309524b /extern/bullet2/patches | |
parent | 3c72e302e1eb25de43dd9d077f0c730cc02b5674 (diff) |
Upgrade Bullet to version 2.83.
I tried to carefully preserve all patches since the last upgrade.
Improves T47195, cloth collision detection bug.
Differential Revision: https://developer.blender.org/D1739
Diffstat (limited to 'extern/bullet2/patches')
-rw-r--r-- | extern/bullet2/patches/blender.patch | 150 | ||||
-rw-r--r-- | extern/bullet2/patches/convex_hull.patch | 127 |
2 files changed, 150 insertions, 127 deletions
diff --git a/extern/bullet2/patches/blender.patch b/extern/bullet2/patches/blender.patch new file mode 100644 index 00000000000..d8e52ec32e8 --- /dev/null +++ b/extern/bullet2/patches/blender.patch @@ -0,0 +1,150 @@ +diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h +index be9eca6..ec40c96 100644 +--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h ++++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h +@@ -15,7 +15,7 @@ subject to the following restrictions: + + + /** +- * @mainpage Bullet Documentation ++ * @page Bullet Documentation + * + * @section intro_sec Introduction + * Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ). +diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp +index 36dd043..57eb817 100644 +--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp ++++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp +@@ -579,14 +579,10 @@ btCollisionShape* btCollisionWorldImporter::convertCollisionShape( btCollisionS + btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData; + btCompoundShape* compoundShape = createCompoundShape(); + +- btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0]; +- + + btAlignedObjectArray<btCollisionShape*> childShapes; + for (int i=0;i<compoundData->m_numChildShapes;i++) + { +- btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i]; +- + btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape; + + btCollisionShape* childShape = convertCollisionShape(cd); +diff --git a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp +index 57fc119..31faf1d 100644 +--- a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp ++++ b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp +@@ -29,14 +29,11 @@ subject to the following restrictions: + static btVector3 + getNormalizedVector(const btVector3& v) + { +- btScalar l = v.length(); +- btVector3 n = v; +- if (l < SIMD_EPSILON) { +- n.setValue(0,0,0); +- } else { +- n /= l; +- } ++ btVector3 n(0, 0, 0); + ++ if (v.length() > SIMD_EPSILON) { ++ n = v.normalized(); ++ } + return n; + } + +diff --git a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h +index 27ccefe..8e4456e 100644 +--- a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h ++++ b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h +@@ -37,8 +37,13 @@ struct btSimdScalar + { + + } +- ++/* workaround for clang 3.4 ( == apple clang 5.1 ) issue, friction would fail with forced inlining */ ++#if (defined(__clang__) && defined(__apple_build_version__) && (__clang_major__ == 5) && (__clang_minor__ == 1)) \ ++|| (defined(__clang__) && !defined(__apple_build_version__) && (__clang_major__ == 3) && (__clang_minor__ == 4)) ++ inline __attribute__ ((noinline)) btSimdScalar(float fl) ++#else + SIMD_FORCE_INLINE btSimdScalar(float fl) ++#endif + :m_vec128 (_mm_set1_ps(fl)) + { + } +diff --git a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp +index 5d62da7..fcd312e 100644 +--- a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp ++++ b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp +@@ -28,7 +28,6 @@ + #include "btMultiBodyJointFeedback.h" + #include "LinearMath/btTransformUtil.h" + #include "LinearMath/btSerializer.h" +-#include "Bullet3Common/b3Logging.h" + // #define INCLUDE_GYRO_TERM + + ///todo: determine if we need these options. If so, make a proper API, otherwise delete those globals +@@ -1732,7 +1731,6 @@ void btMultiBody::goToSleep() + + void btMultiBody::checkMotionAndSleepIfRequired(btScalar timestep) + { +- int num_links = getNumLinks(); + extern bool gDisableDeactivation; + if (!m_canSleep || gDisableDeactivation) + { +diff --git a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp +index 8a034b3..4f66b20 100644 +--- a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp ++++ b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp +@@ -809,7 +809,6 @@ static void applyJointFeedback(btMultiBodyJacobianData& data, const btMultiBodyS + } + #endif + +-#include "Bullet3Common/b3Logging.h" + void btMultiBodyConstraintSolver::writeBackSolverBodyToMultiBody(btMultiBodySolverConstraint& c, btScalar deltaTime) + { + #if 1 +diff --git a/extern/bullet2/src/BulletSoftBody/btSparseSDF.h b/extern/bullet2/src/BulletSoftBody/btSparseSDF.h +index bcf0c79..8992ddb 100644 +--- a/extern/bullet2/src/BulletSoftBody/btSparseSDF.h ++++ b/extern/bullet2/src/BulletSoftBody/btSparseSDF.h +@@ -185,7 +185,6 @@ struct btSparseSdf + { + ++nprobes; + ++ncells; +- int sz = sizeof(Cell); + if (ncells>m_clampCells) + { + static int numResets=0; +diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp +index d58ac95..3fd77df 100644 +--- a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp ++++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp +@@ -2665,6 +2665,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in + } + + vertices.resize(0); ++ original_vertex_index.resize(0); + edges.resize(0); + faces.resize(0); + +@@ -2675,6 +2676,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in + { + btConvexHullInternal::Vertex* v = oldVertices[copied]; + vertices.push_back(hull.getCoordinates(v)); ++ original_vertex_index.push_back(v->point.index); + btConvexHullInternal::Edge* firstEdge = v->edges; + if (firstEdge) + { +diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.h b/extern/bullet2/src/LinearMath/btConvexHullComputer.h +index 7240ac4..6871ce8 100644 +--- a/extern/bullet2/src/LinearMath/btConvexHullComputer.h ++++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.h +@@ -67,6 +67,7 @@ class btConvexHullComputer + + // Vertices of the output hull + btAlignedObjectArray<btVector3> vertices; ++ btAlignedObjectArray<int> original_vertex_index; + + // Edges of the output hull + btAlignedObjectArray<Edge> edges; diff --git a/extern/bullet2/patches/convex_hull.patch b/extern/bullet2/patches/convex_hull.patch deleted file mode 100644 index 1b2978221fb..00000000000 --- a/extern/bullet2/patches/convex_hull.patch +++ /dev/null @@ -1,127 +0,0 @@ -Index: extern/bullet2/src/Bullet-C-Api.h -=================================================================== ---- extern/bullet2/src/Bullet-C-Api.h (revision 51556) -+++ extern/bullet2/src/Bullet-C-Api.h (working copy) -@@ -167,6 +167,16 @@ extern "C" { - // needed for source/blender/blenkernel/intern/collision.c - double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]); - -+ -+ /* Convex Hull */ -+ PL_DECLARE_HANDLE(plConvexHull); -+ plConvexHull plConvexHullCompute(float (*coords)[3], int count); -+ int plConvexHullNumVertices(plConvexHull hull); -+ int plConvexHullNumFaces(plConvexHull hull); -+ void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index); -+ int plConvexHullGetFaceSize(plConvexHull hull, int n); -+ void plConvexHullGetFaceVertices(plConvexHull hull, int n, int *vertices); -+ - #ifdef __cplusplus - } - #endif -Index: extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp -=================================================================== ---- extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp (revision 51556) -+++ extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp (working copy) -@@ -23,7 +23,7 @@ subject to the following restrictions: - #include "Bullet-C-Api.h" - #include "btBulletDynamicsCommon.h" - #include "LinearMath/btAlignedAllocator.h" -- -+#include "LinearMath/btConvexHullComputer.h" - - - #include "LinearMath/btVector3.h" -@@ -403,3 +403,60 @@ double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float - return -1.0f; - } - -+// Convex hull -+plConvexHull plConvexHullCompute(float (*coords)[3], int count) -+{ -+ btConvexHullComputer *computer = new btConvexHullComputer; -+ computer->compute(reinterpret_cast< float* >(coords), -+ sizeof(*coords), count, 0, 0); -+ return reinterpret_cast<plConvexHull>(computer); -+} -+ -+int plConvexHullNumVertices(plConvexHull hull) -+{ -+ btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull)); -+ return computer->vertices.size(); -+} -+ -+int plConvexHullNumFaces(plConvexHull hull) -+{ -+ btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull)); -+ return computer->faces.size(); -+} -+ -+void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], -+ int *original_index) -+{ -+ btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull)); -+ const btVector3 &v(computer->vertices[n]); -+ coords[0] = v[0]; -+ coords[1] = v[1]; -+ coords[2] = v[2]; -+ (*original_index) = computer->original_vertex_index[n]; -+} -+ -+int plConvexHullGetFaceSize(plConvexHull hull, int n) -+{ -+ btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull)); -+ const btConvexHullComputer::Edge *e_orig, *e; -+ int count; -+ -+ for (e_orig = &computer->edges[computer->faces[n]], e = e_orig, count = 0; -+ count == 0 || e != e_orig; -+ e = e->getNextEdgeOfFace(), count++); -+ return count; -+} -+ -+void plConvexHullGetFaceVertices(plConvexHull hull, int n, int *vertices) -+{ -+ btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull)); -+ const btConvexHullComputer::Edge *e_orig, *e; -+ int count; -+ -+ for (e_orig = &computer->edges[computer->faces[n]], e = e_orig, count = 0; -+ count == 0 || e != e_orig; -+ e = e->getNextEdgeOfFace(), count++) -+ { -+ vertices[count] = e->getTargetVertex(); -+ } -+} -Index: extern/bullet2/src/LinearMath/btConvexHullComputer.cpp -=================================================================== ---- extern/bullet2/src/LinearMath/btConvexHullComputer.cpp (revision 51556) -+++ extern/bullet2/src/LinearMath/btConvexHullComputer.cpp (working copy) -@@ -2661,6 +2661,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in - } - - vertices.resize(0); -+ original_vertex_index.resize(0); - edges.resize(0); - faces.resize(0); - -@@ -2671,6 +2672,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in - { - btConvexHullInternal::Vertex* v = oldVertices[copied]; - vertices.push_back(hull.getCoordinates(v)); -+ original_vertex_index.push_back(v->point.index); - btConvexHullInternal::Edge* firstEdge = v->edges; - if (firstEdge) - { -Index: extern/bullet2/src/LinearMath/btConvexHullComputer.h -=================================================================== ---- extern/bullet2/src/LinearMath/btConvexHullComputer.h (revision 51556) -+++ extern/bullet2/src/LinearMath/btConvexHullComputer.h (working copy) -@@ -67,6 +67,7 @@ class btConvexHullComputer - - // Vertices of the output hull - btAlignedObjectArray<btVector3> vertices; -+ btAlignedObjectArray<int> original_vertex_index; - - // Edges of the output hull - btAlignedObjectArray<Edge> edges; |