[Opal-commits] opal/src BlueprintManager.cpp,1.29,1.30 Defines.h,1.65,1.66 EventHandler.h,1.19,1.20
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-03-05 21:26:35
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5467/src Modified Files: BlueprintManager.cpp Defines.h EventHandler.h Joint.cpp Joint.h Motor.cpp Motor.h ShapeData.h Simulator.cpp Simulator.h SolidData.cpp opal.h Removed Files: RayShapeData.h Log Message: removed the Ray Shape; it should only be used for raycasting, not as an actual Shape attached to Solids Index: opal.h =================================================================== RCS file: /cvsroot/opal/opal/src/opal.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** opal.h 26 Feb 2005 10:22:23 -0000 1.18 --- opal.h 5 Mar 2005 21:26:24 -0000 1.19 *************** *** 37,41 **** #include "CapsuleShapeData.h" #include "PlaneShapeData.h" - #include "RayShapeData.h" #include "MeshShapeData.h" #include "Motor.h" --- 37,40 ---- Index: Defines.h =================================================================== RCS file: /cvsroot/opal/opal/src/Defines.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Defines.h 4 Mar 2005 23:26:53 -0000 1.65 --- Defines.h 5 Mar 2005 21:26:24 -0000 1.66 *************** *** 297,300 **** --- 297,301 ---- { const Material material = opal::globals::woodMaterial; + const unsigned int contactGroup = 0; const Vec3r boxDimensions = Vec3r(1, 1, 1); const real sphereRadius = 1; *************** *** 302,307 **** const real capsuleLength = 1; const real planeABCD[4] = {0, 1, 0, 0}; ! const Point3r rayOrigin = Point3r(0, 0, 0); ! const Vec3r rayDir = Vec3r(0, 0, -1); } --- 303,308 ---- const real capsuleLength = 1; const real planeABCD[4] = {0, 1, 0, 0}; ! //const Point3r rayOrigin = Point3r(0, 0, 0); ! //const Vec3r rayDir = Vec3r(0, 0, -1); } Index: Motor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Motor.h 25 Feb 2005 06:40:26 -0000 1.35 --- Motor.h 5 Mar 2005 21:26:24 -0000 1.36 *************** *** 42,49 **** /// attain a desired state, users should use a Motor that takes a /// desired position or velocity, automatically applying forces every ! /// time step to attain that state. Custom Motors can be created by ! /// subclassing the base Motor class, implementing a few virtual ! /// functions, and adding Motor instances to the simulation via the ! /// Simulator class (see Simulator for details). All Motors start out /// disabled and must be initialized via init before they can be /// enabled. --- 42,46 ---- /// attain a desired state, users should use a Motor that takes a /// desired position or velocity, automatically applying forces every ! /// time step to attain that state. All Motors start out /// disabled and must be initialized via init before they can be /// enabled. *************** *** 88,95 **** /// Sets whether this is a custom Motor. Used internally to /// track custom Motors which must not be destroyed by OPAL. ! virtual void OPAL_CALL internal_setCustom(bool c); /// Returns true if this is a custom Motor. ! virtual bool OPAL_CALL internal_isCustom(); protected: --- 85,92 ---- /// Sets whether this is a custom Motor. Used internally to /// track custom Motors which must not be destroyed by OPAL. ! //virtual void OPAL_CALL internal_setCustom(bool c); /// Returns true if this is a custom Motor. ! //virtual bool OPAL_CALL internal_isCustom(); protected: *************** *** 106,110 **** /// True if this is a custom Motor. This is used to ensure that /// custom Motors are not destroyed by OPAL. ! bool mIsCustom; /// True if the Motor has been initialized. Some Motors use --- 103,107 ---- /// True if this is a custom Motor. This is used to ensure that /// custom Motors are not destroyed by OPAL. ! //bool mIsCustom; /// True if the Motor has been initialized. Some Motors use Index: ShapeData.h =================================================================== RCS file: /cvsroot/opal/opal/src/ShapeData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ShapeData.h 1 Mar 2005 05:04:22 -0000 1.4 --- ShapeData.h 5 Mar 2005 21:26:24 -0000 1.5 *************** *** 40,44 **** CAPSULE_SHAPE, PLANE_SHAPE, ! RAY_SHAPE, MESH_SHAPE }; --- 40,44 ---- CAPSULE_SHAPE, PLANE_SHAPE, ! //RAY_SHAPE, MESH_SHAPE }; Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Simulator.h 4 Mar 2005 23:26:53 -0000 1.78 --- Simulator.h 5 Mar 2005 21:26:24 -0000 1.79 *************** *** 147,150 **** --- 147,159 ---- virtual void* OPAL_CALL getUserData(); + /// Defines the interaction between two contact groups. If the + /// last argument is true, the two groups will generate physical + /// points when they collide. Otherwise, they will pass through + /// each other. This does not affect collision events; two + /// colliding objects might not generate contacts but still + /// generate collision events. + virtual void OPAL_CALL setupContactGroups(unsigned int group0, + unsigned int group1, bool makeContacts); + // SOLIDS *************** *** 191,195 **** /// Inform the Simulator of a custom Motor. Custom Motors are /// allocated and deallocated by the user ! virtual void OPAL_CALL registerCustomMotor(Motor* m); /// Marks the given Motor as garbage. --- 200,204 ---- /// Inform the Simulator of a custom Motor. Custom Motors are /// allocated and deallocated by the user ! //virtual void OPAL_CALL registerCustomMotor(Motor* m); /// Marks the given Motor as garbage. *************** *** 307,310 **** --- 316,323 ---- std::vector<Space*> mSpaceList; + /// A set of bitfields used to describe how different contact groups + /// interact. + unsigned long int mContactGroupFlags[32]; + private: }; --- RayShapeData.h DELETED --- Index: Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Joint.cpp 1 Mar 2005 05:04:22 -0000 1.23 --- Joint.cpp 5 Mar 2005 21:26:24 -0000 1.24 *************** *** 80,84 **** } ! void Joint::restoreAccumDamage() { mData.accumDamage = 0; --- 80,84 ---- } ! void Joint::repairAccumDamage() { mData.accumDamage = 0; Index: EventHandler.h =================================================================== RCS file: /cvsroot/opal/opal/src/EventHandler.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** EventHandler.h 18 Feb 2005 23:59:36 -0000 1.19 --- EventHandler.h 5 Mar 2005 21:26:24 -0000 1.20 *************** *** 64,69 **** {} ! /// Called when two Solids collide. Returns true if collision ! /// contacts should be generated between the two Solids. virtual bool OPAL_CALL handleCollisionEvent( const CollisionEvent& event) --- 64,69 ---- {} ! /// Called when two Solids collide. The first Solid in the ! /// CollisionEvent is the one whose event handler got called. virtual bool OPAL_CALL handleCollisionEvent( const CollisionEvent& event) Index: Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.h,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** Joint.h 4 Mar 2005 23:26:53 -0000 1.61 --- Joint.h 5 Mar 2005 21:26:24 -0000 1.62 *************** *** 82,88 **** real breakThresh, real accumThresh=0); ! /// Restores accumulated damage to breakable Joints in accumulated /// damage mode. This does not reenable the Joint. ! virtual void OPAL_CALL restoreAccumDamage(); /// Sets the Joint's event handler. --- 82,88 ---- real breakThresh, real accumThresh=0); ! /// Repairs accumulated damage to breakable Joints in accumulated /// damage mode. This does not reenable the Joint. ! virtual void OPAL_CALL repairAccumDamage(); /// Sets the Joint's event handler. Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** BlueprintManager.cpp 4 Mar 2005 23:26:53 -0000 1.29 --- BlueprintManager.cpp 5 Mar 2005 21:26:23 -0000 1.30 *************** *** 31,35 **** #include "CapsuleShapeData.h" #include "PlaneShapeData.h" - #include "RayShapeData.h" #include "MotorData.h" #include "AttractorMotorData.h" --- 31,34 ---- *************** *** 1278,1296 **** planeData->abcd[3] = getAttributeReal(dimensionsNodePtr, "d"); } ! else if ("ray" == type) ! { ! RayShapeData* rayData = new RayShapeData(); ! data = rayData; ! Point3r origin; ! origin[0] = getAttributeReal(dimensionsNodePtr, "originx"); ! origin[1] = getAttributeReal(dimensionsNodePtr, "originy"); ! origin[2] = getAttributeReal(dimensionsNodePtr, "originz"); ! rayData->ray.setOrigin(origin); ! Vec3r dir; ! dir[0] = getAttributeReal(dimensionsNodePtr, "dirx"); ! dir[1] = getAttributeReal(dimensionsNodePtr, "diry"); ! dir[2] = getAttributeReal(dimensionsNodePtr, "dirz"); ! rayData->ray.setDir(dir); ! } // MESH_SHAPE type not supported in OPAL XML. else --- 1277,1295 ---- planeData->abcd[3] = getAttributeReal(dimensionsNodePtr, "d"); } ! //else if ("ray" == type) ! //{ ! // RayShapeData* rayData = new RayShapeData(); ! // data = rayData; ! // Point3r origin; ! // origin[0] = getAttributeReal(dimensionsNodePtr, "originx"); ! // origin[1] = getAttributeReal(dimensionsNodePtr, "originy"); ! // origin[2] = getAttributeReal(dimensionsNodePtr, "originz"); ! // rayData->ray.setOrigin(origin); ! // Vec3r dir; ! // dir[0] = getAttributeReal(dimensionsNodePtr, "dirx"); ! // dir[1] = getAttributeReal(dimensionsNodePtr, "diry"); ! // dir[2] = getAttributeReal(dimensionsNodePtr, "dirz"); ! // rayData->ray.setDir(dir); ! //} // MESH_SHAPE type not supported in OPAL XML. else Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Simulator.cpp 3 Mar 2005 04:39:55 -0000 1.41 --- Simulator.cpp 5 Mar 2005 21:26:24 -0000 1.42 *************** *** 32,36 **** #include "CapsuleShapeData.h" #include "PlaneShapeData.h" - #include "RayShapeData.h" namespace opal --- 32,35 ---- *************** *** 102,106 **** // TODO: Call some user-defined function here... ! // Update sensors. std::vector<Sensor*>::iterator sensorIter; for (sensorIter = mSensorList.begin(); --- 101,105 ---- // TODO: Call some user-defined function here... ! // Update Sensors. std::vector<Sensor*>::iterator sensorIter; for (sensorIter = mSensorList.begin(); *************** *** 110,114 **** } ! // Update motors. std::vector<Motor*>::iterator motorIter; for (motorIter = mMotorList.begin(); --- 109,113 ---- } ! // Update Motors. std::vector<Motor*>::iterator motorIter; for (motorIter = mMotorList.begin(); *************** *** 126,162 **** } ! // Update joints, check for broken joints. std::vector<Joint*>::iterator jointIter; for (jointIter = mJointList.begin(); ! jointIter != mJointList.end();) { ! Joint* j = (*jointIter); ! j->internal_update(); ! ! // Don't automatically destroy the Joint anymore; just notify ! // the user and let them handle it. ! ! //if (j->internal_isBroken()) ! //{ ! // // Send a Joint break event. ! // j->internal_handleJointBreakEvent(); ! ! // //// don't use Simulator::destroyJoint here because that would loop ! // //// over the joints multiple times; ! // //// swap the element to be deleted with the last element ! // //std::swap(j, mJointList.back()); ! ! // //// update iterator ! // //(*jointIter) = j; ! ! // //// delete the last element ! // //delete mJointList.back(); ! // //mJointList.pop_back(); ! // destroyJoint(j); ! //} ! //else ! //{ ! ++jointIter; ! //} } --- 125,136 ---- } ! // Update Joints. std::vector<Joint*>::iterator jointIter; for (jointIter = mJointList.begin(); ! jointIter != mJointList.end(); ++jointIter) { ! // If the Joint gets broken here, it will automatically ! // send a Joint break event. ! (*jointIter)->internal_update(); } *************** *** 353,365 **** break; } ! case RAY_SHAPE: ! { ! RayShapeData* rayData = ! (RayShapeData*)shapeData; ! Point3r origin = rayData->ray.getOrigin(); ! origin = scale * origin; ! rayData->ray.setOrigin(origin); ! break; ! } case MESH_SHAPE: { --- 327,339 ---- break; } ! //case RAY_SHAPE: ! //{ ! // RayShapeData* rayData = ! // (RayShapeData*)shapeData; ! // Point3r origin = rayData->ray.getOrigin(); ! // origin = scale * origin; ! // rayData->ray.setOrigin(origin); ! // break; ! //} case MESH_SHAPE: { *************** *** 572,575 **** --- 546,567 ---- } + void Simulator::setupContactGroups(unsigned int group0, + unsigned int group1, bool makeContacts) + { + // The interaction always goes both ways, so we need to set the bit + // flags both ways. + unsigned long int group0Bit = 1 << group0; + unsigned long int group1Bit = 1 << group1; + + if (makeContacts) + { + //m + } + else + { + + } + } + void Simulator::destroySolid(Solid* s) { *************** *** 644,652 **** } ! void Simulator::registerCustomMotor(Motor* m) ! { ! m->internal_setCustom(true); ! addMotor(m); ! } void Simulator::destroyMotor(Motor* m) --- 636,644 ---- } ! //void Simulator::registerCustomMotor(Motor* m) ! //{ ! // m->internal_setCustom(true); ! // addMotor(m); ! //} void Simulator::destroyMotor(Motor* m) *************** *** 814,821 **** if(mMotorList[i] == m) { ! if (!m->internal_isCustom()) ! { ! delete m; ! } mMotorList[i] = mMotorList.back(); mMotorList.pop_back(); --- 806,814 ---- if(mMotorList[i] == m) { ! //if (!m->internal_isCustom()) ! //{ ! // delete m; ! //} ! delete m; mMotorList[i] = mMotorList.back(); mMotorList.pop_back(); Index: SolidData.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/SolidData.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SolidData.cpp 1 Mar 2005 05:04:22 -0000 1.2 --- SolidData.cpp 5 Mar 2005 21:26:24 -0000 1.3 *************** *** 31,35 **** #include "CapsuleShapeData.h" #include "PlaneShapeData.h" - #include "RayShapeData.h" #include "MeshShapeData.h" --- 31,34 ---- *************** *** 87,95 **** break; } ! case RAY_SHAPE: ! { ! newShape = new RayShapeData((RayShapeData&)data); ! break; ! } case MESH_SHAPE: { --- 86,94 ---- break; } ! //case RAY_SHAPE: ! //{ ! // newShape = new RayShapeData((RayShapeData&)data); ! // break; ! //} case MESH_SHAPE: { Index: Motor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Motor.cpp 25 Feb 2005 06:40:26 -0000 1.14 --- Motor.cpp 5 Mar 2005 21:26:24 -0000 1.15 *************** *** 33,37 **** { // "mData" is initialized in its own constructor. ! mIsCustom = false; mInitCalled = false; setUserData(NULL); --- 33,37 ---- { // "mData" is initialized in its own constructor. ! //mIsCustom = false; mInitCalled = false; setUserData(NULL); *************** *** 68,79 **** } ! void Motor::internal_setCustom(bool c) ! { ! mIsCustom = c; ! } ! bool Motor::internal_isCustom() ! { ! return mIsCustom; ! } } --- 68,79 ---- } ! //void Motor::internal_setCustom(bool c) ! //{ ! // mIsCustom = c; ! //} ! //bool Motor::internal_isCustom() ! //{ ! // return mIsCustom; ! //} } |