[Opal-commits] opal/src/ODE ODESimulator.cpp,1.95,1.96 ODESolid.cpp,1.81,1.82 ODESolid.h,1.67,1.68
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-04-06 04:48:53
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1764/src/ODE Modified Files: ODESimulator.cpp ODESolid.cpp ODESolid.h Log Message: minor changes; added stuff to sample app Index: ODESolid.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.h,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** ODESolid.h 4 Apr 2005 13:09:11 -0000 1.67 --- ODESolid.h 6 Apr 2005 04:48:45 -0000 1.68 *************** *** 121,124 **** --- 121,126 ---- //virtual void OPAL_CALL setFastRotationAxis(Vec3r axis); + virtual void OPAL_CALL zeroForces(); + virtual real OPAL_CALL getMass()const; Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** ODESimulator.cpp 30 Mar 2005 23:26:23 -0000 1.95 --- ODESimulator.cpp 6 Apr 2005 04:48:44 -0000 1.96 *************** *** 146,153 **** dBodyID bodyID = ((ODESolid*)solid)->internal_getBodyID(); ! dBodySetLinearVel(bodyID, 0.0, 0.0, 0.0); ! dBodySetAngularVel(bodyID, 0.0, 0.0, 0.0); ! dBodySetForce(bodyID, 0.0, 0.0, 0.0); ! dBodySetTorque(bodyID, 0.0, 0.0, 0.0); } else --- 146,153 ---- dBodyID bodyID = ((ODESolid*)solid)->internal_getBodyID(); ! dBodySetLinearVel(bodyID, 0, 0, 0); ! dBodySetAngularVel(bodyID, 0, 0, 0); ! dBodySetForce(bodyID, 0, 0, 0); ! dBodySetTorque(bodyID, 0, 0, 0); } else *************** *** 502,505 **** --- 502,507 ---- // Average the hardness of the two materials. + assert(m0->hardness >= 0 && m0->hardness <= 1 + && m1->hardness >= 0 && m1->hardness <= 1); real hardness = (m0->hardness + m1->hardness) * (real)0.5; *************** *** 519,522 **** --- 521,526 ---- // to max, though it is set to dInfinity when // friction == 1.0. + assert(m0->friction >= 0 && m0->friction <= 1 + && m1->friction >= 0 && m1->friction <= 1); if (1.0 == m0->friction && 1.0 == m1->friction) { *************** *** 531,534 **** --- 535,540 ---- // Average the bounciness of the two materials. + assert(m0->bounciness >= 0 && m0->bounciness <= 1 + && m1->bounciness >= 0 && m1->bounciness <= 1); real bounciness = (m0->bounciness + m1->bounciness) * (real)0.5; *************** *** 1023,1068 **** } - //void ODESimulator::setDefaultSleepiness(real value) - //{ - // Simulator::setDefaultSleepiness(value); - - // if (0 == value) - // { - // // No default sleeping for new Solids. - // dWorldSetAutoDisableFlag(mWorldID, false); - // } - // else - // { - // // Enable default sleeping for new Solids. - // dWorldSetAutoDisableFlag(mWorldID, true); - // } - - // // As value goes from 0.0 to 1.0: - // // AutoDisableLinearThreshold goes from min to max, - // // AutoDisableAngularThreshold goes from min to max, - // // AutoDisableSteps goes from max to min, - // // AutoDisableTime goes from max to min. - - // real range = defaults::ode::autoDisableLinearMax - - // defaults::ode::autoDisableLinearMin; - // dWorldSetAutoDisableLinearThreshold(mWorldID, value * range + - // defaults::ode::autoDisableLinearMin); - - // range = defaults::ode::autoDisableAngularMax - - // defaults::ode::autoDisableAngularMin; - // dWorldSetAutoDisableAngularThreshold(mWorldID, value * range + - // defaults::ode::autoDisableAngularMin); - - // range = (real)(defaults::ode::autoDisableStepsMax - - // defaults::ode::autoDisableStepsMin); - // dWorldSetAutoDisableSteps(mWorldID, - // (int)((real)defaults::ode::autoDisableStepsMax - value * range)); - - // range = defaults::ode::autoDisableTimeMax - - // defaults::ode::autoDisableTimeMin; - // dWorldSetAutoDisableTime(mWorldID, - // defaults::ode::autoDisableTimeMax - value * range); - //} - void ODESimulator::setSolverAccuracy(SolverAccuracyLevel level) { --- 1029,1032 ---- Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** ODESolid.cpp 4 Apr 2005 13:09:10 -0000 1.81 --- ODESolid.cpp 6 Apr 2005 04:48:45 -0000 1.82 *************** *** 481,484 **** --- 481,486 ---- void ODESolid::addShape(const ShapeData& data) { + assert(data.material.density >= 0); + dGeomID newGeomID = NULL; dGeomID newTransformID = NULL; *************** *** 826,829 **** --- 828,845 ---- //} + void ODESolid::zeroForces() + { + if (!mData.isStatic) + { + dBodySetForce(mBodyID, 0, 0, 0); + dBodySetTorque(mBodyID, 0, 0, 0); + + while (!mForceList.empty()) + { + mForceList.pop_back(); + } + } + } + real ODESolid::getMass()const { |