use size_t instead of int, for allocator

added hashtable based PairManager, thanks Pierre Terdiman and Erin Catto
improved friction in 'cachefriendly' solver
moved 'refreshcontactpoints' into collision detection, instead of solver
avoid linear search for contact manifolds, by storing an index
ignore margin for sphere shape (its entire radius is already margin)
avoid alignment checks in BVH serialization, they don't compile on 64-bit architectures
made 'bomb' box more heavy
This commit is contained in:
ejcoumans
2007-10-11 03:17:54 +00:00
parent bb89cbcf08
commit 0405ce278a
36 changed files with 1485 additions and 460 deletions

View File

@@ -27,20 +27,12 @@ btPersistentManifold::btPersistentManifold()
:m_body0(0),
m_body1(0),
m_cachedPoints (0),
m_index1(0)
m_index1a(0)
{
}
void btPersistentManifold::clearManifold()
{
int i;
for (i=0;i<m_cachedPoints;i++)
{
clearUserCache(m_pointCache[i]);
}
m_cachedPoints = 0;
}
#ifdef DEBUG_PERSISTENCY
#include <stdio.h>
@@ -198,10 +190,20 @@ btScalar btPersistentManifold::getContactBreakingThreshold() const
return gContactBreakingThreshold;
}
void btPersistentManifold::refreshContactPoints(const btTransform& trA,const btTransform& trB)
{
int i;
#ifdef DEBUG_PERSISTENCY
printf("refreshContactPoints posA = (%f,%f,%f) posB = (%f,%f,%f)\n",
trA.getOrigin().getX(),
trA.getOrigin().getY(),
trA.getOrigin().getZ(),
trB.getOrigin().getX(),
trB.getOrigin().getY(),
trB.getOrigin().getZ());
#endif //DEBUG_PERSISTENCY
/// first refresh worldspace positions and distance
for (i=getNumContacts()-1;i>=0;i--)
{

View File

@@ -58,7 +58,7 @@ public:
BT_DECLARE_ALIGNED_ALLOCATOR();
int m_index1;
int m_index1a;
btPersistentManifold();
@@ -67,11 +67,11 @@ public:
{
}
inline void* getBody0() { return m_body0;}
inline void* getBody1() { return m_body1;}
SIMD_FORCE_INLINE void* getBody0() { return m_body0;}
SIMD_FORCE_INLINE void* getBody1() { return m_body1;}
inline const void* getBody0() const { return m_body0;}
inline const void* getBody1() const { return m_body1;}
SIMD_FORCE_INLINE const void* getBody0() const { return m_body0;}
SIMD_FORCE_INLINE const void* getBody1() const { return m_body1;}
void setBodies(void* body0,void* body1)
{
@@ -85,22 +85,22 @@ public:
void DebugPersistency();
#endif //
inline int getNumContacts() const { return m_cachedPoints;}
SIMD_FORCE_INLINE int getNumContacts() const { return m_cachedPoints;}
inline const btManifoldPoint& getContactPoint(int index) const
SIMD_FORCE_INLINE const btManifoldPoint& getContactPoint(int index) const
{
btAssert(index < m_cachedPoints);
return m_pointCache[index];
}
inline btManifoldPoint& getContactPoint(int index)
SIMD_FORCE_INLINE btManifoldPoint& getContactPoint(int index)
{
btAssert(index < m_cachedPoints);
return m_pointCache[index];
}
/// todo: get this margin from the current physics / collision environment
btScalar getContactBreakingThreshold() const;
SIMD_FORCE_INLINE btScalar getContactBreakingThreshold() const;
int getCacheEntry(const btManifoldPoint& newPoint) const;
@@ -150,7 +150,16 @@ public:
/// calculated new worldspace coordinates and depth, and reject points that exceed the collision margin
void refreshContactPoints( const btTransform& trA,const btTransform& trB);
void clearManifold();
SIMD_FORCE_INLINE void clearManifold()
{
int i;
for (i=0;i<m_cachedPoints;i++)
{
clearUserCache(m_pointCache[i]);
}
m_cachedPoints = 0;
}