diff --git a/include/reactphysics3d/body/CollisionBody.h b/include/reactphysics3d/body/CollisionBody.h index 98c22c4a..41d7923c 100644 --- a/include/reactphysics3d/body/CollisionBody.h +++ b/include/reactphysics3d/body/CollisionBody.h @@ -143,7 +143,7 @@ class CollisionBody { Collider* getCollider(uint colliderIndex); /// Return the number of colliders associated with this body - uint getNbColliders() const; + uint32 getNbColliders() const; /// Return the world-space coordinates of a point given the local-space coordinates of the body Vector3 getWorldPoint(const Vector3& localPoint) const; diff --git a/include/reactphysics3d/collision/CollisionCallback.h b/include/reactphysics3d/collision/CollisionCallback.h index 716de01f..e1210fad 100644 --- a/include/reactphysics3d/collision/CollisionCallback.h +++ b/include/reactphysics3d/collision/CollisionCallback.h @@ -278,7 +278,7 @@ class CollisionCallback { * @param index Index of the contact pair to retrieve * @return A contact pair object */ - ContactPair getContactPair(uint index) const; + ContactPair getContactPair(uint32 index) const; // -------------------- Friendship -------------------- // @@ -296,7 +296,7 @@ class CollisionCallback { /** * @return The number of contact pairs */ -RP3D_FORCE_INLINE uint CollisionCallback::CallbackData::getNbContactPairs() const { +RP3D_FORCE_INLINE uint32 CollisionCallback::CallbackData::getNbContactPairs() const { return mContactPairsIndices.size() + mLostContactPairsIndices.size(); } diff --git a/include/reactphysics3d/collision/ContactPair.h b/include/reactphysics3d/collision/ContactPair.h index abd648fd..53e4cbfb 100644 --- a/include/reactphysics3d/collision/ContactPair.h +++ b/include/reactphysics3d/collision/ContactPair.h @@ -69,19 +69,19 @@ struct ContactPair { bool isAlreadyInIsland; /// Index of the contact pair in the array of pairs - uint contactPairIndex; + uint32 contactPairIndex; /// Index of the first contact manifold in the array - uint contactManifoldsIndex; + uint32 contactManifoldsIndex; /// Number of contact manifolds int8 nbContactManifolds; /// Index of the first contact point in the array of contact points - uint contactPointsIndex; + uint32 contactPointsIndex; /// Total number of contact points in all the manifolds of the contact pair - uint nbToTalContactPoints; + uint32 nbToTalContactPoints; /// True if the colliders of the pair were already colliding in the previous frame bool collidingInPreviousFrame; diff --git a/include/reactphysics3d/collision/HalfEdgeStructure.h b/include/reactphysics3d/collision/HalfEdgeStructure.h index ca68064a..a8d5ac2e 100644 --- a/include/reactphysics3d/collision/HalfEdgeStructure.h +++ b/include/reactphysics3d/collision/HalfEdgeStructure.h @@ -65,11 +65,11 @@ class HalfEdgeStructure { /// Vertex struct Vertex { - uint vertexPointIndex; // Index of the vertex point in the origin vertex array - uint edgeIndex; // Index of one edge emanting from this vertex + uint32 vertexPointIndex; // Index of the vertex point in the origin vertex array + uint32 edgeIndex; // Index of one edge emanting from this vertex /// Constructor - Vertex(uint vertexCoordsIndex) : vertexPointIndex(vertexCoordsIndex) { } + Vertex(uint32 vertexCoordsIndex) : vertexPointIndex(vertexCoordsIndex) { } }; private: @@ -129,7 +129,7 @@ class HalfEdgeStructure { /** * @param vertexPointIndex Index of the vertex in the vertex data array */ -RP3D_FORCE_INLINE uint HalfEdgeStructure::addVertex(uint vertexPointIndex) { +RP3D_FORCE_INLINE uint32 HalfEdgeStructure::addVertex(uint32 vertexPointIndex) { Vertex vertex(vertexPointIndex); mVertices.add(vertex); return mVertices.size() - 1; @@ -151,31 +151,31 @@ RP3D_FORCE_INLINE void HalfEdgeStructure::addFace(List faceVertices) { /** * @return The number of faces in the polyhedron */ -RP3D_FORCE_INLINE uint HalfEdgeStructure::getNbFaces() const { - return static_cast(mFaces.size()); +RP3D_FORCE_INLINE uint32 HalfEdgeStructure::getNbFaces() const { + return mFaces.size(); } // Return the number of edges /** * @return The number of edges in the polyhedron */ -RP3D_FORCE_INLINE uint HalfEdgeStructure::getNbHalfEdges() const { - return static_cast(mEdges.size()); +RP3D_FORCE_INLINE uint32 HalfEdgeStructure::getNbHalfEdges() const { + return mEdges.size(); } // Return the number of vertices /** * @return The number of vertices in the polyhedron */ -RP3D_FORCE_INLINE uint HalfEdgeStructure::getNbVertices() const { - return static_cast(mVertices.size()); +RP3D_FORCE_INLINE uint32 HalfEdgeStructure::getNbVertices() const { + return mVertices.size(); } // Return a given face /** * @return A given face of the polyhedron */ -RP3D_FORCE_INLINE const HalfEdgeStructure::Face& HalfEdgeStructure::getFace(uint index) const { +RP3D_FORCE_INLINE const HalfEdgeStructure::Face& HalfEdgeStructure::getFace(uint32 index) const { assert(index < mFaces.size()); return mFaces[index]; } @@ -184,7 +184,7 @@ RP3D_FORCE_INLINE const HalfEdgeStructure::Face& HalfEdgeStructure::getFace(uint /** * @return A given edge of the polyhedron */ -RP3D_FORCE_INLINE const HalfEdgeStructure::Edge& HalfEdgeStructure::getHalfEdge(uint index) const { +RP3D_FORCE_INLINE const HalfEdgeStructure::Edge& HalfEdgeStructure::getHalfEdge(uint32 index) const { assert(index < mEdges.size()); return mEdges[index]; } @@ -193,7 +193,7 @@ RP3D_FORCE_INLINE const HalfEdgeStructure::Edge& HalfEdgeStructure::getHalfEdge( /** * @return A given vertex of the polyhedron */ -RP3D_FORCE_INLINE const HalfEdgeStructure::Vertex& HalfEdgeStructure::getVertex(uint index) const { +RP3D_FORCE_INLINE const HalfEdgeStructure::Vertex& HalfEdgeStructure::getVertex(uint32 index) const { assert(index < mVertices.size()); return mVertices[index]; } diff --git a/include/reactphysics3d/collision/OverlapCallback.h b/include/reactphysics3d/collision/OverlapCallback.h index 6601b879..e0126132 100644 --- a/include/reactphysics3d/collision/OverlapCallback.h +++ b/include/reactphysics3d/collision/OverlapCallback.h @@ -165,10 +165,10 @@ class OverlapCallback { // -------------------- Methods -------------------- // /// Return the number of overlapping pairs of bodies - uint getNbOverlappingPairs() const; + uint32 getNbOverlappingPairs() const; /// Return a given overlapping pair of bodies - OverlapPair getOverlappingPair(uint index) const; + OverlapPair getOverlappingPair(uint32 index) const; // -------------------- Friendship -------------------- // @@ -185,7 +185,7 @@ class OverlapCallback { }; // Return the number of overlapping pairs of bodies -RP3D_FORCE_INLINE uint OverlapCallback::CallbackData::getNbOverlappingPairs() const { +RP3D_FORCE_INLINE uint32 OverlapCallback::CallbackData::getNbOverlappingPairs() const { return mContactPairsIndices.size() + mLostContactPairsIndices.size(); } @@ -193,7 +193,7 @@ RP3D_FORCE_INLINE uint OverlapCallback::CallbackData::getNbOverlappingPairs() co /// Note that the returned OverlapPair object is only valid during the call of the CollisionCallback::onOverlap() /// method. Therefore, you need to get contact data from it and make a copy. Do not make a copy of the OverlapPair /// object itself because it won't be valid after the CollisionCallback::onOverlap() call. -RP3D_FORCE_INLINE OverlapCallback::OverlapPair OverlapCallback::CallbackData::getOverlappingPair(uint index) const { +RP3D_FORCE_INLINE OverlapCallback::OverlapPair OverlapCallback::CallbackData::getOverlappingPair(uint32 index) const { assert(index < getNbOverlappingPairs()); diff --git a/include/reactphysics3d/collision/TriangleMesh.h b/include/reactphysics3d/collision/TriangleMesh.h index 1cb4d516..87163407 100644 --- a/include/reactphysics3d/collision/TriangleMesh.h +++ b/include/reactphysics3d/collision/TriangleMesh.h @@ -87,7 +87,7 @@ RP3D_FORCE_INLINE void TriangleMesh::addSubpart(TriangleVertexArray* triangleVer * @param indexSubpart The index of the sub-part of the mesh * @return A pointer to the triangle vertex array of a given sub-part of the mesh */ -RP3D_FORCE_INLINE TriangleVertexArray* TriangleMesh::getSubpart(uint indexSubpart) const { +RP3D_FORCE_INLINE TriangleVertexArray* TriangleMesh::getSubpart(uint32 indexSubpart) const { assert(indexSubpart < mTriangleArrays.size()); return mTriangleArrays[indexSubpart]; } @@ -96,7 +96,7 @@ RP3D_FORCE_INLINE TriangleVertexArray* TriangleMesh::getSubpart(uint indexSubpar /** * @return The number of sub-parts of the mesh */ -RP3D_FORCE_INLINE uint TriangleMesh::getNbSubparts() const { +RP3D_FORCE_INLINE uint32 TriangleMesh::getNbSubparts() const { return mTriangleArrays.size(); } diff --git a/include/reactphysics3d/collision/narrowphase/NarrowPhaseInfoBatch.h b/include/reactphysics3d/collision/narrowphase/NarrowPhaseInfoBatch.h index 73b44cb3..f4f94d38 100644 --- a/include/reactphysics3d/collision/narrowphase/NarrowPhaseInfoBatch.h +++ b/include/reactphysics3d/collision/narrowphase/NarrowPhaseInfoBatch.h @@ -109,7 +109,7 @@ struct NarrowPhaseInfoBatch { OverlappingPairs& mOverlappingPairs; /// Cached capacity - uint mCachedCapacity = 0; + uint32 mCachedCapacity = 0; public: @@ -128,10 +128,10 @@ struct NarrowPhaseInfoBatch { bool needToReportContacts, LastFrameCollisionInfo* lastFrameInfo, MemoryAllocator& shapeAllocator); /// Return the number of objects in the batch - uint getNbObjects() const; + uint32 getNbObjects() const; /// Add a new contact point - void addContactPoint(uint index, const Vector3& contactNormal, decimal penDepth, + void addContactPoint(uint32 index, const Vector3& contactNormal, decimal penDepth, const Vector3& localPt1, const Vector3& localPt2); /// Reset the remaining contact points @@ -145,7 +145,7 @@ struct NarrowPhaseInfoBatch { }; /// Return the number of objects in the batch -RP3D_FORCE_INLINE uint NarrowPhaseInfoBatch::getNbObjects() const { +RP3D_FORCE_INLINE uint32 NarrowPhaseInfoBatch::getNbObjects() const { return narrowPhaseInfos.size(); } diff --git a/include/reactphysics3d/containers/List.h b/include/reactphysics3d/containers/List.h index 11c63915..d0c5a731 100755 --- a/include/reactphysics3d/containers/List.h +++ b/include/reactphysics3d/containers/List.h @@ -51,10 +51,10 @@ class List { void* mBuffer; /// Number of elements in the list - size_t mSize; + uint32 mSize; /// Number of allocated elements in the list - size_t mCapacity; + uint32 mCapacity; /// Memory allocator MemoryAllocator& mAllocator; @@ -69,9 +69,9 @@ class List { private: - size_t mCurrentIndex; + uint32 mCurrentIndex; T* mBuffer; - size_t mSize; + uint32 mSize; public: @@ -88,7 +88,7 @@ class List { Iterator() = default; /// Constructor - Iterator(void* buffer, size_t index, size_t size) + Iterator(void* buffer, uint32 index, uint32 size) :mCurrentIndex(index), mBuffer(static_cast(buffer)), mSize(size) { } @@ -219,7 +219,7 @@ class List { // -------------------- Methods -------------------- // /// Constructor - List(MemoryAllocator& allocator, size_t capacity = 0) + List(MemoryAllocator& allocator, uint32 capacity = 0) : mBuffer(nullptr), mSize(0), mCapacity(0), mAllocator(allocator) { if (capacity > 0) { @@ -253,7 +253,7 @@ class List { } /// Allocate memory for a given number of elements - void reserve(size_t capacity) { + void reserve(uint32 capacity) { if (capacity <= mCapacity) return; @@ -270,7 +270,7 @@ class List { std::uninitialized_copy(items, items + mSize, destination); // Destruct the previous items - for (size_t i=0; i mCapacity) { @@ -330,7 +330,7 @@ class List { /// this method returns the end() iterator Iterator find(const T& element) { - for (uint i=0; i(mBuffer)[i]) { return Iterator(mBuffer, i, mSize); } @@ -352,7 +352,7 @@ class List { } /// Remove an element from the list at a given index (all the following items will be moved) - Iterator removeAt(uint index) { + Iterator removeAt(uint32 index) { assert(index >= 0 && index < mSize); @@ -374,7 +374,7 @@ class List { } /// Remove an element from the list at a given index and replace it by the last one of the list (if any) - void removeAtAndReplaceByLast(uint index) { + void removeAtAndReplaceByLast(uint32 index) { assert(index >= 0 && index < mSize); @@ -405,7 +405,7 @@ class List { } // Add the elements of the list to the current one - for(uint i=0; i(mBuffer) + mSize * sizeof(T)) T(list[i]); mSize++; @@ -416,7 +416,7 @@ class List { void clear(bool releaseMemory = false) { // Call the destructor of each element - for (uint i=0; i < mSize; i++) { + for (uint32 i=0; i < mSize; i++) { (static_cast(mBuffer)[i]).~T(); } @@ -434,23 +434,23 @@ class List { } /// Return the number of elements in the list - size_t size() const { + uint32 size() const { return mSize; } /// Return the capacity of the list - size_t capacity() const { + uint32 capacity() const { return mCapacity; } /// Overloaded index operator - T& operator[](const uint index) { + T& operator[](const uint32 index) { assert(index >= 0 && index < mSize); return (static_cast(mBuffer)[index]); } /// Overloaded const index operator - const T& operator[](const uint index) const { + const T& operator[](const uint32 index) const { assert(index >= 0 && index < mSize); return (static_cast(mBuffer)[index]); } @@ -461,7 +461,7 @@ class List { if (mSize != list.mSize) return false; T* items = static_cast(mBuffer); - for (size_t i=0; i < mSize; i++) { + for (uint32 i=0; i < mSize; i++) { if (items[i] != list[i]) { return false; } diff --git a/include/reactphysics3d/engine/Islands.h b/include/reactphysics3d/engine/Islands.h index 59d09f7e..bfe57081 100644 --- a/include/reactphysics3d/engine/Islands.h +++ b/include/reactphysics3d/engine/Islands.h @@ -96,7 +96,7 @@ struct Islands { /// Return the number of islands uint32 getNbIslands() const { - return static_cast(contactManifoldsIndices.size()); + return contactManifoldsIndices.size(); } /// Add an island and return its index diff --git a/include/reactphysics3d/engine/PhysicsWorld.h b/include/reactphysics3d/engine/PhysicsWorld.h index e2618959..baee7c3b 100644 --- a/include/reactphysics3d/engine/PhysicsWorld.h +++ b/include/reactphysics3d/engine/PhysicsWorld.h @@ -681,7 +681,7 @@ RP3D_FORCE_INLINE void PhysicsWorld::setEventListener(EventListener* eventListen /** * @return The number of collision bodies in the physics world */ -RP3D_FORCE_INLINE uint PhysicsWorld::getNbCollisionBodies() const { +RP3D_FORCE_INLINE uint32 PhysicsWorld::getNbCollisionBodies() const { return mCollisionBodies.size(); } @@ -689,7 +689,7 @@ RP3D_FORCE_INLINE uint PhysicsWorld::getNbCollisionBodies() const { /** * @return The number of rigid bodies in the physics world */ -RP3D_FORCE_INLINE uint PhysicsWorld::getNbRigidBodies() const { +RP3D_FORCE_INLINE uint32 PhysicsWorld::getNbRigidBodies() const { return mRigidBodies.size(); } diff --git a/src/body/CollisionBody.cpp b/src/body/CollisionBody.cpp index 4f065264..dbfada79 100644 --- a/src/body/CollisionBody.cpp +++ b/src/body/CollisionBody.cpp @@ -131,8 +131,8 @@ Collider* CollisionBody::addCollider(CollisionShape* collisionShape, const Trans /** * @return The number of colliders associated with this body */ -uint CollisionBody::getNbColliders() const { - return static_cast(mWorld.mCollisionBodyComponents.getColliders(mEntity).size()); +uint32 CollisionBody::getNbColliders() const { + return mWorld.mCollisionBodyComponents.getColliders(mEntity).size(); } // Return a const pointer to a given collider of the body @@ -202,7 +202,7 @@ void CollisionBody::removeAllColliders() { // Look for the collider that contains the collision shape in parameter. // Note that we need to copy the list of collider entities because we are deleting them in a loop. const List collidersEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < collidersEntities.size(); i++) { + for (uint32 i=0; i < collidersEntities.size(); i++) { removeCollider(mWorld.mCollidersComponents.getCollider(collidersEntities[i])); } @@ -223,7 +223,8 @@ void CollisionBody::updateBroadPhaseState(decimal timeStep) const { // For all the colliders of the body const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + const uint32 nbColliderEntities = colliderEntities.size(); + for (uint32 i=0; i < nbColliderEntities; i++) { // Update the local-to-world transform of the collider mWorld.mCollidersComponents.setLocalToWorldTransform(colliderEntities[i], @@ -253,7 +254,7 @@ void CollisionBody::setIsActive(bool isActive) { // For each collider of the body const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]); @@ -269,7 +270,7 @@ void CollisionBody::setIsActive(bool isActive) { // For each collider of the body const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]); @@ -292,7 +293,7 @@ void CollisionBody::askForBroadPhaseCollisionCheck() const { // For all the colliders of the body const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]); @@ -310,7 +311,7 @@ bool CollisionBody::testPointInside(const Vector3& worldPoint) const { // For each collider of the body const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]); @@ -339,7 +340,7 @@ bool CollisionBody::raycast(const Ray& ray, RaycastInfo& raycastInfo) { // For each collider of the body const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]); @@ -370,7 +371,7 @@ AABB CollisionBody::getAABB() const { collider->getCollisionShape()->computeAABB(bodyAABB, transform * collider->getLocalToBodyTransform()); // For each collider of the body - for (uint i=1; i < colliderEntities.size(); i++) { + for (uint32 i=1; i < colliderEntities.size(); i++) { Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]); diff --git a/src/body/RigidBody.cpp b/src/body/RigidBody.cpp index 222a97d9..74cdf8ed 100644 --- a/src/body/RigidBody.cpp +++ b/src/body/RigidBody.cpp @@ -325,7 +325,7 @@ Vector3 RigidBody::computeCenterOfMass() const { // Compute the local center of mass const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { const uint colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); @@ -357,7 +357,7 @@ void RigidBody::computeMassAndInertiaTensorLocal(Vector3& inertiaTensorLocal, de // Compute the inertia tensor using all the colliders const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { const uint colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); @@ -432,7 +432,7 @@ void RigidBody::updateMassFromColliders() { // Compute the total mass of the body const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { const uint colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); @@ -872,12 +872,12 @@ void RigidBody::resetOverlappingPairs() { // For each collider of the body const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { // Get the currently overlapping pairs for this collider List overlappingPairs = mWorld.mCollidersComponents.getOverlappingPairs(colliderEntities[i]); - for (uint j=0; j < overlappingPairs.size(); j++) { + for (uint32 j=0; j < overlappingPairs.size(); j++) { mWorld.mCollisionDetection.mOverlappingPairs.removePair(overlappingPairs[j]); } @@ -952,7 +952,7 @@ void RigidBody::setProfiler(Profiler* profiler) { // Set the profiler for each collider const List& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); - for (uint i=0; i < colliderEntities.size(); i++) { + for (uint32 i=0; i < colliderEntities.size(); i++) { Collider* collider = mWorld.mCollidersComponents.getCollider(colliderEntities[i]); diff --git a/src/collision/CollisionCallback.cpp b/src/collision/CollisionCallback.cpp index 88779023..c9fbc5ff 100644 --- a/src/collision/CollisionCallback.cpp +++ b/src/collision/CollisionCallback.cpp @@ -82,7 +82,7 @@ CollisionCallback::CallbackData::CallbackData(List* mContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mLostContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mWorld(world) { // Filter the contact pairs to only keep the contact events (not the overlap/trigger events) - for (uint i=0; i < mContactPairs->size(); i++) { + for (uint32 i=0; i < mContactPairs->size(); i++) { // If the contact pair contains contacts (and is therefore not an overlap/trigger event) if (!(*mContactPairs)[i].isTrigger) { @@ -90,7 +90,7 @@ CollisionCallback::CallbackData::CallbackData(List* } } // Filter the lost contact pairs to only keep the contact events (not the overlap/trigger events) - for (uint i=0; i < mLostContactPairs.size(); i++) { + for (uint32 i=0; i < mLostContactPairs.size(); i++) { // If the contact pair contains contacts (and is therefore not an overlap/trigger event) if (!mLostContactPairs[i].isTrigger) { @@ -114,7 +114,7 @@ CollisionCallback::ContactPoint CollisionCallback::ContactPair::getContactPoint( /// Note that the returned ContactPair object is only valid during the call of the CollisionCallback::onContact() /// method. Therefore, you need to get contact data from it and make a copy. Do not make a copy of the ContactPair /// object itself because it won't be valid after the CollisionCallback::onContact() call. -CollisionCallback::ContactPair CollisionCallback::CallbackData::getContactPair(uint index) const { +CollisionCallback::ContactPair CollisionCallback::CallbackData::getContactPair(uint32 index) const { assert(index < getNbContactPairs()); diff --git a/src/collision/HalfEdgeStructure.cpp b/src/collision/HalfEdgeStructure.cpp index b1da7ef8..0892b77c 100644 --- a/src/collision/HalfEdgeStructure.cpp +++ b/src/collision/HalfEdgeStructure.cpp @@ -36,24 +36,24 @@ void HalfEdgeStructure::init() { Map edges(mAllocator); Map nextEdges(mAllocator); - Map mapEdgeToStartVertex(mAllocator); - Map mapEdgeToIndex(mAllocator); - Map mapEdgeIndexToKey(mAllocator); - Map mapFaceIndexToEdgeKey(mAllocator); + Map mapEdgeToStartVertex(mAllocator); + Map mapEdgeToIndex(mAllocator); + Map mapEdgeIndexToKey(mAllocator); + Map mapFaceIndexToEdgeKey(mAllocator); List currentFaceEdges(mAllocator, mFaces[0].faceVertices.size()); // For each face - for (uint f=0; f(pairV1V2, v1Index), true); - mapEdgeToStartVertex.add(Pair(pairV2V1, v2Index), true); + mapEdgeToStartVertex.add(Pair(pairV1V2, v1Index), true); + mapEdgeToStartVertex.add(Pair(pairV2V1, v2Index), true); - mapFaceIndexToEdgeKey.add(Pair(f, pairV1V2), true); + mapFaceIndexToEdgeKey.add(Pair(f, pairV1V2), true); auto itEdge = edges.find(pairV2V1); if (itEdge != edges.end()) { - const uint edgeIndex = mEdges.size(); + const uint32 edgeIndex = mEdges.size(); itEdge->second.twinEdgeIndex = edgeIndex + 1; edge.twinEdgeIndex = edgeIndex; - mapEdgeIndexToKey.add(Pair(edgeIndex, pairV2V1)); - mapEdgeIndexToKey.add(Pair(edgeIndex + 1, pairV1V2)); + mapEdgeIndexToKey.add(Pair(edgeIndex, pairV2V1)); + mapEdgeIndexToKey.add(Pair(edgeIndex + 1, pairV1V2)); mVertices[v1Index].edgeIndex = edgeIndex + 1; mVertices[v2Index].edgeIndex = edgeIndex; - mapEdgeToIndex.add(Pair(pairV1V2, edgeIndex + 1)); - mapEdgeToIndex.add(Pair(pairV2V1, edgeIndex)); + mapEdgeToIndex.add(Pair(pairV1V2, edgeIndex + 1)); + mapEdgeToIndex.add(Pair(pairV2V1, edgeIndex)); mEdges.add(itEdge->second); mEdges.add(edge); @@ -107,12 +107,12 @@ void HalfEdgeStructure::init() { } // Set next edges - for (uint i=0; i < mEdges.size(); i++) { + for (uint32 i=0; i < mEdges.size(); i++) { mEdges[i].nextEdgeIndex = mapEdgeToIndex[nextEdges[mapEdgeIndexToKey[i]]]; } // Set face edge - for (uint f=0; f < mFaces.size(); f++) { + for (uint32 f=0; f < mFaces.size(); f++) { mFaces[f].edgeIndex = mapEdgeToIndex[mapFaceIndexToEdgeKey[f]]; } } diff --git a/src/collision/OverlapCallback.cpp b/src/collision/OverlapCallback.cpp index 5cc9b571..55bdf9f4 100644 --- a/src/collision/OverlapCallback.cpp +++ b/src/collision/OverlapCallback.cpp @@ -72,7 +72,7 @@ OverlapCallback::CallbackData::CallbackData(List& contactPairs, Lis mContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mLostContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mWorld(world) { // Filter the contact pairs to only keep the overlap/trigger events (not the contact events) - for (uint i=0; i < mContactPairs.size(); i++) { + for (uint32 i=0; i < mContactPairs.size(); i++) { // If the contact pair contains contacts (and is therefore not an overlap/trigger event) if (!onlyReportTriggers || mContactPairs[i].isTrigger) { @@ -80,7 +80,7 @@ OverlapCallback::CallbackData::CallbackData(List& contactPairs, Lis } } // Filter the lost contact pairs to only keep the overlap/trigger events (not the contact events) - for (uint i=0; i < mLostContactPairs.size(); i++) { + for (uint32 i=0; i < mLostContactPairs.size(); i++) { // If the contact pair contains contacts (and is therefore not an overlap/trigger event) if (!onlyReportTriggers || mLostContactPairs[i].isTrigger) { diff --git a/src/collision/PolyhedronMesh.cpp b/src/collision/PolyhedronMesh.cpp index 28ae4754..653fde1a 100644 --- a/src/collision/PolyhedronMesh.cpp +++ b/src/collision/PolyhedronMesh.cpp @@ -166,7 +166,7 @@ decimal PolyhedronMesh::getFaceArea(uint faceIndex) const { Vector3 v1 = getVertex(face.faceVertices[0]); // For each vertex of the face - for (uint i=2; i < face.faceVertices.size(); i++) { + for (uint32 i=2; i < face.faceVertices.size(); i++) { const Vector3 v2 = getVertex(face.faceVertices[i-1]); const Vector3 v3 = getVertex(face.faceVertices[i]); diff --git a/src/collision/narrowphase/NarrowPhaseInfoBatch.cpp b/src/collision/narrowphase/NarrowPhaseInfoBatch.cpp index dcde890e..07d17fdd 100644 --- a/src/collision/narrowphase/NarrowPhaseInfoBatch.cpp +++ b/src/collision/narrowphase/NarrowPhaseInfoBatch.cpp @@ -52,7 +52,7 @@ void NarrowPhaseInfoBatch::reserveMemory() { // Clear all the objects in the batch void NarrowPhaseInfoBatch::clear() { - for (uint i=0; i < narrowPhaseInfos.size(); i++) { + for (uint32 i=0; i < narrowPhaseInfos.size(); i++) { assert(narrowPhaseInfos[i].nbContactPoints == 0); diff --git a/src/collision/narrowphase/SAT/SATAlgorithm.cpp b/src/collision/narrowphase/SAT/SATAlgorithm.cpp index 22118b78..b67c94a2 100644 --- a/src/collision/narrowphase/SAT/SATAlgorithm.cpp +++ b/src/collision/narrowphase/SAT/SATAlgorithm.cpp @@ -430,7 +430,7 @@ bool SATAlgorithm::computeCapsulePolyhedronFaceContactPoints(uint referenceFaceI bool contactFound = false; // For each of the two clipped points - for (uint i = 0; igetFace(incidentFaceIndex); - uint nbIncidentFaceVertices = static_cast(incidentFace.faceVertices.size()); + uint32 nbIncidentFaceVertices = incidentFace.faceVertices.size(); List polygonVertices(mMemoryAllocator, nbIncidentFaceVertices); // Vertices to clip of the incident face List planesNormals(mMemoryAllocator, nbIncidentFaceVertices); // Normals of the clipping planes List planesPoints(mMemoryAllocator, nbIncidentFaceVertices); // Points on the clipping planes // Get all the vertices of the incident face (in the reference local-space) - for (uint i=0; i < incidentFace.faceVertices.size(); i++) { + for (uint32 i=0; i < incidentFace.faceVertices.size(); i++) { const Vector3 faceVertexIncidentSpace = incidentPolyhedron->getVertexPosition(incidentFace.faceVertices[i]); polygonVertices.add(incidentToReferenceTransform * faceVertexIncidentSpace); } // Get the reference face clipping planes - uint currentEdgeIndex = referenceFace.edgeIndex; - uint firstEdgeIndex = currentEdgeIndex; + uint32 currentEdgeIndex = referenceFace.edgeIndex; + uint32 firstEdgeIndex = currentEdgeIndex; do { // Get the adjacent edge @@ -963,7 +963,7 @@ bool SATAlgorithm::computePolyhedronVsPolyhedronFaceContactPoints(bool isMinPene // We only keep the clipped points that are below the reference face const Vector3 referenceFaceVertex = referencePolyhedron->getVertexPosition(referencePolyhedron->getHalfEdge(firstEdgeIndex).vertexIndex); bool contactPointsFound = false; - for (uint i=0; isetHasCollisionShapeChangedSize(true); } } diff --git a/src/collision/shapes/ConcaveMeshShape.cpp b/src/collision/shapes/ConcaveMeshShape.cpp index f977b752..766d6d7f 100644 --- a/src/collision/shapes/ConcaveMeshShape.cpp +++ b/src/collision/shapes/ConcaveMeshShape.cpp @@ -142,7 +142,7 @@ void ConcaveMeshShape::computeOverlappingTriangles(const AABB& localAABB, List overlappingNodes(allocator, 64); mDynamicAABBTree.reportAllShapesOverlappingWithAABB(aabb, overlappingNodes); - const uint nbOverlappingNodes = overlappingNodes.size(); + const uint32 nbOverlappingNodes = overlappingNodes.size(); // Add space in the list of triangles vertices/normals for the new triangles triangleVertices.addWithoutInit(nbOverlappingNodes * 3); diff --git a/src/collision/shapes/ConvexMeshShape.cpp b/src/collision/shapes/ConvexMeshShape.cpp index b90f11b6..06589d4e 100644 --- a/src/collision/shapes/ConvexMeshShape.cpp +++ b/src/collision/shapes/ConvexMeshShape.cpp @@ -231,7 +231,7 @@ std::string ConvexMeshShape::to_string() const { ss << "["; - for (uint v=0; v < face.faceVertices.size(); v++) { + for (uint32 v=0; v < face.faceVertices.size(); v++) { ss << face.faceVertices[v]; if (v != face.faceVertices.size() - 1) { diff --git a/src/collision/shapes/HeightFieldShape.cpp b/src/collision/shapes/HeightFieldShape.cpp index dd056ca3..e6c3f7bb 100644 --- a/src/collision/shapes/HeightFieldShape.cpp +++ b/src/collision/shapes/HeightFieldShape.cpp @@ -250,7 +250,7 @@ bool HeightFieldShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collide decimal smallestHitFraction = ray.maxFraction; // For each overlapping triangle - for (uint i=0; i < shapeIds.size(); i++) + for (uint32 i=0; i < shapeIds.size(); i++) { // Create a triangle collision shape TriangleShape triangleShape(&(triangleVertices[i * 3]), &(triangleVerticesNormals[i * 3]), shapeIds[i], allocator); diff --git a/src/engine/EntityManager.cpp b/src/engine/EntityManager.cpp index e7cd4231..15b6aca7 100644 --- a/src/engine/EntityManager.cpp +++ b/src/engine/EntityManager.cpp @@ -53,7 +53,7 @@ Entity EntityManager::createEntity() { mGenerations.add(0); // Create a new indice - index = static_cast(mGenerations.size()) - 1; + index = mGenerations.size() - 1; assert(index < (1 << Entity::ENTITY_INDEX_BITS)); } diff --git a/src/engine/OverlappingPairs.cpp b/src/engine/OverlappingPairs.cpp index c0ad16ef..372e7231 100644 --- a/src/engine/OverlappingPairs.cpp +++ b/src/engine/OverlappingPairs.cpp @@ -81,7 +81,7 @@ void OverlappingPairs::removePair(uint64 pairIndex, bool isConvexVsConvex) { if (isConvexVsConvex) { - const uint nbConvexPairs = mConvexPairs.size(); + const uint32 nbConvexPairs = mConvexPairs.size(); assert(pairIndex < nbConvexPairs); @@ -106,7 +106,7 @@ void OverlappingPairs::removePair(uint64 pairIndex, bool isConvexVsConvex) { } else { - const uint nbConcavePairs = mConcavePairs.size(); + const uint32 nbConcavePairs = mConcavePairs.size(); assert(pairIndex < nbConcavePairs); diff --git a/src/engine/PhysicsWorld.cpp b/src/engine/PhysicsWorld.cpp index 04fd5598..5b67261a 100644 --- a/src/engine/PhysicsWorld.cpp +++ b/src/engine/PhysicsWorld.cpp @@ -239,7 +239,7 @@ void PhysicsWorld::setBodyDisabled(Entity bodyEntity, bool isDisabled) { // For each collider of the body const List& collidersEntities = mCollisionBodyComponents.getColliders(bodyEntity); - for (uint i=0; i < collidersEntities.size(); i++) { + for (uint32 i=0; i < collidersEntities.size(); i++) { mCollidersComponents.setIsEntityDisabled(collidersEntities[i], isDisabled); } @@ -822,7 +822,7 @@ void PhysicsWorld::createIslands() { // If the body is involved in contacts with other bodies // For each contact pair in which the current body is involded - for (uint p=0; p < mRigidBodyComponents.mContactPairs[bodyToVisitIndex].size(); p++) { + for (uint32 p=0; p < mRigidBodyComponents.mContactPairs[bodyToVisitIndex].size(); p++) { ContactPair& pair = (*mCollisionDetection.mCurrentContactPairs)[mRigidBodyComponents.mContactPairs[bodyToVisitIndex][p]]; @@ -884,7 +884,7 @@ void PhysicsWorld::createIslands() { // Reset the isAlreadyIsland variable of the static bodies so that they // can also be included in the other islands - for (uint j=0; j < staticBodiesAddedToIsland.size(); j++) { + for (uint32 j=0; j < staticBodiesAddedToIsland.size(); j++) { assert(mRigidBodyComponents.getBodyType(staticBodiesAddedToIsland[j]) == BodyType::STATIC); mRigidBodyComponents.setIsAlreadyInIsland(staticBodiesAddedToIsland[j], false); diff --git a/src/mathematics/mathematics_functions.cpp b/src/mathematics/mathematics_functions.cpp index daf021b0..4db9367c 100755 --- a/src/mathematics/mathematics_functions.cpp +++ b/src/mathematics/mathematics_functions.cpp @@ -234,7 +234,7 @@ List reactphysics3d::clipSegmentWithPlanes(const Vector3& segA, const V inputVertices.add(segB); // For each clipping plane - for (uint p=0; p reactphysics3d::clipPolygonWithPlanes(const List& polygon assert(planesPoints.size() == planesNormals.size()); - uint nbMaxElements = polygonVertices.size() + planesPoints.size(); + uint32 nbMaxElements = polygonVertices.size() + planesPoints.size(); List inputVertices(allocator, nbMaxElements); List outputVertices(allocator, nbMaxElements); inputVertices.addRange(polygonVertices); // For each clipping plane - for (uint p=0; p nodePair = overlappingNodes[i]; @@ -475,8 +475,8 @@ void CollisionDetectionSystem::computeConvexVsConcaveMiddlePhase(OverlappingPair } // For each overlapping triangle - const uint nbShapeIds = shapeIds.size(); - for (uint i=0; i < nbShapeIds; i++) { + const uint32 nbShapeIds = shapeIds.size(); + for (uint32 i=0; i < nbShapeIds; i++) { // Create a triangle collision shape (the allocated memory for the TriangleShape will be released in the // destructor of the corresponding NarrowPhaseInfo. @@ -620,7 +620,7 @@ void CollisionDetectionSystem::computeNarrowPhase() { void CollisionDetectionSystem::computeMapPreviousContactPairs() { mPreviousMapPairIdToContactPairIndex.clear(); - for (uint i=0; i < mCurrentContactPairs->size(); i++) { + for (uint32 i=0; i < mCurrentContactPairs->size(); i++) { mPreviousMapPairIdToContactPairIndex.add(Pair((*mCurrentContactPairs)[i].pairId, i)); } } @@ -678,8 +678,8 @@ void CollisionDetectionSystem::notifyOverlappingPairsToTestOverlap(Collider* col // Get the overlapping pairs involved with this collider List& overlappingPairs = mCollidersComponents.getOverlappingPairs(collider->getEntity()); - const uint nbPairs = overlappingPairs.size(); - for (uint i=0; i < nbPairs; i++) { + const uint32 nbPairs = overlappingPairs.size(); + for (uint32 i=0; i < nbPairs; i++) { // Notify that the overlapping pair needs to be testbed for overlap mOverlappingPairs.setNeedToTestOverlap(overlappingPairs[i], true); @@ -818,7 +818,7 @@ void CollisionDetectionSystem::createContacts() { ContactManifoldInfo& potentialManifold = mPotentialContactManifolds[contactPair.potentialContactManifoldsIndices[m]]; // Start index and number of contact points for this manifold - const uint contactPointsIndex = mCurrentContactPoints->size(); + const uint32 contactPointsIndex = mCurrentContactPoints->size(); const int8 nbContactPoints = static_cast(potentialManifold.nbPotentialContactPoints); contactPair.nbToTalContactPoints += nbContactPoints; @@ -858,8 +858,8 @@ void CollisionDetectionSystem::createContacts() { void CollisionDetectionSystem::computeLostContactPairs() { // For each convex pair - const uint nbConvexPairs = mOverlappingPairs.mConvexPairs.size(); - for (uint i=0; i < nbConvexPairs; i++) { + const uint32 nbConvexPairs = mOverlappingPairs.mConvexPairs.size(); + for (uint32 i=0; i < nbConvexPairs; i++) { // If the two colliders of the pair were colliding in the previous frame but not in the current one if (mOverlappingPairs.mConvexPairs[i].collidingInPreviousFrame && !mOverlappingPairs.mConvexPairs[i].collidingInCurrentFrame) { @@ -874,8 +874,8 @@ void CollisionDetectionSystem::computeLostContactPairs() { } // For each convex pair - const uint nbConcavePairs = mOverlappingPairs.mConcavePairs.size(); - for (uint i=0; i < nbConcavePairs; i++) { + const uint32 nbConcavePairs = mOverlappingPairs.mConcavePairs.size(); + for (uint32 i=0; i < nbConcavePairs; i++) { // If the two colliders of the pair were colliding in the previous frame but not in the current one if (mOverlappingPairs.mConcavePairs[i].collidingInPreviousFrame && !mOverlappingPairs.mConcavePairs[i].collidingInCurrentFrame) { @@ -903,8 +903,8 @@ void CollisionDetectionSystem::createSnapshotContacts(List& contact contactPoints.reserve(contactManifolds.size()); // For each contact pair - const uint nbContactPairs = contactPairs.size(); - for (uint p=0; p < nbContactPairs; p++) { + const uint32 nbContactPairs = contactPairs.size(); + for (uint32 p=0; p < nbContactPairs; p++) { ContactPair& contactPair = contactPairs[p]; assert(contactPair.nbPotentialContactManifolds > 0); @@ -914,12 +914,12 @@ void CollisionDetectionSystem::createSnapshotContacts(List& contact contactPair.contactPointsIndex = contactPoints.size(); // For each potential contact manifold of the pair - for (uint m=0; m < contactPair.nbPotentialContactManifolds; m++) { + for (uint32 m=0; m < contactPair.nbPotentialContactManifolds; m++) { ContactManifoldInfo& potentialManifold = potentialContactManifolds[contactPair.potentialContactManifoldsIndices[m]]; // Start index and number of contact points for this manifold - const uint contactPointsIndex = contactPoints.size(); + const uint32 contactPointsIndex = contactPoints.size(); const uint8 nbContactPoints = potentialManifold.nbPotentialContactPoints; contactPair.nbToTalContactPoints += nbContactPoints; @@ -930,7 +930,7 @@ void CollisionDetectionSystem::createSnapshotContacts(List& contact assert(potentialManifold.nbPotentialContactPoints > 0); // For each contact point of the manifold - for (uint c=0; c < potentialManifold.nbPotentialContactPoints; c++) { + for (uint32 c=0; c < potentialManifold.nbPotentialContactPoints; c++) { ContactPointInfo& potentialContactPoint = potentialContactPoints[potentialManifold.potentialContactPointsIndices[c]]; @@ -948,7 +948,7 @@ void CollisionDetectionSystem::createSnapshotContacts(List& contact void CollisionDetectionSystem::initContactsWithPreviousOnes() { // For each contact pair of the current frame - for (uint i=0; i < mCurrentContactPairs->size(); i++) { + for (uint32 i=0; i < mCurrentContactPairs->size(); i++) { ContactPair& currentContactPair = (*mCurrentContactPairs)[i]; @@ -1124,7 +1124,7 @@ void CollisionDetectionSystem::processPotentialContacts(NarrowPhaseInfoBatch& na assert(!mWorld->mCollisionBodyComponents.getIsEntityDisabled(body1Entity) || !mWorld->mCollisionBodyComponents.getIsEntityDisabled(body2Entity)); - const uint newContactPairIndex = contactPairs->size(); + const uint32 newContactPairIndex = contactPairs->size(); contactPairs->emplace(pairId, body1Entity, body2Entity, collider1Entity, collider2Entity, newContactPairIndex, overlappingPair->collidingInPreviousFrame, isTrigger); @@ -1132,11 +1132,11 @@ void CollisionDetectionSystem::processPotentialContacts(NarrowPhaseInfoBatch& na ContactPair* pairContact = &((*contactPairs)[newContactPairIndex]); // Create a new potential contact manifold for the overlapping pair - uint contactManifoldIndex = static_cast(potentialContactManifolds.size()); + uint32 contactManifoldIndex = static_cast(potentialContactManifolds.size()); potentialContactManifolds.emplace(pairId); ContactManifoldInfo& contactManifoldInfo = potentialContactManifolds[contactManifoldIndex]; - const uint contactPointIndexStart = static_cast(potentialContactPoints.size()); + const uint32 contactPointIndexStart = static_cast(potentialContactPoints.size()); // Add the potential contacts for (uint j=0; j < narrowPhaseInfoBatch.narrowPhaseInfos[i].nbContactPoints; j++) { @@ -1172,7 +1172,7 @@ void CollisionDetectionSystem::processPotentialContacts(NarrowPhaseInfoBatch& na assert(!mWorld->mCollisionBodyComponents.getIsEntityDisabled(body1Entity) || !mWorld->mCollisionBodyComponents.getIsEntityDisabled(body2Entity)); - const uint newContactPairIndex = contactPairs->size(); + const uint32 newContactPairIndex = contactPairs->size(); contactPairs->emplace(pairId, body1Entity, body2Entity, collider1Entity, collider2Entity, newContactPairIndex, overlappingPair->collidingInPreviousFrame , isTrigger); pairContact = &((*contactPairs)[newContactPairIndex]); @@ -1195,7 +1195,7 @@ void CollisionDetectionSystem::processPotentialContacts(NarrowPhaseInfoBatch& na const ContactPointInfo& contactPoint = narrowPhaseInfoBatch.narrowPhaseInfos[i].contactPoints[j]; // Add the contact point to the list of potential contact points - const uint contactPointIndex = static_cast(potentialContactPoints.size()); + const uint32 contactPointIndex = potentialContactPoints.size(); potentialContactPoints.add(contactPoint); @@ -1232,7 +1232,7 @@ void CollisionDetectionSystem::processPotentialContacts(NarrowPhaseInfoBatch& na if (!similarManifoldFound && pairContact->nbPotentialContactManifolds < NB_MAX_POTENTIAL_CONTACT_MANIFOLDS) { // Create a new potential contact manifold for the overlapping pair - uint contactManifoldIndex = static_cast(potentialContactManifolds.size()); + uint32 contactManifoldIndex = potentialContactManifolds.size(); potentialContactManifolds.emplace(pairId); ContactManifoldInfo& contactManifoldInfo = potentialContactManifolds[contactManifoldIndex]; @@ -1265,8 +1265,8 @@ void CollisionDetectionSystem::reducePotentialContactManifolds(List RP3D_PROFILE("CollisionDetectionSystem::reducePotentialContactManifolds()", mProfiler); // Reduce the number of potential contact manifolds in a contact pair - const uint nbContactPairs = contactPairs->size(); - for (uint i=0; i < nbContactPairs; i++) { + const uint32 nbContactPairs = contactPairs->size(); + for (uint32 i=0; i < nbContactPairs; i++) { ContactPair& contactPair = (*contactPairs)[i]; @@ -1276,7 +1276,7 @@ void CollisionDetectionSystem::reducePotentialContactManifolds(List // Look for a manifold with the smallest contact penetration depth. decimal minDepth = DECIMAL_LARGEST; int minDepthManifoldIndex = -1; - for (uint j=0; j < contactPair.nbPotentialContactManifolds; j++) { + for (uint32 j=0; j < contactPair.nbPotentialContactManifolds; j++) { ContactManifoldInfo& manifold = potentialContactManifolds[contactPair.potentialContactManifoldsIndices[j]]; @@ -1296,12 +1296,12 @@ void CollisionDetectionSystem::reducePotentialContactManifolds(List } // Reduce the number of potential contact points in the manifolds - for (uint i=0; i < nbContactPairs; i++) { + for (uint32 i=0; i < nbContactPairs; i++) { const ContactPair& pairContact = (*contactPairs)[i]; // For each potential contact manifold - for (uint j=0; j < pairContact.nbPotentialContactManifolds; j++) { + for (uint32 j=0; j < pairContact.nbPotentialContactManifolds; j++) { ContactManifoldInfo& manifold = potentialContactManifolds[pairContact.potentialContactManifoldsIndices[j]]; @@ -1327,7 +1327,7 @@ decimal CollisionDetectionSystem::computePotentialManifoldLargestContactDepth(co assert(manifold.nbPotentialContactPoints > 0); - for (uint i=0; i < manifold.nbPotentialContactPoints; i++) { + for (uint32 i=0; i < manifold.nbPotentialContactPoints; i++) { decimal depth = potentialContactPoints[manifold.potentialContactPointsIndices[i]].penetrationDepth; if (depth > largestDepth) { @@ -1726,8 +1726,8 @@ void CollisionDetectionSystem::testCollision(CollisionCallback& callback) { void CollisionDetectionSystem::filterOverlappingPairs(Entity bodyEntity, List& convexPairs, List& concavePairs) const { // For each convex pairs - const uint nbConvexPairs = mOverlappingPairs.mConvexPairs.size(); - for (uint i=0; i < nbConvexPairs; i++) { + const uint32 nbConvexPairs = mOverlappingPairs.mConvexPairs.size(); + for (uint32 i=0; i < nbConvexPairs; i++) { if (mCollidersComponents.getBody(mOverlappingPairs.mConvexPairs[i].collider1) == bodyEntity || mCollidersComponents.getBody(mOverlappingPairs.mConvexPairs[i].collider2) == bodyEntity) { @@ -1737,8 +1737,8 @@ void CollisionDetectionSystem::filterOverlappingPairs(Entity bodyEntity, List& convexPairs, List& concavePairs) const { // For each convex pair - const uint nbConvexPairs = mOverlappingPairs.mConvexPairs.size(); - for (uint i=0; i < nbConvexPairs; i++) { + const uint32 nbConvexPairs = mOverlappingPairs.mConvexPairs.size(); + for (uint32 i=0; i < nbConvexPairs; i++) { const Entity collider1Body = mCollidersComponents.getBody(mOverlappingPairs.mConvexPairs[i].collider1); const Entity collider2Body = mCollidersComponents.getBody(mOverlappingPairs.mConvexPairs[i].collider2); diff --git a/src/systems/ContactSolverSystem.cpp b/src/systems/ContactSolverSystem.cpp index 1944c143..40220359 100644 --- a/src/systems/ContactSolverSystem.cpp +++ b/src/systems/ContactSolverSystem.cpp @@ -71,8 +71,8 @@ void ContactSolverSystem::init(List* contactManifolds, Listsize(); - const uint nbContactPoints = mAllContactPoints->size(); + const uint32 nbContactManifolds = mAllContactManifolds->size(); + const uint32 nbContactPoints = mAllContactPoints->size(); mNbContactManifolds = 0; mNbContactPoints = 0; diff --git a/src/utils/DefaultLogger.cpp b/src/utils/DefaultLogger.cpp index bb1a2dd2..cd3b2d35 100644 --- a/src/utils/DefaultLogger.cpp +++ b/src/utils/DefaultLogger.cpp @@ -79,7 +79,7 @@ void DefaultLogger::addStreamDestination(std::ostream& outputStream, uint logLev void DefaultLogger::removeAllDestinations() { // Delete all the destinations - for (uint i=0; igetSizeBytes();