[Opal-commits] opal/src/ODE ODESimulator.cpp,1.107,1.108 ODESimulator.h,1.71,1.72 ODESpace.cpp,1.8,1
Status: Inactive
Brought to you by:
tylerstreeter
|
From: Olex <ole...@us...> - 2005-11-26 22:40:26
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7819/src/ODE Modified Files: ODESimulator.cpp ODESimulator.h ODESpace.cpp ODESpace.h Log Message: Simulator::getRootSpace() Added option for the custom simulator. Additional unit tests. Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** ODESimulator.h 12 Apr 2005 21:23:46 -0000 1.71 --- ODESimulator.h 26 Nov 2005 22:40:18 -0000 1.72 *************** *** 42,62 **** namespace opal { ! /// The ODE implementation of the Simulator class. class ODESimulator : public Simulator { public: ! /// The types of ODE constraint solvers. enum SolverType { ! /// Time complexity: O(m^3), space complexity O(m^2), where /// m = # of constraints. SOLVER_WORLDSTEP, ! /// Time complexity: O(m*N), space complexity O(m), where /// m = # of constraints and N = # of iterations. SOLVER_QUICKSTEP }; ! ODESimulator(); virtual ~ODESimulator(); --- 42,66 ---- namespace opal { ! /// The ODE implementation of the Simulator class. class ODESimulator : public Simulator { public: ! /// The types of ODE constraint solvers. enum SolverType { ! /// Time complexity: O(m^3), space complexity O(m^2), where /// m = # of constraints. SOLVER_WORLDSTEP, ! /// Time complexity: O(m*N), space complexity O(m), where /// m = # of constraints and N = # of iterations. SOLVER_QUICKSTEP }; ! /// use initData to complete ! ODESimulator( ); ! ! /// complete creation ! void initData( SimulatorData data ); virtual ~ODESimulator(); *************** *** 99,103 **** virtual const RaycastResult& OPAL_CALL internal_fireRay( ! const Rayr& r, real length, const Solid* attachedSolid, unsigned int rayContactGroup); --- 103,107 ---- virtual const RaycastResult& OPAL_CALL internal_fireRay( ! const Rayr& r, real length, const Solid* attachedSolid, unsigned int rayContactGroup); *************** *** 105,116 **** const Solid* volume, const Solid* attachedSolid); ! /// Helper function used for ray casting. ! virtual void OPAL_CALL internal_setRaycastResult(Solid* solid, const Point3r& intersection, const Vec3r& normal, real distance); ! /// Helper function for volume collision checking. virtual void OPAL_CALL internal_addCollidedSolid(Solid* solid); ! /// Helper function used for ray casting. virtual unsigned int OPAL_CALL internal_getRayContactGroup(); --- 109,120 ---- const Solid* volume, const Solid* attachedSolid); ! /// Helper function used for ray casting. ! virtual void OPAL_CALL internal_setRaycastResult(Solid* solid, const Point3r& intersection, const Vec3r& normal, real distance); ! /// Helper function for volume collision checking. virtual void OPAL_CALL internal_addCollidedSolid(Solid* solid); ! /// Helper function used for ray casting. virtual unsigned int OPAL_CALL internal_getRayContactGroup(); *************** *** 118,150 **** virtual void stepPhysics(); ! /// The ODE world ID used by this Simulator. dWorldID mWorldID; ! /// The root of the ODE collision detection hierarchy. dSpaceID mRootSpaceID; ! /// The ODE joint constraint group. dJointGroupID mContactJointGroupID; ! /// The type of constraint solver to use. SolverType mSolverType; ! /// Used for volume collision checks. long int mCollisionCount; ! /// Temporary list of Solids that collided in a volume collision /// check. VolumeQueryResult mVolumeQueryResult; ! /// Used for ray casting. RaycastResult mRaycastResult; ! /// Used for ray casting and volume queries. If a RaycastSensor or ! /// VolumeSensor is attached to a Solid, this pointer will point to ! /// that Solid. It is used to make sure the raycasts and collision /// query doesn't collide with the attached Solid. const Solid* mSensorSolid; ! /// A temporary variable that lets rays to use contact groups. This /// allows them to limit which Shapes they collide with. unsigned int mRayContactGroup; --- 122,154 ---- virtual void stepPhysics(); ! /// The ODE world ID used by this Simulator. dWorldID mWorldID; ! /// The root of the ODE collision detection hierarchy. dSpaceID mRootSpaceID; ! /// The ODE joint constraint group. dJointGroupID mContactJointGroupID; ! /// The type of constraint solver to use. SolverType mSolverType; ! /// Used for volume collision checks. long int mCollisionCount; ! /// Temporary list of Solids that collided in a volume collision /// check. VolumeQueryResult mVolumeQueryResult; ! /// Used for ray casting. RaycastResult mRaycastResult; ! /// Used for ray casting and volume queries. If a RaycastSensor or ! /// VolumeSensor is attached to a Solid, this pointer will point to ! /// that Solid. It is used to make sure the raycasts and collision /// query doesn't collide with the attached Solid. const Solid* mSensorSolid; ! /// A temporary variable that lets rays to use contact groups. This /// allows them to limit which Shapes they collide with. unsigned int mRayContactGroup; *************** *** 152,181 **** }; ! /// A namespace containing internal ODE functions. namespace ode_hidden { ! // These function don't use the OPAL_CALL calling convention ! // because they are functors passed to ODE, which expects a different // calling convention. ! /// Main collision callback functor. void internal_collisionCallback(void* data, dGeomID o0, dGeomID o1); ! /// Assuming the two ODE bodies are connected by an ODE joint, this ! /// function returns the OPAL Joint connecting the two bodies' /// Solids. Joint* internal_getCommonJoint(dBodyID body0, dBodyID body1); ! /// Special collision callback functor for volume collision /// checking. ! void internal_volumeCollisionCallback(void* data, dGeomID o0, dGeomID o1); ! /// Collision callback functor for ray casting. ! void internal_raycastCollisionCallback(void* data, dGeomID o0, dGeomID o1); //helper function for collision callback ! //void createOneSidedContact(dJointID contactJoint, // dBodyID movingObject, dBodyID staticObject, dVector3 pos); } --- 156,185 ---- }; ! /// A namespace containing internal ODE functions. namespace ode_hidden { ! // These function don't use the OPAL_CALL calling convention ! // because they are functors passed to ODE, which expects a different // calling convention. ! /// Main collision callback functor. void internal_collisionCallback(void* data, dGeomID o0, dGeomID o1); ! /// Assuming the two ODE bodies are connected by an ODE joint, this ! /// function returns the OPAL Joint connecting the two bodies' /// Solids. Joint* internal_getCommonJoint(dBodyID body0, dBodyID body1); ! /// Special collision callback functor for volume collision /// checking. ! void internal_volumeCollisionCallback(void* data, dGeomID o0, dGeomID o1); ! /// Collision callback functor for ray casting. ! void internal_raycastCollisionCallback(void* data, dGeomID o0, dGeomID o1); //helper function for collision callback ! //void createOneSidedContact(dJointID contactJoint, // dBodyID movingObject, dBodyID staticObject, dVector3 pos); } Index: ODESpace.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESpace.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ODESpace.cpp 11 Feb 2005 02:18:36 -0000 1.8 --- ODESpace.cpp 26 Nov 2005 22:40:18 -0000 1.9 *************** *** 31,41 **** { ODESpace::ODESpace() - : Space() { // Create the Space without adding it to another Space. ! mSpaceID = dSimpleSpaceCreate(0); mParentSpaceID = NULL; } ODESpace::~ODESpace() { --- 31,52 ---- { ODESpace::ODESpace() { // Create the Space without adding it to another Space. ! if ( false ) ! mSpaceID = dSimpleSpaceCreate(0); ! else ! { ! mSpaceID = dHashSpaceCreate(0); ! dHashSpaceSetLevels(mSpaceID, 3, 9); ! } mParentSpaceID = NULL; } + ODESpace::ODESpace( dSpaceID space ) + { + mSpaceID = space; + mParentSpaceID = NULL; + } + ODESpace::~ODESpace() { *************** *** 44,51 **** void ODESpace::setParentSpace(Space* parentSpace) { ! dSpaceID tempSpaceID = ((ODESpace*)parentSpace)->internal_getSpaceID(); ! // First remove this Space from its current parent Space, if one // exists. if (NULL != mParentSpaceID) --- 55,62 ---- void ODESpace::setParentSpace(Space* parentSpace) { ! dSpaceID tempSpaceID = ((ODESpace*)parentSpace)->internal_getSpaceID(); ! // First remove this Space from its current parent Space, if one // exists. if (NULL != mParentSpaceID) Index: ODESpace.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESpace.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ODESpace.h 18 Feb 2005 23:59:42 -0000 1.11 --- ODESpace.h 26 Nov 2005 22:40:18 -0000 1.12 *************** *** 35,39 **** namespace opal { ! /// The ODE implementation of the Space class. class ODESpace : public Space { --- 35,39 ---- namespace opal { ! /// The ODE implementation of the Space class. class ODESpace : public Space { *************** *** 41,56 **** ODESpace(); virtual ~ODESpace(); virtual void OPAL_CALL setParentSpace(Space* parentSpace); ! /// Returns the ODE space ID. virtual dSpaceID OPAL_CALL internal_getSpaceID()const; ! protected: ! /// The ODE space ID. dSpaceID mSpaceID; ! /// The ODE space ID of this ODESpace's parent ODESpace. dSpaceID mParentSpaceID; --- 41,58 ---- ODESpace(); + ODESpace( dSpaceID space ); + virtual ~ODESpace(); virtual void OPAL_CALL setParentSpace(Space* parentSpace); ! /// Returns the ODE space ID. virtual dSpaceID OPAL_CALL internal_getSpaceID()const; ! protected: ! /// The ODE space ID. dSpaceID mSpaceID; ! /// The ODE space ID of this ODESpace's parent ODESpace. dSpaceID mParentSpaceID; Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** ODESimulator.cpp 19 Nov 2005 18:09:01 -0000 1.107 --- ODESimulator.cpp 26 Nov 2005 22:40:18 -0000 1.108 *************** *** 1,28 **** /************************************************************************* ! * * ! * Open Physics Abstraction Layer * ! * Copyright (C) 2004-2005 * ! * Alan Fischer ala...@gm... * ! * Andres Reinot an...@re... * ! * Tyler Streeter tyl...@gm... * ! * All rights reserved. * ! * Web: opal.sourceforge.net * ! * * [...2283 lines suppressed...] ! assert( false ); ! break; ! } ! } ! ! dWorldID ODESimulator::internal_getWorldID() const ! { ! return mWorldID; ! } ! ! dSpaceID ODESimulator::internal_getSpaceID() const ! { ! return mRootSpaceID; ! } ! ! dJointGroupID ODESimulator::internal_getJointGroupID() const ! { ! return mContactJointGroupID; ! } } |