[Opal-commits] opal/src AccelerationSensor.cpp,1.3,1.4 AccelerationSensor.h,1.3,1.4 BlueprintManager
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-03-23 20:25:56
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22833/src Modified Files: AccelerationSensor.cpp AccelerationSensor.h BlueprintManager.cpp RaycastSensor.cpp RaycastSensorData.h SensorData.h Simulator.h Log Message: a bunch of minor updates Index: AccelerationSensor.h =================================================================== RCS file: /cvsroot/opal/opal/src/AccelerationSensor.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AccelerationSensor.h 23 Mar 2005 07:54:33 -0000 1.3 --- AccelerationSensor.h 23 Mar 2005 20:24:33 -0000 1.4 *************** *** 99,113 **** Simulator* mSim; ! /// Stored copy of the current global linear acceleration. ! Vec3r mGlobalLinearAccel; ! /// Stored copy of the current global angular acceleration. ! Vec3r mGlobalAngularAccel; ! /// Stored copy of the current local linear acceleration. ! Vec3r mLocalLinearAccel; ! /// Stored copy of the current local angular acceleration. ! Vec3r mLocalAngularAccel; /// Stored copy of the previous step's velocity data; used for --- 99,117 ---- Simulator* mSim; ! /// Stored copy of the current step's velocity data; used for ! /// acceleration calculations. ! Vec3r mCurrentGlobalLinearVel; ! /// Stored copy of the current step's velocity data; used for ! /// acceleration calculations. ! Vec3r mCurrentGlobalAngularVel; ! /// Stored copy of the current step's velocity data; used for ! /// acceleration calculations. ! Vec3r mCurrentLocalLinearVel; ! /// Stored copy of the current step's velocity data; used for ! /// acceleration calculations. ! Vec3r mCurrentLocalAngularVel; /// Stored copy of the previous step's velocity data; used for Index: AccelerationSensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/AccelerationSensor.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AccelerationSensor.cpp 23 Mar 2005 07:54:33 -0000 1.3 --- AccelerationSensor.cpp 23 Mar 2005 20:24:32 -0000 1.4 *************** *** 36,43 **** mSim = s; ! // "mGlobalLinearAccel" is initialized in its own constructor. ! // "mGlobalAngularAccel" is initialized in its own constructor. ! // "mLocalLinearAccel" is initialized in its own constructor. ! // "mLocalAngularAccel" is initialized in its own constructor. // "mPrevGlobalLinearVel" is initialized in its own constructor. --- 36,43 ---- mSim = s; ! // "mCurrentGlobalLinearVel" is initialized in its own constructor. ! // "mCurrentGlobalAngularVel" is initialized in its own constructor. ! // "mCurrentLocalLinearVel" is initialized in its own constructor. ! // "mCurrentLocalAngularVel" is initialized in its own constructor. // "mPrevGlobalLinearVel" is initialized in its own constructor. *************** *** 69,73 **** } ! return mGlobalLinearAccel; } --- 69,74 ---- } ! return (mCurrentGlobalLinearVel - mPrevGlobalLinearVel) / ! mSim->getStepSize(); } *************** *** 79,83 **** } ! return mGlobalAngularAccel; } --- 80,85 ---- } ! return (mCurrentGlobalAngularVel - mPrevGlobalAngularVel) / ! mSim->getStepSize(); } *************** *** 89,93 **** } ! return mLocalLinearAccel; } --- 91,96 ---- } ! return (mCurrentLocalLinearVel - mPrevLocalLinearVel) / ! mSim->getStepSize(); } *************** *** 99,103 **** } ! return mLocalAngularAccel; } --- 102,107 ---- } ! return (mCurrentLocalAngularVel - mPrevLocalAngularVel) / ! mSim->getStepSize(); } *************** *** 146,175 **** if (mData.enabled) { ! real dt = mSim->getStepSize(); ! ! Vec3r currentGlobalLinearVel = mData.solid->getGlobalLinearVelAtLocalPos( mData.transform.getPosition()); ! Vec3r currentGlobalAngularVel = mData.solid->getGlobalAngularVel(); ! Vec3r currentLocalLinearVel = mData.solid->getLocalLinearVelAtLocalPos( mData.transform.getPosition()); ! Vec3r currentLocalAngularVel = mData.solid->getLocalAngularVel(); ! mGlobalLinearAccel = (currentGlobalLinearVel - ! mPrevGlobalLinearVel) / dt; ! mGlobalAngularAccel = (currentGlobalAngularVel - ! mPrevGlobalAngularVel) / dt; ! mLocalLinearAccel = (currentLocalLinearVel - ! mPrevLocalLinearVel) / dt; ! mLocalAngularAccel = (currentLocalAngularVel - ! mPrevLocalAngularVel) / dt; ! ! mPrevGlobalLinearVel = currentGlobalLinearVel; ! mPrevGlobalAngularVel = currentGlobalAngularVel; ! mPrevLocalLinearVel = currentLocalLinearVel; ! mPrevLocalAngularVel = currentLocalAngularVel; } } --- 150,168 ---- if (mData.enabled) { ! mCurrentGlobalLinearVel = mData.solid->getGlobalLinearVelAtLocalPos( mData.transform.getPosition()); ! mCurrentGlobalAngularVel = mData.solid->getGlobalAngularVel(); ! mCurrentLocalLinearVel = mData.solid->getLocalLinearVelAtLocalPos( mData.transform.getPosition()); ! mCurrentLocalAngularVel = mData.solid->getLocalAngularVel(); ! mPrevGlobalLinearVel = mCurrentGlobalLinearVel; ! mPrevGlobalAngularVel = mCurrentGlobalAngularVel; ! mPrevLocalLinearVel = mCurrentLocalLinearVel; ! mPrevLocalAngularVel = mCurrentLocalAngularVel; } } Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** BlueprintManager.cpp 23 Mar 2005 07:54:33 -0000 1.35 --- BlueprintManager.cpp 23 Mar 2005 20:24:34 -0000 1.36 *************** *** 1333,1336 **** --- 1333,1347 ---- data->ray.setDir(dir); } + + // Load ContactGroup element if it exists. + paramNodePtr = + const_cast<TiXmlNode*>(nodePtr)->FirstChild("ContactGroup"); + if (NULL != paramNodePtr) + { + data->contactGroup = + (unsigned long int)getAttributeReal( + paramNodePtr, "value"); + } + #endif return data; *************** *** 1428,1432 **** } ! // Load Offset element. TiXmlNode* offsetNodePtr = const_cast<TiXmlNode*> (nodePtr)->FirstChild("Offset"); --- 1439,1443 ---- } ! // Load Offset element if it exists. TiXmlNode* offsetNodePtr = const_cast<TiXmlNode*> (nodePtr)->FirstChild("Offset"); *************** *** 1436,1440 **** } ! // Load Material element. TiXmlNode* materialNodePtr = const_cast<TiXmlNode*> (nodePtr)->FirstChild("Material"); --- 1447,1451 ---- } ! // Load Material element if it exists. TiXmlNode* materialNodePtr = const_cast<TiXmlNode*> (nodePtr)->FirstChild("Material"); *************** *** 1451,1454 **** --- 1462,1475 ---- } + // Load ContactGroup element if it exists. + TiXmlNode* contactGroupNodePtr = + const_cast<TiXmlNode*>(nodePtr)->FirstChild("ContactGroup"); + if (NULL != contactGroupNodePtr) + { + data->contactGroup = + (unsigned long int)getAttributeReal( + contactGroupNodePtr, "value"); + } + #endif return data; Index: SensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/SensorData.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SensorData.h 23 Mar 2005 07:54:34 -0000 1.8 --- SensorData.h 23 Mar 2005 20:24:47 -0000 1.9 *************** *** 69,73 **** } ! /// True if the Motor is enabled. bool enabled; --- 69,73 ---- } ! /// True if the Sensor is enabled. bool enabled; Index: RaycastSensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/RaycastSensorData.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RaycastSensorData.h 13 Mar 2005 23:07:10 -0000 1.3 --- RaycastSensorData.h 23 Mar 2005 20:24:47 -0000 1.4 *************** *** 43,46 **** --- 43,47 ---- mType = RAYCAST_SENSOR; // "ray" is initialized in its own constructor. + contactGroup = defaults::shape::contactGroup; } *************** *** 75,78 **** --- 76,84 ---- Rayr ray; + /// The ray's contact group. This can be used to limit which objects + /// the ray collides with. If this exceeds 31, bad things + /// might happen since there are only 32 groups. + unsigned long int contactGroup; + protected: Index: RaycastSensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/RaycastSensor.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RaycastSensor.cpp 23 Mar 2005 04:04:30 -0000 1.7 --- RaycastSensor.cpp 23 Mar 2005 20:24:36 -0000 1.8 *************** *** 75,79 **** // that Solid. ! return mSim->internal_fireRay(ray, length, mData.solid); } --- 75,80 ---- // that Solid. ! return mSim->internal_fireRay(ray, length, mData.solid, ! mData.contactGroup); } Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** Simulator.h 23 Mar 2005 07:54:34 -0000 1.89 --- Simulator.h 23 Mar 2005 20:24:47 -0000 1.90 *************** *** 241,247 **** /// Helper function used for ray casting. Immediately fires a ray ! /// into the scene and returns intersections results. virtual const RaycastResult& OPAL_CALL internal_fireRay( ! const Rayr& r, real length, const Solid* attachedSolid) = 0; /// Helper function used for volume queries. --- 241,249 ---- /// Helper function used for ray casting. Immediately fires a ray ! /// into the scene and returns intersections results. Uses the ! /// ray's contact group parameter to limit collision checks. virtual const RaycastResult& OPAL_CALL internal_fireRay( ! const Rayr& r, real length, const Solid* attachedSolid, ! unsigned long int rayContactGroup) = 0; /// Helper function used for volume queries. |