Use uint32 type for size/capacity of List

This commit is contained in:
Daniel Chappuis 2020-08-30 00:00:47 +02:00
parent de6630a03d
commit 2b362b5098
29 changed files with 154 additions and 153 deletions

View File

@ -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;

View File

@ -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();
}

View File

@ -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;

View File

@ -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<uint> faceVertices) {
/**
* @return The number of faces in the polyhedron
*/
RP3D_FORCE_INLINE uint HalfEdgeStructure::getNbFaces() const {
return static_cast<uint>(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<uint>(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<uint>(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];
}

View File

@ -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());

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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<T*>(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<mSize; i++) {
for (uint32 i=0; i<mSize; i++) {
items[i].~T();
}
}
@ -315,7 +315,7 @@ class List {
}
/// Add a given numbers of elements at the end of the list but do not init them
void addWithoutInit(uint nbElements) {
void addWithoutInit(uint32 nbElements) {
// If we need to allocate more memory
if ((mSize + nbElements) > mCapacity) {
@ -330,7 +330,7 @@ class List {
/// this method returns the end() iterator
Iterator find(const T& element) {
for (uint i=0; i<mSize; i++) {
for (uint32 i=0; i<mSize; i++) {
if (element == static_cast<T*>(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<list.size(); i++) {
for(uint32 i=0; i<list.size(); i++) {
new (static_cast<char*>(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<T*>(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<T*>(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<T*>(mBuffer)[index]);
}
@ -461,7 +461,7 @@ class List {
if (mSize != list.mSize) return false;
T* items = static_cast<T*>(mBuffer);
for (size_t i=0; i < mSize; i++) {
for (uint32 i=0; i < mSize; i++) {
if (items[i] != list[i]) {
return false;
}

View File

@ -96,7 +96,7 @@ struct Islands {
/// Return the number of islands
uint32 getNbIslands() const {
return static_cast<uint32>(contactManifoldsIndices.size());
return contactManifoldsIndices.size();
}
/// Add an island and return its index

View File

@ -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();
}

View File

@ -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<uint>(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<Entity> 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<Entity>& 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<Entity>& 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<Entity>& 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<Entity>& 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<Entity>& 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<Entity>& 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]);

View File

@ -325,7 +325,7 @@ Vector3 RigidBody::computeCenterOfMass() const {
// Compute the local center of mass
const List<Entity>& 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<Entity>& 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<Entity>& 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<Entity>& 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<uint64> 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<Entity>& 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]);

View File

@ -82,7 +82,7 @@ CollisionCallback::CallbackData::CallbackData(List<reactphysics3d::ContactPair>*
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<reactphysics3d::ContactPair>*
}
}
// 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());

View File

@ -36,24 +36,24 @@ void HalfEdgeStructure::init() {
Map<VerticesPair, Edge> edges(mAllocator);
Map<VerticesPair, VerticesPair> nextEdges(mAllocator);
Map<VerticesPair, uint> mapEdgeToStartVertex(mAllocator);
Map<VerticesPair, uint> mapEdgeToIndex(mAllocator);
Map<uint, VerticesPair> mapEdgeIndexToKey(mAllocator);
Map<uint, VerticesPair> mapFaceIndexToEdgeKey(mAllocator);
Map<VerticesPair, uint32> mapEdgeToStartVertex(mAllocator);
Map<VerticesPair, uint32> mapEdgeToIndex(mAllocator);
Map<uint32, VerticesPair> mapEdgeIndexToKey(mAllocator);
Map<uint32, VerticesPair> mapFaceIndexToEdgeKey(mAllocator);
List<VerticesPair> currentFaceEdges(mAllocator, mFaces[0].faceVertices.size());
// For each face
for (uint f=0; f<mFaces.size(); f++) {
for (uint32 f=0; f<mFaces.size(); f++) {
Face face = mFaces[f];
VerticesPair firstEdgeKey(0, 0);
// For each vertex of the face
for (uint v=0; v < face.faceVertices.size(); v++) {
uint v1Index = face.faceVertices[v];
uint v2Index = face.faceVertices[v == (face.faceVertices.size() - 1) ? 0 : v + 1];
for (uint32 v=0; v < face.faceVertices.size(); v++) {
uint32 v1Index = face.faceVertices[v];
uint32 v2Index = face.faceVertices[v == (face.faceVertices.size() - 1) ? 0 : v + 1];
const VerticesPair pairV1V2 = VerticesPair(v1Index, v2Index);
@ -74,27 +74,27 @@ void HalfEdgeStructure::init() {
const VerticesPair pairV2V1(v2Index, v1Index);
mapEdgeToStartVertex.add(Pair<VerticesPair, uint>(pairV1V2, v1Index), true);
mapEdgeToStartVertex.add(Pair<VerticesPair, uint>(pairV2V1, v2Index), true);
mapEdgeToStartVertex.add(Pair<VerticesPair, uint32>(pairV1V2, v1Index), true);
mapEdgeToStartVertex.add(Pair<VerticesPair, uint32>(pairV2V1, v2Index), true);
mapFaceIndexToEdgeKey.add(Pair<uint, VerticesPair>(f, pairV1V2), true);
mapFaceIndexToEdgeKey.add(Pair<uint32, VerticesPair>(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<uint, VerticesPair>(edgeIndex, pairV2V1));
mapEdgeIndexToKey.add(Pair<uint, VerticesPair>(edgeIndex + 1, pairV1V2));
mapEdgeIndexToKey.add(Pair<uint32, VerticesPair>(edgeIndex, pairV2V1));
mapEdgeIndexToKey.add(Pair<uint32, VerticesPair>(edgeIndex + 1, pairV1V2));
mVertices[v1Index].edgeIndex = edgeIndex + 1;
mVertices[v2Index].edgeIndex = edgeIndex;
mapEdgeToIndex.add(Pair<VerticesPair, uint>(pairV1V2, edgeIndex + 1));
mapEdgeToIndex.add(Pair<VerticesPair, uint>(pairV2V1, edgeIndex));
mapEdgeToIndex.add(Pair<VerticesPair, uint32>(pairV1V2, edgeIndex + 1));
mapEdgeToIndex.add(Pair<VerticesPair, uint32>(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]];
}
}

View File

@ -72,7 +72,7 @@ OverlapCallback::CallbackData::CallbackData(List<ContactPair>& 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<ContactPair>& 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) {

View File

@ -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]);

View File

@ -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);

View File

@ -430,7 +430,7 @@ bool SATAlgorithm::computeCapsulePolyhedronFaceContactPoints(uint referenceFaceI
bool contactFound = false;
// For each of the two clipped points
for (uint i = 0; i<clipSegment.size(); i++) {
for (uint32 i = 0; i<clipSegment.size(); i++) {
// Compute the penetration depth of the two clipped points (to filter out the points that does not correspond to the penetration depth)
const decimal clipPointPenDepth = (planesPoints[0] - clipSegment[i]).dot(faceNormal);
@ -915,20 +915,20 @@ bool SATAlgorithm::computePolyhedronVsPolyhedronFaceContactPoints(bool isMinPene
// Get the incident face
const HalfEdgeStructure::Face& incidentFace = incidentPolyhedron->getFace(incidentFaceIndex);
uint nbIncidentFaceVertices = static_cast<uint>(incidentFace.faceVertices.size());
uint32 nbIncidentFaceVertices = incidentFace.faceVertices.size();
List<Vector3> polygonVertices(mMemoryAllocator, nbIncidentFaceVertices); // Vertices to clip of the incident face
List<Vector3> planesNormals(mMemoryAllocator, nbIncidentFaceVertices); // Normals of the clipping planes
List<Vector3> 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; i<clipPolygonVertices.size(); i++) {
for (uint32 i=0; i<clipPolygonVertices.size(); i++) {
// Compute the penetration depth of this contact point (can be different from the minPenetration depth which is
// the maximal penetration depth of any contact point for this separating axis

View File

@ -96,7 +96,7 @@ void CollisionShape::computeAABB(AABB& aabb, const Transform& transform) const {
/// Notify all the assign colliders that the size of the collision shape has changed
void CollisionShape::notifyColliderAboutChangedSize() {
for (uint i=0; i < mColliders.size(); i++) {
for (uint32 i=0; i < mColliders.size(); i++) {
mColliders[i]->setHasCollisionShapeChangedSize(true);
}
}

View File

@ -142,7 +142,7 @@ void ConcaveMeshShape::computeOverlappingTriangles(const AABB& localAABB, List<V
List<int> 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);

View File

@ -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) {

View File

@ -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);

View File

@ -53,7 +53,7 @@ Entity EntityManager::createEntity() {
mGenerations.add(0);
// Create a new indice
index = static_cast<uint32>(mGenerations.size()) - 1;
index = mGenerations.size() - 1;
assert(index < (1 << Entity::ENTITY_INDEX_BITS));
}

View File

@ -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);

View File

@ -239,7 +239,7 @@ void PhysicsWorld::setBodyDisabled(Entity bodyEntity, bool isDisabled) {
// For each collider of the body
const List<Entity>& 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);

View File

@ -234,7 +234,7 @@ List<Vector3> reactphysics3d::clipSegmentWithPlanes(const Vector3& segA, const V
inputVertices.add(segB);
// For each clipping plane
for (uint p=0; p<planesPoints.size(); p++) {
for (uint32 p=0; p<planesPoints.size(); p++) {
// If there is no more vertices, stop
if (inputVertices.size() == 0) return inputVertices;
@ -301,19 +301,19 @@ List<Vector3> reactphysics3d::clipPolygonWithPlanes(const List<Vector3>& polygon
assert(planesPoints.size() == planesNormals.size());
uint nbMaxElements = polygonVertices.size() + planesPoints.size();
uint32 nbMaxElements = polygonVertices.size() + planesPoints.size();
List<Vector3> inputVertices(allocator, nbMaxElements);
List<Vector3> outputVertices(allocator, nbMaxElements);
inputVertices.addRange(polygonVertices);
// For each clipping plane
for (uint p=0; p<planesPoints.size(); p++) {
for (uint32 p=0; p<planesPoints.size(); p++) {
outputVertices.clear();
uint nbInputVertices = inputVertices.size();
uint vStart = nbInputVertices - 1;
uint32 nbInputVertices = inputVertices.size();
uint32 vStart = nbInputVertices - 1;
// For each edge of the polygon
for (uint vEnd = 0; vEnd<nbInputVertices; vEnd++) {

View File

@ -197,8 +197,8 @@ void CollisionDetectionSystem::updateOverlappingPairs(const List<Pair<int32, int
RP3D_PROFILE("CollisionDetectionSystem::updateOverlappingPairs()", mProfiler);
// For each overlapping pair of nodes
const uint nbOverlappingNodes = overlappingNodes.size();
for (uint i=0; i < nbOverlappingNodes; i++) {
const uint32 nbOverlappingNodes = overlappingNodes.size();
for (uint32 i=0; i < nbOverlappingNodes; i++) {
Pair<int32, int32> 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<uint64, uint>((*mCurrentContactPairs)[i].pairId, i));
}
}
@ -678,8 +678,8 @@ void CollisionDetectionSystem::notifyOverlappingPairsToTestOverlap(Collider* col
// Get the overlapping pairs involved with this collider
List<uint64>& 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<int8>(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<ContactPair>& 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<ContactPair>& 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<ContactPair>& 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<ContactPair>& 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<uint>(potentialContactManifolds.size());
uint32 contactManifoldIndex = static_cast<uint>(potentialContactManifolds.size());
potentialContactManifolds.emplace(pairId);
ContactManifoldInfo& contactManifoldInfo = potentialContactManifolds[contactManifoldIndex];
const uint contactPointIndexStart = static_cast<uint>(potentialContactPoints.size());
const uint32 contactPointIndexStart = static_cast<uint>(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<uint>(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<uint>(potentialContactManifolds.size());
uint32 contactManifoldIndex = potentialContactManifolds.size();
potentialContactManifolds.emplace(pairId);
ContactManifoldInfo& contactManifoldInfo = potentialContactManifolds[contactManifoldIndex];
@ -1265,8 +1265,8 @@ void CollisionDetectionSystem::reducePotentialContactManifolds(List<ContactPair>
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<ContactPair>
// 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<ContactPair>
}
// 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<uint64>& convexPairs, List<uint64>& 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<ui
}
// For each concave pairs
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 (mCollidersComponents.getBody(mOverlappingPairs.mConcavePairs[i].collider1) == bodyEntity ||
mCollidersComponents.getBody(mOverlappingPairs.mConcavePairs[i].collider2) == bodyEntity) {
@ -1752,8 +1752,8 @@ void CollisionDetectionSystem::filterOverlappingPairs(Entity bodyEntity, List<ui
void CollisionDetectionSystem::filterOverlappingPairs(Entity body1Entity, Entity body2Entity, List<uint64>& convexPairs, List<uint64>& 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);

View File

@ -71,8 +71,8 @@ void ContactSolverSystem::init(List<ContactManifold>* contactManifolds, List<Con
mTimeStep = timeStep;
const uint nbContactManifolds = mAllContactManifolds->size();
const uint nbContactPoints = mAllContactPoints->size();
const uint32 nbContactManifolds = mAllContactManifolds->size();
const uint32 nbContactPoints = mAllContactPoints->size();
mNbContactManifolds = 0;
mNbContactPoints = 0;

View File

@ -79,7 +79,7 @@ void DefaultLogger::addStreamDestination(std::ostream& outputStream, uint logLev
void DefaultLogger::removeAllDestinations() {
// Delete all the destinations
for (uint i=0; i<mDestinations.size(); i++) {
for (uint32 i=0; i<mDestinations.size(); i++) {
size_t size = mDestinations[i]->getSizeBytes();