Remove ProxyShapes pointers from OverlappingPair
This commit is contained in:
parent
3acdeb8cd2
commit
20c9794a20
|
@ -163,10 +163,11 @@ short int ContactManifoldSet::computeCubemapNormalId(const Vector3& normal) cons
|
|||
}
|
||||
|
||||
// Update the contact manifolds
|
||||
void ContactManifoldSet::update(const Transform& transform1, const Transform& transform2) {
|
||||
void ContactManifoldSet::update() {
|
||||
|
||||
for (int i=0; i<mNbManifolds; i++) {
|
||||
mManifolds[i]->update(transform1, transform2);
|
||||
mManifolds[i]->update(mShape1->getBody()->getTransform() * mShape1->getLocalToBodyTransform(),
|
||||
mShape2->getBody()->getTransform() * mShape2->getLocalToBodyTransform());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,11 +93,17 @@ class ContactManifoldSet {
|
|||
/// Destructor
|
||||
~ContactManifoldSet();
|
||||
|
||||
/// Return the first proxy shape
|
||||
ProxyShape* getShape1() const;
|
||||
|
||||
/// Return the second proxy shape
|
||||
ProxyShape* getShape2() const;
|
||||
|
||||
/// Add a contact point to the manifold set
|
||||
void addContactPoint(ContactPoint* contact);
|
||||
|
||||
/// Update the contact manifolds
|
||||
void update(const Transform& transform1, const Transform& transform2);
|
||||
void update();
|
||||
|
||||
/// Clear the contact manifold set
|
||||
void clear();
|
||||
|
@ -112,6 +118,16 @@ class ContactManifoldSet {
|
|||
int getTotalNbContactPoints() const;
|
||||
};
|
||||
|
||||
// Return the first proxy shape
|
||||
inline ProxyShape* ContactManifoldSet::getShape1() const {
|
||||
return mShape1;
|
||||
}
|
||||
|
||||
// Return the second proxy shape
|
||||
inline ProxyShape* ContactManifoldSet::getShape2() const {
|
||||
return mShape2;
|
||||
}
|
||||
|
||||
// Return the number of manifolds in the set
|
||||
inline int ContactManifoldSet::getNbContactManifolds() const {
|
||||
return mNbManifolds;
|
||||
|
|
|
@ -32,8 +32,7 @@ using namespace reactphysics3d;
|
|||
// Constructor
|
||||
OverlappingPair::OverlappingPair(ProxyShape* shape1, ProxyShape* shape2,
|
||||
int nbMaxContactManifolds, MemoryAllocator& memoryAllocator)
|
||||
: mShape1(shape1), mShape2(shape2),
|
||||
mContactManifoldSet(shape1, shape2, memoryAllocator, nbMaxContactManifolds),
|
||||
: mContactManifoldSet(shape1, shape2, memoryAllocator, nbMaxContactManifolds),
|
||||
mCachedSeparatingAxis(1.0, 1.0, 1.0) {
|
||||
|
||||
}
|
||||
|
|
|
@ -51,12 +51,6 @@ class OverlappingPair {
|
|||
|
||||
// -------------------- Attributes -------------------- //
|
||||
|
||||
/// Pointer to the first proxy collision shape
|
||||
ProxyShape* mShape1;
|
||||
|
||||
/// Pointer to the second proxy collision shape
|
||||
ProxyShape* mShape2;
|
||||
|
||||
/// Set of persistent contact manifolds
|
||||
ContactManifoldSet mContactManifoldSet;
|
||||
|
||||
|
@ -122,12 +116,12 @@ class OverlappingPair {
|
|||
|
||||
// Return the pointer to first body
|
||||
inline ProxyShape* OverlappingPair::getShape1() const {
|
||||
return mShape1;
|
||||
return mContactManifoldSet.getShape1();
|
||||
}
|
||||
|
||||
// Return the pointer to second body
|
||||
inline ProxyShape* OverlappingPair::getShape2() const {
|
||||
return mShape2;
|
||||
return mContactManifoldSet.getShape2();
|
||||
}
|
||||
|
||||
// Add a contact to the contact manifold
|
||||
|
@ -137,8 +131,7 @@ inline void OverlappingPair::addContact(ContactPoint* contact) {
|
|||
|
||||
// Update the contact manifold
|
||||
inline void OverlappingPair::update() {
|
||||
mContactManifoldSet.update(mShape1->getBody()->getTransform() * mShape1->getLocalToBodyTransform(),
|
||||
mShape2->getBody()->getTransform() *mShape2->getLocalToBodyTransform());
|
||||
mContactManifoldSet.update();
|
||||
}
|
||||
|
||||
// Return the cached separating axis
|
||||
|
|
Loading…
Reference in New Issue
Block a user