d8e52ec32e8acc0ee27223d5ad39a6fec032b23e
[blender-staging.git] / extern / bullet2 / patches / blender.patch
1 diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
2 index be9eca6..ec40c96 100644
3 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
4 +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
5 @@ -15,7 +15,7 @@ subject to the following restrictions:
6  
7  
8  /**
9 - * @mainpage Bullet Documentation
10 + * @page Bullet Documentation
11   *
12   * @section intro_sec Introduction
13   * 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 ).
14 diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
15 index 36dd043..57eb817 100644
16 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
17 +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
18 @@ -579,14 +579,10 @@ btCollisionShape* btCollisionWorldImporter::convertCollisionShape(  btCollisionS
19                                 btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
20                                 btCompoundShape* compoundShape = createCompoundShape();
21  
22 -                               btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0];
23 -
24  
25                                 btAlignedObjectArray<btCollisionShape*> childShapes;
26                                 for (int i=0;i<compoundData->m_numChildShapes;i++)
27                                 {
28 -                                       btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i];
29 -
30                                         btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape;
31  
32                                         btCollisionShape* childShape = convertCollisionShape(cd);
33 diff --git a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
34 index 57fc119..31faf1d 100644
35 --- a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
36 +++ b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
37 @@ -29,14 +29,11 @@ subject to the following restrictions:
38  static btVector3
39  getNormalizedVector(const btVector3& v)
40  {
41 -       btScalar l = v.length();
42 -       btVector3 n = v;
43 -       if (l < SIMD_EPSILON) {
44 -               n.setValue(0,0,0);
45 -       } else {
46 -               n /= l;
47 -       }
48 +       btVector3 n(0, 0, 0);
49  
50 +       if (v.length() > SIMD_EPSILON) {
51 +               n = v.normalized();
52 +       }
53         return n;
54  }
55  
56 diff --git a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
57 index 27ccefe..8e4456e 100644
58 --- a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
59 +++ b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
60 @@ -37,8 +37,13 @@ struct       btSimdScalar
61         {
62  
63         }
64 -
65 +/* workaround for clang 3.4 ( == apple clang 5.1 ) issue, friction would fail with forced inlining */
66 +#if (defined(__clang__) && defined(__apple_build_version__) &&  (__clang_major__ == 5) && (__clang_minor__ == 1)) \
67 +|| (defined(__clang__) && !defined(__apple_build_version__) && (__clang_major__ == 3) && (__clang_minor__ == 4))
68 +       inline __attribute__ ((noinline)) btSimdScalar(float    fl)
69 +#else
70         SIMD_FORCE_INLINE       btSimdScalar(float      fl)
71 +#endif
72         :m_vec128 (_mm_set1_ps(fl))
73         {
74         }
75 diff --git a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
76 index 5d62da7..fcd312e 100644
77 --- a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
78 +++ b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
79 @@ -28,7 +28,6 @@
80  #include "btMultiBodyJointFeedback.h"
81  #include "LinearMath/btTransformUtil.h"
82  #include "LinearMath/btSerializer.h"
83 -#include "Bullet3Common/b3Logging.h"
84  // #define INCLUDE_GYRO_TERM 
85  
86  ///todo: determine if we need these options. If so, make a proper API, otherwise delete those globals
87 @@ -1732,7 +1731,6 @@ void btMultiBody::goToSleep()
88  
89  void btMultiBody::checkMotionAndSleepIfRequired(btScalar timestep)
90  {
91 -       int num_links = getNumLinks();
92         extern bool gDisableDeactivation;
93      if (!m_canSleep || gDisableDeactivation) 
94         {
95 diff --git a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
96 index 8a034b3..4f66b20 100644
97 --- a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
98 +++ b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
99 @@ -809,7 +809,6 @@ static void applyJointFeedback(btMultiBodyJacobianData& data, const btMultiBodyS
100  }
101  #endif
102  
103 -#include "Bullet3Common/b3Logging.h"
104  void btMultiBodyConstraintSolver::writeBackSolverBodyToMultiBody(btMultiBodySolverConstraint& c, btScalar deltaTime)
105  {
106  #if 1 
107 diff --git a/extern/bullet2/src/BulletSoftBody/btSparseSDF.h b/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
108 index bcf0c79..8992ddb 100644
109 --- a/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
110 +++ b/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
111 @@ -185,7 +185,6 @@ struct      btSparseSdf
112                 {
113                         ++nprobes;              
114                         ++ncells;
115 -                       int sz = sizeof(Cell);
116                         if (ncells>m_clampCells)
117                         {
118                                 static int numResets=0;
119 diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
120 index d58ac95..3fd77df 100644
121 --- a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
122 +++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
123 @@ -2665,6 +2665,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
124         }
125  
126         vertices.resize(0);
127 +       original_vertex_index.resize(0);
128         edges.resize(0);
129         faces.resize(0);
130  
131 @@ -2675,6 +2676,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
132         {
133                 btConvexHullInternal::Vertex* v = oldVertices[copied];
134                 vertices.push_back(hull.getCoordinates(v));
135 +               original_vertex_index.push_back(v->point.index);
136                 btConvexHullInternal::Edge* firstEdge = v->edges;
137                 if (firstEdge)
138                 {
139 diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.h b/extern/bullet2/src/LinearMath/btConvexHullComputer.h
140 index 7240ac4..6871ce8 100644
141 --- a/extern/bullet2/src/LinearMath/btConvexHullComputer.h
142 +++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.h
143 @@ -67,6 +67,7 @@ class btConvexHullComputer
144  
145                 // Vertices of the output hull
146                 btAlignedObjectArray<btVector3> vertices;
147 +               btAlignedObjectArray<int> original_vertex_index;
148  
149                 // Edges of the output hull
150                 btAlignedObjectArray<Edge> edges;