Fix warnings
This commit is contained in:
parent
08da70bfcd
commit
b3d8b13214
|
@ -66,7 +66,6 @@ do not hesitate to take a look at the user manual.
|
||||||
- Issue in copy-constructors in Map and Set classes
|
- Issue in copy-constructors in Map and Set classes
|
||||||
- A lot of code warnings have been fixed
|
- A lot of code warnings have been fixed
|
||||||
|
|
||||||
|
|
||||||
## Version 0.8.0 (May 31, 2020)
|
## Version 0.8.0 (May 31, 2020)
|
||||||
|
|
||||||
Note that this release contains some public API changes. Please read carefully the following changes before upgrading to this new version and
|
Note that this release contains some public API changes. Please read carefully the following changes before upgrading to this new version and
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct ContactManifoldInfo {
|
||||||
// -------------------- Methods -------------------- //
|
// -------------------- Methods -------------------- //
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
ContactManifoldInfo(uint64 pairId) : nbPotentialContactPoints(0), pairId(pairId) {
|
ContactManifoldInfo(uint64 pairId) : nbPotentialContactPoints(0), potentialContactPointsIndices{0}, pairId(pairId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ struct ContactPair {
|
||||||
/// Constructor
|
/// Constructor
|
||||||
ContactPair(uint64 pairId, Entity body1Entity, Entity body2Entity, Entity collider1Entity,
|
ContactPair(uint64 pairId, Entity body1Entity, Entity body2Entity, Entity collider1Entity,
|
||||||
Entity collider2Entity, uint32 contactPairIndex, bool collidingInPreviousFrame, bool isTrigger)
|
Entity collider2Entity, uint32 contactPairIndex, bool collidingInPreviousFrame, bool isTrigger)
|
||||||
: pairId(pairId), nbPotentialContactManifolds(0), body1Entity(body1Entity), body2Entity(body2Entity),
|
: pairId(pairId), nbPotentialContactManifolds(0), potentialContactManifoldsIndices{0}, body1Entity(body1Entity), body2Entity(body2Entity),
|
||||||
collider1Entity(collider1Entity), collider2Entity(collider2Entity),
|
collider1Entity(collider1Entity), collider2Entity(collider2Entity),
|
||||||
isAlreadyInIsland(false), contactPairIndex(contactPairIndex), contactManifoldsIndex(0), nbContactManifolds(0),
|
isAlreadyInIsland(false), contactPairIndex(contactPairIndex), contactManifoldsIndex(0), nbContactManifolds(0),
|
||||||
contactPointsIndex(0), nbToTalContactPoints(0), collidingInPreviousFrame(collidingInPreviousFrame), isTrigger(isTrigger) {
|
contactPointsIndex(0), nbToTalContactPoints(0), collidingInPreviousFrame(collidingInPreviousFrame), isTrigger(isTrigger) {
|
||||||
|
|
|
@ -57,10 +57,10 @@ class HalfEdgeStructure {
|
||||||
Array<uint32> faceVertices; // Index of the vertices of the face
|
Array<uint32> faceVertices; // Index of the vertices of the face
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
Face(MemoryAllocator& allocator) : faceVertices(allocator) {}
|
Face(MemoryAllocator& allocator) : edgeIndex(0), faceVertices(allocator) {}
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
Face(Array<uint32> vertices) : faceVertices(vertices) {}
|
Face(Array<uint32> vertices) : edgeIndex(0), faceVertices(vertices) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Vertex
|
/// Vertex
|
||||||
|
@ -69,7 +69,7 @@ class HalfEdgeStructure {
|
||||||
uint32 edgeIndex; // Index of one edge emanting from this vertex
|
uint32 edgeIndex; // Index of one edge emanting from this vertex
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
Vertex(uint32 vertexCoordsIndex) : vertexPointIndex(vertexCoordsIndex) { }
|
Vertex(uint32 vertexCoordsIndex) : vertexPointIndex(vertexCoordsIndex), edgeIndex(0) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -241,7 +241,7 @@ class DynamicAABBTree {
|
||||||
void* getNodeDataPointer(int32 nodeID) const;
|
void* getNodeDataPointer(int32 nodeID) const;
|
||||||
|
|
||||||
/// Report all shapes overlapping with all the shapes in the map in parameter
|
/// Report all shapes overlapping with all the shapes in the map in parameter
|
||||||
void reportAllShapesOverlappingWithShapes(const Array<int32>& nodesToTest, size_t startIndex,
|
void reportAllShapesOverlappingWithShapes(const Array<int32>& nodesToTest, uint32 startIndex,
|
||||||
size_t endIndex, Array<Pair<int32, int32>>& outOverlappingNodes) const;
|
size_t endIndex, Array<Pair<int32, int32>>& outOverlappingNodes) const;
|
||||||
|
|
||||||
/// Report all shapes overlapping with the AABB given in parameter.
|
/// Report all shapes overlapping with the AABB given in parameter.
|
||||||
|
|
|
@ -55,10 +55,10 @@ class Deque {
|
||||||
// -------------------- Constants -------------------- //
|
// -------------------- Constants -------------------- //
|
||||||
|
|
||||||
/// Number of items in a chunk
|
/// Number of items in a chunk
|
||||||
const uint64 CHUNK_NB_ITEMS = 17;
|
const uint8 CHUNK_NB_ITEMS = 17;
|
||||||
|
|
||||||
/// First item index in a chunk
|
/// First item index in a chunk
|
||||||
const uint64 CHUNK_FIRST_ITEM_INDEX = CHUNK_NB_ITEMS / 2;
|
const uint8 CHUNK_FIRST_ITEM_INDEX = CHUNK_NB_ITEMS / 2;
|
||||||
|
|
||||||
// -------------------- Attributes -------------------- //
|
// -------------------- Attributes -------------------- //
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ class Map {
|
||||||
uint64* newBuckets = static_cast<uint64*>(mAllocator.allocate(capacity * sizeof(uint64)));
|
uint64* newBuckets = static_cast<uint64*>(mAllocator.allocate(capacity * sizeof(uint64)));
|
||||||
|
|
||||||
// Allocate memory for the entries
|
// Allocate memory for the entries
|
||||||
const uint64 nbAllocatedEntries = static_cast<uint64>(capacity * DEFAULT_LOAD_FACTOR);
|
const uint64 nbAllocatedEntries = static_cast<uint64>(static_cast<float>(capacity) * DEFAULT_LOAD_FACTOR);
|
||||||
assert(nbAllocatedEntries > 0);
|
assert(nbAllocatedEntries > 0);
|
||||||
Pair<K, V>* newEntries = static_cast<Pair<K, V>*>(mAllocator.allocate(nbAllocatedEntries * sizeof(Pair<K, V>)));
|
Pair<K, V>* newEntries = static_cast<Pair<K, V>*>(mAllocator.allocate(nbAllocatedEntries * sizeof(Pair<K, V>)));
|
||||||
uint64* newNextEntries = static_cast<uint64*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint64)));
|
uint64* newNextEntries = static_cast<uint64*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint64)));
|
||||||
|
|
|
@ -275,7 +275,7 @@ class Set {
|
||||||
uint64* newBuckets = static_cast<uint64*>(mAllocator.allocate(capacity * sizeof(uint64)));
|
uint64* newBuckets = static_cast<uint64*>(mAllocator.allocate(capacity * sizeof(uint64)));
|
||||||
|
|
||||||
// Allocate memory for the entries
|
// Allocate memory for the entries
|
||||||
const uint64 nbAllocatedEntries = static_cast<uint64>(capacity * DEFAULT_LOAD_FACTOR);
|
const uint64 nbAllocatedEntries = static_cast<uint64>(static_cast<float>(capacity) * DEFAULT_LOAD_FACTOR);
|
||||||
assert(nbAllocatedEntries > 0);
|
assert(nbAllocatedEntries > 0);
|
||||||
V* newEntries = static_cast<V*>(mAllocator.allocate(nbAllocatedEntries * sizeof(V)));
|
V* newEntries = static_cast<V*>(mAllocator.allocate(nbAllocatedEntries * sizeof(V)));
|
||||||
uint64* newNextEntries = static_cast<uint64*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint64)));
|
uint64* newNextEntries = static_cast<uint64*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint64)));
|
||||||
|
|
|
@ -1005,8 +1005,8 @@ void RigidBody::resetOverlappingPairs() {
|
||||||
// Get the currently overlapping pairs for this collider
|
// Get the currently overlapping pairs for this collider
|
||||||
Array<uint64> overlappingPairs = mWorld.mCollidersComponents.getOverlappingPairs(colliderEntities[i]);
|
Array<uint64> overlappingPairs = mWorld.mCollidersComponents.getOverlappingPairs(colliderEntities[i]);
|
||||||
|
|
||||||
const uint32 nbOverlappingPairs = overlappingPairs.size();
|
const uint64 nbOverlappingPairs = overlappingPairs.size();
|
||||||
for (uint32 j=0; j < nbOverlappingPairs; j++) {
|
for (uint64 j=0; j < nbOverlappingPairs; j++) {
|
||||||
|
|
||||||
mWorld.mCollisionDetection.mOverlappingPairs.removePair(overlappingPairs[j]);
|
mWorld.mCollisionDetection.mOverlappingPairs.removePair(overlappingPairs[j]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ CollisionCallback::CallbackData::CallbackData(Array<reactphysics3d::ContactPair>
|
||||||
mWorld(world) {
|
mWorld(world) {
|
||||||
|
|
||||||
// Filter the contact pairs to only keep the contact events (not the overlap/trigger events)
|
// Filter the contact pairs to only keep the contact events (not the overlap/trigger events)
|
||||||
const uint32 nbContactPairs = mContactPairs->size();
|
const uint64 nbContactPairs = mContactPairs->size();
|
||||||
for (uint32 i=0; i < nbContactPairs; i++) {
|
for (uint64 i=0; i < nbContactPairs; i++) {
|
||||||
|
|
||||||
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
||||||
if (!(*mContactPairs)[i].isTrigger) {
|
if (!(*mContactPairs)[i].isTrigger) {
|
||||||
|
@ -92,8 +92,8 @@ CollisionCallback::CallbackData::CallbackData(Array<reactphysics3d::ContactPair>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Filter the lost contact pairs to only keep the contact events (not the overlap/trigger events)
|
// Filter the lost contact pairs to only keep the contact events (not the overlap/trigger events)
|
||||||
const uint32 nbLostContactPairs = mLostContactPairs.size();
|
const uint64 nbLostContactPairs = mLostContactPairs.size();
|
||||||
for (uint32 i=0; i < nbLostContactPairs; i++) {
|
for (uint64 i=0; i < nbLostContactPairs; i++) {
|
||||||
|
|
||||||
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
||||||
if (!mLostContactPairs[i].isTrigger) {
|
if (!mLostContactPairs[i].isTrigger) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ void HalfEdgeStructure::init() {
|
||||||
Array<VerticesPair> currentFaceEdges(mAllocator, mFaces[0].faceVertices.size());
|
Array<VerticesPair> currentFaceEdges(mAllocator, mFaces[0].faceVertices.size());
|
||||||
|
|
||||||
// For each face
|
// For each face
|
||||||
const uint32 nbFaces = mFaces.size();
|
const uint32 nbFaces = static_cast<uint32>(mFaces.size());
|
||||||
for (uint32 f=0; f < nbFaces; f++) {
|
for (uint32 f=0; f < nbFaces; f++) {
|
||||||
|
|
||||||
Face& face = mFaces[f];
|
Face& face = mFaces[f];
|
||||||
|
@ -52,7 +52,7 @@ void HalfEdgeStructure::init() {
|
||||||
VerticesPair firstEdgeKey(0, 0);
|
VerticesPair firstEdgeKey(0, 0);
|
||||||
|
|
||||||
// For each vertex of the face
|
// For each vertex of the face
|
||||||
const uint32 nbFaceVertices = face.faceVertices.size();
|
const uint32 nbFaceVertices = static_cast<uint32>(face.faceVertices.size());
|
||||||
for (uint32 v=0; v < nbFaceVertices; v++) {
|
for (uint32 v=0; v < nbFaceVertices; v++) {
|
||||||
uint32 v1Index = face.faceVertices[v];
|
uint32 v1Index = face.faceVertices[v];
|
||||||
uint32 v2Index = face.faceVertices[v == (face.faceVertices.size() - 1) ? 0 : v + 1];
|
uint32 v2Index = face.faceVertices[v == (face.faceVertices.size() - 1) ? 0 : v + 1];
|
||||||
|
@ -84,7 +84,7 @@ void HalfEdgeStructure::init() {
|
||||||
auto itEdge = edges.find(pairV2V1);
|
auto itEdge = edges.find(pairV2V1);
|
||||||
if (itEdge != edges.end()) {
|
if (itEdge != edges.end()) {
|
||||||
|
|
||||||
const uint32 edgeIndex = mEdges.size();
|
const uint32 edgeIndex = static_cast<uint32>(mEdges.size());
|
||||||
|
|
||||||
itEdge->second.twinEdgeIndex = edgeIndex + 1;
|
itEdge->second.twinEdgeIndex = edgeIndex + 1;
|
||||||
edge.twinEdgeIndex = edgeIndex;
|
edge.twinEdgeIndex = edgeIndex;
|
||||||
|
@ -109,7 +109,7 @@ void HalfEdgeStructure::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set next edges
|
// Set next edges
|
||||||
const uint32 nbEdges = mEdges.size();
|
const uint32 nbEdges = static_cast<uint32>(mEdges.size());
|
||||||
for (uint32 i=0; i < nbEdges; i++) {
|
for (uint32 i=0; i < nbEdges; i++) {
|
||||||
mEdges[i].nextEdgeIndex = mapEdgeToIndex[nextEdges[mapEdgeIndexToKey[i]]];
|
mEdges[i].nextEdgeIndex = mapEdgeToIndex[nextEdges[mapEdgeIndexToKey[i]]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,8 @@ OverlapCallback::CallbackData::CallbackData(Array<ContactPair>& contactPairs, Ar
|
||||||
mContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mLostContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mWorld(world) {
|
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)
|
// Filter the contact pairs to only keep the overlap/trigger events (not the contact events)
|
||||||
const uint32 nbContactPairs = mContactPairs.size();
|
const uint64 nbContactPairs = mContactPairs.size();
|
||||||
for (uint32 i=0; i < nbContactPairs; i++) {
|
for (uint64 i=0; i < nbContactPairs; i++) {
|
||||||
|
|
||||||
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
||||||
if (!onlyReportTriggers || mContactPairs[i].isTrigger) {
|
if (!onlyReportTriggers || mContactPairs[i].isTrigger) {
|
||||||
|
@ -81,8 +81,8 @@ OverlapCallback::CallbackData::CallbackData(Array<ContactPair>& contactPairs, Ar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Filter the lost contact pairs to only keep the overlap/trigger events (not the contact events)
|
// Filter the lost contact pairs to only keep the overlap/trigger events (not the contact events)
|
||||||
const uint32 nbLostContactPairs = mLostContactPairs.size();
|
const uint64 nbLostContactPairs = mLostContactPairs.size();
|
||||||
for (uint32 i=0; i < nbLostContactPairs; i++) {
|
for (uint i=0; i < nbLostContactPairs; i++) {
|
||||||
|
|
||||||
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
// If the contact pair contains contacts (and is therefore not an overlap/trigger event)
|
||||||
if (!onlyReportTriggers || mLostContactPairs[i].isTrigger) {
|
if (!onlyReportTriggers || mLostContactPairs[i].isTrigger) {
|
||||||
|
|
|
@ -213,7 +213,7 @@ decimal PolyhedronMesh::getFaceArea(uint32 faceIndex) const {
|
||||||
Vector3 v1 = getVertex(face.faceVertices[0]);
|
Vector3 v1 = getVertex(face.faceVertices[0]);
|
||||||
|
|
||||||
// For each vertex of the face
|
// For each vertex of the face
|
||||||
const uint32 nbFaceVertices = face.faceVertices.size();
|
const uint32 nbFaceVertices = static_cast<uint32>(face.faceVertices.size());
|
||||||
for (uint32 i=2; i < nbFaceVertices; i++) {
|
for (uint32 i=2; i < nbFaceVertices; i++) {
|
||||||
|
|
||||||
const Vector3 v2 = getVertex(face.faceVertices[i-1]);
|
const Vector3 v2 = getVertex(face.faceVertices[i-1]);
|
||||||
|
|
|
@ -587,7 +587,7 @@ int32 DynamicAABBTree::balanceSubTreeAtNode(int32 nodeID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Take an array of shapes to be tested for broad-phase overlap and return an array of pair of overlapping shapes
|
/// Take an array of shapes to be tested for broad-phase overlap and return an array of pair of overlapping shapes
|
||||||
void DynamicAABBTree::reportAllShapesOverlappingWithShapes(const Array<int32>& nodesToTest, size_t startIndex,
|
void DynamicAABBTree::reportAllShapesOverlappingWithShapes(const Array<int32>& nodesToTest, uint32 startIndex,
|
||||||
size_t endIndex, Array<Pair<int32, int32>>& outOverlappingNodes) const {
|
size_t endIndex, Array<Pair<int32, int32>>& outOverlappingNodes) const {
|
||||||
|
|
||||||
RP3D_PROFILE("DynamicAABBTree::reportAllShapesOverlappingWithAABB()", mProfiler);
|
RP3D_PROFILE("DynamicAABBTree::reportAllShapesOverlappingWithAABB()", mProfiler);
|
||||||
|
|
|
@ -52,7 +52,7 @@ void NarrowPhaseInfoBatch::reserveMemory() {
|
||||||
// Clear all the objects in the batch
|
// Clear all the objects in the batch
|
||||||
void NarrowPhaseInfoBatch::clear() {
|
void NarrowPhaseInfoBatch::clear() {
|
||||||
|
|
||||||
const uint32 nbNarrowPhaseInfos = narrowPhaseInfos.size();
|
const uint32 nbNarrowPhaseInfos = static_cast<uint32>(narrowPhaseInfos.size());
|
||||||
for (uint32 i=0; i < nbNarrowPhaseInfos; i++) {
|
for (uint32 i=0; i < nbNarrowPhaseInfos; i++) {
|
||||||
|
|
||||||
assert(narrowPhaseInfos[i].nbContactPoints == 0);
|
assert(narrowPhaseInfos[i].nbContactPoints == 0);
|
||||||
|
@ -76,7 +76,7 @@ void NarrowPhaseInfoBatch::clear() {
|
||||||
// allocated in the next frame at a possibly different location in memory (remember that the
|
// allocated in the next frame at a possibly different location in memory (remember that the
|
||||||
// location of the allocated memory of a single frame allocator might change between two frames)
|
// location of the allocated memory of a single frame allocator might change between two frames)
|
||||||
|
|
||||||
mCachedCapacity = narrowPhaseInfos.capacity();
|
mCachedCapacity = static_cast<uint32>(narrowPhaseInfos.capacity());
|
||||||
|
|
||||||
narrowPhaseInfos.clear(true);
|
narrowPhaseInfos.clear(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ void BroadPhaseSystem::computeOverlappingPairs(MemoryManager& memoryManager, Arr
|
||||||
Array<int> shapesToTest = mMovedShapes.toArray(memoryManager.getHeapAllocator());
|
Array<int> shapesToTest = mMovedShapes.toArray(memoryManager.getHeapAllocator());
|
||||||
|
|
||||||
// Ask the dynamic AABB tree to report all collision shapes that overlap with the shapes to test
|
// Ask the dynamic AABB tree to report all collision shapes that overlap with the shapes to test
|
||||||
mDynamicAABBTree.reportAllShapesOverlappingWithShapes(shapesToTest, 0, shapesToTest.size(), overlappingNodes);
|
mDynamicAABBTree.reportAllShapesOverlappingWithShapes(shapesToTest, 0, static_cast<uint32>(shapesToTest.size()), overlappingNodes);
|
||||||
|
|
||||||
// Reset the array of collision shapes that have move (or have been created) during the
|
// Reset the array of collision shapes that have move (or have been created) during the
|
||||||
// last simulation step
|
// last simulation step
|
||||||
|
|
Loading…
Reference in New Issue
Block a user