[Opal-commits] opal/src/ODE ODEJoint.cpp,1.22,1.23 ODEJoint.h,1.26,1.27 ODESimulator.cpp,1.77,1.78 O
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-02-22 01:26:08
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17286/src/ODE Modified Files: ODEJoint.cpp ODEJoint.h ODESimulator.cpp ODESimulator.h ODESolid.cpp ODESolid.h Log Message: added new Data classes Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** ODESimulator.cpp 19 Feb 2005 20:54:37 -0000 1.77 --- ODESimulator.cpp 22 Feb 2005 01:25:56 -0000 1.78 *************** *** 27,31 **** #include "ODESimulator.h" ! #include <ode/config.h> namespace opal --- 27,32 ---- #include "ODESimulator.h" ! #include "../ShapeData.h" ! //#include <ode/config.h> namespace opal *************** *** 74,78 **** dWorldSetContactSurfaceLayer(mWorldID, defaults::ode::surfaceLayer); ! setAccuracy(defaults::accuracy); setSleepiness(defaults::sleepiness); mCollisionCount = 0; --- 75,79 ---- dWorldSetContactSurfaceLayer(mWorldID, defaults::ode::surfaceLayer); ! setSolverAccuracy(defaults::solverAccuracy); setSleepiness(defaults::sleepiness); mCollisionCount = 0; *************** *** 383,388 **** for(int i=0; i<numContacts; ++i) { ! const Material* m0 = &(geomData0->shape.material); ! const Material* m1 = &(geomData1->shape.material); tempContact.surface.mode = dContactBounce | --- 384,389 ---- for(int i=0; i<numContacts; ++i) { ! const Material* m0 = &(geomData0->shape->material); ! const Material* m1 = &(geomData1->shape->material); tempContact.surface.mode = dContactBounce | *************** *** 817,842 **** } ! void ODESimulator::setAccuracy(AccuracyLevel level) { switch(level) { ! case ACCURACY_VERY_LOW: mSolverType = SOLVER_QUICKSTEP; dWorldSetQuickStepNumIterations(mWorldID, 5); break; ! case ACCURACY_LOW: mSolverType = SOLVER_QUICKSTEP; dWorldSetQuickStepNumIterations(mWorldID, 10); break; ! case ACCURACY_MEDIUM: mSolverType = SOLVER_QUICKSTEP; // 20 is the default in ODE dWorldSetQuickStepNumIterations(mWorldID, 20); break; ! case ACCURACY_HIGH: mSolverType = SOLVER_QUICKSTEP; dWorldSetQuickStepNumIterations(mWorldID, 40); break; ! case ACCURACY_VERY_HIGH: mSolverType = SOLVER_WORLDSTEP; break; --- 818,845 ---- } ! void ODESimulator::setSolverAccuracy(SolverAccuracyLevel level) { + Simulator::setSolverAccuracy(level); + switch(level) { ! case SOLVER_ACCURACY_VERY_LOW: mSolverType = SOLVER_QUICKSTEP; dWorldSetQuickStepNumIterations(mWorldID, 5); break; ! case SOLVER_ACCURACY_LOW: mSolverType = SOLVER_QUICKSTEP; dWorldSetQuickStepNumIterations(mWorldID, 10); break; ! case SOLVER_ACCURACY_MEDIUM: mSolverType = SOLVER_QUICKSTEP; // 20 is the default in ODE dWorldSetQuickStepNumIterations(mWorldID, 20); break; ! case SOLVER_ACCURACY_HIGH: mSolverType = SOLVER_QUICKSTEP; dWorldSetQuickStepNumIterations(mWorldID, 40); break; ! case SOLVER_ACCURACY_VERY_HIGH: mSolverType = SOLVER_WORLDSTEP; break; *************** *** 845,850 **** break; } - - Simulator::setAccuracy(level); } --- 848,851 ---- Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** ODESolid.cpp 19 Feb 2005 20:54:37 -0000 1.64 --- ODESolid.cpp 22 Feb 2005 01:25:57 -0000 1.65 *************** *** 28,31 **** --- 28,34 ---- #include "ODESolid.h" #include "ODESpace.h" + #include "../BoxShapeData.h" + #include "../SphereShapeData.h" + #include "../CapsuleShapeData.h" namespace opal *************** *** 38,42 **** [...1234 lines suppressed...] ! dMassRotate(&newMass, R); ! dMassTranslate(&newMass, offset[12], offset[13], offset[14]); ! ! // If this mass is for the first Shape, just set the Solid's mass ! // equal to the new one. ODE bodies start with an initial mass ! // already setup, but we want to ignore that, not add to it. ! if (0 == mGeomDataList.size()) ! { ! dBodySetMass(mBodyID, &newMass); ! } ! else ! { ! // Add new mass to the Solid's existing mass. First get the ! // existing mass struct from ODE. ! dMass totalMass; ! dBodyGetMass(mBodyID, &totalMass); ! dMassAdd(&totalMass, &newMass); ! dBodySetMass(mBodyID, &totalMass); } } Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** ODESimulator.h 18 Feb 2005 23:59:38 -0000 1.53 --- ODESimulator.h 22 Feb 2005 01:25:56 -0000 1.54 *************** *** 88,92 **** virtual void OPAL_CALL setSleepiness(real value); ! virtual void OPAL_CALL setAccuracy(AccuracyLevel level); virtual void OPAL_CALL internal_stepPhysics(); --- 88,92 ---- virtual void OPAL_CALL setSleepiness(real value); ! virtual void OPAL_CALL setSolverAccuracy(SolverAccuracyLevel level); virtual void OPAL_CALL internal_stepPhysics(); Index: ODEJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ODEJoint.h 19 Feb 2005 20:54:37 -0000 1.26 --- ODEJoint.h 22 Feb 2005 01:25:56 -0000 1.27 *************** *** 44,47 **** --- 44,50 ---- virtual ~ODEJoint(); + /// Note: For a perfect save/restore in ODE, the "warm starting" + /// data should be stored in JointData. However, there is + /// currently no easy way to get this data. virtual void OPAL_CALL init(const JointData& jd); Index: ODESolid.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** ODESolid.h 19 Feb 2005 20:54:37 -0000 1.59 --- ODESolid.h 22 Feb 2005 01:25:57 -0000 1.60 *************** *** 38,42 **** /// A data structure used within ODESolids to store data describing /// ODE geoms. - // TODO: replace this with ShapeData? struct GeomData { --- 38,41 ---- *************** *** 44,47 **** --- 43,47 ---- { solid = NULL; + shape = NULL; geomID = 0; spaceID = 0; *************** *** 50,55 **** } - ShapeDescription shape; Solid* solid; dGeomID geomID; dSpaceID spaceID; --- 50,55 ---- } Solid* solid; + ShapeData* shape; dGeomID geomID; dSpaceID spaceID; *************** *** 58,62 **** }; ! /// The ODE implementation of the Solid class. class ODESolid : public Solid { --- 58,63 ---- }; ! /// The ODE implementation of the Solid class. Each ODE geom's user ! /// data pointer points to its corresponding ShapeData object. class ODESolid : public Solid { *************** *** 76,107 **** virtual void OPAL_CALL setStatic(bool s); ! virtual void OPAL_CALL addBox(const Vec3r& dimensions, ! const Matrix44r& offset = Matrix44r(), ! const Material& m = defaults::material); ! ! virtual void OPAL_CALL addSphere(real radius, ! const Matrix44r& offset = Matrix44r(), ! const Material& m = defaults::material); ! virtual void OPAL_CALL addPlane(real abcd[4], ! const Material& m = defaults::material); ! //note: normal cylinders are not yet part of standard ODE ! //virtual void addCylinder(real radius, real length, // const Matrix44r& offset = Matrix44r(), // const Material& m = defaults::material); ! virtual void OPAL_CALL addCapsule(real radius, real length, ! const Matrix44r& offset = Matrix44r(), ! const Material& m = defaults::material); ! virtual void OPAL_CALL addRay(const Point3r& origin, const Vec3r& dir, ! real length, const Matrix44r& offset = Matrix44r(), ! const Material& m = defaults::material); ! ! virtual void OPAL_CALL addMesh(const real* vertexArray[3], ! int numVertices, const int* faceArray, int numFaces, ! const Matrix44r& offset = Matrix44r(), ! const Material& m = defaults::material); virtual void OPAL_CALL setLocalLinearVel(const Vec3r& vel); --- 77,110 ---- virtual void OPAL_CALL setStatic(bool s); ! virtual void OPAL_CALL addShape(const ShapeData& sd); ! //virtual void OPAL_CALL addBox(const Vec3r& dimensions, ! // const Matrix44r& offset = Matrix44r(), ! // const Material& m = defaults::material); ! //virtual void OPAL_CALL addSphere(real radius, // const Matrix44r& offset = Matrix44r(), // const Material& m = defaults::material); ! //virtual void OPAL_CALL addPlane(real abcd[4], ! // const Material& m = defaults::material); ! ////note: normal cylinders are not yet part of standard ODE ! ////virtual void addCylinder(real radius, real length, ! //// const Matrix44r& offset = Matrix44r(), ! //// const Material& m = defaults::material); ! ! //virtual void OPAL_CALL addCapsule(real radius, real length, ! // const Matrix44r& offset = Matrix44r(), ! // const Material& m = defaults::material); ! ! //virtual void OPAL_CALL addRay(const Point3r& origin, const Vec3r& dir, ! // real length, const Matrix44r& offset = Matrix44r(), ! // const Material& m = defaults::material); ! // ! //virtual void OPAL_CALL addMesh(const real* vertexArray[3], ! // int numVertices, const int* faceArray, int numFaces, ! // const Matrix44r& offset = Matrix44r(), ! // const Material& m = defaults::material); virtual void OPAL_CALL setLocalLinearVel(const Vec3r& vel); *************** *** 152,160 **** protected: ! //void addNewGeom(dGeomID geomID, dGeomID transformID, ! // const Matrix44r& offset, const Material& material, ShapeType type); ! ! /// Adds a new geom data object to the internal list. ! void addNewGeom(GeomData* newGeom); virtual void applyForce(const Force& f); --- 155,161 ---- protected: ! /// Adds a new GeomData object to the internal list and sets up the ! /// ODE geom. ! void setupNewGeom(GeomData* newGeom); virtual void applyForce(const Force& f); *************** *** 162,166 **** /// Adds the given mass to this Solid's existing mass. The offset is /// relative to the Solid's center. This must be called before ! /// addNewGeom is called. void addMass(dMass& newMass, const Matrix44r& offset); --- 163,167 ---- /// Adds the given mass to this Solid's existing mass. The offset is /// relative to the Solid's center. This must be called before ! /// setupNewGeom is called. void addMass(dMass& newMass, const Matrix44r& offset); Index: ODEJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ODEJoint.cpp 19 Feb 2005 20:54:37 -0000 1.22 --- ODEJoint.cpp 22 Feb 2005 01:25:56 -0000 1.23 *************** *** 647,651 **** } ! if (NULL == mSolid0 && NULL == mSolid1) { return; --- 647,651 ---- } ! if (NULL == mData.solid0 && NULL == mData.solid1) { return; *************** *** 658,662 **** { // Enable the joint. ! attachODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } else --- 658,663 ---- { // Enable the joint. ! attachODEBodies((ODESolid*)mData.solid0, ! (ODESolid*)mData.solid1); } else |