Fix warnings

This commit is contained in:
Daniel Chappuis 2021-11-22 07:41:38 +01:00
parent b3d8b13214
commit 6cbd6693ca
11 changed files with 25 additions and 29 deletions

View File

@ -239,10 +239,10 @@ class CollisionCallback {
Array<reactphysics3d::ContactPair>& mLostContactPairs;
/// Array of indices in the mContactPairs array that are contact events (not overlap/triggers)
Array<uint> mContactPairsIndices;
Array<uint64> mContactPairsIndices;
/// Array of indices in the mLostContactPairs array that are contact events (not overlap/triggers)
Array<uint> mLostContactPairsIndices;
Array<uint64> mLostContactPairsIndices;
/// Reference to the physics world
PhysicsWorld& mWorld;
@ -278,7 +278,7 @@ class CollisionCallback {
* @param index Index of the contact pair to retrieve
* @return A contact pair object
*/
ContactPair getContactPair(uint32 index) const;
ContactPair getContactPair(uint64 index) const;
// -------------------- Friendship -------------------- //

View File

@ -138,10 +138,10 @@ class OverlapCallback {
Array<ContactPair>& mLostContactPairs;
/// Array of indices of the mContactPairs array that are overlap/triggers events (not contact events)
Array<uint> mContactPairsIndices;
Array<uint64> mContactPairsIndices;
/// Array of indices of the mLostContactPairs array that are overlap/triggers events (not contact events)
Array<uint> mLostContactPairsIndices;
Array<uint64> mLostContactPairsIndices;
/// Reference to the physics world
PhysicsWorld& mWorld;

View File

@ -491,18 +491,14 @@ class Deque {
/// Return a reference to the first item of the deque
const T& getFront() const {
if (mSize > 0) {
return mChunks[mFirstChunkIndex][mFirstItemIndex];
}
assert(false);
assert(mSize > 0);
return mChunks[mFirstChunkIndex][mFirstItemIndex];
}
/// Return a reference to the last item of the deque
const T& getBack() const {
if (mSize > 0) {
return mChunks[mLastChunkIndex][mLastItemIndex];
}
assert(false);
assert(mSize > 0);
return mChunks[mLastChunkIndex][mLastItemIndex];
}
/// Clear the elements of the deque

View File

@ -276,7 +276,7 @@ class Map {
uint64* newBuckets = static_cast<uint64*>(mAllocator.allocate(capacity * sizeof(uint64)));
// Allocate memory for the entries
const uint64 nbAllocatedEntries = static_cast<uint64>(static_cast<float>(capacity) * DEFAULT_LOAD_FACTOR);
const uint64 nbAllocatedEntries = static_cast<uint64>(capacity * double(DEFAULT_LOAD_FACTOR));
assert(nbAllocatedEntries > 0);
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)));

View File

@ -275,7 +275,7 @@ class Set {
uint64* newBuckets = static_cast<uint64*>(mAllocator.allocate(capacity * sizeof(uint64)));
// Allocate memory for the entries
const uint64 nbAllocatedEntries = static_cast<uint64>(static_cast<float>(capacity) * DEFAULT_LOAD_FACTOR);
const uint64 nbAllocatedEntries = static_cast<uint64>(capacity * double(DEFAULT_LOAD_FACTOR));
assert(nbAllocatedEntries > 0);
V* newEntries = static_cast<V*>(mAllocator.allocate(nbAllocatedEntries * sizeof(V)));
uint64* newNextEntries = static_cast<uint64*>(mAllocator.allocate(nbAllocatedEntries * sizeof(uint64)));
@ -351,7 +351,7 @@ class Set {
/// Returns true if the item has been inserted and false otherwise.
bool add(const V& value) {
uint64 bucket;
uint64 bucket = INVALID_INDEX;
// Compute the hash code of the value
const size_t hashCode = Hash()(value);
@ -397,6 +397,8 @@ class Set {
mNbEntries++;
assert(bucket != INVALID_INDEX);
mNextEntries[entryIndex] = mBuckets[bucket];
new (mEntries + entryIndex) V(value);
mBuckets[bucket] = entryIndex;

View File

@ -84,15 +84,11 @@ struct LastFrameCollisionInfo {
uint8 satMinEdge2Index;
/// Constructor
LastFrameCollisionInfo() {
LastFrameCollisionInfo()
:isValid(false), isObsolete(false), wasColliding(false), wasUsingGJK(false), gjkSeparatingAxis(Vector3(0, 1, 0)),
satIsAxisFacePolyhedron1(false), satIsAxisFacePolyhedron2(false), satMinAxisFaceIndex(0),
satMinEdge1Index(0), satMinEdge2Index(0) {
isValid = false;
isObsolete = false;
wasColliding = false;
wasUsingSAT = false;
wasUsingGJK = false;
gjkSeparatingAxis = Vector3(0, 1, 0);
}
};

View File

@ -427,7 +427,9 @@ RP3D_FORCE_INLINE uint64 nextPowerOfTwo64Bits(uint64 number) {
/// http://szudzik.com/ElegantPairing.pdf
RP3D_FORCE_INLINE uint64 pairNumbers(uint32 number1, uint32 number2) {
assert(number1 == std::max(number1, number2));
return number1 * number1 + number1 + number2;
uint64 nb1 = number1;
uint64 nb2 = number2;
return nb1 * nb1 + nb1 + nb2;
}

View File

@ -68,7 +68,7 @@ struct ConstraintSolverData {
/// Constructor
ConstraintSolverData(RigidBodyComponents& rigidBodyComponents, JointComponents& jointComponents)
:rigidBodyComponents(rigidBodyComponents), jointComponents(jointComponents) {
:timeStep(0), isWarmStartingActive(true), rigidBodyComponents(rigidBodyComponents), jointComponents(jointComponents) {
}

View File

@ -117,7 +117,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(uint32 index) const {
CollisionCallback::ContactPair CollisionCallback::CallbackData::getContactPair(uint64 index) const {
assert(index < getNbContactPairs());

View File

@ -82,7 +82,7 @@ OverlapCallback::CallbackData::CallbackData(Array<ContactPair>& contactPairs, Ar
}
// Filter the lost contact pairs to only keep the overlap/trigger events (not the contact events)
const uint64 nbLostContactPairs = mLostContactPairs.size();
for (uint 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 (!onlyReportTriggers || mLostContactPairs[i].isTrigger) {

View File

@ -281,7 +281,7 @@ void DebugRenderer::drawConvexMesh(const Transform& transform, const ConvexMeshS
assert(face.faceVertices.size() >= 3);
// Perform a fan triangulation of the convex polygon face
const uint32 nbFaceVertices = face.faceVertices.size();
const uint32 nbFaceVertices = static_cast<uint32>(face.faceVertices.size());
for (uint32 v = 2; v < nbFaceVertices; v++) {
uint32 v1Index = face.faceVertices[v - 2];