From ab866204125228818df23c68b60f3806fa48ade0 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Sun, 24 May 2020 16:52:44 +0200 Subject: [PATCH] Small modifications --- src/body/RigidBody.cpp | 2 -- src/systems/CollisionDetectionSystem.cpp | 2 +- src/systems/SolveSliderJointSystem.cpp | 12 ++++++------ src/utils/Profiler.cpp | 2 -- testbed/scenes/joints/JointsScene.cpp | 1 - testbed/scenes/pile/PileScene.cpp | 3 --- testbed/src/TestbedApplication.cpp | 2 ++ 7 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/body/RigidBody.cpp b/src/body/RigidBody.cpp index e099adb9..c177e0bf 100644 --- a/src/body/RigidBody.cpp +++ b/src/body/RigidBody.cpp @@ -401,8 +401,6 @@ void RigidBody::computeMassAndInertiaTensorLocal(Vector3& inertiaTensorLocal, de /// mass that has been set with the RigidBody::setInertiaTensorLocal() method. void RigidBody::updateLocalInertiaTensorFromColliders() { - const Vector3 centerOfMassLocal = mWorld.mRigidBodyComponents.getCenterOfMassLocal(mEntity); - // Compute the local-space inertia tensor Vector3 inertiaTensorLocal; decimal totalMass; diff --git a/src/systems/CollisionDetectionSystem.cpp b/src/systems/CollisionDetectionSystem.cpp index 817fb12e..823ab321 100644 --- a/src/systems/CollisionDetectionSystem.cpp +++ b/src/systems/CollisionDetectionSystem.cpp @@ -1329,7 +1329,7 @@ void CollisionDetectionSystem::reduceContactPoints(ContactManifoldInfo& manifold } nbReducedPoints = 3; - // Compute the 4th point by choosing the triangle that add the most + // Compute the 4th point by choosing the triangle that adds the most // triangle area to the previous triangle and has opposite sign area (opposite winding) decimal largestArea = decimal(0.0); // Largest area (positive or negative) diff --git a/src/systems/SolveSliderJointSystem.cpp b/src/systems/SolveSliderJointSystem.cpp index f222cbcd..03cdd571 100644 --- a/src/systems/SolveSliderJointSystem.cpp +++ b/src/systems/SolveSliderJointSystem.cpp @@ -496,9 +496,6 @@ void SolveSliderJointSystem::solveVelocityConstraint() { Vector3& v1 = mRigidBodyComponents.mConstrainedLinearVelocities[componentIndexBody1]; Vector3& v2 = mRigidBodyComponents.mConstrainedLinearVelocities[componentIndexBody2]; - Vector3& w1 = mRigidBodyComponents.mConstrainedAngularVelocities[componentIndexBody1]; - Vector3& w2 = mRigidBodyComponents.mConstrainedAngularVelocities[componentIndexBody2]; - decimal inverseMassBody1 = mRigidBodyComponents.mInverseMasses[componentIndexBody1]; decimal inverseMassBody2 = mRigidBodyComponents.mInverseMasses[componentIndexBody2]; @@ -511,6 +508,9 @@ void SolveSliderJointSystem::solveVelocityConstraint() { if (mSliderJointComponents.mIsLimitEnabled[i]) { + Vector3& w1 = mRigidBodyComponents.mConstrainedAngularVelocities[componentIndexBody1]; + Vector3& w2 = mRigidBodyComponents.mConstrainedAngularVelocities[componentIndexBody2]; + const decimal inverseMassMatrixLimit = mSliderJointComponents.mInverseMassMatrixLimit[i]; // If the lower limit is violated @@ -786,9 +786,6 @@ void SolveSliderJointSystem::solvePositionConstraint() { const uint32 componentIndexBody1 = mRigidBodyComponents.getEntityIndex(body1Entity); const uint32 componentIndexBody2 = mRigidBodyComponents.getEntityIndex(body2Entity); - Vector3& x1 = mRigidBodyComponents.mConstrainedPositions[componentIndexBody1]; - Vector3& x2 = mRigidBodyComponents.mConstrainedPositions[componentIndexBody2]; - Quaternion& q1 = mRigidBodyComponents.mConstrainedOrientations[componentIndexBody1]; Quaternion& q2 = mRigidBodyComponents.mConstrainedOrientations[componentIndexBody2]; @@ -861,6 +858,9 @@ void SolveSliderJointSystem::solvePositionConstraint() { if (mSliderJointComponents.mIsLimitEnabled[i]) { + Vector3& x1 = mRigidBodyComponents.mConstrainedPositions[componentIndexBody1]; + Vector3& x2 = mRigidBodyComponents.mConstrainedPositions[componentIndexBody2]; + const Vector3& r2CrossSliderAxis = mSliderJointComponents.mR2CrossSliderAxis[i]; const Vector3& r1PlusUCrossSliderAxis = mSliderJointComponents.mR1PlusUCrossSliderAxis[i]; diff --git a/src/utils/Profiler.cpp b/src/utils/Profiler.cpp index 152bb531..2ffb5108 100644 --- a/src/utils/Profiler.cpp +++ b/src/utils/Profiler.cpp @@ -292,7 +292,6 @@ void Profiler::printRecursiveNodeReport(ProfileNodeIterator* iterator, for (int i=0; igetCurrentParentName() << " (total running time : " << parentTime << " ms) ---" << std::endl; - long double totalTime = 0.0L; // Recurse over the children of the current node int nbChildren = 0; @@ -307,7 +306,6 @@ void Profiler::printRecursiveNodeReport(ProfileNodeIterator* iterator, fraction << " % | " << (currentTotalTime / (long double) (nbFrames)) << " ms/frame (" << iterator->getCurrentNbTotalCalls() << " calls)" << std::endl; - totalTime += currentTotalTime; } if (parentTime < accumulatedTime) { diff --git a/testbed/scenes/joints/JointsScene.cpp b/testbed/scenes/joints/JointsScene.cpp index 00b1e1ca..d0e49075 100644 --- a/testbed/scenes/joints/JointsScene.cpp +++ b/testbed/scenes/joints/JointsScene.cpp @@ -215,7 +215,6 @@ void JointsScene::createBallAndSocketJoints() { rp3d::Vector3 positionBox(0, 15, 5); openglframework::Vector3 boxDimension(1, 1, 1); - const float boxMass = 0.5f; for (int i=0; i