Small modifs in ECS
This commit is contained in:
parent
c5c7e81260
commit
827b14f1b0
|
@ -278,7 +278,6 @@ void ContactManifoldSet::clearObsoleteManifoldsAndContactPoints() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove some contact manifolds and contact points if there are too many of them
|
||||
void ContactManifoldSet::reduce() {
|
||||
|
||||
|
|
|
@ -148,8 +148,7 @@ void BroadPhaseAlgorithm::computeOverlappingPairs(MemoryManager& memoryManager)
|
|||
|
||||
LinkedList<int> 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<int>::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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Entity, uint32> mMapEntityToComponentIndex;
|
||||
|
||||
/// Map a proxy shape to the index of the corresponding component in the array
|
||||
Map<const ProxyShape*, uint32> mMapProxyShapeToComponentIndex;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user