diff --git a/examples/DeformableDemo/DeformableMultibody.cpp b/examples/DeformableDemo/DeformableMultibody.cpp index 6a99e08db..5ffaefc36 100644 --- a/examples/DeformableDemo/DeformableMultibody.cpp +++ b/examples/DeformableDemo/DeformableMultibody.cpp @@ -49,7 +49,7 @@ static bool g_floatingBase = true; static float friction = 1.; class DeformableMultibody : public CommonMultiBodyBase { - btAlignedObjectArray forces; + btAlignedObjectArray m_forces; public: DeformableMultibody(struct GUIHelperInterface* helper) : CommonMultiBodyBase(helper) @@ -229,11 +229,11 @@ void DeformableMultibody::initPhysics() btDeformableMassSpringForce* mass_spring = new btDeformableMassSpringForce(2, 0.01, false); getDeformableDynamicsWorld()->addForce(psb, mass_spring); - forces.push_back(mass_spring); + m_forces.push_back(mass_spring); btDeformableGravityForce* gravity_force = new btDeformableGravityForce(gravity); getDeformableDynamicsWorld()->addForce(psb, gravity_force); - forces.push_back(gravity_force); + m_forces.push_back(gravity_force); } m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld); @@ -257,11 +257,12 @@ void DeformableMultibody::exitPhysics() delete obj; } // delete forces - for (int j = 0; j < forces.size(); j++) + for (int j = 0; j < m_forces.size(); j++) { - btDeformableLagrangianForce* force = forces[j]; + btDeformableLagrangianForce* force = m_forces[j]; delete force; } + m_forces.clear(); //delete collision shapes for (int j = 0; j < m_collisionShapes.size(); j++) { diff --git a/examples/DeformableDemo/DeformableRigid.cpp b/examples/DeformableDemo/DeformableRigid.cpp index 576803cc8..3cbfba451 100644 --- a/examples/DeformableDemo/DeformableRigid.cpp +++ b/examples/DeformableDemo/DeformableRigid.cpp @@ -44,7 +44,7 @@ ///Generally it is best to leave the rolling friction coefficient zero (or close to zero). class DeformableRigid : public CommonRigidBodyBase { - btAlignedObjectArray forces; + btAlignedObjectArray m_forces; public: DeformableRigid(struct GUIHelperInterface* helper) : CommonRigidBodyBase(helper) @@ -240,11 +240,11 @@ void DeformableRigid::initPhysics() btDeformableMassSpringForce* mass_spring = new btDeformableMassSpringForce(2,0.01, false); getDeformableDynamicsWorld()->addForce(psb, mass_spring); - forces.push_back(mass_spring); + m_forces.push_back(mass_spring); btDeformableGravityForce* gravity_force = new btDeformableGravityForce(gravity); getDeformableDynamicsWorld()->addForce(psb, gravity_force); - forces.push_back(gravity_force); + m_forces.push_back(gravity_force); // add a few rigid bodies Ctor_RbUpStack(1); } @@ -269,11 +269,12 @@ void DeformableRigid::exitPhysics() delete obj; } // delete forces - for (int j = 0; j < forces.size(); j++) + for (int j = 0; j < m_forces.size(); j++) { - btDeformableLagrangianForce* force = forces[j]; + btDeformableLagrangianForce* force = m_forces[j]; delete force; } + m_forces.clear(); //delete collision shapes for (int j = 0; j < m_collisionShapes.size(); j++) { diff --git a/examples/DeformableDemo/GraspDeformable.cpp b/examples/DeformableDemo/GraspDeformable.cpp index 341f4c737..b5cc66626 100644 --- a/examples/DeformableDemo/GraspDeformable.cpp +++ b/examples/DeformableDemo/GraspDeformable.cpp @@ -59,7 +59,7 @@ static bool supportsJointMotor(btMultiBody* mb, int mbLinkIndex) class GraspDeformable : public CommonRigidBodyBase { - btAlignedObjectArray forces; + btAlignedObjectArray m_forces; public: GraspDeformable(struct GUIHelperInterface* helper) : CommonRigidBodyBase(helper) @@ -359,15 +359,15 @@ void GraspDeformable::initPhysics() btDeformableMassSpringForce* mass_spring = new btDeformableMassSpringForce(.5,0.04, true); getDeformableDynamicsWorld()->addForce(psb, mass_spring); - forces.push_back(mass_spring); + m_forces.push_back(mass_spring); btDeformableGravityForce* gravity_force = new btDeformableGravityForce(gravity); getDeformableDynamicsWorld()->addForce(psb, gravity_force); - forces.push_back(gravity_force); + m_forces.push_back(gravity_force); btDeformableNeoHookeanForce* neohookean = new btDeformableNeoHookeanForce(2,10); getDeformableDynamicsWorld()->addForce(psb, neohookean); - forces.push_back(neohookean); + m_forces.push_back(neohookean); } // // create a piece of cloth @@ -440,11 +440,13 @@ void GraspDeformable::exitPhysics() delete obj; } // delete forces - for (int j = 0; j < forces.size(); j++) + for (int j = 0; j < m_forces.size(); j++) { - btDeformableLagrangianForce* force = forces[j]; + btDeformableLagrangianForce* force = m_forces[j]; delete force; } + m_forces.clear(); + //delete collision shapes for (int j = 0; j < m_collisionShapes.size(); j++) { diff --git a/examples/DeformableDemo/Pinch.cpp b/examples/DeformableDemo/Pinch.cpp index 3685869a0..661698a06 100644 --- a/examples/DeformableDemo/Pinch.cpp +++ b/examples/DeformableDemo/Pinch.cpp @@ -56,7 +56,7 @@ struct TetraBunny class Pinch : public CommonRigidBodyBase { - btAlignedObjectArray forces; + btAlignedObjectArray m_forces; public: Pinch(struct GUIHelperInterface* helper) : CommonRigidBodyBase(helper) @@ -339,15 +339,15 @@ void Pinch::initPhysics() btDeformableMassSpringForce* mass_spring = new btDeformableMassSpringForce(1,0.05); getDeformableDynamicsWorld()->addForce(psb, mass_spring); - forces.push_back(mass_spring); + m_forces.push_back(mass_spring); btDeformableGravityForce* gravity_force = new btDeformableGravityForce(gravity); getDeformableDynamicsWorld()->addForce(psb, gravity_force); - forces.push_back(gravity_force); + m_forces.push_back(gravity_force); btDeformableNeoHookeanForce* neohookean = new btDeformableNeoHookeanForce(.2,1); getDeformableDynamicsWorld()->addForce(psb, neohookean); - forces.push_back(neohookean); + m_forces.push_back(neohookean); // add a grippers createGrip(); } @@ -372,11 +372,12 @@ void Pinch::exitPhysics() delete obj; } // delete forces - for (int j = 0; j < forces.size(); j++) + for (int j = 0; j < m_forces.size(); j++) { - btDeformableLagrangianForce* force = forces[j]; + btDeformableLagrangianForce* force = m_forces[j]; delete force; } + m_forces.clear(); //delete collision shapes for (int j = 0; j < m_collisionShapes.size(); j++) { diff --git a/examples/DeformableDemo/VolumetricDeformable.cpp b/examples/DeformableDemo/VolumetricDeformable.cpp index b6657de0c..cff07a175 100644 --- a/examples/DeformableDemo/VolumetricDeformable.cpp +++ b/examples/DeformableDemo/VolumetricDeformable.cpp @@ -51,7 +51,7 @@ struct TetraCube class VolumetricDeformable : public CommonRigidBodyBase { - btAlignedObjectArray forces; + btAlignedObjectArray m_forces; public: VolumetricDeformable(struct GUIHelperInterface* helper) : CommonRigidBodyBase(helper) @@ -238,15 +238,15 @@ void VolumetricDeformable::initPhysics() btDeformableMassSpringForce* mass_spring = new btDeformableMassSpringForce(0,0.03); getDeformableDynamicsWorld()->addForce(psb, mass_spring); - forces.push_back(mass_spring); + m_forces.push_back(mass_spring); btDeformableGravityForce* gravity_force = new btDeformableGravityForce(gravity); getDeformableDynamicsWorld()->addForce(psb, gravity_force); - forces.push_back(gravity_force); + m_forces.push_back(gravity_force); btDeformableNeoHookeanForce* neohookean = new btDeformableNeoHookeanForce(.5,2.5); getDeformableDynamicsWorld()->addForce(psb, neohookean); - forces.push_back(neohookean); + m_forces.push_back(neohookean); } // add a few rigid bodies @@ -273,12 +273,13 @@ void VolumetricDeformable::exitPhysics() delete obj; } // delete forces - for (int j = 0; j < forces.size(); j++) + for (int j = 0; j < m_forces.size(); j++) { - btDeformableLagrangianForce* force = forces[j]; + btDeformableLagrangianForce* force = m_forces[j]; delete force; } - + m_forces.clear(); + //delete collision shapes for (int j = 0; j < m_collisionShapes.size(); j++) {