Remove unused cachedCollisionData variable

This commit is contained in:
Daniel Chappuis 2017-11-22 22:58:31 +01:00
parent f403a6e804
commit f09331c185
6 changed files with 7 additions and 36 deletions

View File

@ -169,8 +169,7 @@ void CollisionDetection::computeMiddlePhase() {
mNarrowPhaseInfoList = new (mSingleFrameAllocator.allocate(sizeof(NarrowPhaseInfo))) mNarrowPhaseInfoList = new (mSingleFrameAllocator.allocate(sizeof(NarrowPhaseInfo)))
NarrowPhaseInfo(pair, shape1->getCollisionShape(), NarrowPhaseInfo(pair, shape1->getCollisionShape(),
shape2->getCollisionShape(), shape1->getLocalToWorldTransform(), shape2->getCollisionShape(), shape1->getLocalToWorldTransform(),
shape2->getLocalToWorldTransform(), shape1->getCachedCollisionData(), shape2->getLocalToWorldTransform(), mSingleFrameAllocator);
shape2->getCachedCollisionData(), mSingleFrameAllocator);
mNarrowPhaseInfoList->next = firstNarrowPhaseInfo; mNarrowPhaseInfoList->next = firstNarrowPhaseInfo;
} }
@ -488,8 +487,7 @@ NarrowPhaseInfo* CollisionDetection::computeMiddlePhaseForProxyShapes(Overlappin
// for the narrow-phase collision detection // for the narrow-phase collision detection
narrowPhaseInfo = new (mPoolAllocator.allocate(sizeof(NarrowPhaseInfo))) NarrowPhaseInfo(pair, shape1->getCollisionShape(), narrowPhaseInfo = new (mPoolAllocator.allocate(sizeof(NarrowPhaseInfo))) NarrowPhaseInfo(pair, shape1->getCollisionShape(),
shape2->getCollisionShape(), shape1->getLocalToWorldTransform(), shape2->getCollisionShape(), shape1->getLocalToWorldTransform(),
shape2->getLocalToWorldTransform(), shape1->getCachedCollisionData(), shape2->getLocalToWorldTransform(), mPoolAllocator);
shape2->getCachedCollisionData(), mPoolAllocator);
} }
// Concave vs Convex algorithm // Concave vs Convex algorithm

View File

@ -55,7 +55,6 @@ void MiddlePhaseTriangleCallback::testTriangle(const Vector3* trianglePoints, co
isShape1Convex ? triangleShape : mConvexProxyShape->getCollisionShape(), isShape1Convex ? triangleShape : mConvexProxyShape->getCollisionShape(),
shape1->getLocalToWorldTransform(), shape1->getLocalToWorldTransform(),
shape2->getLocalToWorldTransform(), shape2->getLocalToWorldTransform(),
shape1->getCachedCollisionData(), mAllocator);
shape2->getCachedCollisionData(), mAllocator);
narrowPhaseInfoList->next = firstNarrowPhaseInfo; narrowPhaseInfoList->next = firstNarrowPhaseInfo;
} }

View File

@ -35,12 +35,10 @@ using namespace reactphysics3d;
// Constructor // Constructor
NarrowPhaseInfo::NarrowPhaseInfo(OverlappingPair* pair, CollisionShape* shape1, NarrowPhaseInfo::NarrowPhaseInfo(OverlappingPair* pair, CollisionShape* shape1,
CollisionShape* shape2, const Transform& shape1Transform, CollisionShape* shape2, const Transform& shape1Transform,
const Transform& shape2Transform, void** cachedData1, void** cachedData2, const Transform& shape2Transform, Allocator& shapeAllocator)
Allocator& shapeAllocator)
: overlappingPair(pair), collisionShape1(shape1), collisionShape2(shape2), : overlappingPair(pair), collisionShape1(shape1), collisionShape2(shape2),
shape1ToWorldTransform(shape1Transform), shape2ToWorldTransform(shape2Transform), shape1ToWorldTransform(shape1Transform), shape2ToWorldTransform(shape2Transform),
contactPoints(nullptr), cachedCollisionData1(cachedData1), contactPoints(nullptr), next(nullptr), collisionShapeAllocator(shapeAllocator) {
cachedCollisionData2(cachedData2), next(nullptr), collisionShapeAllocator(shapeAllocator) {
// Add a collision info for the two collision shapes into the overlapping pair (if not present yet) // Add a collision info for the two collision shapes into the overlapping pair (if not present yet)
overlappingPair->addLastFrameInfoIfNecessary(shape1->getId(), shape2->getId()); overlappingPair->addLastFrameInfoIfNecessary(shape1->getId(), shape2->getId());

View File

@ -63,14 +63,6 @@ struct NarrowPhaseInfo {
/// Linked-list of contact points created during the narrow-phase /// Linked-list of contact points created during the narrow-phase
ContactPointInfo* contactPoints; ContactPointInfo* contactPoints;
/// Cached collision data of the proxy shape
// TODO : Check if we can use separating axis in OverlappingPair instead of cachedCollisionData1 and cachedCollisionData2
void** cachedCollisionData1;
/// Cached collision data of the proxy shape
// TODO : Check if we can use separating axis in OverlappingPair instead of cachedCollisionData1 and cachedCollisionData2
void** cachedCollisionData2;
/// Pointer to the next element in the linked list /// Pointer to the next element in the linked list
NarrowPhaseInfo* next; NarrowPhaseInfo* next;
@ -80,7 +72,7 @@ struct NarrowPhaseInfo {
/// Constructor /// Constructor
NarrowPhaseInfo(OverlappingPair* pair, CollisionShape* shape1, NarrowPhaseInfo(OverlappingPair* pair, CollisionShape* shape1,
CollisionShape* shape2, const Transform& shape1Transform, CollisionShape* shape2, const Transform& shape1Transform,
const Transform& shape2Transform, void** cachedData1, void** cachedData2, Allocator& shapeAllocator); const Transform& shape2Transform, Allocator& shapeAllocator);
/// Destructor /// Destructor
~NarrowPhaseInfo(); ~NarrowPhaseInfo();

View File

@ -37,18 +37,13 @@ using namespace reactphysics3d;
*/ */
ProxyShape::ProxyShape(CollisionBody* body, CollisionShape* shape, const Transform& transform, decimal mass) ProxyShape::ProxyShape(CollisionBody* body, CollisionShape* shape, const Transform& transform, decimal mass)
:mBody(body), mCollisionShape(shape), mLocalToBodyTransform(transform), mMass(mass), :mBody(body), mCollisionShape(shape), mLocalToBodyTransform(transform), mMass(mass),
mNext(nullptr), mBroadPhaseID(-1), mCachedCollisionData(nullptr), mUserData(nullptr), mNext(nullptr), mBroadPhaseID(-1), mCollisionCategoryBits(0x0001), mCollideWithMaskBits(0xFFFF) {
mCollisionCategoryBits(0x0001), mCollideWithMaskBits(0xFFFF) {
} }
// Destructor // Destructor
ProxyShape::~ProxyShape() { ProxyShape::~ProxyShape() {
// Release the cached collision data memory
if (mCachedCollisionData != nullptr) {
free(mCachedCollisionData);
}
} }
// Return true if a point is inside the collision shape // Return true if a point is inside the collision shape

View File

@ -66,9 +66,6 @@ class ProxyShape {
/// Broad-phase ID (node ID in the dynamic AABB tree) /// Broad-phase ID (node ID in the dynamic AABB tree)
int mBroadPhaseID; int mBroadPhaseID;
/// Cached collision data
void* mCachedCollisionData;
/// Pointer to user data /// Pointer to user data
void* mUserData; void* mUserData;
@ -168,9 +165,6 @@ class ProxyShape {
/// Return the next proxy shape in the linked list of proxy shapes /// Return the next proxy shape in the linked list of proxy shapes
const ProxyShape* getNext() const; const ProxyShape* getNext() const;
/// Return the pointer to the cached collision data
void** getCachedCollisionData();
/// Return the local scaling vector of the collision shape /// Return the local scaling vector of the collision shape
Vector3 getLocalScaling() const; Vector3 getLocalScaling() const;
@ -201,11 +195,6 @@ class ProxyShape {
}; };
// Return the pointer to the cached collision data
inline void** ProxyShape::getCachedCollisionData() {
return &mCachedCollisionData;
}
// Return the collision shape // Return the collision shape
/** /**
* @return Pointer to the internal collision shape * @return Pointer to the internal collision shape