Fix compilation warnings

This commit is contained in:
Daniel Chappuis 2018-04-16 07:54:46 +02:00
parent e0c624205c
commit 96c581ae9b
16 changed files with 41 additions and 29 deletions

View File

@ -38,4 +38,8 @@ Body::Body(bodyindex id)
: mID(id), mIsAlreadyInIsland(false), mIsAllowedToSleep(true), mIsActive(true),
mIsSleeping(false), mSleepTime(0), mUserData(nullptr) {
#ifdef IS_LOGGING_ACTIVE
mLogger = nullptr;
#endif
}

View File

@ -41,6 +41,10 @@ CollisionBody::CollisionBody(const Transform& transform, CollisionWorld& world,
: Body(id), mType(BodyType::DYNAMIC), mTransform(transform), mProxyCollisionShapes(nullptr),
mNbCollisionShapes(0), mContactManifoldsList(nullptr), mWorld(world) {
#ifdef IS_PROFILING_ACTIVE
mProfiler = nullptr;
#endif
}
// Destructor

View File

@ -37,7 +37,7 @@ using namespace reactphysics3d;
*/
ProxyShape::ProxyShape(CollisionBody* body, CollisionShape* shape, const Transform& transform, decimal mass, MemoryManager& memoryManager)
:mMemoryManager(memoryManager), mBody(body), mCollisionShape(shape), mLocalToBodyTransform(transform), mMass(mass),
mNext(nullptr), mBroadPhaseID(-1), mCollisionCategoryBits(0x0001), mCollideWithMaskBits(0xFFFF) {
mNext(nullptr), mBroadPhaseID(-1), mUserData(nullptr), mCollisionCategoryBits(0x0001), mCollideWithMaskBits(0xFFFF) {
}

View File

@ -47,6 +47,10 @@ const decimal SATAlgorithm::SAME_SEPARATING_AXIS_BIAS = decimal(0.001);
// Constructor
SATAlgorithm::SATAlgorithm(MemoryAllocator& memoryAllocator) : mMemoryAllocator(memoryAllocator) {
#ifdef IS_PROFILING_ACTIVE
mProfiler = nullptr;
#endif
}
// Test collision between a sphere and a convex mesh

View File

@ -34,7 +34,11 @@ using namespace reactphysics3d;
// Constructor
CollisionShape::CollisionShape(CollisionShapeName name, CollisionShapeType type)
: mType(type), mName(name), mId(0) {
#ifdef IS_PROFILING_ACTIVE
mProfiler = nullptr;
#endif
}
// Compute the world-space AABB of the collision shape given a transform from shape

View File

@ -348,7 +348,7 @@ class List {
if (mSize != list.mSize) return false;
T* items = static_cast<T*>(mBuffer);
for (int i=0; i < mSize; i++) {
for (size_t i=0; i < mSize; i++) {
if (items[i] != list[i]) {
return false;
}

View File

@ -45,6 +45,10 @@ ContactSolver::ContactSolver(MemoryManager& memoryManager, const WorldSettings&
mLinearVelocities(nullptr), mAngularVelocities(nullptr),
mIsSplitImpulseActive(true), mWorldSettings(worldSettings) {
#ifdef IS_PROFILING_ACTIVE
mProfiler = nullptr;
#endif
}
// Initialize the contact constraints

View File

@ -30,7 +30,7 @@
using namespace reactphysics3d;
// Constructor
Timer::Timer(double timeStep) : mTimeStep(timeStep), mIsRunning(false) {
Timer::Timer(double timeStep) : mTimeStep(timeStep), mLastUpdateTime(0), mIsRunning(false) {
assert(timeStep > 0.0);
}

View File

@ -100,7 +100,7 @@ void SingleFrameAllocator::reset() {
// Divide the total memory to allocate by two
mTotalSizeBytes /= 2;
if (mTotalSizeBytes <= 0) mTotalSizeBytes = 1;
if (mTotalSizeBytes == 0) mTotalSizeBytes = 1;
// Allocate a whole block of memory at the beginning
mMemoryBufferStart = static_cast<char*>(MemoryManager::getBaseAllocator().allocate(mTotalSizeBytes));

View File

@ -2620,10 +2620,7 @@ class TestCollisionWorld : public Test {
test(collisionData->getNbContactManifolds() == 1);
test(collisionData->getTotalNbContactPoints() == 4);
// True if the bodies are swapped in the collision callback response
bool swappedBodiesCollisionData = collisionData->getBody1()->getId() != mConvexMeshBody1->getId();
for (int i=0; i<collisionData->contactManifolds[0].contactPoints.size(); i++) {
for (size_t i=0; i<collisionData->contactManifolds[0].contactPoints.size(); i++) {
test(approxEqual(collisionData->contactManifolds[0].contactPoints[i].penetrationDepth, 1.0f));
}

View File

@ -47,7 +47,7 @@ class TestTriangleVertexArray : public Test {
double mVertices2[4*3];
float mNormals2[4*3];
uint mIndices1[6];
short mIndices2[6];
uint mIndices2[6];
TriangleVertexArray* mTriangleVertexArray1;
TriangleVertexArray* mTriangleVertexArray2;

View File

@ -29,6 +29,7 @@
/// Constructor
PhysicsObject::PhysicsObject() : openglframework::Mesh() {
mBody = nullptr;
mColor = openglframework::Color(1, 1, 1, 1);
mSleepingColor = openglframework::Color(1, 0, 0, 1);
}

View File

@ -39,7 +39,7 @@ double Gui::mCachedUpdateTime = 0;
double Gui::mCachedPhysicsUpdateTime = 0;
// Constructor
Gui::Gui(TestbedApplication* app) : mApp(app) {
Gui::Gui(TestbedApplication* app) : mApp(app), mSimulationPanel(nullptr) {
}

View File

@ -31,7 +31,7 @@ using namespace openglframework;
// Constructor
Scene::Scene(const std::string& name, EngineSettings& engineSettings, bool isShadowMappingEnabled)
: mName(name), mEngineSettings(engineSettings), mInterpolationFactor(0.0f), mViewportX(0), mViewportY(0),
: mName(name), mEngineSettings(engineSettings), mLastMouseX(0), mLastMouseY(0), mInterpolationFactor(0.0f), mViewportX(0), mViewportY(0),
mViewportWidth(0), mViewportHeight(0), mIsShadowMappingEnabled(isShadowMappingEnabled),
mIsContactPointsDisplayed(true), mIsAABBsDisplayed(false), mIsWireframeEnabled(false) {

View File

@ -48,7 +48,8 @@ SceneDemo::SceneDemo(const std::string& name, EngineSettings& settings, float sc
mPhongShader("shaders/phong.vert", "shaders/phong.frag"),
mColorShader("shaders/color.vert", "shaders/color.frag"),
mQuadShader("shaders/quad.vert", "shaders/quad.frag"),
mVBOQuad(GL_ARRAY_BUFFER), mMeshFolderPath("meshes/") {
mVBOQuad(GL_ARRAY_BUFFER), mMeshFolderPath("meshes/"),
mPhysicsWorld(nullptr) {
shadowMapTextureLevel++;

View File

@ -54,22 +54,15 @@ const float TestbedApplication::SCROLL_SENSITIVITY = 0.08f;
// Constructor
TestbedApplication::TestbedApplication(bool isFullscreen)
: Screen(Vector2i(1280, 800), "Testbed ReactPhysics3D", true, isFullscreen),
mIsInitialized(false), mGui(this), mFPS(0), mNbFrames(0), mPreviousTime(0),
mLastTimeComputedFPS(0), mFrameTime(0), mPhysicsTime(0) {
mCurrentScene = NULL;
mIsMultisamplingActive = true;
mWidth = 1280;
mHeight = 720;
mEngineSettings = EngineSettings::defaultSettings();
mSinglePhysicsStepEnabled = false;
mSinglePhysicsStepDone = false;
mWindowToFramebufferRatio = Vector2(1, 1);
mIsShadowMappingEnabled = true;
mIsVSyncEnabled = true;
mIsContactPointsDisplayed = false;
mIsAABBsDisplayed = false;
mIsWireframeEnabled = false;
mIsInitialized(false), mGui(this), mCurrentScene(nullptr),
mEngineSettings(EngineSettings::defaultSettings()),
mFPS(0), mNbFrames(0), mPreviousTime(0),
mLastTimeComputedFPS(0), mFrameTime(0), mPhysicsTime(0),
mIsMultisamplingActive(true), mWidth(1280), mHeight(720),
mSinglePhysicsStepEnabled(false), mSinglePhysicsStepDone(false),
mWindowToFramebufferRatio(Vector2(1, 1)), mIsShadowMappingEnabled(true),
mIsContactPointsDisplayed(false), mIsAABBsDisplayed(false), mIsWireframeEnabled(false),
mIsVSyncEnabled(true) {
init();