- DemoApplication, debug text rendering was broken, glLoadIdentity() missing

- copy user data over to child shape
- added applied impulse to btManifoldPoint
- add ContactProcessedCallback (needs test/demo)
- didn't copy over m_additionalDampingFactor into btRigidBody.
This commit is contained in:
ejcoumans
2008-02-07 08:00:16 +00:00
parent f22d338959
commit a4e63aed00
8 changed files with 60 additions and 9 deletions

View File

@@ -30,6 +30,7 @@ class btManifoldPoint
public:
btManifoldPoint()
:m_userPersistentData(0),
m_appliedImpulse(0.f),
m_lifeTime(0)
{
}
@@ -43,7 +44,8 @@ class btManifoldPoint
m_distance1( distance ),
m_combinedFriction(btScalar(0.)),
m_combinedRestitution(btScalar(0.)),
m_userPersistentData(0),
m_userPersistentData(0),
m_appliedImpulse(0.f),
m_lifeTime(0)
{
@@ -65,6 +67,7 @@ class btManifoldPoint
mutable void* m_userPersistentData;
btScalar m_appliedImpulse;
int m_lifeTime;//lifetime of the contactpoint in frames

View File

@@ -20,6 +20,7 @@ subject to the following restrictions:
btScalar gContactBreakingThreshold = btScalar(0.02);
ContactDestroyedCallback gContactDestroyedCallback = 0;
ContactProcessedCallback gContactProcessedCallback = 0;
@@ -234,6 +235,11 @@ void btPersistentManifold::refreshContactPoints(const btTransform& trA,const btT
if (distance2d > getContactBreakingThreshold()*getContactBreakingThreshold() )
{
removeContactPoint(i);
} else
{
//contact point processed callback
if (gContactProcessedCallback)
(*gContactProcessedCallback)(manifoldPoint,m_body0,m_body1);
}
}
}

View File

@@ -28,6 +28,7 @@ struct btCollisionResult;
extern btScalar gContactBreakingThreshold;
typedef bool (*ContactDestroyedCallback)(void* userPersistentData);
typedef bool (*ContactProcessedCallback)(btManifoldPoint& cp,void* body0,void* body1);
extern ContactDestroyedCallback gContactDestroyedCallback;
@@ -123,6 +124,7 @@ public:
m_pointCache[index] = m_pointCache[lastUsedIndex];
//get rid of duplicated userPersistentData pointer
m_pointCache[lastUsedIndex].m_userPersistentData = 0;
m_pointCache[lastUsedIndex].m_appliedImpulse = 0.f;
m_pointCache[lastUsedIndex].m_lifeTime = 0;
}
@@ -136,12 +138,14 @@ public:
#define MAINTAIN_PERSISTENCY 1
#ifdef MAINTAIN_PERSISTENCY
int lifeTime = m_pointCache[insertIndex].getLifeTime();
btScalar appliedImpulse = m_pointCache[insertIndex].m_appliedImpulse;
btAssert(lifeTime>=0);
void* cache = m_pointCache[insertIndex].m_userPersistentData;
m_pointCache[insertIndex] = newPoint;
m_pointCache[insertIndex].m_userPersistentData = cache;
m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse;
m_pointCache[insertIndex].m_lifeTime = lifeTime;
#else
clearUserCache(m_pointCache[insertIndex]);