From bb0da781a7dcc845e543a0aef7104ab11bdd147a Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Sun, 1 Feb 2015 01:09:58 +0100 Subject: [PATCH] Fix compilation warnings --- src/collision/CollisionDetection.cpp | 2 +- src/collision/broadphase/BroadPhaseAlgorithm.cpp | 2 +- src/collision/narrowphase/EPA/EPAAlgorithm.cpp | 8 ++++---- src/collision/narrowphase/GJK/GJKAlgorithm.cpp | 3 --- src/constraint/Joint.h | 6 +++--- src/engine/DynamicsWorld.cpp | 13 +++++++------ src/engine/Impulse.h | 6 +++--- src/memory/MemoryAllocator.cpp | 6 +++--- src/memory/MemoryAllocator.h | 2 +- 9 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/collision/CollisionDetection.cpp b/src/collision/CollisionDetection.cpp index d531d3e2..7885bbca 100644 --- a/src/collision/CollisionDetection.cpp +++ b/src/collision/CollisionDetection.cpp @@ -117,7 +117,7 @@ void CollisionDetection::reportCollisionBetweenShapes(CollisionCallback* callbac // For each contact manifold of the overlapping pair ContactManifold* manifold = pair->getContactManifold(); - for (int i=0; igetNbContactPoints(); i++) { + for (uint i=0; igetNbContactPoints(); i++) { ContactPoint* contactPoint = manifold->getContactPoint(i); diff --git a/src/collision/broadphase/BroadPhaseAlgorithm.cpp b/src/collision/broadphase/BroadPhaseAlgorithm.cpp index d2722f4d..9de9e27e 100644 --- a/src/collision/broadphase/BroadPhaseAlgorithm.cpp +++ b/src/collision/broadphase/BroadPhaseAlgorithm.cpp @@ -168,7 +168,7 @@ void BroadPhaseAlgorithm::computeOverlappingPairs() { // For all collision shapes that have moved (or have been created) during the // last simulation step for (uint i=0; i 0.0 == normal1.dot(p4) > 0.0) { + if ((normal1.dot(p1) > 0.0) == (normal1.dot(p4) > 0.0)) { return 4; } // Check vertex 2 Vector3 normal2 = (p4-p2).cross(p3-p2); - if (normal2.dot(p2) > 0.0 == normal2.dot(p1) > 0.0) { + if ((normal2.dot(p2) > 0.0) == (normal2.dot(p1) > 0.0)) { return 1; } // Check vertex 3 Vector3 normal3 = (p4-p3).cross(p1-p3); - if (normal3.dot(p3) > 0.0 == normal3.dot(p2) > 0.0) { + if ((normal3.dot(p3) > 0.0) == (normal3.dot(p2) > 0.0)) { return 2; } // Check vertex 4 Vector3 normal4 = (p2-p4).cross(p1-p4); - if (normal4.dot(p4) > 0.0 == normal4.dot(p3) > 0.0) { + if ((normal4.dot(p4) > 0.0) == (normal4.dot(p3) > 0.0)) { return 3; } diff --git a/src/collision/narrowphase/GJK/GJKAlgorithm.cpp b/src/collision/narrowphase/GJK/GJKAlgorithm.cpp index a9cd6c4d..742bbe30 100644 --- a/src/collision/narrowphase/GJK/GJKAlgorithm.cpp +++ b/src/collision/narrowphase/GJK/GJKAlgorithm.cpp @@ -336,7 +336,6 @@ bool GJKAlgorithm::testPointInside(const Vector3& localPoint, ProxyShape* collis Vector3 suppA; // Support point of object A Vector3 w; // Support point of Minkowski difference A-B - decimal vDotw; decimal prevDistSquare; // Support point of object B (object B is a single point) @@ -359,8 +358,6 @@ bool GJKAlgorithm::testPointInside(const Vector3& localPoint, ProxyShape* collis // Compute the support point for the Minkowski difference A-B w = suppA - suppB; - vDotw = v.dot(w); - // Add the new support point to the simplex simplex.addPoint(w, suppA, suppB); diff --git a/src/constraint/Joint.h b/src/constraint/Joint.h index 9daeb04d..082ffd4b 100644 --- a/src/constraint/Joint.h +++ b/src/constraint/Joint.h @@ -85,13 +85,13 @@ struct JointInfo { /// Type of the joint JointType type; - /// True if the two bodies of the joint are allowed to collide with each other - bool isCollisionEnabled; - /// Position correction technique used for the constraint (used for joints). /// By default, the BAUMGARTE technique is used JointsPositionCorrectionTechnique positionCorrectionTechnique; + /// True if the two bodies of the joint are allowed to collide with each other + bool isCollisionEnabled; + /// Constructor JointInfo(JointType constraintType) : body1(NULL), body2(NULL), type(constraintType), diff --git a/src/engine/DynamicsWorld.cpp b/src/engine/DynamicsWorld.cpp index 15e9c344..01792b54 100644 --- a/src/engine/DynamicsWorld.cpp +++ b/src/engine/DynamicsWorld.cpp @@ -36,16 +36,17 @@ using namespace std; // Constructor DynamicsWorld::DynamicsWorld(const Vector3 &gravity, decimal timeStep = DEFAULT_TIMESTEP) - : CollisionWorld(), mTimer(timeStep), mGravity(gravity), mIsGravityEnabled(true), - mConstrainedLinearVelocities(NULL), mConstrainedAngularVelocities(NULL), - mConstrainedPositions(NULL), mConstrainedOrientations(NULL), + : CollisionWorld(), mTimer(timeStep), mContactSolver(mMapBodyToConstrainedVelocityIndex), mConstraintSolver(mMapBodyToConstrainedVelocityIndex), mNbVelocitySolverIterations(DEFAULT_VELOCITY_SOLVER_NB_ITERATIONS), mNbPositionSolverIterations(DEFAULT_POSITION_SOLVER_NB_ITERATIONS), - mIsSleepingEnabled(SPLEEPING_ENABLED), mSplitLinearVelocities(NULL), - mSplitAngularVelocities(NULL), mNbIslands(0), mNbIslandsCapacity(0), - mIslands(NULL), mNbBodiesCapacity(0), + mIsSleepingEnabled(SPLEEPING_ENABLED), mGravity(gravity), + mIsGravityEnabled(true), mConstrainedLinearVelocities(NULL), + mConstrainedAngularVelocities(NULL), mSplitLinearVelocities(NULL), + mSplitAngularVelocities(NULL), mConstrainedPositions(NULL), + mConstrainedOrientations(NULL), mNbIslands(0), + mNbIslandsCapacity(0), mIslands(NULL), mNbBodiesCapacity(0), mSleepLinearVelocity(DEFAULT_SLEEP_LINEAR_VELOCITY), mSleepAngularVelocity(DEFAULT_SLEEP_ANGULAR_VELOCITY), mTimeBeforeSleep(DEFAULT_TIME_BEFORE_SLEEP) { diff --git a/src/engine/Impulse.h b/src/engine/Impulse.h index 8e4fa4fc..d01ad76c 100644 --- a/src/engine/Impulse.h +++ b/src/engine/Impulse.h @@ -51,12 +51,12 @@ struct Impulse { /// Linear impulse applied to the first body const Vector3 linearImpulseBody1; - /// Linear impulse applied to the second body - const Vector3 linearImpulseBody2; - /// Angular impulse applied to the first body const Vector3 angularImpulseBody1; + /// Linear impulse applied to the second body + const Vector3 linearImpulseBody2; + /// Angular impulse applied to the second body const Vector3 angularImpulseBody2; diff --git a/src/memory/MemoryAllocator.cpp b/src/memory/MemoryAllocator.cpp index ec074042..60468276 100644 --- a/src/memory/MemoryAllocator.cpp +++ b/src/memory/MemoryAllocator.cpp @@ -43,8 +43,8 @@ MemoryAllocator::MemoryAllocator() { mNbCurrentMemoryBlocks = 0; const size_t sizeToAllocate = mNbAllocatedMemoryBlocks * sizeof(MemoryBlock); mMemoryBlocks = (MemoryBlock*) malloc(sizeToAllocate); - memset(mMemoryBlocks, NULL, sizeToAllocate); - memset(mFreeMemoryUnits, NULL, sizeof(mFreeMemoryUnits)); + memset(mMemoryBlocks, 0, sizeToAllocate); + memset(mFreeMemoryUnits, 0, sizeof(mFreeMemoryUnits)); #ifndef NDEBUG mNbTimesAllocateMethodCalled = 0; @@ -55,7 +55,7 @@ MemoryAllocator::MemoryAllocator() { // Initialize the array that contains the sizes the memory units that will // be allocated in each different heap - for (uint i=0; i < NB_HEAPS; i++) { + for (int i=0; i < NB_HEAPS; i++) { mUnitSizes[i] = (i+1) * 8; } diff --git a/src/memory/MemoryAllocator.h b/src/memory/MemoryAllocator.h index 02bcd209..66aa17f3 100644 --- a/src/memory/MemoryAllocator.h +++ b/src/memory/MemoryAllocator.h @@ -78,7 +78,7 @@ class MemoryAllocator { // -------------------- Constants -------------------- // /// Number of heaps - static const uint NB_HEAPS = 128; + static const int NB_HEAPS = 128; /// Maximum memory unit size. An allocation request of a size smaller or equal to /// this size will be handled using the small block allocator. However, for an