Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-10-31 21:19:57 +0300
committerErwin Coumans <blender@erwincoumans.com>2006-10-31 21:19:57 +0300
commit92fd0433463695bff37167a03e1fd87921368955 (patch)
tree184bd01d47b1fcd0eea144c4a46b1f40520625db /extern/bullet2/src/BulletCollision/NarrowPhaseCollision
parent35d6c6e695351051febf7d6aa84761db1d733295 (diff)
update Bullet 2.x with latest changes, notice that the integration is not finished yet, and GameBlender is still using extern/bullet.
Diffstat (limited to 'extern/bullet2/src/BulletCollision/NarrowPhaseCollision')
-rw-r--r--extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp29
-rw-r--r--extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h6
-rw-r--r--extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp10
-rw-r--r--extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h8
4 files changed, 31 insertions, 22 deletions
diff --git a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
index f6fdd6435cf..4b38ced7f12 100644
--- a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
+++ b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
@@ -36,11 +36,7 @@ m_penetrationDepthSolver(penetrationDepthSolver),
m_simplexSolver(simplexSolver),
m_minkowskiA(objectA),
m_minkowskiB(objectB),
-m_ignoreMargin(false),
-m_partId0(-1),
-m_index0(-1),
-m_partId1(-1),
-m_index1(-1)
+m_ignoreMargin(false)
{
}
@@ -60,7 +56,8 @@ void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result&
marginB = 0.f;
}
-int curIter = 0;
+ int curIter = 0;
+ int gGjkMaxIter = 1000;//this is to catch invalid input, perhaps check for #NaN?
bool isValid = false;
bool checkSimplex = false;
@@ -131,6 +128,25 @@ int curIter = 0;
checkSimplex = true;
break;
}
+
+ //degeneracy, this is typically due to invalid/uninitialized worldtransforms for a btCollisionObject
+ if (curIter++ > gGjkMaxIter)
+ {
+ #if defined(DEBUG) || defined (_DEBUG)
+ printf("btGjkPairDetector maxIter exceeded:%i\n",curIter);
+ printf("sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n",
+ m_cachedSeparatingAxis.getX(),
+ m_cachedSeparatingAxis.getY(),
+ m_cachedSeparatingAxis.getZ(),
+ squaredDistance,
+ m_minkowskiA->getShapeType(),
+ m_minkowskiB->getShapeType());
+ #endif
+ break;
+
+ }
+
+
bool check = (!m_simplexSolver->fullSimplex());
//bool check = (!m_simplexSolver->fullSimplex() && squaredDistance > SIMD_EPSILON * m_simplexSolver->maxVertex());
@@ -200,7 +216,6 @@ int curIter = 0;
//spu_printf("distance\n");
#endif //__CELLOS_LV2__
- output.setShapeIdentifiers(m_partId0,m_index0,m_partId1,m_index1);
output.addContactPoint(
normalInB,
diff --git a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h
index bccb0542370..c4842cd3023 100644
--- a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h
+++ b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h
@@ -43,12 +43,6 @@ class btGjkPairDetector : public btDiscreteCollisionDetectorInterface
public:
- //experimental feature information, per triangle, per convex etc.
- //'material combiner' / contact added callback
- int m_partId0;
- int m_index0;
- int m_partId1;
- int m_index1;
btGjkPairDetector(btConvexShape* objectA,btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver* penetrationDepthSolver);
virtual ~btGjkPairDetector() {};
diff --git a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp
index fafceafa5ed..ee2be163063 100644
--- a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp
+++ b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp
@@ -18,7 +18,7 @@ subject to the following restrictions:
#include "LinearMath/btTransform.h"
#include <assert.h>
-float gContactBreakingTreshold = 0.02f;
+float gContactBreakingThreshold = 0.02f;
ContactDestroyedCallback gContactDestroyedCallback = 0;
@@ -151,7 +151,7 @@ int btPersistentManifold::sortCachedPoints(const btManifoldPoint& pt)
int btPersistentManifold::getCacheEntry(const btManifoldPoint& newPoint) const
{
- btScalar shortestDist = getContactBreakingTreshold() * getContactBreakingTreshold();
+ btScalar shortestDist = getContactBreakingThreshold() * getContactBreakingThreshold();
int size = getNumContacts();
int nearestPoint = -1;
for( int i = 0; i < size; i++ )
@@ -193,9 +193,9 @@ void btPersistentManifold::AddManifoldPoint(const btManifoldPoint& newPoint)
replaceContactPoint(newPoint,insertIndex);
}
-float btPersistentManifold::getContactBreakingTreshold() const
+float btPersistentManifold::getContactBreakingThreshold() const
{
- return gContactBreakingTreshold;
+ return gContactBreakingThreshold;
}
void btPersistentManifold::refreshContactPoints(const btTransform& trA,const btTransform& trB)
@@ -229,7 +229,7 @@ void btPersistentManifold::refreshContactPoints(const btTransform& trA,const btT
projectedPoint = manifoldPoint.m_positionWorldOnA - manifoldPoint.m_normalWorldOnB * manifoldPoint.m_distance1;
projectedDifference = manifoldPoint.m_positionWorldOnB - projectedPoint;
distance2d = projectedDifference.dot(projectedDifference);
- if (distance2d > getContactBreakingTreshold()*getContactBreakingTreshold() )
+ if (distance2d > getContactBreakingThreshold()*getContactBreakingThreshold() )
{
removeContactPoint(i);
}
diff --git a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h
index d0cc2577fb0..ab0e8767e5d 100644
--- a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h
+++ b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h
@@ -23,8 +23,8 @@ subject to the following restrictions:
struct btCollisionResult;
-///contact breaking and merging treshold
-extern float gContactBreakingTreshold;
+///contact breaking and merging threshold
+extern float gContactBreakingThreshold;
typedef bool (*ContactDestroyedCallback)(void* userPersistentData);
extern ContactDestroyedCallback gContactDestroyedCallback;
@@ -97,7 +97,7 @@ public:
}
/// todo: get this margin from the current physics / collision environment
- float getContactBreakingTreshold() const;
+ float getContactBreakingThreshold() const;
int getCacheEntry(const btManifoldPoint& newPoint) const;
@@ -124,7 +124,7 @@ public:
bool validContactDistance(const btManifoldPoint& pt) const
{
- return pt.m_distance1 <= getContactBreakingTreshold();
+ return pt.m_distance1 <= getContactBreakingThreshold();
}
/// calculated new worldspace coordinates and depth, and reject points that exceed the collision margin
void refreshContactPoints( const btTransform& trA,const btTransform& trB);