Fix compilation warnings

This commit is contained in:
Daniel Chappuis 2015-02-01 01:09:58 +01:00
parent 3b2ce61cf2
commit bb0da781a7
9 changed files with 23 additions and 25 deletions

View File

@ -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; i<manifold->getNbContactPoints(); i++) {
for (uint i=0; i<manifold->getNbContactPoints(); i++) {
ContactPoint* contactPoint = manifold->getContactPoint(i);

View File

@ -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<mNbMovedShapes; i++) {
uint shapeID = mMovedShapes[i];
int shapeID = mMovedShapes[i];
if (shapeID == -1) continue;

View File

@ -50,25 +50,25 @@ int EPAAlgorithm::isOriginInTetrahedron(const Vector3& p1, const Vector3& p2,
// Check vertex 1
Vector3 normal1 = (p2-p1).cross(p3-p1);
if (normal1.dot(p1) > 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;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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