blender.patch 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. - * @mainpage Bullet Documentation
  8. + * @page Bullet Documentation
  9. *
  10. * @section intro_sec Introduction
  11. * 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 ).
  12. diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
  13. index 36dd043..57eb817 100644
  14. --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
  15. +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
  16. @@ -579,14 +579,10 @@ btCollisionShape* btCollisionWorldImporter::convertCollisionShape( btCollisionS
  17. btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
  18. btCompoundShape* compoundShape = createCompoundShape();
  19. - btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0];
  20. -
  21. btAlignedObjectArray<btCollisionShape*> childShapes;
  22. for (int i=0;i<compoundData->m_numChildShapes;i++)
  23. {
  24. - btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i];
  25. -
  26. btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape;
  27. btCollisionShape* childShape = convertCollisionShape(cd);
  28. diff --git a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
  29. index 57fc119..31faf1d 100644
  30. --- a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
  31. +++ b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
  32. @@ -29,14 +29,11 @@ subject to the following restrictions:
  33. static btVector3
  34. getNormalizedVector(const btVector3& v)
  35. {
  36. - btScalar l = v.length();
  37. - btVector3 n = v;
  38. - if (l < SIMD_EPSILON) {
  39. - n.setValue(0,0,0);
  40. - } else {
  41. - n /= l;
  42. - }
  43. + btVector3 n(0, 0, 0);
  44. + if (v.length() > SIMD_EPSILON) {
  45. + n = v.normalized();
  46. + }
  47. return n;
  48. }
  49. diff --git a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
  50. index 27ccefe..8e4456e 100644
  51. --- a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
  52. +++ b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
  53. @@ -37,8 +37,13 @@ struct btSimdScalar
  54. {
  55. }
  56. -
  57. +/* workaround for clang 3.4 ( == apple clang 5.1 ) issue, friction would fail with forced inlining */
  58. +#if (defined(__clang__) && defined(__apple_build_version__) && (__clang_major__ == 5) && (__clang_minor__ == 1)) \
  59. +|| (defined(__clang__) && !defined(__apple_build_version__) && (__clang_major__ == 3) && (__clang_minor__ == 4))
  60. + inline __attribute__ ((noinline)) btSimdScalar(float fl)
  61. +#else
  62. SIMD_FORCE_INLINE btSimdScalar(float fl)
  63. +#endif
  64. :m_vec128 (_mm_set1_ps(fl))
  65. {
  66. }
  67. diff --git a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
  68. index 5d62da7..fcd312e 100644
  69. --- a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
  70. +++ b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
  71. @@ -28,7 +28,6 @@
  72. #include "btMultiBodyJointFeedback.h"
  73. #include "LinearMath/btTransformUtil.h"
  74. #include "LinearMath/btSerializer.h"
  75. -#include "Bullet3Common/b3Logging.h"
  76. // #define INCLUDE_GYRO_TERM
  77. ///todo: determine if we need these options. If so, make a proper API, otherwise delete those globals
  78. @@ -1732,7 +1731,6 @@ void btMultiBody::goToSleep()
  79. void btMultiBody::checkMotionAndSleepIfRequired(btScalar timestep)
  80. {
  81. - int num_links = getNumLinks();
  82. extern bool gDisableDeactivation;
  83. if (!m_canSleep || gDisableDeactivation)
  84. {
  85. diff --git a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
  86. index 8a034b3..4f66b20 100644
  87. --- a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
  88. +++ b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
  89. @@ -809,7 +809,6 @@ static void applyJointFeedback(btMultiBodyJacobianData& data, const btMultiBodyS
  90. }
  91. #endif
  92. -#include "Bullet3Common/b3Logging.h"
  93. void btMultiBodyConstraintSolver::writeBackSolverBodyToMultiBody(btMultiBodySolverConstraint& c, btScalar deltaTime)
  94. {
  95. #if 1
  96. diff --git a/extern/bullet2/src/BulletSoftBody/btSparseSDF.h b/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
  97. index bcf0c79..8992ddb 100644
  98. --- a/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
  99. +++ b/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
  100. @@ -185,7 +185,6 @@ struct btSparseSdf
  101. {
  102. ++nprobes;
  103. ++ncells;
  104. - int sz = sizeof(Cell);
  105. if (ncells>m_clampCells)
  106. {
  107. static int numResets=0;
  108. diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
  109. index d58ac95..3fd77df 100644
  110. --- a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
  111. +++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
  112. @@ -2665,6 +2665,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
  113. }
  114. vertices.resize(0);
  115. + original_vertex_index.resize(0);
  116. edges.resize(0);
  117. faces.resize(0);
  118. @@ -2675,6 +2676,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
  119. {
  120. btConvexHullInternal::Vertex* v = oldVertices[copied];
  121. vertices.push_back(hull.getCoordinates(v));
  122. + original_vertex_index.push_back(v->point.index);
  123. btConvexHullInternal::Edge* firstEdge = v->edges;
  124. if (firstEdge)
  125. {
  126. diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.h b/extern/bullet2/src/LinearMath/btConvexHullComputer.h
  127. index 7240ac4..6871ce8 100644
  128. --- a/extern/bullet2/src/LinearMath/btConvexHullComputer.h
  129. +++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.h
  130. @@ -67,6 +67,7 @@ class btConvexHullComputer
  131. // Vertices of the output hull
  132. btAlignedObjectArray<btVector3> vertices;
  133. + btAlignedObjectArray<int> original_vertex_index;
  134. // Edges of the output hull
  135. btAlignedObjectArray<Edge> edges;
  136. diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
  137. index 0623e35..02ea503 100644
  138. --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
  139. +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
  140. @@ -13,9 +13,9 @@ subject to the following restrictions:
  141. 3. This notice may not be removed or altered from any source distribution.
  142. */
  143. -#if defined (_WIN32) || defined (__i386__)
  144. -#define BT_USE_SSE_IN_API
  145. -#endif
  146. +//#if defined (_WIN32) || defined (__i386__)
  147. +//#define BT_USE_SSE_IN_API
  148. +//#endif
  149. #include "btConvexHullShape.h"
  150. #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
  151. diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
  152. index b56d729..88018b4 100644
  153. --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
  154. +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.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. -#if defined (_WIN32) || defined (__i386__)
  159. -#define BT_USE_SSE_IN_API
  160. -#endif
  161. +//#if defined (_WIN32) || defined (__i386__)
  162. +//#define BT_USE_SSE_IN_API
  163. +//#endif
  164. #include "btConvexShape.h"
  165. #include "btTriangleShape.h"
  166. diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
  167. index a7362ea..6abfdff 100644
  168. --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
  169. +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
  170. @@ -13,9 +13,9 @@ subject to the following restrictions:
  171. 3. This notice may not be removed or altered from any source distribution.
  172. */
  173. -#if defined (_WIN32) || defined (__i386__)
  174. -#define BT_USE_SSE_IN_API
  175. -#endif
  176. +//#if defined (_WIN32) || defined (__i386__)
  177. +//#define BT_USE_SSE_IN_API
  178. +//#endif
  179. #include "btMultiSphereShape.h"
  180. #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
  181. diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
  182. index 4854f37..9095c59 100644
  183. --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
  184. +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
  185. @@ -12,9 +12,9 @@ subject to the following restrictions:
  186. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  187. 3. This notice may not be removed or altered from any source distribution.
  188. */
  189. -#if defined (_WIN32) || defined (__i386__)
  190. -#define BT_USE_SSE_IN_API
  191. -#endif
  192. +//#if defined (_WIN32) || defined (__i386__)
  193. +//#define BT_USE_SSE_IN_API
  194. +//#endif
  195. #include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
  196. #include "btConvexPolyhedron.h"
  197. diff --git a/extern/bullet2/src/LinearMath/btVector3.cpp b/extern/bullet2/src/LinearMath/btVector3.cpp
  198. index e05bdcc..dbcf2b6 100644
  199. --- a/extern/bullet2/src/LinearMath/btVector3.cpp
  200. +++ b/extern/bullet2/src/LinearMath/btVector3.cpp
  201. @@ -15,9 +15,9 @@
  202. This source version has been altered.
  203. */
  204. -#if defined (_WIN32) || defined (__i386__)
  205. -#define BT_USE_SSE_IN_API
  206. -#endif
  207. +//#if defined (_WIN32) || defined (__i386__)
  208. +//#define BT_USE_SSE_IN_API
  209. +//#endif
  210. #include "btVector3.h"
  211. diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp
  212. index e0e8bc7..a788268 100644
  213. --- a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp
  214. +++ b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp
  215. @@ -425,50 +425,38 @@ void btRigidBody::setCenterOfMassTransform(const btTransform& xform)
  216. }
  217. +bool btRigidBody::checkCollideWithOverride(const btCollisionObject* co) const
  218. +{
  219. + const btRigidBody* otherRb = btRigidBody::upcast(co);
  220. + if (!otherRb)
  221. + return true;
  222. +
  223. + for (int i = 0; i < m_constraintRefs.size(); ++i)
  224. + {
  225. + const btTypedConstraint* c = m_constraintRefs[i];
  226. + if (c->isEnabled())
  227. + if (&c->getRigidBodyA() == otherRb || &c->getRigidBodyB() == otherRb)
  228. + return false;
  229. + }
  230. +
  231. + return true;
  232. +}
  233. void btRigidBody::addConstraintRef(btTypedConstraint* c)
  234. {
  235. - ///disable collision with the 'other' body
  236. -
  237. int index = m_constraintRefs.findLinearSearch(c);
  238. - //don't add constraints that are already referenced
  239. - //btAssert(index == m_constraintRefs.size());
  240. if (index == m_constraintRefs.size())
  241. - {
  242. - m_constraintRefs.push_back(c);
  243. - btCollisionObject* colObjA = &c->getRigidBodyA();
  244. - btCollisionObject* colObjB = &c->getRigidBodyB();
  245. - if (colObjA == this)
  246. - {
  247. - colObjA->setIgnoreCollisionCheck(colObjB, true);
  248. - }
  249. - else
  250. - {
  251. - colObjB->setIgnoreCollisionCheck(colObjA, true);
  252. - }
  253. - }
  254. + m_constraintRefs.push_back(c);
  255. +
  256. + m_checkCollideWith = true;
  257. }
  258. void btRigidBody::removeConstraintRef(btTypedConstraint* c)
  259. {
  260. - int index = m_constraintRefs.findLinearSearch(c);
  261. - //don't remove constraints that are not referenced
  262. - if(index < m_constraintRefs.size())
  263. - {
  264. - m_constraintRefs.remove(c);
  265. - btCollisionObject* colObjA = &c->getRigidBodyA();
  266. - btCollisionObject* colObjB = &c->getRigidBodyB();
  267. - if (colObjA == this)
  268. - {
  269. - colObjA->setIgnoreCollisionCheck(colObjB, false);
  270. - }
  271. - else
  272. - {
  273. - colObjB->setIgnoreCollisionCheck(colObjA, false);
  274. - }
  275. - }
  276. + m_constraintRefs.remove(c);
  277. + m_checkCollideWith = m_constraintRefs.size() > 0;
  278. }
  279. int btRigidBody::calculateSerializeBufferSize() const
  280. diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
  281. index 1d177db..c2f8c5d 100644
  282. --- a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
  283. +++ b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
  284. @@ -509,6 +509,8 @@ public:
  285. return (getBroadphaseProxy() != 0);
  286. }
  287. + virtual bool checkCollideWithOverride(const btCollisionObject* co) const;
  288. +
  289. void addConstraintRef(btTypedConstraint* c);
  290. void removeConstraintRef(btTypedConstraint* c);