[Opal-commits] opal/src Blueprint.h,1.18,1.19 Defines.h,1.55,1.56 Joint.cpp,1.17,1.18 Joint.h,1.51,1
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-02-21 15:56:20
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13377/src Modified Files: Blueprint.h Defines.h Joint.cpp Joint.h Motor.cpp Motor.h Sensor.cpp Sensor.h Simulator.cpp Simulator.h Log Message: added userdata pointers to Joints, Motors, Sensors, and Simulators Index: Sensor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Sensor.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Sensor.h 19 Feb 2005 20:54:36 -0000 1.5 --- Sensor.h 21 Feb 2005 15:54:39 -0000 1.6 *************** *** 52,55 **** --- 52,63 ---- virtual void OPAL_CALL setEnabled(bool e); + /// Set the user data pointer to some external data. The user data + /// is totally user-managed + /// (i.e. it is not destroyed when the Sensor is destroyed). + virtual void OPAL_CALL setUserData(void* data); + + /// Returns the user data pointer (NULL if it has not been set). + virtual void* OPAL_CALL getUserData(); + /// Called regularly to update the Sensor. This does nothing if the /// Sensor is disabled. *************** *** 63,66 **** --- 71,78 ---- bool mEnabled; + /// Pointer to user data. This is totally user-managed (i.e. OPAL + /// will never delete it). + void* mUserData; + /// True if the Sensor has been initialized. bool mInitCalled; Index: Sensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Sensor.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Sensor.cpp 19 Feb 2005 20:54:36 -0000 1.2 --- Sensor.cpp 21 Feb 2005 15:54:38 -0000 1.3 *************** *** 34,37 **** --- 34,38 ---- mEnabled = false; mInitCalled = false; + setUserData(NULL); } *************** *** 55,58 **** --- 56,69 ---- } + void Sensor::setUserData(void* data) + { + mUserData = data; + } + + void* Sensor::getUserData() + { + return mUserData; + } + bool Sensor::internal_dependsOn(Solid* solid) { Index: Defines.h =================================================================== RCS file: /cvsroot/opal/opal/src/Defines.h,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Defines.h 19 Feb 2005 20:54:36 -0000 1.55 --- Defines.h 21 Feb 2005 15:54:35 -0000 1.56 *************** *** 119,131 **** }; - /// TODO: replace with SolidData struct - struct BodyState - { - Matrix44r transform; - Vec3r globalLinearVel; - Vec3r globalAngularVel; - }; - - /// Data structure describing material properties. These properties /// determine the collision response when two Solids collide. --- 119,122 ---- *************** *** 416,439 **** }; - /// TODO: replace with SolidData - struct SolidDescription - { - ~SolidDescription() - { - shapeList.clear(); - userProperties.clear(); - } - - // TODO: this needs an operator= - - std::string name; - Matrix44r transform; - bool isStatic; - real linearDamping; - real angularDamping; - std::vector<ShapeDescription> shapeList; - std::vector<UserProperty> userProperties; - }; - /// TODO: replace with SpaceData? struct SpaceDescription --- 407,410 ---- *************** *** 464,467 **** --- 435,466 ---- }; + /// TODO: replace with SolidData struct + struct BodyState + { + Matrix44r transform; + Vec3r globalLinearVel; + Vec3r globalAngularVel; + }; + + /// TODO: replace with SolidData + struct SolidDescription + { + ~SolidDescription() + { + shapeList.clear(); + userProperties.clear(); + } + + // TODO: this needs an operator= + + std::string name; + Matrix44r transform; + bool isStatic; + real linearDamping; + real angularDamping; + std::vector<ShapeDescription> shapeList; + std::vector<UserProperty> userProperties; + }; + /// TODO: expand this to include all Solid data struct SolidData Index: Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Joint.cpp 19 Feb 2005 20:54:36 -0000 1.17 --- Joint.cpp 21 Feb 2005 15:54:37 -0000 1.18 *************** *** 37,40 **** --- 37,41 ---- mSolid1 = NULL; mEventHandler = NULL; + setUserData(NULL); mInitCalled = false; mNumAxes = 0; *************** *** 283,286 **** --- 284,297 ---- } + void Joint::setUserData(void* data) + { + mUserData = data; + } + + void* Joint::getUserData() + { + return mUserData; + } + bool Joint::internal_dependsOn(Solid* solid) { Index: Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.h,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Joint.h 20 Feb 2005 06:28:34 -0000 1.51 --- Joint.h 21 Feb 2005 15:54:38 -0000 1.52 *************** *** 102,105 **** --- 102,106 ---- } + /// Copy constructor. JointData(const JointData& jd) { *************** *** 123,127 **** /// This is necessary because JointDatas contain an array. ! void operator= (const JointData& jd) { type = jd.type; --- 124,128 ---- /// This is necessary because JointDatas contain an array. ! void operator=(const JointData& jd) { type = jd.type; *************** *** 328,331 **** --- 329,340 ---- virtual bool OPAL_CALL isRotational(int axisNum); + /// Set the user data pointer to some external data. The user data + /// is totally user-managed + /// (i.e. it is not destroyed when the Joint is destroyed). + virtual void OPAL_CALL setUserData(void* data); + + /// Returns the user data pointer (NULL if it has not been set). + virtual void* OPAL_CALL getUserData(); + /// Various things could be updated here, including damage values. /// If the Joint breaks during this update, it will automatically *************** *** 380,383 **** --- 389,396 ---- EventHandler* mEventHandler; + /// Pointer to user data. This is totally user-managed (i.e. OPAL + /// will never delete it). + void* mUserData; + /// This is set to true when the Joint is initialized. bool mInitCalled; Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Simulator.cpp 19 Feb 2005 20:54:36 -0000 1.32 --- Simulator.cpp 21 Feb 2005 15:54:39 -0000 1.33 *************** *** 39,42 **** --- 39,43 ---- setMaxLinearVel(defaults::maxLinearVel); setMaxAngularVel(defaults::maxAngularVel); + setUserData(NULL); } *************** *** 452,455 **** --- 453,466 ---- //} + void Simulator::setUserData(void* data) + { + mUserData = data; + } + + void* Simulator::getUserData() + { + return mUserData; + } + void Simulator::destroySolid(Solid* s) { Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** Simulator.h 18 Feb 2005 23:59:37 -0000 1.71 --- Simulator.h 21 Feb 2005 15:54:40 -0000 1.72 *************** *** 140,143 **** --- 140,151 ---- virtual real OPAL_CALL getMaxAngularVel()const; + /// Set the user data pointer to some external data. The user data + /// is totally user-managed + /// (i.e. it is not destroyed when the Simulator is destroyed). + virtual void OPAL_CALL setUserData(void* data); + + /// Returns the user data pointer (NULL if it has not been set). + virtual void* OPAL_CALL getUserData(); + // SOLIDS *************** *** 263,266 **** --- 271,278 ---- AccuracyLevel mAccuracyLevel; + /// Pointer to user data. This is totally user-managed (i.e. OPAL + /// will never delete it). + void* mUserData; + //real mDefaultLinearDamping; //real mDefaultAngularDamping; Index: Blueprint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Blueprint.h 19 Feb 2005 20:54:36 -0000 1.18 --- Blueprint.h 21 Feb 2005 15:54:33 -0000 1.19 *************** *** 34,38 **** namespace opal { ! /// Blueprints are for storing a descriptions of groups of Solids, /// Joints, Motors, and/or Sensors. --- 34,38 ---- namespace opal { ! /// Blueprints are useful for saving and loading systems of Solids, /// Joints, Motors, and/or Sensors. Index: Motor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Motor.h 19 Feb 2005 20:54:36 -0000 1.32 --- Motor.h 21 Feb 2005 15:54:38 -0000 1.33 *************** *** 62,65 **** --- 62,73 ---- virtual void OPAL_CALL setEnabled(bool e); + /// Set the user data pointer to some external data. The user data + /// is totally user-managed + /// (i.e. it is not destroyed when the Motor is destroyed). + virtual void OPAL_CALL setUserData(void* data); + + /// Returns the user data pointer (NULL if it has not been set). + virtual void* OPAL_CALL getUserData(); + /// Called regularly to update the Motor. This does nothing if the /// Motor is disabled. *************** *** 86,89 **** --- 94,101 ---- bool mEnabled; + /// Pointer to user data. This is totally user-managed (i.e. OPAL + /// will never delete it). + void* mUserData; + /// True if this is a custom Motor. This is used to ensure that /// custom Motors are not destroyed by OPAL. Index: Motor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Motor.cpp 19 Feb 2005 20:54:36 -0000 1.11 --- Motor.cpp 21 Feb 2005 15:54:38 -0000 1.12 *************** *** 35,38 **** --- 35,39 ---- mIsCustom = false; mInitCalled = false; + setUserData(NULL); } *************** *** 62,65 **** --- 63,76 ---- } + void Motor::setUserData(void* data) + { + mUserData = data; + } + + void* Motor::getUserData() + { + return mUserData; + } + bool Motor::internal_dependsOn(Solid* solid) { |