This commit is contained in:
Daniel Chappuis 2017-09-04 22:23:29 +02:00
parent 95ade79af5
commit dd91f6dcbf
8 changed files with 55 additions and 55 deletions

View File

@ -103,7 +103,7 @@ void CollisionDetection::computeMiddlePhase() {
OverlappingPair* pair = it->second; OverlappingPair* pair = it->second;
// Make all the contact manifolds and contact points of the pair obselete // Make all the contact manifolds and contact points of the pair obsolete
pair->makeContactsObselete(); pair->makeContactsObselete();
ProxyShape* shape1 = pair->getShape1(); ProxyShape* shape1 = pair->getShape1();
@ -410,8 +410,8 @@ void CollisionDetection::processPotentialContacts(OverlappingPair* pair) {
potentialManifold = potentialManifold->mNext; potentialManifold = potentialManifold->mNext;
} }
// Clear the obselete contact manifolds and contact points // Clear the obsolete contact manifolds and contact points
pair->clearObseleteManifoldsAndContactPoints(); pair->clearObsoleteManifoldsAndContactPoints();
// Reset the potential contacts of the pair // Reset the potential contacts of the pair
pair->clearPotentialContactManifolds(); pair->clearPotentialContactManifolds();

View File

@ -34,7 +34,7 @@ ContactManifold::ContactManifold(const ContactManifoldInfo* manifoldInfo, ProxyS
: mShape1(shape1), mShape2(shape2), mContactPoints(nullptr), mContactNormalId(manifoldInfo->getContactNormalId()), : mShape1(shape1), mShape2(shape2), mContactPoints(nullptr), mContactNormalId(manifoldInfo->getContactNormalId()),
mNbContactPoints(0), mFrictionImpulse1(0.0), mFrictionImpulse2(0.0), mNbContactPoints(0), mFrictionImpulse1(0.0), mFrictionImpulse2(0.0),
mFrictionTwistImpulse(0.0), mIsAlreadyInIsland(false), mFrictionTwistImpulse(0.0), mIsAlreadyInIsland(false),
mMemoryAllocator(memoryAllocator), mNext(nullptr), mPrevious(nullptr), mIsObselete(false) { mMemoryAllocator(memoryAllocator), mNext(nullptr), mPrevious(nullptr), mIsObsolete(false) {
// For each contact point info in the manifold // For each contact point info in the manifold
const ContactPointInfo* pointInfo = manifoldInfo->getFirstContactPointInfo(); const ContactPointInfo* pointInfo = manifoldInfo->getFirstContactPointInfo();
@ -87,7 +87,7 @@ void ContactManifold::addContactPoint(const ContactPointInfo* contactPointInfo)
mNbContactPoints++; mNbContactPoints++;
} }
// Clear the obselete contact points // Clear the obsolete contact points
void ContactManifold::clearObseleteContactPoints() { void ContactManifold::clearObseleteContactPoints() {
ContactPoint* contactPoint = mContactPoints; ContactPoint* contactPoint = mContactPoints;
@ -96,7 +96,7 @@ void ContactManifold::clearObseleteContactPoints() {
ContactPoint* nextContactPoint = contactPoint->getNext(); ContactPoint* nextContactPoint = contactPoint->getNext();
if (contactPoint->getIsObselete()) { if (contactPoint->getIsObsolete()) {
// Delete the contact point // Delete the contact point
contactPoint->~ContactPoint(); contactPoint->~ContactPoint();

View File

@ -140,8 +140,8 @@ class ContactManifold {
/// Pointer to the previous contact manifold in linked-list /// Pointer to the previous contact manifold in linked-list
ContactManifold* mPrevious; ContactManifold* mPrevious;
/// True if the contact manifold is obselete /// True if the contact manifold is obsolete
bool mIsObselete; bool mIsObsolete;
// -------------------- Methods -------------------- // // -------------------- Methods -------------------- //
@ -151,13 +151,13 @@ class ContactManifold {
/// Set the pointer to the next element in the linked-list /// Set the pointer to the next element in the linked-list
void setNext(ContactManifold* nextManifold); void setNext(ContactManifold* nextManifold);
/// Return true if the manifold is obselete /// Return true if the manifold is obsolete
bool getIsObselete() const; bool getIsObsolete() const;
/// Set to true to make the manifold obselete /// Set to true to make the manifold obsolete
void setIsObselete(bool isObselete, bool setContactPoints); void setIsObsolete(bool isObselete, bool setContactPoints);
/// Clear the obselete contact points /// Clear the obsolete contact points
void clearObseleteContactPoints(); void clearObseleteContactPoints();
/// Return the contact normal direction Id of the manifold /// Return the contact normal direction Id of the manifold
@ -384,19 +384,19 @@ inline void ContactManifold::setNext(ContactManifold* nextManifold) {
mNext = nextManifold; mNext = nextManifold;
} }
// Return true if the manifold is obselete // Return true if the manifold is obsolete
inline bool ContactManifold::getIsObselete() const { inline bool ContactManifold::getIsObsolete() const {
return mIsObselete; return mIsObsolete;
} }
// Set to true to make the manifold obselete // Set to true to make the manifold obsolete
inline void ContactManifold::setIsObselete(bool isObselete, bool setContactPoints) { inline void ContactManifold::setIsObsolete(bool isObsolete, bool setContactPoints) {
mIsObselete = isObselete; mIsObsolete = isObsolete;
if (setContactPoints) { if (setContactPoints) {
ContactPoint* contactPoint = mContactPoints; ContactPoint* contactPoint = mContactPoints;
while (contactPoint != nullptr) { while (contactPoint != nullptr) {
contactPoint->setIsObselete(isObselete); contactPoint->setIsObsolete(isObsolete);
contactPoint = contactPoint->getNext(); contactPoint = contactPoint->getNext();
} }

View File

@ -131,8 +131,8 @@ void ContactManifoldSet::updateManifoldWithNewOne(ContactManifold* oldManifold,
contactPointInfo = contactPointInfo->next; contactPointInfo = contactPointInfo->next;
} }
// The old manifold is no longer obselete // The old manifold is no longer obsolete
oldManifold->setIsObselete(false, false); oldManifold->setIsObsolete(false, false);
} }
// Return the manifold with the smallest contact penetration depth among its points // Return the manifold with the smallest contact penetration depth among its points
@ -270,27 +270,27 @@ void ContactManifoldSet::removeManifold(ContactManifold* manifold) {
mNbManifolds--; mNbManifolds--;
} }
// Make all the contact manifolds and contact points obselete // Make all the contact manifolds and contact points obsolete
void ContactManifoldSet::makeContactsObselete() { void ContactManifoldSet::makeContactsObsolete() {
ContactManifold* manifold = mManifolds; ContactManifold* manifold = mManifolds;
while (manifold != nullptr) { while (manifold != nullptr) {
manifold->setIsObselete(true, true); manifold->setIsObsolete(true, true);
manifold = manifold->getNext(); manifold = manifold->getNext();
} }
} }
// Clear the obselete contact manifolds and contact points // Clear the obsolete contact manifolds and contact points
void ContactManifoldSet::clearObseleteManifoldsAndContactPoints() { void ContactManifoldSet::clearObsoleteManifoldsAndContactPoints() {
ContactManifold* manifold = mManifolds; ContactManifold* manifold = mManifolds;
ContactManifold* previousManifold = nullptr; ContactManifold* previousManifold = nullptr;
while (manifold != nullptr) { while (manifold != nullptr) {
ContactManifold* nextManifold = manifold->getNext(); ContactManifold* nextManifold = manifold->getNext();
if (manifold->getIsObselete()) { if (manifold->getIsObsolete()) {
if (previousManifold != nullptr) { if (previousManifold != nullptr) {
previousManifold->setNext(nextManifold); previousManifold->setNext(nextManifold);

View File

@ -115,14 +115,14 @@ class ContactManifoldSet {
/// Return a pointer to the first element of the linked-list of contact manifolds /// Return a pointer to the first element of the linked-list of contact manifolds
ContactManifold* getContactManifolds() const; ContactManifold* getContactManifolds() const;
/// Make all the contact manifolds and contact points obselete /// Make all the contact manifolds and contact points obsolete
void makeContactsObselete(); void makeContactsObsolete();
/// Return the total number of contact points in the set of manifolds /// Return the total number of contact points in the set of manifolds
int getTotalNbContactPoints() const; int getTotalNbContactPoints() const;
/// Clear the obselete contact manifolds and contact points /// Clear the obsolete contact manifolds and contact points
void clearObseleteManifoldsAndContactPoints(); void clearObsoleteManifoldsAndContactPoints();
// Map the normal vector into a cubemap face bucket (a face contains 4x4 buckets) // Map the normal vector into a cubemap face bucket (a face contains 4x4 buckets)
// Each face of the cube is divided into 4x4 buckets. This method maps the // Each face of the cube is divided into 4x4 buckets. This method maps the

View File

@ -37,7 +37,7 @@ ContactPoint::ContactPoint(const ContactPointInfo* contactInfo, const Transform&
mPenetrationDepth(contactInfo->penetrationDepth), mPenetrationDepth(contactInfo->penetrationDepth),
mLocalPointOnBody1(contactInfo->localPoint1), mLocalPointOnBody1(contactInfo->localPoint1),
mLocalPointOnBody2(contactInfo->localPoint2), mLocalPointOnBody2(contactInfo->localPoint2),
mIsRestingContact(false), mIsObselete(false), mNext(nullptr) { mIsRestingContact(false), mIsObsolete(false), mNext(nullptr) {
assert(mPenetrationDepth > decimal(0.0)); assert(mPenetrationDepth > decimal(0.0));
@ -45,7 +45,7 @@ ContactPoint::ContactPoint(const ContactPointInfo* contactInfo, const Transform&
mWorldPointOnBody1 = body1Transform * mLocalPointOnBody1; mWorldPointOnBody1 = body1Transform * mLocalPointOnBody1;
mWorldPointOnBody2 = body2Transform * mLocalPointOnBody2; mWorldPointOnBody2 = body2Transform * mLocalPointOnBody2;
mIsObselete = false; mIsObsolete = false;
} }
// Update the contact point with a new one that is similar (very close) // Update the contact point with a new one that is similar (very close)
@ -64,5 +64,5 @@ void ContactPoint::update(const ContactPointInfo* contactInfo, const Transform&
mWorldPointOnBody1 = body1Transform * mLocalPointOnBody1; mWorldPointOnBody1 = body1Transform * mLocalPointOnBody1;
mWorldPointOnBody2 = body2Transform * mLocalPointOnBody2; mWorldPointOnBody2 = body2Transform * mLocalPointOnBody2;
mIsObselete = false; mIsObsolete = false;
} }

View File

@ -71,8 +71,8 @@ class ContactPoint {
/// Cached penetration impulse /// Cached penetration impulse
decimal mPenetrationImpulse; decimal mPenetrationImpulse;
/// True if the contact point is obselete /// True if the contact point is obsolete
bool mIsObselete; bool mIsObsolete;
/// Pointer to the next contact point in the linked-list /// Pointer to the next contact point in the linked-list
ContactPoint* mNext; ContactPoint* mNext;
@ -93,14 +93,14 @@ class ContactPoint {
/// Set the mIsRestingContact variable /// Set the mIsRestingContact variable
void setIsRestingContact(bool isRestingContact); void setIsRestingContact(bool isRestingContact);
/// Set to true to make the contact point obselete /// Set to true to make the contact point obsolete
void setIsObselete(bool isObselete); void setIsObsolete(bool isObselete);
/// Set the next contact point in the linked list /// Set the next contact point in the linked list
void setNext(ContactPoint* next); void setNext(ContactPoint* next);
/// Return true if the contact point is obselete /// Return true if the contact point is obsolete
bool getIsObselete() const; bool getIsObsolete() const;
public : public :
@ -206,14 +206,14 @@ inline void ContactPoint::setIsRestingContact(bool isRestingContact) {
mIsRestingContact = isRestingContact; mIsRestingContact = isRestingContact;
} }
// Return true if the contact point is obselete // Return true if the contact point is obsolete
inline bool ContactPoint::getIsObselete() const { inline bool ContactPoint::getIsObsolete() const {
return mIsObselete; return mIsObsolete;
} }
// Set to true to make the contact point obselete // Set to true to make the contact point obsolete
inline void ContactPoint::setIsObselete(bool isObselete) { inline void ContactPoint::setIsObsolete(bool isObsolete) {
mIsObselete = isObselete; mIsObsolete = isObsolete;
} }
// Return the next contact point in the linked list // Return the next contact point in the linked list

View File

@ -164,11 +164,11 @@ class OverlappingPair {
/// Reduce the number of contact points of all the potential contact manifolds /// Reduce the number of contact points of all the potential contact manifolds
void reducePotentialContactManifolds(); void reducePotentialContactManifolds();
/// Make the contact manifolds and contact points obselete /// Make the contact manifolds and contact points obsolete
void makeContactsObselete(); void makeContactsObselete();
/// Clear the obselete contact manifold and contact points /// Clear the obsolete contact manifold and contact points
void clearObseleteManifoldsAndContactPoints(); void clearObsoleteManifoldsAndContactPoints();
/// Return the pair of bodies index /// Return the pair of bodies index
static overlappingpairid computeID(ProxyShape* shape1, ProxyShape* shape2); static overlappingpairid computeID(ProxyShape* shape1, ProxyShape* shape2);
@ -211,10 +211,10 @@ inline const ContactManifoldSet& OverlappingPair::getContactManifoldSet() {
return mContactManifoldSet; return mContactManifoldSet;
} }
// Make the contact manifolds and contact points obselete // Make the contact manifolds and contact points obsolete
inline void OverlappingPair::makeContactsObselete() { inline void OverlappingPair::makeContactsObselete() {
mContactManifoldSet.makeContactsObselete(); mContactManifoldSet.makeContactsObsolete();
} }
// Return the pair of bodies index // Return the pair of bodies index
@ -262,9 +262,9 @@ inline ContactManifoldInfo* OverlappingPair::getPotentialContactManifolds() {
return mPotentialContactManifolds; return mPotentialContactManifolds;
} }
// Clear the obselete contact manifold and contact points // Clear the obsolete contact manifold and contact points
inline void OverlappingPair::clearObseleteManifoldsAndContactPoints() { inline void OverlappingPair::clearObsoleteManifoldsAndContactPoints() {
mContactManifoldSet.clearObseleteManifoldsAndContactPoints(); mContactManifoldSet.clearObsoleteManifoldsAndContactPoints();
} }
} }