diff --git a/src/collision/ContactManifoldSet.cpp b/src/collision/ContactManifoldSet.cpp index 5c6f8d7f..a842fe64 100644 --- a/src/collision/ContactManifoldSet.cpp +++ b/src/collision/ContactManifoldSet.cpp @@ -278,7 +278,6 @@ void ContactManifoldSet::clearObsoleteManifoldsAndContactPoints() { } } - // Remove some contact manifolds and contact points if there are too many of them void ContactManifoldSet::reduce() { diff --git a/src/collision/broadphase/BroadPhaseAlgorithm.cpp b/src/collision/broadphase/BroadPhaseAlgorithm.cpp index 43b9a5d2..ebd6912b 100644 --- a/src/collision/broadphase/BroadPhaseAlgorithm.cpp +++ b/src/collision/broadphase/BroadPhaseAlgorithm.cpp @@ -148,8 +148,7 @@ void BroadPhaseAlgorithm::computeOverlappingPairs(MemoryManager& memoryManager) LinkedList overlappingNodes(memoryManager.getPoolAllocator()); - // For all collision shapes that have moved (or have been created) during the - // last simulation step + // For all collision shapes that have moved (or have been created) during the last simulation step for (auto it = mMovedShapes.begin(); it != mMovedShapes.end(); ++it) { int shapeID = *it; @@ -224,7 +223,7 @@ void BroadPhaseAlgorithm::addOverlappingNodes(int referenceNodeId, const LinkedL LinkedList::ListElement* elem = overlappingNodes.getListHead(); while (elem != nullptr) { - // If both the nodes are the same, we do not create store the overlapping pair + // If both the nodes are the same, we do not create the overlapping pair if (referenceNodeId != elem->data) { // Add the new potential pair into the array of potential overlapping pairs diff --git a/src/components/ProxyShapesComponents.cpp b/src/components/ProxyShapesComponents.cpp index f2284582..f623d006 100644 --- a/src/components/ProxyShapesComponents.cpp +++ b/src/components/ProxyShapesComponents.cpp @@ -35,8 +35,8 @@ using namespace reactphysics3d; // Constructor ProxyShapesComponents::ProxyShapesComponents(MemoryAllocator& allocator) - :mMemoryAllocator(allocator), mNbComponents(0), mNbAllocatedComponents(0), - mSleepingStartIndex(0), mBuffer(nullptr), mMapEntityToComponentIndex(allocator), + :Components(allocator), + mSleepingStartIndex(0), mMapProxyShapeToComponentIndex(allocator) { // Allocate memory for the components data diff --git a/src/components/ProxyShapesComponents.h b/src/components/ProxyShapesComponents.h index 7ba0e0e6..d2e58233 100644 --- a/src/components/ProxyShapesComponents.h +++ b/src/components/ProxyShapesComponents.h @@ -31,6 +31,7 @@ #include "engine/Entity.h" #include "containers/Map.h" #include "collision/shapes/AABB.h" +#include "components/Components.h" // ReactPhysics3D namespace namespace reactphysics3d { @@ -50,42 +51,21 @@ class ProxyShape; * link information to quickly know all the proxy shapes of a given entity (body). We also make * sure that proxy shapes of sleeping entities (bodies) are always stored at the end of the array. */ -class ProxyShapesComponents { +class ProxyShapesComponents : public Components { private: // -------------------- Constants -------------------- // - /// Number of components to allocated at the beginning - const uint32 INIT_ALLOCATED_COMPONENTS = 10; - - /// Number of valid entities to hit before stopping garbage collection - const uint32 GARBAGE_COLLECTION_MAX_VALID_ENTITIES = 5; - const size_t COMPONENT_DATA_SIZE = sizeof(Entity) + sizeof(ProxyShape*) + sizeof(int) + sizeof(AABB) + sizeof(Transform) + sizeof(CollisionShape*) + sizeof(decimal) + sizeof(uint32) + sizeof(uint32) + sizeof(unsigned short) + sizeof(unsigned short); // -------------------- Attributes -------------------- // - /// Memory allocator - MemoryAllocator& mMemoryAllocator; - - /// Current number of components - uint32 mNbComponents; - - /// Number of allocated components - uint32 mNbAllocatedComponents; - /// Index of the first component of a sleeping entity (sleeping components are stored at the end) uint32 mSleepingStartIndex; - /// Allocated memory for all the data of the components - void* mBuffer; - - /// Map an entity to the index of its component in the array - Map mMapEntityToComponentIndex; - /// Map a proxy shape to the index of the corresponding component in the array Map mMapProxyShapeToComponentIndex;