6bbb683a740b79c6b786e33eb4ac36868a6b8d94
[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;
151 diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
152 index 0623e35..02ea503 100644
153 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
154 +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
155 @@ -13,9 +13,9 @@ subject to the following restrictions:
156  3. This notice may not be removed or altered from any source distribution.
157  */
158  
159 -#if defined (_WIN32) || defined (__i386__)
160 -#define BT_USE_SSE_IN_API
161 -#endif
162 +//#if defined (_WIN32) || defined (__i386__)
163 +//#define BT_USE_SSE_IN_API
164 +//#endif
165  
166  #include "btConvexHullShape.h"
167  #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
168 diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
169 index b56d729..88018b4 100644
170 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
171 +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
172 @@ -13,9 +13,9 @@ subject to the following restrictions:
173  3. This notice may not be removed or altered from any source distribution.
174  */
175  
176 -#if defined (_WIN32) || defined (__i386__)
177 -#define BT_USE_SSE_IN_API
178 -#endif
179 +//#if defined (_WIN32) || defined (__i386__)
180 +//#define BT_USE_SSE_IN_API
181 +//#endif
182  
183  #include "btConvexShape.h"
184  #include "btTriangleShape.h"
185 diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
186 index a7362ea..6abfdff 100644
187 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
188 +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
189 @@ -13,9 +13,9 @@ subject to the following restrictions:
190  3. This notice may not be removed or altered from any source distribution.
191  */
192  
193 -#if defined (_WIN32) || defined (__i386__)
194 -#define BT_USE_SSE_IN_API
195 -#endif
196 +//#if defined (_WIN32) || defined (__i386__)
197 +//#define BT_USE_SSE_IN_API
198 +//#endif
199  
200  #include "btMultiSphereShape.h"
201  #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
202 diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
203 index 4854f37..9095c59 100644
204 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
205 +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
206 @@ -12,9 +12,9 @@ subject to the following restrictions:
207  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
208  3. This notice may not be removed or altered from any source distribution.
209  */
210 -#if defined (_WIN32) || defined (__i386__)
211 -#define BT_USE_SSE_IN_API
212 -#endif
213 +//#if defined (_WIN32) || defined (__i386__)
214 +//#define BT_USE_SSE_IN_API
215 +//#endif
216  
217  #include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
218  #include "btConvexPolyhedron.h"
219 diff --git a/extern/bullet2/src/LinearMath/btScalar.h b/extern/bullet2/src/LinearMath/btScalar.h
220 index 0bfd255..2e24676 100644
221 --- a/extern/bullet2/src/LinearMath/btScalar.h
222 +++ b/extern/bullet2/src/LinearMath/btScalar.h
223 @@ -179,7 +179,7 @@ inline int  btGetVersion()
224                 #define BT_USE_SSE
225                 //BT_USE_SSE_IN_API is enabled on Mac OSX by default, because memory is automatically aligned on 16-byte boundaries
226                 //if apps run into issues, we will disable the next line
227 -               #define BT_USE_SSE_IN_API
228 +               //#define BT_USE_SSE_IN_API
229          #ifdef BT_USE_SSE
230              // include appropriate SSE level
231              #if defined (__SSE4_1__)
232 diff --git a/extern/bullet2/src/LinearMath/btVector3.cpp b/extern/bullet2/src/LinearMath/btVector3.cpp
233 index e05bdcc..dbcf2b6 100644
234 --- a/extern/bullet2/src/LinearMath/btVector3.cpp
235 +++ b/extern/bullet2/src/LinearMath/btVector3.cpp
236 @@ -15,9 +15,9 @@
237   This source version has been altered.
238   */
239  
240 -#if defined (_WIN32) || defined (__i386__)
241 -#define BT_USE_SSE_IN_API
242 -#endif
243 +//#if defined (_WIN32) || defined (__i386__)
244 +//#define BT_USE_SSE_IN_API
245 +//#endif
246  
247  
248  #include "btVector3.h"