From f09331c185ddc81a3415ed26e565fd94ae2e71fa Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Wed, 22 Nov 2017 22:58:31 +0100 Subject: [PATCH] Remove unused cachedCollisionData variable --- src/collision/CollisionDetection.cpp | 6 ++---- src/collision/MiddlePhaseTriangleCallback.cpp | 3 +-- src/collision/NarrowPhaseInfo.cpp | 6 ++---- src/collision/NarrowPhaseInfo.h | 10 +--------- src/collision/ProxyShape.cpp | 7 +------ src/collision/ProxyShape.h | 11 ----------- 6 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/collision/CollisionDetection.cpp b/src/collision/CollisionDetection.cpp index 4808ea65..f1a7b80a 100644 --- a/src/collision/CollisionDetection.cpp +++ b/src/collision/CollisionDetection.cpp @@ -169,8 +169,7 @@ void CollisionDetection::computeMiddlePhase() { mNarrowPhaseInfoList = new (mSingleFrameAllocator.allocate(sizeof(NarrowPhaseInfo))) NarrowPhaseInfo(pair, shape1->getCollisionShape(), shape2->getCollisionShape(), shape1->getLocalToWorldTransform(), - shape2->getLocalToWorldTransform(), shape1->getCachedCollisionData(), - shape2->getCachedCollisionData(), mSingleFrameAllocator); + shape2->getLocalToWorldTransform(), mSingleFrameAllocator); mNarrowPhaseInfoList->next = firstNarrowPhaseInfo; } @@ -488,8 +487,7 @@ NarrowPhaseInfo* CollisionDetection::computeMiddlePhaseForProxyShapes(Overlappin // for the narrow-phase collision detection narrowPhaseInfo = new (mPoolAllocator.allocate(sizeof(NarrowPhaseInfo))) NarrowPhaseInfo(pair, shape1->getCollisionShape(), shape2->getCollisionShape(), shape1->getLocalToWorldTransform(), - shape2->getLocalToWorldTransform(), shape1->getCachedCollisionData(), - shape2->getCachedCollisionData(), mPoolAllocator); + shape2->getLocalToWorldTransform(), mPoolAllocator); } // Concave vs Convex algorithm diff --git a/src/collision/MiddlePhaseTriangleCallback.cpp b/src/collision/MiddlePhaseTriangleCallback.cpp index 58604087..f8736a0b 100644 --- a/src/collision/MiddlePhaseTriangleCallback.cpp +++ b/src/collision/MiddlePhaseTriangleCallback.cpp @@ -55,7 +55,6 @@ void MiddlePhaseTriangleCallback::testTriangle(const Vector3* trianglePoints, co isShape1Convex ? triangleShape : mConvexProxyShape->getCollisionShape(), shape1->getLocalToWorldTransform(), shape2->getLocalToWorldTransform(), - shape1->getCachedCollisionData(), - shape2->getCachedCollisionData(), mAllocator); + mAllocator); narrowPhaseInfoList->next = firstNarrowPhaseInfo; } diff --git a/src/collision/NarrowPhaseInfo.cpp b/src/collision/NarrowPhaseInfo.cpp index 660f6704..a6440367 100644 --- a/src/collision/NarrowPhaseInfo.cpp +++ b/src/collision/NarrowPhaseInfo.cpp @@ -35,12 +35,10 @@ using namespace reactphysics3d; // Constructor NarrowPhaseInfo::NarrowPhaseInfo(OverlappingPair* pair, CollisionShape* shape1, CollisionShape* shape2, const Transform& shape1Transform, - const Transform& shape2Transform, void** cachedData1, void** cachedData2, - Allocator& shapeAllocator) + const Transform& shape2Transform, Allocator& shapeAllocator) : overlappingPair(pair), collisionShape1(shape1), collisionShape2(shape2), shape1ToWorldTransform(shape1Transform), shape2ToWorldTransform(shape2Transform), - contactPoints(nullptr), cachedCollisionData1(cachedData1), - cachedCollisionData2(cachedData2), next(nullptr), collisionShapeAllocator(shapeAllocator) { + contactPoints(nullptr), next(nullptr), collisionShapeAllocator(shapeAllocator) { // Add a collision info for the two collision shapes into the overlapping pair (if not present yet) overlappingPair->addLastFrameInfoIfNecessary(shape1->getId(), shape2->getId()); diff --git a/src/collision/NarrowPhaseInfo.h b/src/collision/NarrowPhaseInfo.h index b100939f..b732480c 100644 --- a/src/collision/NarrowPhaseInfo.h +++ b/src/collision/NarrowPhaseInfo.h @@ -63,14 +63,6 @@ struct NarrowPhaseInfo { /// Linked-list of contact points created during the narrow-phase 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 NarrowPhaseInfo* next; @@ -80,7 +72,7 @@ struct NarrowPhaseInfo { /// Constructor NarrowPhaseInfo(OverlappingPair* pair, CollisionShape* shape1, CollisionShape* shape2, const Transform& shape1Transform, - const Transform& shape2Transform, void** cachedData1, void** cachedData2, Allocator& shapeAllocator); + const Transform& shape2Transform, Allocator& shapeAllocator); /// Destructor ~NarrowPhaseInfo(); diff --git a/src/collision/ProxyShape.cpp b/src/collision/ProxyShape.cpp index 50418011..6e6eefbd 100644 --- a/src/collision/ProxyShape.cpp +++ b/src/collision/ProxyShape.cpp @@ -37,18 +37,13 @@ using namespace reactphysics3d; */ ProxyShape::ProxyShape(CollisionBody* body, CollisionShape* shape, const Transform& transform, decimal mass) :mBody(body), mCollisionShape(shape), mLocalToBodyTransform(transform), mMass(mass), - mNext(nullptr), mBroadPhaseID(-1), mCachedCollisionData(nullptr), mUserData(nullptr), - mCollisionCategoryBits(0x0001), mCollideWithMaskBits(0xFFFF) { + mNext(nullptr), mBroadPhaseID(-1), mCollisionCategoryBits(0x0001), mCollideWithMaskBits(0xFFFF) { } // Destructor ProxyShape::~ProxyShape() { - // Release the cached collision data memory - if (mCachedCollisionData != nullptr) { - free(mCachedCollisionData); - } } // Return true if a point is inside the collision shape diff --git a/src/collision/ProxyShape.h b/src/collision/ProxyShape.h index 574758d4..8e9a9e9f 100644 --- a/src/collision/ProxyShape.h +++ b/src/collision/ProxyShape.h @@ -66,9 +66,6 @@ class ProxyShape { /// Broad-phase ID (node ID in the dynamic AABB tree) int mBroadPhaseID; - /// Cached collision data - void* mCachedCollisionData; - /// Pointer to user data void* mUserData; @@ -168,9 +165,6 @@ class ProxyShape { /// Return the next proxy shape in the linked list of proxy shapes const ProxyShape* getNext() const; - /// Return the pointer to the cached collision data - void** getCachedCollisionData(); - /// Return the local scaling vector of the collision shape 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 Pointer to the internal collision shape