[Opal-commits] opal/src Simulator.cpp,1.34,1.35 Simulator.h,1.73,1.74 SolidData.h,1.4,1.5
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-02-23 06:35:56
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19126/src Modified Files: Simulator.cpp Simulator.h SolidData.h Log Message: minor fixes Index: SolidData.h =================================================================== RCS file: /cvsroot/opal/opal/src/SolidData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SolidData.h 23 Feb 2005 04:56:49 -0000 1.4 --- SolidData.h 23 Feb 2005 06:35:46 -0000 1.5 *************** *** 31,34 **** --- 31,40 ---- #include "Defines.h" #include "ShapeData.h" + #include "BoxShapeData.h" + #include "SphereShapeData.h" + #include "CapsuleShapeData.h" + #include "PlaneShapeData.h" + #include "RayShapeData.h" + #include "MeshShapeData.h" namespace opal *************** *** 59,66 **** virtual ~SolidData() { ! while (!shapes.empty()) { ! delete shapes.back(); ! shapes.pop_back(); } } --- 65,134 ---- virtual ~SolidData() { ! destroyShapes(); ! } ! ! /// Adds a new Shape to the SolidData. This automatically ! /// allocates the right ShapeData type. ! virtual void OPAL_CALL addShape(const ShapeData& data) ! { ! ShapeData* newShape = NULL; ! ! switch(data.getType()) { ! case BOX_SHAPE: ! { ! newShape = new BoxShapeData((BoxShapeData&)data); ! break; ! } ! case SPHERE_SHAPE: ! { ! newShape = new SphereShapeData((SphereShapeData&)data); ! break; ! } ! case CAPSULE_SHAPE: ! { ! newShape = new CapsuleShapeData((CapsuleShapeData&)data); ! break; ! } ! case PLANE_SHAPE: ! { ! newShape = new PlaneShapeData((PlaneShapeData&)data); ! break; ! } ! case RAY_SHAPE: ! { ! newShape = new RayShapeData((RayShapeData&)data); ! break; ! } ! case MESH_SHAPE: ! { ! newShape = new MeshShapeData((MeshShapeData&)data); ! break; ! } ! default: ! assert(false); ! } ! ! mShapes.push_back(newShape); ! } ! ! /// Returns the number of Shapes in this SolidData. ! virtual int OPAL_CALL getNumShapes()const ! { ! return (int)(mShapes.size()); ! } ! /// Returns a pointer to the ShapeData at the given index. ! virtual ShapeData* OPAL_CALL getShapeData(unsigned int i)const ! { ! return mShapes.at(i); ! } ! ! /// Destroys all Shapes in the SolidData. ! virtual void OPAL_CALL destroyShapes() ! { ! while (!mShapes.empty()) ! { ! delete mShapes.back(); ! mShapes.pop_back(); } } *************** *** 95,101 **** real linearDamping; real angularDamping; ! std::vector<ShapeData*> shapes; ! protected: private: --- 163,169 ---- real linearDamping; real angularDamping; ! protected: + std::vector<ShapeData*> mShapes; private: Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Simulator.cpp 22 Feb 2005 01:25:55 -0000 1.34 --- Simulator.cpp 23 Feb 2005 06:35:46 -0000 1.35 *************** *** 66,70 **** } ! internal_collectGarbage(); while (!mSpaceList.empty()) --- 66,70 ---- } ! collectGarbage(); while (!mSpaceList.empty()) *************** *** 220,224 **** // Deallocate memory here now that it's safe. ! internal_collectGarbage(); return stepOccurred; --- 220,224 ---- // Deallocate memory here now that it's safe. ! collectGarbage(); return stepOccurred; *************** *** 741,745 **** } ! void Simulator::internal_collectGarbage() { for (size_t i=0; i<mSolidGarbageList.size(); ++i) --- 741,745 ---- } ! void Simulator::collectGarbage() { for (size_t i=0; i<mSolidGarbageList.size(); ++i) Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** Simulator.h 22 Feb 2005 01:25:55 -0000 1.73 --- Simulator.h 23 Feb 2005 06:35:46 -0000 1.74 *************** *** 132,136 **** /// A convenient volume collision check function. TODO: replace ! /// with a Sensor. virtual void OPAL_CALL collide(const Solid* solid, std::vector<Solid*>* solids) = 0; --- 132,138 ---- /// A convenient volume collision check function. TODO: replace ! /// with a Sensor. TODO: the vector pointer here is bad because ! /// memory is allocated within the DLL and deallocated on the ! /// user's side virtual void OPAL_CALL collide(const Solid* solid, std::vector<Solid*>* solids) = 0; *************** *** 138,143 **** /// A convenient ray casting function. TODO: replace with a /// Sensor. ! virtual void OPAL_CALL shootRay(const Point3r& origin, ! const Vec3r& dir, real length, RayHit& rayHit) = 0; /// Sets the gravity used in the simulation. --- 140,145 ---- /// A convenient ray casting function. TODO: replace with a /// Sensor. ! virtual RayHit OPAL_CALL shootRay(const Point3r& origin, ! const Vec3r& dir, real length) = 0; /// Sets the gravity used in the simulation. *************** *** 145,149 **** /// Returns the gravity used in the simulation. ! virtual void OPAL_CALL getGravity(Vec3r& gravity)const = 0; virtual void OPAL_CALL setSleepiness(real value); --- 147,151 ---- /// Returns the gravity used in the simulation. ! virtual Vec3r OPAL_CALL getGravity()const = 0; virtual void OPAL_CALL setSleepiness(real value); *************** *** 268,272 **** /// Destroys all objects in the Simulator marked as garbage. ! void internal_collectGarbage(); /// Adds a Solid to the internal list of Solids. --- 270,274 ---- /// Destroys all objects in the Simulator marked as garbage. ! void collectGarbage(); /// Adds a Solid to the internal list of Solids. |