From: <a-...@us...> - 2009-11-16 10:24:19
|
Revision: 98 http://simspark.svn.sourceforge.net/simspark/?rev=98&view=rev Author: a-held Date: 2009-11-16 10:24:11 +0000 (Mon, 16 Nov 2009) Log Message: ----------- added abstract PhysicsObject class refactored CappedCylinder to Capsule (method is deprecated and sometimes causes compiler errors with newer ODE versions) Modified Paths: -------------- branches/multiphys/spark/lib/oxygen/CMakeLists.txt branches/multiphys/spark/lib/oxygen/oxygen.cpp branches/multiphys/spark/lib/oxygen/oxygen.h branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp branches/multiphys/spark/lib/oxygen/physicsserver/body.h branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.cpp branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.h branches/multiphys/spark/lib/oxygen/physicsserver/odeobject_c.cpp branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp Added Paths: ----------- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject_c.cpp Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt =================================================================== --- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-16 10:24:11 UTC (rev 98) @@ -14,33 +14,38 @@ gamecontrolserver/behavior.h oxygen.h oxygen_defines.h + + #abstract physics + physicsserver/physicsserver.h + physicsserver/physicsobject.h physicsserver/body.h - physicsserver/bodycontroller.h + physicsserver/collider.h physicsserver/boxcollider.h physicsserver/ccylindercollider.h - physicsserver/collider.h - physicsserver/collisionhandler.h - physicsserver/contactjointhandler.h - physicsserver/odeobject.h - physicsserver/odewrapper.h - physicsserver/physicsserver.h physicsserver/planecollider.h - physicsserver/raycollider.h - physicsserver/recorderhandler.h - physicsserver/space.h physicsserver/spherecollider.h - physicsserver/transformcollider.h - physicsserver/world.h - physicsserver/dragcontroller.h - physicsserver/velocitycontroller.h physicsserver/joint.h physicsserver/balljoint.h physicsserver/hingejoint.h + physicsserver/hinge2joint.h physicsserver/fixedjoint.h physicsserver/sliderjoint.h physicsserver/universaljoint.h - physicsserver/hinge2joint.h - physicsserver/angularmotor.h + physicsserver/space.h + physicsserver/world.h + physicsserver/bodycontroller.h + physicsserver/collisionhandler.h + physicsserver/contactjointhandler.h + physicsserver/dragcontroller.h + physicsserver/raycollider.h + physicsserver/recorderhandler.h + physicsserver/transformcollider.h + physicsserver/velocitycontroller.h + + #ODE-specific physics + physicsserver/odewrapper.h + physicsserver/odeobject.h + sceneserver/sceneimporter.h sceneserver/basenode.h sceneserver/fpscontroller.h @@ -100,58 +105,62 @@ gamecontrolserver/behavior.cpp gamecontrolserver/behavior_c.cpp oxygen.cpp + + #abstract physics NOTE: Should only be *_c.cpp files in the end + physicsserver/physicsserver.cpp + physicsserver/physicsserver_c.cpp + physicsserver/physicsobject_c.cpp physicsserver/body.cpp physicsserver/body_c.cpp - physicsserver/bodycontroller.cpp - physicsserver/bodycontroller_c.cpp - physicsserver/transformcollider.cpp - physicsserver/transformcollider_c.cpp + physicsserver/collider.cpp + physicsserver/collider_c.cpp physicsserver/boxcollider.cpp physicsserver/boxcollider_c.cpp physicsserver/ccylindercollider.cpp physicsserver/ccylindercollider_c.cpp - physicsserver/collider.cpp - physicsserver/collider_c.cpp - physicsserver/collisionhandler.cpp - physicsserver/collisionhandler_c.cpp - physicsserver/contactjointhandler.cpp - physicsserver/contactjointhandler_c.cpp - physicsserver/odeobject.cpp - physicsserver/odeobject_c.cpp - physicsserver/physicsserver.cpp - physicsserver/physicsserver_c.cpp physicsserver/planecollider.cpp physicsserver/planecollider_c.cpp - physicsserver/raycollider.cpp - physicsserver/raycollider_c.cpp - physicsserver/recorderhandler.cpp - physicsserver/recorderhandler_c.cpp - physicsserver/space.cpp - physicsserver/space_c.cpp physicsserver/spherecollider.cpp physicsserver/spherecollider_c.cpp - physicsserver/world.cpp - physicsserver/world_c.cpp - physicsserver/dragcontroller.cpp - physicsserver/dragcontroller_c.cpp - physicsserver/velocitycontroller.cpp - physicsserver/velocitycontroller_c.cpp physicsserver/joint.cpp physicsserver/joint_c.cpp physicsserver/balljoint.cpp physicsserver/balljoint_c.cpp physicsserver/hingejoint.cpp physicsserver/hingejoint_c.cpp + physicsserver/hinge2joint.cpp + physicsserver/hinge2joint_c.cpp physicsserver/fixedjoint.cpp physicsserver/fixedjoint_c.cpp physicsserver/sliderjoint.cpp physicsserver/sliderjoint_c.cpp physicsserver/universaljoint.cpp physicsserver/universaljoint_c.cpp - physicsserver/hinge2joint.cpp - physicsserver/hinge2joint_c.cpp - physicsserver/angularmotor.cpp - physicsserver/angularmotor_c.cpp + physicsserver/space.cpp + physicsserver/space_c.cpp + physicsserver/world.cpp + physicsserver/world_c.cpp + physicsserver/bodycontroller.cpp + physicsserver/bodycontroller_c.cpp + physicsserver/collisionhandler.cpp + physicsserver/collisionhandler_c.cpp + physicsserver/contactjointhandler.cpp + physicsserver/contactjointhandler_c.cpp + physicsserver/dragcontroller.cpp + physicsserver/dragcontroller_c.cpp + physicsserver/raycollider.cpp + physicsserver/raycollider_c.cpp + physicsserver/recorderhandler.cpp + physicsserver/recorderhandler_c.cpp + physicsserver/transformcollider.cpp + physicsserver/transformcollider_c.cpp + physicsserver/velocitycontroller.cpp + physicsserver/velocitycontroller_c.cpp + + #ODE-specific physics + physicsserver/odeobject.cpp + physicsserver/odeobject_c.cpp + sceneserver/basenode.cpp sceneserver/basenode_c.cpp sceneserver/fpscontroller.cpp Modified: branches/multiphys/spark/lib/oxygen/oxygen.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-16 10:24:11 UTC (rev 98) @@ -53,35 +53,34 @@ // physics zg.GetCore()->RegisterClassObject(new CLASS(PhysicsServer), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(PhysicsObject), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(Body), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(BodyController), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(DragController), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(VelocityController), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(Space), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(World), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(Collider), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(BoxCollider), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(CCylinderCollider), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(PlaneCollider), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(SphereCollider), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(Joint), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(BallJoint), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(HingeJoint), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(Hinge2Joint), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(FixedJoint), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(SliderJoint), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(UniversalJoint), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(Hinge2Joint), "oxygen/"); - - // collider - zg.GetCore()->RegisterClassObject(new CLASS(Collider), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(TransformCollider), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(BoxCollider), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(CCylinderCollider), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(PlaneCollider), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(RayCollider), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(SphereCollider), "oxygen/"); - - // collision handler + zg.GetCore()->RegisterClassObject(new CLASS(Space), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(World), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(BodyController), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(CollisionHandler), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(ContactJointHandler), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(DragController), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(RayCollider), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(RecorderHandler), "oxygen/"); - + zg.GetCore()->RegisterClassObject(new CLASS(TransformCollider), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(VelocityController), "oxygen/"); + + //ODE-specific physics + zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/"); + // agentaspect zg.GetCore()->RegisterClassObject(new CLASS(AgentAspect), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(Effector), "oxygen/"); Modified: branches/multiphys/spark/lib/oxygen/oxygen.h =================================================================== --- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-16 10:24:11 UTC (rev 98) @@ -34,32 +34,36 @@ #include "gamecontrolserver/actionobject.h" #include "gamecontrolserver/behavior.h" -#include "physicsserver/body.h" -#include "physicsserver/bodycontroller.h" -#include "physicsserver/dragcontroller.h" -#include "physicsserver/velocitycontroller.h" -#include "physicsserver/transformcollider.h" -#include "physicsserver/boxcollider.h" -#include "physicsserver/ccylindercollider.h" -#include "physicsserver/collider.h" -#include "physicsserver/odeobject.h" -#include "physicsserver/physicsserver.h" -#include "physicsserver/planecollider.h" -#include "physicsserver/raycollider.h" -#include "physicsserver/space.h" -#include "physicsserver/spherecollider.h" -#include "physicsserver/world.h" -#include "physicsserver/collisionhandler.h" -#include "physicsserver/contactjointhandler.h" -#include "physicsserver/recorderhandler.h" -#include "physicsserver/joint.h" -#include "physicsserver/balljoint.h" -#include "physicsserver/hingejoint.h" -#include "physicsserver/fixedjoint.h" -#include "physicsserver/sliderjoint.h" -#include "physicsserver/universaljoint.h" -#include "physicsserver/hinge2joint.h" +//general includes +#include <oxygen/physicsserver/physicsserver.h> +#include <oxygen/physicsserver/physicsobject.h> +#include <oxygen/physicsserver/body.h> +#include <oxygen/physicsserver/collider.h> +#include <oxygen/physicsserver/boxcollider.h> +#include <oxygen/physicsserver/ccylindercollider.h> +#include <oxygen/physicsserver/planecollider.h> +#include <oxygen/physicsserver/spherecollider.h> +#include <oxygen/physicsserver/joint.h> +#include <oxygen/physicsserver/balljoint.h> +#include <oxygen/physicsserver/hingejoint.h> +#include <oxygen/physicsserver/hinge2joint.h> +#include <oxygen/physicsserver/fixedjoint.h> +#include <oxygen/physicsserver/sliderjoint.h> +#include <oxygen/physicsserver/universaljoint.h> +#include <oxygen/physicsserver/space.h> +#include <oxygen/physicsserver/world.h> +#include <oxygen/physicsserver/bodycontroller.h> +#include <oxygen/physicsserver/collisionhandler.h> +#include <oxygen/physicsserver/contactjointhandler.h> +#include <oxygen/physicsserver/dragcontroller.h> +#include <oxygen/physicsserver/recorderhandler.h> +#include <oxygen/physicsserver/transformcollider.h> +#include <oxygen/physicsserver/raycollider.h> +#include <oxygen/physicsserver/velocitycontroller.h> +//ODE-specific includes +#include <oxygen/physicsserver/odeobject.h> + #include "sceneserver/basenode.h" #include "sceneserver/camera.h" #include "sceneserver/fpscontroller.h" Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-11-16 10:24:11 UTC (rev 98) @@ -334,47 +334,47 @@ AddMass(ODEMass, matrix); } -void Body::PrepareCappedCylinder (dMass& mass, float density, float radius, float length) const +void Body::PrepareCapsule (dMass& mass, float density, float radius, float length) const { // direction: (1=x, 2=y, 3=z) int direction = 3; - dMassSetCappedCylinder (&mass, density, direction, radius, length); + dMassSetCapsule (&mass, density, direction, radius, length); } -void Body::SetCappedCylinder (float density, float radius, float length) +void Body::SetCapsule (float density, float radius, float length) { dMass ODEMass; - PrepareCappedCylinder(ODEMass, density, radius, length); + PrepareCapsule(ODEMass, density, radius, length); dBodySetMass(mODEBody, &ODEMass); } -void Body::AddCappedCylinder (float density, float radius, float length, const Matrix& matrix) +void Body::AddCapsule (float density, float radius, float length, const Matrix& matrix) { dMass ODEMass; - PrepareCappedCylinder(ODEMass, density, radius, length); + PrepareCapsule(ODEMass, density, radius, length); AddMass(ODEMass, matrix); } -void Body::PrepareCappedCylinderTotal(dMass& mass, float total_mass, float radius, float length) const +void Body::PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const { // direction: (1=x, 2=y, 3=z) int direction = 3; - dMassSetCappedCylinderTotal(&mass, total_mass, direction, radius, length); + dMassSetCapsuleTotal(&mass, total_mass, direction, radius, length); } -void Body::SetCappedCylinderTotal(float total_mass, float radius, float length) +void Body::SetCapsuleTotal(float total_mass, float radius, float length) { dMass ODEMass; - PrepareCappedCylinderTotal(ODEMass, total_mass, radius, length); + PrepareCapsuleTotal(ODEMass, total_mass, radius, length); dBodySetMass(mODEBody, &ODEMass); } -void Body::AddCappedCylinderTotal(float total_mass, float radius, float length, const salt::Matrix& matrix) +void Body::AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix) { dMass ODEMass; - PrepareCappedCylinderTotal(ODEMass, total_mass, radius, length); + PrepareCapsuleTotal(ODEMass, total_mass, radius, length); AddMass(ODEMass, matrix); } Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-16 10:24:11 UTC (rev 98) @@ -167,13 +167,13 @@ counting the spherical cap) is length. The cylinder's long axis is oriented along the body's z axis. */ - void SetCappedCylinder (float density, float radius, float length); + void SetCapsule (float density, float radius, float length); /* Add a mass representing a capped cylinder of the given parameters and density, with the matrix determining its center and orientation */ - void AddCappedCylinder (float density, float radius, float length, const salt::Matrix& matrix); + void AddCapsule (float density, float radius, float length, const salt::Matrix& matrix); /* Set the mass parameters to represent a capped cylinder of the given parameters and total mass, with the center of mass at @@ -182,13 +182,13 @@ counting the spherical cap) is length. The cylinder's long axis is oriented along the body's z axis. */ - void SetCappedCylinderTotal(float total_mass, float radius, float length); + void SetCapsuleTotal(float total_mass, float radius, float length); /* Add a mass representing a capped cylinder of the given parameters and total mass, with the matrix determining its center and orientation */ - void AddCappedCylinderTotal(float total_mass, float radius, float length, const salt::Matrix& matrix); + void AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix); /** displace the mass center relative to the body frame */ void TranslateMass(const salt::Vector3f& v); @@ -293,7 +293,7 @@ counting the spherical cap) is length. The cylinder's long axis is oriented along the body's z axis. */ - void PrepareCappedCylinder (dMass& mass, float density, float radius, float length) const; + void PrepareCapsule (dMass& mass, float density, float radius, float length) const; /* sets up an ode mass struct representing a capped cylinder of the given parameters and total mass, with the center of mass at @@ -302,7 +302,7 @@ counting the spherical cap) is length. The cylinder's long axis is oriented along the body's z axis. */ - void PrepareCappedCylinderTotal(dMass& mass, float total_mass, float radius, float length) const; + void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const; private: /** updates internal state before physics calculation */ Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp 2009-11-16 10:24:11 UTC (rev 98) @@ -379,7 +379,7 @@ return true; } -FUNCTION(Body,setCappedCylinder) +FUNCTION(Body,setCapsule) { float inDensity; float inRadius; @@ -395,11 +395,11 @@ return false; } - obj->SetCappedCylinder(inDensity,inRadius,inLength); + obj->SetCapsule(inDensity,inRadius,inLength); return true; } -FUNCTION(Body,addCappedCylinder) +FUNCTION(Body,addCapsule) { float inDensity; float inRadius; @@ -421,11 +421,11 @@ // Matrix is allowed to be missing, defaults to identity in.GetValue(in[3],inMat); - obj->AddCappedCylinder(inDensity,inRadius,inLength,inMat); + obj->AddCapsule(inDensity,inRadius,inLength,inMat); return true; } -FUNCTION(Body,setCappedCylinderTotal) +FUNCTION(Body,setCapsuleTotal) { float inMassTotal; float inRadius; @@ -441,11 +441,11 @@ return false; } - obj->SetCappedCylinderTotal(inMassTotal,inRadius,inLength); + obj->SetCapsuleTotal(inMassTotal,inRadius,inLength); return true; } -FUNCTION(Body,addCappedCylinderTotal) +FUNCTION(Body,addCapsuleTotal) { float inMassTotal; float inRadius; @@ -466,7 +466,7 @@ // Matrix is allowed to be missing, defaults to identity in.GetValue(in[3],inMat); - obj->AddCappedCylinderTotal(inMassTotal,inRadius,inLength,inMat); + obj->AddCapsuleTotal(inMassTotal,inRadius,inLength,inMat); return true; } @@ -585,10 +585,10 @@ DEFINE_FUNCTION(addCylinder); DEFINE_FUNCTION(setCylinderTotal); DEFINE_FUNCTION(addCylinderTotal); - DEFINE_FUNCTION(setCappedCylinder); - DEFINE_FUNCTION(addCappedCylinder); - DEFINE_FUNCTION(setCappedCylinderTotal); - DEFINE_FUNCTION(addCappedCylinderTotal); + DEFINE_FUNCTION(setCapsule); + DEFINE_FUNCTION(addCapsule); + DEFINE_FUNCTION(setCapsuleTotal); + DEFINE_FUNCTION(addCapsuleTotal); DEFINE_FUNCTION(setMass); DEFINE_FUNCTION(getMass); DEFINE_FUNCTION(setVelocity); Modified: branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.cpp 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.cpp 2009-11-16 10:24:11 UTC (rev 98) @@ -19,16 +19,16 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "odeobject.h" -#include "space.h" -#include "world.h" +#include <oxygen/physicsserver/odeobject.h> +#include <oxygen/physicsserver/space.h> +#include <oxygen/physicsserver/world.h> #include <oxygen/sceneserver/scene.h> #include <zeitgeist/logserver/logserver.h> using namespace oxygen; using namespace boost; -ODEObject::ODEObject() : BaseNode() +ODEObject::ODEObject() : PhysicsObject() { } Modified: branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.h 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.h 2009-11-16 10:24:11 UTC (rev 98) @@ -24,8 +24,9 @@ #define OXYGEN_ODEOBJECT_H #include <oxygen/oxygen_defines.h> +#include <oxygen/physicsserver/odewrapper.h> +#include <oxygen/physicsserver/physicsobject.h> #include <oxygen/sceneserver/basenode.h> -#include "odewrapper.h" namespace oxygen { @@ -34,7 +35,7 @@ /** ODEObject is the base of all classes encapsulating ODE concepts */ -class OXYGEN_API ODEObject : public BaseNode +class OXYGEN_API ODEObject : public PhysicsObject { public: // Modified: branches/multiphys/spark/lib/oxygen/physicsserver/odeobject_c.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2009-11-16 10:24:11 UTC (rev 98) @@ -19,11 +19,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "odeobject.h" +#include <oxygen/physicsserver/odeobject.h> using namespace oxygen; void CLASS(ODEObject)::DefineClass() { - DEFINE_BASECLASS(oxygen/BaseNode); + DEFINE_BASECLASS(oxygen/PhysicsObject); } Added: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h (rev 0) +++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-11-16 10:24:11 UTC (rev 98) @@ -0,0 +1,81 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id: odeobject.h 56 2009-03-17 18:03:47Z hedayat $ + $Id: odeobject.h 56 2009-03-17 18:03:47Z hedayat $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef OXYGEN_PHYSICSOBJECT_H +#define OXYGEN_PHYSICSOBJECT_H + +#include <oxygen/oxygen_defines.h> +#include <oxygen/physicsserver/odewrapper.h> +#include <oxygen/sceneserver/basenode.h> + +namespace oxygen +{ +class Space; +class World; + +/*PhysicsObjects provides an interface for all classes +encapsulating physics objects.*/ + +class OXYGEN_API PhysicsObject : public BaseNode +{ +public: + PhysicsObject() : BaseNode(){}; + virtual ~PhysicsObject(){}; + + /** This rountine is called, before the hierarchy object is + removed from the parent. It can be overridden to support + custom 'unlink' behavior. + */ + virtual void OnUnlink() = 0; + + /** returns the ODE world handle */ + virtual dWorldID GetWorldID() = 0; + + /** returns the nearest parent space ODE handle */ + virtual dSpaceID FindSpaceID() = 0; + + /** returns the ODE handle ID of the containing parent space */ + virtual dSpaceID GetParentSpaceID() = 0; + + /** destroy the managed ODE object */ + virtual void DestroyODEObject() = 0; + +protected: + /** returns the world node */ + virtual boost::shared_ptr<World> GetWorld() = 0; + + /** finds the nearest parent space node */ + virtual boost::shared_ptr<Space> GetSpace() = 0; + + /** converts the rotation part of a salt::Matrix to an ODE + dMatrix3 */ + virtual void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix) = 0; + + /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */ + virtual void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const = 0; +}; + +DECLARE_ABSTRACTCLASS(PhysicsObject); + +} //namespace oxygen + +#endif //OXYGEN_PHYSICSOBJECT_H Added: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject_c.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject_c.cpp (rev 0) +++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject_c.cpp 2009-11-16 10:24:11 UTC (rev 98) @@ -0,0 +1,29 @@ +/* -*- mode: c++ -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2003 Koblenz University + $Id: odeobject_c.cpp 3 2008-11-21 02:38:08Z hedayat $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <oxygen/physicsserver/physicsobject.h> + +using namespace oxygen; + +void CLASS(PhysicsObject)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/BaseNode); +} Modified: branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp =================================================================== --- branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp 2009-10-31 09:41:13 UTC (rev 97) +++ branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp 2009-11-16 10:24:11 UTC (rev 98) @@ -1036,7 +1036,7 @@ if (body.get() != 0) { body->SetName(S_BODY+name); - body->SetCappedCylinderTotal(physical.mass, radius, height); + body->SetCapsuleTotal(physical.mass, radius, height); GetContext().AddMass(physical.mass, Trans()); } @@ -1055,7 +1055,7 @@ collider->AddChildReference(handler); } - GetLog()->Debug() << "(RosImporter) created capped cylinder " << name << "\n"; + GetLog()->Debug() << "(RosImporter) created capsule " << name << "\n"; return ReadChildElements(transform, element); } @@ -2014,7 +2014,7 @@ shared_ptr<Body> body = GetContextBody(contextTransform); if (body.get() != 0) { - body->AddCappedCylinderTotal(physical.mass, radius, height, trans.matrix); + body->AddCapsuleTotal(physical.mass, radius, height, trans.matrix); GetContext().AddMass(physical.mass, trans); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |