[Opal-commits] opal/src/ODE ODEJoint.cpp,1.24,1.25 ODEJoint.h,1.28,1.29 ODESimulator.cpp,1.79,1.80 O
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-02-25 06:40:37
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5241/src/ODE Modified Files: ODEJoint.cpp ODEJoint.h ODESimulator.cpp ODESimulator.h ODESolid.cpp ODESolid.h Log Message: updated XML parsing to reflect new object creation method Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** ODESimulator.cpp 23 Feb 2005 06:35:46 -0000 1.79 --- ODESimulator.cpp 25 Feb 2005 06:40:26 -0000 1.80 *************** *** 76,80 **** setSolverAccuracy(defaults::solverAccuracy); ! setSleepiness(defaults::sleepiness); mCollisionCount = 0; } --- 76,80 ---- setSolverAccuracy(defaults::solverAccuracy); ! //setDefaultSleepiness(defaults::sleepiness); mCollisionCount = 0; } *************** *** 711,740 **** } ! void ODESimulator::collide(const Solid* solid, std::vector<Solid*>* solids) ! { ! mCollisionCount++; ! mCollidedSolids.clear(); ! const std::vector<GeomData*>* geomList = ! ((ODESolid*)solid)->internal_getGeomDataList(); ! ! //check for collisions; this will fill up mCollidedSolids ! std::vector<GeomData*>::const_iterator iter; ! for (iter = geomList->begin(); iter != geomList->end(); ++iter) ! { ! dSpaceCollide2((*iter)->geomID, (dGeomID)mRootSpaceID, this, ! &ode_hidden::internal_pickingCollisionCallback); ! } ! std::vector<Solid*>::iterator solidIter; ! for (solidIter = mCollidedSolids.begin(); ! solidIter != mCollidedSolids.end(); ++solidIter) ! { ! //we don't want the picking solid to be added ! if (*solidIter != solid) ! { ! solids->push_back(*solidIter); ! } ! } ! } RayHit ODESimulator::shootRay(const Point3r& origin, const Vec3r& dir, --- 711,740 ---- } ! //void ODESimulator::collide(const Solid* solid, std::vector<Solid*>* solids) ! //{ ! // mCollisionCount++; ! // mCollidedSolids.clear(); ! // const std::vector<GeomData*>* geomList = ! // ((ODESolid*)solid)->internal_getGeomDataList(); ! // ! // //check for collisions; this will fill up mCollidedSolids ! // std::vector<GeomData*>::const_iterator iter; ! // for (iter = geomList->begin(); iter != geomList->end(); ++iter) ! // { ! // dSpaceCollide2((*iter)->geomID, (dGeomID)mRootSpaceID, this, ! // &ode_hidden::internal_pickingCollisionCallback); ! // } ! // std::vector<Solid*>::iterator solidIter; ! // for (solidIter = mCollidedSolids.begin(); ! // solidIter != mCollidedSolids.end(); ++solidIter) ! // { ! // //we don't want the picking solid to be added ! // if (*solidIter != solid) ! // { ! // solids->push_back(*solidIter); ! // } ! // } ! //} RayHit ODESimulator::shootRay(const Point3r& origin, const Vec3r& dir, *************** *** 779,825 **** } ! void ODESimulator::setSleepiness(real value) ! { ! assert(value >= 0.0 && value <= 1.0); ! ! if (0.0 == value) ! { ! //no sleeping at all ! dWorldSetAutoDisableFlag(mWorldID, false); ! } ! else ! { ! //enable sleeping ! 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); ! Simulator::setSleepiness(value); ! } void ODESimulator::setSolverAccuracy(SolverAccuracyLevel level) --- 779,823 ---- } ! //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) Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** ODESolid.cpp 23 Feb 2005 06:35:46 -0000 1.70 --- ODESolid.cpp 25 Feb 2005 06:40:26 -0000 1.71 *************** *** 123,126 **** --- 123,129 ---- setSleeping(data.sleeping); + // Set the Solid's sleepiness level. + setSleepiness(data.sleepiness); + // Set whether the Solid is enabled. setEnabled(data.enabled); *************** *** 267,270 **** --- 270,277 ---- mBodyID = dBodyCreate(mWorldID); + // Set the ODE sleepiness params using the stored Solid + // sleepiness param. + setSleepiness(mData.sleepiness); + // Set the position of the new body. dMatrix3 R = *************** *** 403,406 **** --- 410,463 ---- } + void ODESolid::setSleepiness(real s) + { + Solid::setSleepiness(s); + + /// If this Solid has no ODE body, just return. The sleepiness + /// level will still be saved and applied if this Solid ever + /// becomes dynamic. + if (mData.isStatic) + { + return; + } + + if (0 == s) + { + // No sleeping at all for the Solid. + dBodySetAutoDisableFlag(mBodyID, false); + } + else + { + // Enable sleeping for the Solid.. + dBodySetAutoDisableFlag(mBodyID, 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; + dBodySetAutoDisableLinearThreshold(mBodyID, s * range + + defaults::ode::autoDisableLinearMin); + + range = defaults::ode::autoDisableAngularMax - + defaults::ode::autoDisableAngularMin; + dBodySetAutoDisableAngularThreshold(mBodyID, s * range + + defaults::ode::autoDisableAngularMin); + + range = (real)(defaults::ode::autoDisableStepsMax - + defaults::ode::autoDisableStepsMin); + dBodySetAutoDisableSteps(mBodyID, + (int)((real)defaults::ode::autoDisableStepsMax - s * range)); + + range = defaults::ode::autoDisableTimeMax - + defaults::ode::autoDisableTimeMin; + dBodySetAutoDisableTime(mBodyID, + defaults::ode::autoDisableTimeMax - s * range); + } + void ODESolid::translateMass(const Vec3r& offset) { *************** *** 979,983 **** //} ! //bool ODESolid::getFastRotation() //{ // if (mStatic) --- 1036,1040 ---- //} ! //bool ODESolid::getFastRotation()const //{ // if (mStatic) *************** *** 1001,1005 **** //} ! real ODESolid::getMass() { if (mData.isStatic) --- 1058,1062 ---- //} ! real ODESolid::getMass()const { if (mData.isStatic) Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** ODESimulator.h 23 Feb 2005 06:35:46 -0000 1.55 --- ODESimulator.h 25 Feb 2005 06:40:26 -0000 1.56 *************** *** 75,80 **** //convenience collision check function ! virtual void OPAL_CALL collide(const Solid* solid, ! std::vector<Solid*>* solids); //convenience ray casting function --- 75,80 ---- //convenience collision check function ! //virtual void OPAL_CALL collide(const Solid* solid, ! // std::vector<Solid*>* solids); //convenience ray casting function *************** *** 86,90 **** virtual Vec3r OPAL_CALL getGravity()const; ! virtual void OPAL_CALL setSleepiness(real value); virtual void OPAL_CALL setSolverAccuracy(SolverAccuracyLevel level); --- 86,90 ---- virtual Vec3r OPAL_CALL getGravity()const; ! //virtual void OPAL_CALL setDefaultSleepiness(real value); virtual void OPAL_CALL setSolverAccuracy(SolverAccuracyLevel level); Index: ODEJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ODEJoint.h 23 Feb 2005 03:58:23 -0000 1.28 --- ODEJoint.h 25 Feb 2005 06:40:26 -0000 1.29 *************** *** 57,61 **** //virtual void OPAL_CALL setLimits(int axisNum, JointLimits l); ! //virtual const JointLimits& OPAL_CALL getLimits(int axisNum); virtual void OPAL_CALL setEnabled(bool e); --- 57,61 ---- //virtual void OPAL_CALL setLimits(int axisNum, JointLimits l); ! //virtual const JointLimits& OPAL_CALL getLimits(int axisNum)const; virtual void OPAL_CALL setEnabled(bool e); *************** *** 87,93 **** /// Helper function to make it easier to get parameters for /// various ODE Joint types. ! //real getJointParam(int parameter); ! /// Returns the current amount of stress on this Joint. virtual real calcStress(); --- 87,93 ---- /// Helper function to make it easier to get parameters for /// various ODE Joint types. ! //real getJointParam(int parameter)const; ! /// Returns the current amount of stress on this Joint. virtual real calcStress(); Index: ODESolid.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.h,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** ODESolid.h 23 Feb 2005 04:56:49 -0000 1.62 --- ODESolid.h 25 Feb 2005 06:40:26 -0000 1.63 *************** *** 77,80 **** --- 77,82 ---- virtual bool OPAL_CALL isSleeping()const; + virtual void OPAL_CALL setSleepiness(real s); + virtual void OPAL_CALL setStatic(bool s); *************** *** 132,136 **** //virtual void OPAL_CALL setFastRotation(bool fast); ! //virtual bool OPAL_CALL getFastRotation(); //virtual void OPAL_CALL setFastRotationAxis(Vec3r axis); --- 134,138 ---- //virtual void OPAL_CALL setFastRotation(bool fast); ! //virtual bool OPAL_CALL getFastRotation()const; //virtual void OPAL_CALL setFastRotationAxis(Vec3r axis); *************** *** 138,142 **** /// Returns the Solid's mass. This will return 0 if the Solid /// is static. ! virtual real OPAL_CALL getMass(); virtual void OPAL_CALL internal_updateOPALTransform(); --- 140,144 ---- /// Returns the Solid's mass. This will return 0 if the Solid /// is static. ! virtual real OPAL_CALL getMass()const; virtual void OPAL_CALL internal_updateOPALTransform(); Index: ODEJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ODEJoint.cpp 23 Feb 2005 03:58:23 -0000 1.24 --- ODEJoint.cpp 25 Feb 2005 06:40:26 -0000 1.25 *************** *** 310,314 **** //} ! //const JointLimits& ODEJoint::getLimits(int axisNum) //{ --- 310,314 ---- //} ! //const JointLimits& ODEJoint::getLimits(int axisNum)const //{ *************** *** 752,756 **** } ! //real ODEJoint::getJointParam(int parameter) //{ // real value = 0; --- 752,756 ---- } ! //real ODEJoint::getJointParam(int parameter)const //{ // real value = 0; *************** *** 793,801 **** switch(mData.breakMode) { ! case UNBREAKABLE: ! //don't waste time calculating the stress here break; ! case THRESHOLD: //fall through... ! case ACCUMULATED: { dJointFeedback* jf = dJointGetFeedback(mJointID); --- 793,802 ---- switch(mData.breakMode) { ! case UNBREAKABLE_MODE: ! // Nothing to do. break; ! case THRESHOLD_MODE: ! // Fall through... ! case ACCUMULATED_MODE: { dJointFeedback* jf = dJointGetFeedback(mJointID); *************** *** 805,809 **** Vec3r t2(jf->t2[0], jf->t2[1], jf->t2[2]); ! //this is a simplification, but it should still work currentStress = f1.length() + t1.length() + f2.length() + t2.length(); --- 806,810 ---- Vec3r t2(jf->t2[0], jf->t2[1], jf->t2[2]); ! // This is a simplification, but it should still work. currentStress = f1.length() + t1.length() + f2.length() + t2.length(); |