You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(20) |
Feb
(11) |
Mar
(6) |
Apr
(5) |
May
(4) |
Jun
(7) |
Jul
(9) |
Aug
(11) |
Sep
|
Oct
(4) |
Nov
(13) |
Dec
(21) |
| 2010 |
Jan
(23) |
Feb
(32) |
Mar
(6) |
Apr
(2) |
May
(10) |
Jun
(15) |
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
(1) |
Dec
(16) |
| 2011 |
Jan
(1) |
Feb
(5) |
Mar
(19) |
Apr
(13) |
May
(4) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
(4) |
Feb
(8) |
Mar
(2) |
Apr
(6) |
May
(13) |
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
| 2013 |
Jan
(1) |
Feb
(2) |
Mar
(15) |
Apr
(2) |
May
(4) |
Jun
(17) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(6) |
Jun
(6) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(6) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
(7) |
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <a-...@us...> - 2009-12-08 07:56:59
|
Revision: 116
http://simspark.svn.sourceforge.net/simspark/?rev=116&view=rev
Author: a-held
Date: 2009-12-08 07:56:49 +0000 (Tue, 08 Dec 2009)
Log Message:
-----------
updated ccyluinder to capsule
removed some unnecessary includes in interfaces
prepared bridge pattern for Collider class
provided bridge pattern for Compound-, Concave- and EmptyCollider
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/collider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/int/colliderint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/compoundcolliderint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/concavecolliderint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/emptycolliderint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecompoundcollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecompoundcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeconcavecollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeconcavecollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeemptycollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeemptycollider.h
Removed Paths:
-------------
branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider_c.cpp
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-12-08 07:56:49 UTC (rev 116)
@@ -22,7 +22,7 @@
physicsserver/softbody.h
physicsserver/bodycontroller.h
physicsserver/boxcollider.h
- physicsserver/ccylindercollider.h
+ physicsserver/capsulecollider.h
physicsserver/cylindercollider.h
physicsserver/collider.h
physicsserver/compoundcollider.h
@@ -55,7 +55,11 @@
#interfaces
physicsserver/int/bodyint.h
+ physicsserver/int/colliderint.h
+ physicsserver/int/compoundcolliderint.h
+ physicsserver/int/concavecolliderint.h
physicsserver/int/dynamicbodyint.h
+ physicsserver/int/emptycolliderint.h
physicsserver/int/physicsobjectint.h
physicsserver/int/physicsserverint.h
physicsserver/int/rigidbodyint.h
@@ -67,6 +71,10 @@
#ode-specific files
physicsserver/ode/odebody.h
physicsserver/ode/odedynamicbody.h
+ physicsserver/ode/odecollider.h
+ physicsserver/ode/odecompoundcollider.h
+ physicsserver/ode/odeconcavecollider.h
+ physicsserver/ode/odeemptycollider.h
physicsserver/ode/odephysicsobject.h
physicsserver/ode/odephysicsserver.h
physicsserver/ode/oderigidbody.h
@@ -153,12 +161,14 @@
physicsserver/transformcollider_c.cpp
physicsserver/boxcollider.cpp
physicsserver/boxcollider_c.cpp
- physicsserver/ccylindercollider.cpp
- physicsserver/ccylindercollider_c.cpp
+ physicsserver/capsulecollider.cpp
+ physicsserver/capsulecollider_c.cpp
physicsserver/cylindercollider_c.cpp
physicsserver/collider.cpp
physicsserver/collider_c.cpp
+ physicsserver/compoundcollider.cpp
physicsserver/compoundcollider_c.cpp
+ physicsserver/concavecollider.cpp
physicsserver/concavecollider_c.cpp
physicsserver/conecollider_c.cpp
physicsserver/convexcollider_c.cpp
@@ -166,6 +176,7 @@
physicsserver/collisionhandler_c.cpp
physicsserver/contactjointhandler.cpp
physicsserver/contactjointhandler_c.cpp
+ physicsserver/emptycollider.cpp
physicsserver/emptycollider_c.cpp
physicsserver/physicsserver.cpp
physicsserver/physicsserver_c.cpp
@@ -206,7 +217,11 @@
#ODE-specific files
physicsserver/ode/odebody.cpp
+ physicsserver/ode/odecompoundcollider.cpp
+ physicsserver/ode/odeconcavecollider.cpp
+ physicsserver/ode/odecollider.cpp
physicsserver/ode/odedynamicbody.cpp
+ physicsserver/ode/odeemptycollider.cpp
physicsserver/ode/odephysicsobject.cpp
physicsserver/ode/odephysicsserver.cpp
physicsserver/ode/oderigidbody.cpp
Modified: branches/multiphys/spark/lib/oxygen/oxygen.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -83,7 +83,7 @@
zg.GetCore()->RegisterClassObject(new CLASS(EmptyCollider), "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(CapsuleCollider), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(CylinderCollider), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(PlaneCollider), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(RayCollider), "oxygen/");
Modified: branches/multiphys/spark/lib/oxygen/oxygen.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -46,7 +46,7 @@
#include <oxygen/physicsserver/velocitycontroller.h>
#include <oxygen/physicsserver/transformcollider.h>
#include <oxygen/physicsserver/boxcollider.h>
-#include <oxygen/physicsserver/ccylindercollider.h>
+#include <oxygen/physicsserver/capsulecollider.h>
#include <oxygen/physicsserver/cylindercollider.h>
#include <oxygen/physicsserver/collider.h>
#include <oxygen/physicsserver/compoundcollider.h>
Added: branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,89 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id: ccylindercollider.cpp 108 2009-11-25 10:20:10Z a-held $
+
+ 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/capsulecollider.h>
+
+using namespace oxygen;
+using namespace salt;
+
+CapsuleCollider::CapsuleCollider() : ConvexCollider()
+{
+}
+
+void CapsuleCollider::SetParams(float radius, float length)
+{
+ dGeomCCylinderSetParams (mODEGeom, radius, length);
+}
+
+void CapsuleCollider::SetRadius(float radius)
+{
+ SetParams(radius,GetLength());
+}
+
+void CapsuleCollider::SetLength(float length)
+{
+ SetParams(GetRadius(),length);
+}
+
+void CapsuleCollider::GetParams(float& radius, float& length)
+{
+ dReal r,l;
+ dGeomCCylinderGetParams(mODEGeom,&r,&l);
+ radius = r;
+ length = l;
+}
+
+float CapsuleCollider::GetRadius()
+{
+ float length;
+ float radius;
+ GetParams(radius,length);
+ return radius;
+}
+
+float CapsuleCollider::GetLength()
+{
+ float radius;
+ float length;
+ GetParams(radius,length);
+ return length;
+}
+
+bool CapsuleCollider::ConstructInternal()
+{
+ if (! Collider::ConstructInternal())
+ {
+ return false;
+ }
+
+ // create a unit capped cylinder
+ mODEGeom = dCreateCCylinder(0, 1.0f, 1.0f);
+
+ return (mODEGeom != 0);
+}
+
+float CapsuleCollider::GetPointDepth(const Vector3f& pos)
+{
+ Vector3f worldPos(GetWorldTransform() * pos);
+ return dGeomCCylinderPointDepth
+ (mODEGeom,worldPos[0],worldPos[1],worldPos[2]);
+}
+
Added: branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,83 @@
+/* -*- 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: ccylindercollider.h 108 2009-11-25 10:20:10Z a-held $
+
+ 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_CAPSULECOLLIDER_H
+#define OXYGEN_CAPSULECOLLIDER_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/convexcollider.h>
+
+namespace oxygen
+{
+
+/** CapsuleCollider encapsulates an ODE capsule geometry
+ object. A capsule is like a cylinder except it has
+ half-sphere caps at its ends. This feature makes the internal
+ collision detection code particularly fast and accurate.
+ */
+class OXYGEN_API CapsuleCollider : public ConvexCollider
+{
+ //
+ // Functions
+ //
+public:
+ CapsuleCollider();
+
+ /** sets the parameters of the capsule.
+
+ \param radius is the radius of the caps, and of the cylinder itself
+ \param length is the height of the cylinder, not counting the caps
+ */
+ void SetParams(float radius, float length);
+
+ /** sets the radius of the capsule */
+ void SetRadius(float radius);
+
+ /** sets the length of the capsule */
+ void SetLength(float length);
+
+ /** gets the radius and the length of the capsule */
+ void GetParams(float& radius, float& length);
+
+ /** returns the radius of the capsule */
+ float GetRadius();
+
+ /** return the length of the capsule */
+ float GetLength();
+
+ /** returns the depth of the given relative position in the
+ managed capsule geom. Points inside the geom will have
+ positive depth, points outside it will have negative depth, and
+ points on the surface will have zero depth.
+ */
+ float GetPointDepth(const salt::Vector3f& pos);
+
+protected:
+ /** constructs a default capsule with an radius of 1 and a
+ length of 1 */
+ virtual bool ConstructInternal();
+};
+
+DECLARE_CLASS(CapsuleCollider);
+
+} //namespace oxygen
+
+#endif //OXYGEN_CAPSULECOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/capsulecollider_c.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,112 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id: ccylindercollider_c.cpp 108 2009-11-25 10:20:10Z a-held $
+
+ 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/capsulecollider.h>
+
+using namespace oxygen;
+using namespace boost;
+using namespace salt;
+
+FUNCTION(CapsuleCollider,setParams)
+{
+ float inRadius;
+ float inLength;
+
+ if (
+ (in.GetSize() != 2) ||
+ (! in.GetValue(in[0],inRadius)) ||
+ (! in.GetValue(in[1],inLength))
+ )
+ {
+ return false;
+ }
+
+ obj->SetParams(inRadius,inLength);
+ return true;
+}
+
+FUNCTION(CapsuleCollider,setRadius)
+{
+ float inRadius;
+
+ if (
+ (in.GetSize() != 1) ||
+ (! in.GetValue(in[0],inRadius))
+ )
+ {
+ return false;
+ }
+
+ obj->SetRadius(inRadius);
+ return true;
+}
+
+FUNCTION(CapsuleCollider,setLength)
+{
+ float inLength;
+
+ if (
+ (in.GetSize() != 1) ||
+ (! in.GetValue(in[0],inLength))
+ )
+ {
+ return false;
+ }
+
+ obj->SetLength(inLength);
+ return true;
+}
+
+FUNCTION(CapsuleCollider,getRadius)
+{
+ return obj->GetRadius();
+}
+
+FUNCTION(CapsuleCollider,getLength)
+{
+ return obj->GetLength();
+}
+
+FUNCTION(CapsuleCollider,getPointDepth)
+{
+ Vector3f inPos;
+
+ if (
+ (in.GetSize() == 0) ||
+ (! in.GetValue(in.begin(), inPos))
+ )
+ {
+ return 0;
+ }
+
+ return obj->GetPointDepth(inPos);
+}
+
+void CLASS(CapsuleCollider)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/ConvexCollider);
+ DEFINE_FUNCTION(setParams);
+ DEFINE_FUNCTION(setRadius);
+ DEFINE_FUNCTION(setLength);
+ DEFINE_FUNCTION(getRadius);
+ DEFINE_FUNCTION(getLength);
+ DEFINE_FUNCTION(getPointDepth);
+}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.cpp 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -1,94 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
-
- this file is part of rcssserver3D
- Fri May 9 2003
- Copyright (C) 2003 Koblenz University
- $Id$
-
- 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/ccylindercollider.h>
-
-using namespace oxygen;
-using namespace salt;
-
-CCylinderCollider::CCylinderCollider() : ConvexCollider()
-{
-}
-
-void CCylinderCollider::SetParams(float radius, float length)
-{
- dGeomCCylinderSetParams (mODEGeom, radius, length);
-}
-
-void CCylinderCollider::SetRadius(float radius)
-{
- SetParams(radius,GetLength());
-}
-
-void CCylinderCollider::SetLength(float length)
-{
- SetParams(GetRadius(),length);
-}
-
-void
-CCylinderCollider::GetParams(float& radius, float& length)
-{
- dReal r,l;
- dGeomCCylinderGetParams(mODEGeom,&r,&l);
- radius = r;
- length = l;
-}
-
-float
-CCylinderCollider::GetRadius()
-{
- float length;
- float radius;
- GetParams(radius,length);
- return radius;
-}
-
-float
-CCylinderCollider::GetLength()
-{
- float radius;
- float length;
- GetParams(radius,length);
- return length;
-}
-
-bool
-CCylinderCollider::ConstructInternal()
-{
- if (! Collider::ConstructInternal())
- {
- return false;
- }
-
- // create a unit capped cylinder
- mODEGeom = dCreateCCylinder(0, 1.0f, 1.0f);
-
- return (mODEGeom != 0);
-}
-
-float
-CCylinderCollider::GetPointDepth(const Vector3f& pos)
-{
- Vector3f worldPos(GetWorldTransform() * pos);
- return dGeomCCylinderPointDepth
- (mODEGeom,worldPos[0],worldPos[1],worldPos[2]);
-}
-
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -1,83 +0,0 @@
-/* -*- 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$
-
- 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_CCYLINDERCOLLIDER_H
-#define OXYGEN_CCYLINDERCOLLIDER_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/convexcollider.h>
-
-namespace oxygen
-{
-
-/** CCylinderCollider encapsulates an ODE capped cylinder geometry
- object. A capped cylinder is like a normal cylinder except it has
- half-sphere caps at its ends. This feature makes the internal
- collision detection code particularly fast and accurate.
- */
-class OXYGEN_API CCylinderCollider : public ConvexCollider
-{
- //
- // Functions
- //
-public:
- CCylinderCollider();
-
- /** sets the parameters of the capped cylinder.
-
- \param radius is the radius of the caps, and of the cylinder itself
- \param length is the height of the cylinder, not counting the caps
- */
- void SetParams(float radius, float length);
-
- /** sets the radius of the capped cylinder */
- void SetRadius(float radius);
-
- /** sets the length of the capped cylinder */
- void SetLength(float length);
-
- /** gets the radius and the length of the capped cylinder */
- void GetParams(float& radius, float& length);
-
- /** returns the radius of the capped cylinder */
- float GetRadius();
-
- /** return the length of the capped cylinder */
- float GetLength();
-
- /** returns the depth of the given relative position in the
- managed capped cylinder geom. Points inside the geom will have
- positive depth, points outside it will have negative depth, and
- points on the surface will have zero depth.
- */
- float GetPointDepth(const salt::Vector3f& pos);
-
-protected:
- /** constructs a default capped cylinder with an radius of 1 and a
- length of 1 */
- virtual bool ConstructInternal();
-};
-
-DECLARE_CLASS(CCylinderCollider);
-
-} //namespace oxygen
-
-#endif //OXYGEN_CCYLINDERCOLLIDER_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider_c.cpp 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider_c.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -1,112 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
-
- this file is part of rcssserver3D
- Fri May 9 2003
- Copyright (C) 2003 Koblenz University
- $Id$
-
- 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/ccylindercollider.h>
-
-using namespace oxygen;
-using namespace boost;
-using namespace salt;
-
-FUNCTION(CCylinderCollider,setParams)
-{
- float inRadius;
- float inLength;
-
- if (
- (in.GetSize() != 2) ||
- (! in.GetValue(in[0],inRadius)) ||
- (! in.GetValue(in[1],inLength))
- )
- {
- return false;
- }
-
- obj->SetParams(inRadius,inLength);
- return true;
-}
-
-FUNCTION(CCylinderCollider,setRadius)
-{
- float inRadius;
-
- if (
- (in.GetSize() != 1) ||
- (! in.GetValue(in[0],inRadius))
- )
- {
- return false;
- }
-
- obj->SetRadius(inRadius);
- return true;
-}
-
-FUNCTION(CCylinderCollider,setLength)
-{
- float inLength;
-
- if (
- (in.GetSize() != 1) ||
- (! in.GetValue(in[0],inLength))
- )
- {
- return false;
- }
-
- obj->SetLength(inLength);
- return true;
-}
-
-FUNCTION(CCylinderCollider,getRadius)
-{
- return obj->GetRadius();
-}
-
-FUNCTION(CCylinderCollider,getLength)
-{
- return obj->GetLength();
-}
-
-FUNCTION(CCylinderCollider,getPointDepth)
-{
- Vector3f inPos;
-
- if (
- (in.GetSize() == 0) ||
- (! in.GetValue(in.begin(), inPos))
- )
- {
- return 0;
- }
-
- return obj->GetPointDepth(inPos);
-}
-
-void CLASS(CCylinderCollider)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/ConvexCollider);
- DEFINE_FUNCTION(setParams);
- DEFINE_FUNCTION(setRadius);
- DEFINE_FUNCTION(setLength);
- DEFINE_FUNCTION(getRadius);
- DEFINE_FUNCTION(getLength);
- DEFINE_FUNCTION(getPointDepth);
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -19,6 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <oxygen/physicsserver/collider.h>
+#include <oxygen/physicsserver/ode/odecollider.h>
#include <oxygen/physicsserver/collisionhandler.h>
#include <oxygen/physicsserver/space.h>
#include <oxygen/physicsserver/transformcollider.h>
@@ -34,6 +35,7 @@
Collider::Collider() : PhysicsObject(), mODEGeom(0)
{
+ mColliderImp = boost::shared_ptr<ODECollider>(new ODECollider());
}
Collider::~Collider()
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -30,6 +30,7 @@
namespace oxygen
{
+class ColliderInt;
/** \class Collider encapsulates an ODE geometry object- geom for
short. Geoms are the fundamental objects in the collision
@@ -158,6 +159,9 @@
protected:
/** the ode collision geometry */
dGeomID mODEGeom;
+
+private:
+ boost::shared_ptr<ColliderInt> mColliderImp;
protected:
/** a set that store the colliders that I never collide with
Added: branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,33 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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/compoundcollider.h>
+#include <oxygen/physicsserver/ode/odecompoundcollider.h>
+
+using namespace oxygen;
+
+CompoundCollider::CompoundCollider() : Collider(){
+ mCompoundColliderImp = boost::shared_ptr<ODECompoundCollider>(new ODECompoundCollider());
+}
+
+CompoundCollider::~CompoundCollider(){
+
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -27,6 +27,7 @@
namespace oxygen
{
+class CompoundColliderInt;
/**
CompoundCollider is not yet implemented.
*/
@@ -37,8 +38,11 @@
// Functions
//
public:
- CompoundCollider() : Collider(){};
- virtual ~CompoundCollider(){};
+ CompoundCollider();
+ virtual ~CompoundCollider();
+
+private:
+ boost::shared_ptr<CompoundColliderInt> mCompoundColliderImp;
};
DECLARE_CLASS(CompoundCollider);
Added: branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,33 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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/concavecollider.h>
+#include <oxygen/physicsserver/ode/odeconcavecollider.h>
+
+using namespace oxygen;
+
+ConcaveCollider::ConcaveCollider() : Collider(){
+ mConcaveColliderImp = boost::shared_ptr<ODEConcaveCollider>(new ODEConcaveCollider());
+}
+
+ConcaveCollider::~ConcaveCollider(){
+
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -27,6 +27,7 @@
namespace oxygen
{
+class ConcaveColliderInt;
/**
ConcaveCollider is not yet implemented.
*/
@@ -37,8 +38,11 @@
// Functions
//
public:
- ConcaveCollider() : Collider(){};
- virtual ~ConcaveCollider(){};
+ ConcaveCollider();
+ virtual ~ConcaveCollider();
+
+private:
+ boost::shared_ptr<ConcaveColliderInt> mConcaveColliderImp;
};
DECLARE_CLASS(ConcaveCollider);
Added: branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,33 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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/emptycollider.h>
+#include <oxygen/physicsserver/ode/odeemptycollider.h>
+
+using namespace oxygen;
+
+EmptyCollider::EmptyCollider() : Collider(){
+ mEmptyColliderImp = boost::shared_ptr<ODEEmptyCollider>(new ODEEmptyCollider());
+}
+
+EmptyCollider::~EmptyCollider(){
+
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -27,6 +27,7 @@
namespace oxygen
{
+class EmptyColliderInt;
/**
EmptyCollider is not yet implemented.
*/
@@ -37,8 +38,11 @@
// Functions
//
public:
- EmptyCollider() : Collider(){};
- virtual ~EmptyCollider(){};
+ EmptyCollider();
+ virtual ~EmptyCollider();
+
+private:
+ boost::shared_ptr<EmptyColliderInt> mEmptyColliderImp;
};
DECLARE_CLASS(EmptyCollider);
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/colliderint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/colliderint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/colliderint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,72 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_COLLIDERINT_H
+#define OXYGEN_COLLIDERINT_H
+
+#include <oxygen/physicsserver/ode/odewrapper.h>
+#include <oxygen/oxygen_defines.h>
+#include <set>
+#include <string>
+
+namespace oxygen
+{
+class Collider;
+
+class OXYGEN_API ColliderInt
+{
+
+public:
+ enum ECollisionType
+ {
+ CT_DIRECT,
+ CT_SYMMETRIC
+ };
+
+ typedef std::set<std::string> TColliderNameSet;
+
+ static boost::shared_ptr<Collider> GetCollider(long GeomID){};
+
+ virtual void OnCollision(boost::shared_ptr<Collider> collidee, dContact& contact, ECollisionType type) = 0;
+ virtual bool AddCollisionHandler(const std::string& handlerName) = 0;
+ virtual long GetGeomID() = 0;
+ virtual void SetPosition(const salt::Vector3f& pos) = 0;
+ virtual void SetLocalPosition(const salt::Vector3f& pos) = 0;
+ virtual salt::Vector3f GetPosition() const = 0;
+ virtual void SetRotation(const salt::Matrix& rot) = 0;
+ virtual bool Intersects(boost::shared_ptr<Collider> collider) = 0;
+ virtual long GetParentSpaceID() = 0;
+ virtual void AddNotCollideWithColliderName(const std::string& colliderName, bool isAdd) = 0;
+ virtual const TColliderNameSet& GetNotCollideWithSet() const = 0;
+ virtual void OnLink() = 0;
+ virtual void OnUnlink() = 0;
+ virtual void PrePhysicsUpdateInternal(float deltaTime) = 0;
+ virtual void DestroyPhysicsObject() = 0;
+
+protected:
+ dGeomID mODEGeom;
+ TColliderNameSet mNotCollideWithSet;
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_COLLIDERINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/compoundcolliderint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/compoundcolliderint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/compoundcolliderint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,38 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_COMPOUNDCOLLIDERINT_H
+#define OXYGEN_COMPOUNDCOLLIDERINT_H
+
+#include <oxygen/oxygen_defines.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API CompoundColliderInt
+{
+
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_COMPOUNDCOLLIDERINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/concavecolliderint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/concavecolliderint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/concavecolliderint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,38 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_CONCAVECOLLIDERINT_H
+#define OXYGEN_CONCAVECOLLIDERINT_H
+
+#include <oxygen/oxygen_defines.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ConcaveColliderInt
+{
+
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_CONCAVECOLLIDERINT_H
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -24,7 +24,6 @@
#define OXYGEN_DYNAMICBODYINT_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odebody.h>
namespace oxygen
{
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/emptycolliderint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/emptycolliderint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/emptycolliderint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,38 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_EMPTYCOLLIDERINT_H
+#define OXYGEN_EMPTYCOLLIDERINT_H
+
+#include <oxygen/oxygen_defines.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API EmptyColliderInt
+{
+
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_EMPTYCOLLIDERINT_H
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -24,8 +24,7 @@
#define OXYGEN_PHYSICSOBJECTINT_H
#include <boost/smart_ptr/shared_ptr.hpp>
-#include <oxygen/physicsserver/ode/odewrapper.h>
-#include <oxygen/sceneserver/basenode.h>
+#include <salt/salt.h>
#include <oxygen/oxygen_defines.h>
namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -24,8 +24,6 @@
#define OXYGEN_RIGIDBODYINT_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odebody.h>
-#include <iostream>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -24,7 +24,6 @@
#define OXYGEN_SOFTBODYINT_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odebody.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -23,7 +23,6 @@
#ifndef OXYGEN_SPACEINT_H
#define OXYGEN_SPACEINT_H
-#include <oxygen/physicsserver/ode/odephysicsobject.h>
#include <set>
#include <oxygen/oxygen_defines.h>
@@ -32,6 +31,7 @@
class Transform;
class RigidBody;
class Collider;
+class Scene;
class OXYGEN_API SpaceInt
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -24,7 +24,6 @@
#define OXYGEN_STATICBODYINT_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odebody.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h 2009-12-07 08:43:40 UTC (rev 115)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -22,8 +22,8 @@
#ifndef OXYGEN_WORLDINT_H
#define OXYGEN_WORLDINT_H
+#include <salt/salt.h>
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odephysicsobject.h>
namespace oxygen
{
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,305 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id: collider.cpp 115 2009-12-07 08:43:40Z a-held $
+
+ 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/collider.h>
+#include <oxygen/physicsserver/ode/odecollider.h>
+#include <oxygen/physicsserver/collisionhandler.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/physicsserver/transformcollider.h>
+#include <oxygen/physicsserver/rigidbody.h>
+#include <oxygen/sceneserver/basenode.h>
+#include <oxygen/sceneserver/scene.h>
+#include <zeitgeist/leaf.h>
+#include <zeitgeist/logserver/logserver.h>
+
+using namespace oxygen;
+using namespace salt;
+using namespace zeitgeist;
+using namespace boost;
+using namespace std;
+
+ODECollider::ODECollider() : ODEPhysicsObject(), mODEGeom(0)
+{
+}
+
+ODECollider::~ODECollider()
+{
+}
+
+void ODECollider::OnLink()
+{/*
+ //PhysicsObject::OnLink();
+
+
+ //weak_ptr<Node> parent = GetParent();
+ if (
+ (mODEGeom == 0) //||
+ //(parent.expired())
+ )
+ {
+ return;
+ }
+
+ // shared_ptr<TransformCollider> tcParent =
+ // shared_dynamic_cast<TransformCollider>(parent.lock());
+
+ if (tcParent.get() != 0)
+ {
+ // our parent is an ODE transform geom that encapsulates
+ // this geom, so register ourself to it. This geom must
+ // not directly register to a space or a body.
+ dGeomTransformSetGeom((dGeomID) tcParent->GetGeomID(), mODEGeom);
+ return;
+ }
+
+ // this geom is independent, so register to space and body
+ // if we have a space add the geom to it
+ //long spaceID = FindSpaceID();
+ if (
+ (spaceID) &&
+ (! dSpaceQuery((dSpaceID) spaceID, mODEGeom))
+ )
+ {
+ dGeomSetData(mODEGeom, this);
+ dSpaceAdd((dSpaceID) spaceID, mODEGeom);
+ }
+ // if there is a Body below our parent, link to it
+ shared_ptr<RigidBody> body = shared_static_cast<RigidBody>
+ (parent.lock()->GetChildOfClass("RigidBody"));
+
+ if (body.get() != 0)
+ {
+ dGeomSetBody (mODEGeom, (dBodyID) body->GetBodyID());
+ } else
+ {
+ // no body node found, setup initial position and
+ // orientation identical to the parent node
+ SetRotation(GetWorldTransform());
+ SetPosition(Vector3f(0,0,0));
+ }
+*/}
+
+void ODECollider::OnUnlink()
+{
+ //PhysicsObject::OnUnlink();
+
+ // remove collision geometry from space
+ long space = GetParentSpaceID();
+
+ if (
+ (mODEGeom == 0) ||
+ (space == 0)
+ )
+ {
+ return;
+ }
+
+ if (space)
+ {
+ dSpaceRemove((dSpaceID) space, mODEGeom);
+ }
+}
+
+void ODECollider::PrePhysicsUpdateInternal(float /*deltaTime*/)
+{
+ // if (FindChildSupportingClass<CollisionHandler>(false).get() == 0)
+ // {
+ // for convenience we add a ContactJointHandler if no
+ // other handler is registered. This behaviour covers the
+ // majority of all use cases and eases the creation of
+ // Colliders.
+ AddCollisionHandler("oxygen/ContactJointHandler");
+ // }
+}
+
+long ODECollider::GetGeomID()
+{
+ return (long) mODEGeom;
+}
+
+bool ODECollider::AddCollisionHandler(const std::string& handlerName)
+{/*
+ shared_ptr<CollisionHandler> handler =
+ shared_dynamic_cast<CollisionHandler>(GetCore()->New(handlerName));
+
+ if (handler.get() == 0)
+ {
+ GetLog()->Error()
+ << "ERROR: (Collider) Cannot create CollisionHandler "
+ << handlerName << "\n";
+ return false;
+ }
+
+ return AddChildReference(handler);
+*/}
+
+void ODECollider::OnCollision (boost::shared_ptr<Collider> collidee,
+ dContact& contact, ECollisionType type)
+
+{/*
+ TLeafList handlers;
+ ListChildrenSupportingClass<CollisionHandler>(handlers);
+
+ for (
+ TLeafList::iterator iter = handlers.begin();
+ iter != handlers.end();
+ ++iter
+ )
+ {
+ shared_ptr<CollisionHandler> handler =
+ shared_static_cast<CollisionHandler>(*iter);
+
+ if (
+ (type == CT_SYMMETRIC) &&
+ (! handler->IsSymmetricHandler())
+ )
+ {
+ continue;
+ }
+
+ handler->HandleCollision(collidee, contact);
+ }
+*/}
+
+/*shared_ptr<Collider> ODECollider::GetCollider(long geomID)
+{
+ if (geomID == 0)
+ {
+ return shared_ptr<Collider>();
+ }
+
+ Collider* collPtr =
+ static_cast<Collider*>(dGeomGetData((dGeomID) geomID));
+
+ if (collPtr == 0)
+ {
+ // we cannot use the logserver here
+ cerr << "ERROR: (Collider) no Collider found for GeomID "
+ << geomID << "\n";
+ return shared_ptr<Collider>();
+ }
+
+ shared_ptr<Collider> collider = shared_static_cast<Collider>
+ (collPtr->GetSelf().lock());
+
+ if (collider.get() == 0)
+ {
+ // we cannot use the logserver here
+ cerr << "ERROR: (Collider) got no shared_ptr for GeomID "
+ << geomID << "\n";
+ }
+
+ return collider;
+}*/
+
+void ODECollider::SetRotation(const Matrix& rot)
+{
+ dMatrix3 ODEMatrix;
+ void* matrixPtr = (void*) &ODEMatrix;
+ ConvertRotationMatrix(rot, matrixPtr);
+ dGeomSetRotation(mODEGeom, ODEMatrix);
+}
+
+void ODECollider::SetPosition(const Vector3f& pos)
+{
+ //Vector3f globalPos(GetWorldTransform() * pos);
+ //dGeomSetPosition (mODEGeom, globalPos[0], globalPos[1], globalPos[2]);
+}
+
+void ODECollider::SetLocalPosition(const Vector3f& pos)
+{
+ dGeomSetPosition (mODEGeom, pos[0], pos[1], pos[2]);
+}
+
+Vector3f ODECollider::GetPosition() const
+{
+ const dReal* pos = dGeomGetPosition(mODEGeom);
+ return Vector3f(pos[0],pos[1],pos[2]);
+}
+
+long ODECollider::GetParentSpaceID()
+{
+ if (mODEGeom == 0)
+ {
+ return 0;
+ }
+
+ return (long) dGeomGetSpace(mODEGeom);
+}
+
+bool ODECollider::Intersects(boost::shared_ptr<Collider> collider)
+{
+ if (
+ (mODEGeom == 0) ||
+ (collider.get() == 0)
+ )
+ {
+ return false;
+ }
+
+ dContactGeom contact;
+
+ return dCollide
+ (
+ mODEGeom,
+ (dGeomID) collider->GetGeomID(),
+ 1, /* ask for at most one collision point */
+ &contact,
+ sizeof(contact)
+ ) > 0;
+}
+
+void ODECollider::DestroyPhysicsObject()
+{
+ if (! mODEGeom)
+ {
+ return;
+ }
+
+ dGeomDestroy(mODEGeom);
+ mODEGeom = 0;
+}
+
+void ODECollider::AddNotCollideWithColliderName(const std::string & colliderName, bool isAdd)
+{
+ TColliderNameSet::iterator it = mNotCollideWithSet.find(colliderName);
+
+ if (isAdd)
+ {
+ if (it == mNotCollideWithSet.end())
+ {
+ //I'm not have this one
+ mNotCollideWithSet.insert(colliderName);
+ }
+ }
+ else
+ {
+ if (it != mNotCollideWithSet.end())
+ {
+ //Remove
+ mNotCollideWithSet.erase(it);
+ }
+ }
+}
+
+const ODECollider::TColliderNameSet& ODECollider::GetNotCollideWithSet() const
+{
+ return mNotCollideWithSet;
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,62 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_ODECOLLIDER_H
+#define OXYGEN_ODECOLLIDER_H
+
+#include <oxygen/physicsserver/ode/odephysicsobject.h>
+#include <oxygen/physicsserver/int/colliderint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODECollider : public ColliderInt, public ODEPhysicsObject
+{
+
+public:
+ ODECollider();
+ virtual ~ODECollider();
+
+ void OnCollision(boost::shared_ptr<Collider> collidee, dContact& contact, ECollisionType type);
+ bool AddCollisionHandler(const std::string& handlerName);
+ long GetGeomID();
+ void SetPosition(const salt::Vector3f& pos);
+ void SetLocalPosition(const salt::Vector3f& pos);
+ salt::Vector3f GetPosition() const;
+ void SetRotation(const salt::Matrix& rot);
+ bool Intersects(boost::shared_ptr<Collider> collider);
+ long GetParentSpaceID();
+ void AddNotCollideWithColliderName(const std::string& colliderName, bool isAdd);
+ const TColliderNameSet& GetNotCollideWithSet() const;
+ void OnLink();
+ void OnUnlink();
+ void PrePhysicsUpdateInternal(float deltaTime);
+ void DestroyPhysicsObject();
+
+protected:
+ dGeomID mODEGeom;
+ TColliderNameSet mNotCollideWithSet;
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODECOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecompoundcollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecompoundcollider.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecompoundcollider.cpp 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,28 @@
+/* -*- 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.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/ode/odecompoundcollider.h>
+
+using namespace oxygen;
+
+ODECompoundCollider::ODECompoundCollider() : ODECollider(){
+
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecompoundcollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecompoundcollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecompoundcollider.h 2009-12-08 07:56:49 UTC (rev 116)
@@ -0,0 +1,39 @@
+/* -*- 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.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.
+*/
+#ifndef OXYGEN_ODECOMPOUNDCOLLIDER_H
+#define OXYGEN_ODECOMPOUNDCOLLIDER_H
+
+#include <oxygen/physicsserver/ode/odecollider.h>
+#include <oxygen/physicsserver/int/compoundcolliderint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODECompoundCollider : public CompoundColliderInt, public ODECollider
+{
+public:
+ ODECompoundCollider();
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODECOMPOUNDCOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeconcavecollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeconcavecollider.cpp (rev 0)
+++ br...
[truncated message content] |
|
From: <a-...@us...> - 2009-12-07 08:43:54
|
Revision: 115
http://simspark.svn.sourceforge.net/simspark/?rev=115&view=rev
Author: a-held
Date: 2009-12-07 08:43:40 +0000 (Mon, 07 Dec 2009)
Log Message:
-----------
Went back to multiple inheritances so abstract interface won't be derived from specific classes
Removed constructors from Interfaces
Did some refactoring to avoid casting as much as possible
Modified Paths:
--------------
branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -208,9 +208,10 @@
void Collider::SetRotation(const Matrix& rot)
{
- dMatrix3 m;
- ConvertRotationMatrix(rot,(int&) m);
- dGeomSetRotation(mODEGeom,m);
+ dMatrix3 ODEMatrix;
+ void* matrixPtr = (void*) &ODEMatrix;
+ ConvertRotationMatrix(rot, matrixPtr);
+ dGeomSetRotation(mODEGeom, ODEMatrix);
}
void Collider::SetPosition(const Vector3f& pos)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -29,12 +29,9 @@
namespace oxygen
{
-class OXYGEN_API BodyInt : public ODEPhysicsObject
+class OXYGEN_API BodyInt
{
-protected:
- BodyInt() : ODEPhysicsObject(){
- };
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -29,11 +29,9 @@
namespace oxygen
{
-class OXYGEN_API DynamicBodyInt : public ODEBody
+class OXYGEN_API DynamicBodyInt
{
-protected:
- DynamicBodyInt() : ODEBody(){};
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -35,12 +35,8 @@
{
public:
- virtual void ConvertRotationMatrix(const salt::Matrix& rot, int& matrix) = 0;
+ virtual void ConvertRotationMatrix(const salt::Matrix& rot, void* matrix) = 0;
virtual void ConvertRotationMatrix(const void* matrix, salt::Matrix& rot) const = 0;
-
-protected:
- PhysicsObjectInt(){
- };
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -31,8 +31,6 @@
class OXYGEN_API PhysicsServerInt
{
-protected:
- PhysicsServerInt(){};
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -30,7 +30,7 @@
namespace oxygen
{
-class OXYGEN_API RigidBodyInt : public ODEBody
+class OXYGEN_API RigidBodyInt
{
public:
@@ -43,7 +43,6 @@
virtual void SetMass(float mass) = 0;
virtual void SetMassParameters(const float& mass) = 0;
virtual float GetMass() const = 0;
- virtual void GetMassParameters(float& mass) const = 0;
virtual void SetSphere(float density, float radius) = 0;
virtual void AddSphere(float density, float radius, const salt::Matrix& matrix) = 0;
virtual void SetSphereTotal(float total_mass, float radius) = 0;
@@ -73,8 +72,6 @@
virtual salt::Vector3f GetPosition() const = 0;
virtual void DestroyPhysicsObject() = 0;
virtual salt::Matrix GetSynchronisationMatrix() = 0;
- virtual void AddMass(const float& mass, const salt::Matrix& matrix) = 0;
- //virtual salt::Vector3f GetMassCenter() const = 0;
virtual void BodySetData(RigidBody* rb) = 0;
virtual RigidBody* BodyGetData(long bodyID) = 0;
@@ -84,77 +81,21 @@
virtual bool GetMassTransformed() = 0;
virtual void SetMassTransformed(bool f) = 0;
- /** Here, we have to cheat with the preprocessor, since a static method
- is required, and the bridge pattern requires member variables to
- be used (so we cannot use the bridge pattern)
- */
+ // Here, we have to cheat with the preprocessor, since a static method
+ // is required, and the bridge pattern requires member variables to
+ // be used (so we cannot use the bridge pattern)
static RigidBody* GetBodyPointer(long bodyID){
- //if ODE is used (currently not checked since ODE is the only supported engine)
+ #ifdef OXYGEN_ODEWRAPPER_H
return static_cast<RigidBody*>(dBodyGetData( (dBodyID) bodyID));
- //if another engine is used
- //do something else
+ #endif
}
protected:
- RigidBodyInt() : ODEBody(), mBodyID(0), mMassTrans(0,0,0), mMassTransformed(false){
- };
-
- /** sets up an ode mass struct representing a box of the given
- size and total_mass
+ /** The ID of the managed body. This must be unique within the simulation.
+ It is used externally to reference this partcular body.
*/
- virtual void PrepareBoxTotal(float& mass, float total_mass, const salt::Vector3f& size) const = 0;
-
- /** sets up an ode mass struct representing a box of the given
- density and size
- */
- virtual void PrepareBox(float& mass, float density, const salt::Vector3f& size) const = 0;
-
- /** sets up an ode mass struct representing a sphere of the given
- density and radius
- */
- virtual void PrepareSphere(float& mass, float density, float radius) const = 0;
-
- /** sets up an ode mass struct representing a sphere of the given
- radius and total_mass
- */
- virtual void PrepareSphereTotal(float& mass, float total_mass, float radius) const = 0;
-
- /** sets up an ode mass struct representing a flat-ended cylinder
- of the given parameters and density, with the center of mass
- at (0,0,0) relative to the body. The radius of the cylinder is
- radius. The length of the cylinder is length. The cylinder's
- long axis is oriented along the body's z axis.
- */
- virtual void PrepareCylinder(float& mass, float density, float radius, float length) const = 0;
-
- /** sets up an ode mass struct representing a flat-ended cylinder
- of the given parameters and total mass, with the center of
- mass at (0,0,0) relative to the body. The radius of the
- cylinder is radius. The length of the cylinder is length. The
- cylinder's long axis is oriented along the body's z axis.
- */
- virtual void PrepareCylinderTotal(float& mass, float total_mass, float radius, float length) const = 0;
-
- /* sets up an ode mass struct representing a capsule of
- the given parameters and density, with the center of mass at
- (0,0,0) relative to the body. The radius of the capsule (and
- the spherical cap) is radius. The length of the capsule (not
- counting the spherical cap) is length. The capsule's long axis
- is oriented along the body's z axis.
- */
- virtual void PrepareCapsule(float& mass, float density, float radius, float length) const = 0;
-
- /* sets up an ode mass struct representing a capsule of
- the given parameters and total mass, with the center of mass at
- (0,0,0) relative to the body. The radius of the capsule (and
- the spherical cap) is radius. The length of the capsule (not
- counting the spherical cap) is length. The capsule's long axis
- is oriented along the body's z axis.
- */
- virtual void PrepareCapsuleTotal(float& mass, float total_mass, float radius, float length) const = 0;
-
-protected:
long mBodyID;
+
salt::Vector3f mMassTrans;
bool mMassTransformed;
};
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -29,11 +29,9 @@
namespace oxygen
{
-class OXYGEN_API SoftBodyInt : public ODEBody
+class OXYGEN_API SoftBodyInt
{
-protected:
- SoftBodyInt() : ODEBody(){};
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -33,7 +33,7 @@
class RigidBody;
class Collider;
-class OXYGEN_API SpaceInt : public ODEPhysicsObject
+class OXYGEN_API SpaceInt
{
public:
@@ -58,10 +58,6 @@
virtual void DestroySpaceObjects() = 0;
boost::shared_ptr<Scene> scene;
-
-protected:
- SpaceInt() : ODEPhysicsObject(){
- };
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -29,11 +29,9 @@
namespace oxygen
{
-class OXYGEN_API StaticBodyInt : public ODEBody
+class OXYGEN_API StaticBodyInt
{
-protected:
- StaticBodyInt() : ODEBody(){};
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -28,7 +28,7 @@
namespace oxygen
{
-class OXYGEN_API WorldInt : public ODEPhysicsObject
+class OXYGEN_API WorldInt
{
public:
@@ -48,9 +48,6 @@
virtual void DestroyWorld() = 0;
protected:
- WorldInt() : ODEPhysicsObject(), mWorldID(0){
- };
-
long mWorldID;
};
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -23,6 +23,6 @@
using namespace oxygen;
-ODEBody::ODEBody() : BodyInt(){
+ODEBody::ODEBody() : ODEPhysicsObject(){
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -27,7 +27,7 @@
namespace oxygen
{
-class OXYGEN_API ODEBody : public BodyInt
+class OXYGEN_API ODEBody : public BodyInt, public ODEPhysicsObject
{
public:
ODEBody();
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -23,6 +23,6 @@
using namespace oxygen;
-ODEDynamicBody::ODEDynamicBody() : DynamicBodyInt(){
+ODEDynamicBody::ODEDynamicBody() : ODEBody(){
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -27,7 +27,7 @@
namespace oxygen
{
-class OXYGEN_API ODEDynamicBody : public DynamicBodyInt
+class OXYGEN_API ODEDynamicBody : public DynamicBodyInt, public ODEBody
{
public:
ODEDynamicBody();
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -29,13 +29,15 @@
using namespace boost;
using namespace std;
-ODEPhysicsObject::ODEPhysicsObject() : PhysicsObjectInt()
-{
+ODEPhysicsObject::ODEPhysicsObject(){
}
-void ODEPhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, int& matrix)
+void ODEPhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, void* matrix)
{
- dMatrix3& odeMatrix = (dMatrix3&) matrix;
+ // cast to a pointer first because the compiler doesn't want to cast
+ // from a void* directly to a reference
+ dMatrix3* helpMatrix = (dMatrix3*) matrix;
+ dMatrix3& odeMatrix = (dMatrix3&) *helpMatrix;
odeMatrix[0] = rot.m[0];
odeMatrix[1] = rot.m[4];
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -34,7 +34,7 @@
{
public:
ODEPhysicsObject();
- void ConvertRotationMatrix(const salt::Matrix& rot, int& matrix);
+ void ConvertRotationMatrix(const salt::Matrix& rot, void* matrix);
void ConvertRotationMatrix(const void* matrix, salt::Matrix& rot) const;
};
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -32,7 +32,10 @@
using namespace salt;
using namespace std;
-ODERigidBody::ODERigidBody() : RigidBodyInt(){
+ODERigidBody::ODERigidBody() : ODEBody(){
+ mBodyID = 0;
+ mMassTrans = Vector3f(0,0,0);
+ mMassTransformed = false;
}
long ODERigidBody::GetBodyID(){
@@ -57,17 +60,17 @@
void ODERigidBody::Enable()
{
- dBodyEnable((dBodyID) mBodyID);
+ dBodyEnable(mODEBody);
}
void ODERigidBody::Disable()
{
- dBodyDisable((dBodyID) mBodyID);
+ dBodyDisable(mODEBody);
}
bool ODERigidBody::IsEnabled() const
{
- return (dBodyIsEnabled((dBodyID) mBodyID) != 0);
+ return (dBodyIsEnabled(mODEBody) != 0);
}
void ODERigidBody::UseGravity(bool f)
@@ -75,23 +78,24 @@
if (f == true)
{
// body is affected by gravity
- dBodySetGravityMode((dBodyID) mBodyID, 1);
+ dBodySetGravityMode(mODEBody, 1);
}
else
{
// body is not affected by gravity
- dBodySetGravityMode((dBodyID) mBodyID, 0);
+ dBodySetGravityMode(mODEBody, 0);
}
}
bool ODERigidBody::UsesGravity() const{
- return (dBodyGetGravityMode((dBodyID) mBodyID) != 0);
+ return (dBodyGetGravityMode(mODEBody) != 0);
}
void ODERigidBody::CreateBody(long world)
{
// create the managed body
- mBodyID = (long) dBodyCreate((dWorldID) world);
+ mODEBody = dBodyCreate((dWorldID) world);
+ mBodyID = (long) mODEBody;
}
void ODERigidBody::DestroyPhysicsObject(){
@@ -100,38 +104,38 @@
return;
}
- dBodyDestroy((dBodyID) mBodyID);
+ dBodyDestroy(mODEBody);
mBodyID = 0;
}
void ODERigidBody::BodySetData(RigidBody* rb)
{
- dBodySetData((dBodyID) mBodyID, rb);
+ dBodySetData(mODEBody, rb);
}
void ODERigidBody::SetMass(float mass)
{
dMass ODEMass;
- dBodyGetMass((dBodyID) mBodyID, &ODEMass);
+ dBodyGetMass(mODEBody, &ODEMass);
dMassAdjust(&ODEMass, mass);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ dBodySetMass(mODEBody, &ODEMass);
}
float ODERigidBody::GetMass() const
{
dMass m;
- dBodyGetMass((dBodyID) mBodyID, &m);
+ dBodyGetMass(mODEBody, &m);
return m.mass;
}
-void ODERigidBody::AddMass(const float& mass, const Matrix& matrix)
+void ODERigidBody::AddMass(const dMass& ODEMass, const Matrix& matrix)
{
- dMass ODEMass = (dMass&) mass;
dMass transMass(ODEMass);
- dMatrix3 rot;
- ConvertRotationMatrix(matrix,(int&) rot);
- dMassRotate(&transMass,rot);
+ dMatrix3 ODEMatrix;
+ void* matrixPtr = (void*) &ODEMatrix;
+ ConvertRotationMatrix(matrix, matrixPtr);
+ dMassRotate(&transMass, ODEMatrix);
const Vector3f& trans(matrix.Pos());
dMassTranslate(&transMass,trans[0],trans[1],trans[2]);
@@ -139,7 +143,7 @@
dMassTranslate(&transMass,mMassTrans[0],mMassTrans[1],mMassTrans[2]);
dMass bodyMass;
- dBodyGetMass((dBodyID) mBodyID, &bodyMass);
+ dBodyGetMass(mODEBody, &bodyMass);
dMassAdd(&bodyMass, &transMass);
/** ODE currently requires that the center mass is always in the
@@ -149,7 +153,7 @@
dMassTranslate(&bodyMass, -trans2[0], -trans2[1], -trans2[2]);
bodyMass.c[0] = bodyMass.c[1] = bodyMass.c[2] = 0.0f;
- dBodySetMass((dBodyID) mBodyID, (const dMass*)&bodyMass);
+ dBodySetMass(mODEBody, (const dMass*)&bodyMass);
// Move body so mass is at right position again
SetPosition(GetPosition() + trans2);
@@ -160,228 +164,198 @@
mMassTransformed = true;
}
-void ODERigidBody::GetMassParameters(float& mass) const
-{
- dMass& ODEMass = (dMass&) mass;
- dBodyGetMass((dBodyID) mBodyID, &ODEMass);
- mass = (float&) ODEMass;
-}
-
void ODERigidBody::SetMassParameters(const float& mass)
{
dMass& ODEMass = (dMass&) mass;
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ dBodySetMass(mODEBody, &ODEMass);
}
-void ODERigidBody::PrepareSphere(float& mass, float density, float radius) const
+void ODERigidBody::PrepareSphere(dMass& mass, float density, float radius) const
{
- dMass& ODEMass = (dMass&) mass;
- dMassSetSphere(&ODEMass, density, radius);
+ dMassSetSphere(&mass, density, radius);
}
void ODERigidBody::SetSphere(float density, float radius)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareSphere(massRef, density, radius);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ PrepareSphere(ODEMass, density, radius);
+ dBodySetMass(mODEBody, &ODEMass);
}
void ODERigidBody::AddSphere(float density, float radius, const Matrix& matrix)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareSphere(massRef, density, radius);
- AddMass(massRef, matrix);
+ PrepareSphere(ODEMass, density, radius);
+ AddMass(ODEMass, matrix);
}
-void ODERigidBody::PrepareSphereTotal(float& mass, float total_mass, float radius) const
+void ODERigidBody::PrepareSphereTotal(dMass& mass, float total_mass, float radius) const
{
- dMass& ODEMass = (dMass&) mass;
- dMassSetSphereTotal(&ODEMass, total_mass, radius);
+ dMassSetSphereTotal(&mass, total_mass, radius);
}
void ODERigidBody::SetSphereTotal(float total_mass, float radius)
{
- dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareSphereTotal(massRef, total_mass, radius);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ dMass ODEMass;;
+ PrepareSphereTotal(ODEMass, total_mass, radius);
+ dBodySetMass(mODEBody, &ODEMass);
}
void ODERigidBody::AddSphereTotal(float total_mass, float radius, const Matrix& matrix)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareSphereTotal(massRef, total_mass, radius);
- AddMass(massRef, matrix);
+ PrepareSphereTotal(ODEMass, total_mass, radius);
+ AddMass(ODEMass, matrix);
}
-void ODERigidBody::PrepareBox(float& mass, float density, const Vector3f& size) const
+void ODERigidBody::PrepareBox(dMass& mass, float density, const Vector3f& size) const
{
- dMass& ODEMass = (dMass&) mass;
- dMassSetBox(&ODEMass, density, size[0], size[1], size[2]);
+ dMassSetBox(&mass, density, size[0], size[1], size[2]);
}
void ODERigidBody::SetBox(float density, const Vector3f& size)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareBox(massRef, density, size);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ PrepareBox(ODEMass, density, size);
+ dBodySetMass(mODEBody, &ODEMass);
}
void ODERigidBody::AddBox(float density, const Vector3f& size, const Matrix& matrix)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareBox(massRef, density, size);
- AddMass(massRef, matrix);
+ PrepareBox(ODEMass, density, size);
+ AddMass(ODEMass, matrix);
}
-void ODERigidBody::PrepareBoxTotal(float& mass, float total_mass, const Vector3f& size) const
+void ODERigidBody::PrepareBoxTotal(dMass& mass, float total_mass, const Vector3f& size) const
{
- dMass& ODEMass = (dMass&) mass;
- dMassSetBoxTotal(&ODEMass, total_mass, size[0], size[1], size[2]);
+ dMassSetBoxTotal(&mass, total_mass, size[0], size[1], size[2]);
}
void ODERigidBody::SetBoxTotal(float total_mass, const Vector3f& size)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareBoxTotal(massRef, total_mass, size);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ PrepareBoxTotal(ODEMass, total_mass, size);
+ dBodySetMass(mODEBody, &ODEMass);
}
void ODERigidBody::AddBoxTotal(float total_mass, const Vector3f& size, const Matrix& matrix)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareBoxTotal(massRef, total_mass, size);
- AddMass(massRef, matrix);
+ PrepareBoxTotal(ODEMass, total_mass, size);
+ AddMass(ODEMass, matrix);
}
-void ODERigidBody::PrepareCylinder (float& mass, float density, float radius, float length) const
+void ODERigidBody::PrepareCylinder (dMass& mass, float density, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMass& ODEMass = (dMass&) mass;
- dMassSetCylinder (&ODEMass, density, direction, radius, length);
+ dMassSetCylinder (&mass, density, direction, radius, length);
}
void ODERigidBody::SetCylinder (float density, float radius, float length)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareCylinder(massRef, density, radius, length);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ PrepareCylinder(ODEMass, density, radius, length);
+ dBodySetMass(mODEBody, &ODEMass);
}
void ODERigidBody::AddCylinder (float density, float radius, float length, const Matrix& matrix)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareCylinder(massRef, density, radius, length);
- AddMass(massRef, matrix);
+ PrepareCylinder(ODEMass, density, radius, length);
+ AddMass(ODEMass, matrix);
}
-void ODERigidBody::PrepareCylinderTotal(float& mass, float total_mass, float radius, float length) const
+void ODERigidBody::PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
-
- dMass& ODEMass = (dMass&) mass;
- dMassSetCylinderTotal(&ODEMass, total_mass, direction, radius, length);
+;
+ dMassSetCylinderTotal(&mass, total_mass, direction, radius, length);
}
void ODERigidBody::SetCylinderTotal(float total_mass, float radius, float length)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareCylinderTotal(massRef, total_mass, radius, length);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ PrepareCylinderTotal(ODEMass, total_mass, radius, length);
+ dBodySetMass(mODEBody, &ODEMass);
}
void ODERigidBody::AddCylinderTotal(float total_mass, float radius, float length, const Matrix& matrix)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareCylinderTotal(massRef, total_mass, radius, length);
- AddMass(massRef, matrix);
+ PrepareCylinderTotal(ODEMass, total_mass, radius, length);
+ AddMass(ODEMass, matrix);
}
-void ODERigidBody::PrepareCapsule (float& mass, float density, float radius, float length) const
+void ODERigidBody::PrepareCapsule (dMass& mass, float density, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMass ODEMass = (dMass&) mass;
- dMassSetCapsule (&ODEMass, density, direction, radius, length);
+ dMassSetCapsule (&mass, density, direction, radius, length);
}
void ODERigidBody::SetCapsule (float density, float radius, float length)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareCapsule(massRef, density, radius, length);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ PrepareCapsule(ODEMass, density, radius, length);
+ dBodySetMass(mODEBody, &ODEMass);
}
void ODERigidBody::AddCapsule (float density, float radius, float length, const Matrix& matrix)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareCapsule(massRef, density, radius, length);
- AddMass(massRef, matrix);
+ PrepareCapsule(ODEMass, density, radius, length);
+ AddMass(ODEMass, matrix);
}
-void ODERigidBody::PrepareCapsuleTotal(float& mass, float total_mass, float radius, float length) const
+void ODERigidBody::PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMass& ODEMass = (dMass&) mass;
- dMassSetCapsuleTotal(&ODEMass, total_mass, direction, radius, length);
+ dMassSetCapsuleTotal(&mass, total_mass, direction, radius, length);
}
void ODERigidBody::SetCapsuleTotal(float total_mass, float radius, float length)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareCapsuleTotal(massRef, total_mass, radius, length);
- dBodySetMass((dBodyID) mBodyID, &ODEMass);
+ PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
+ dBodySetMass(mODEBody, &ODEMass);
}
void ODERigidBody::AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix)
{
dMass ODEMass;
- float& massRef = (float&) ODEMass;
- PrepareCapsuleTotal(massRef, total_mass, radius, length);
- AddMass(massRef, matrix);
+ PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
+ AddMass(ODEMass, matrix);
}
Vector3f ODERigidBody::GetVelocity() const
{
- const dReal* vel = dBodyGetLinearVel((dBodyID) mBodyID);
+ const dReal* vel = dBodyGetLinearVel(mODEBody);
return Vector3f(vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetVelocity(const Vector3f& vel)
{
- dBodySetLinearVel((dBodyID) mBodyID, vel[0], vel[1], vel[2]);
+ dBodySetLinearVel(mODEBody, vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetRotation(const Matrix& rot)
{
- dMatrix3 m;
- ConvertRotationMatrix(rot,(int&) m);
- dBodySetRotation((dBodyID) mBodyID,m);
+ dMatrix3 ODEMatrix;
+ void* matrixPtr = (void*) &ODEMatrix;
+ ConvertRotationMatrix(rot, matrixPtr);
+ dBodySetRotation(mODEBody, ODEMatrix);
}
salt::Matrix ODERigidBody::GetRotation() const
{
- const dReal* m = dBodyGetRotation((dBodyID) mBodyID);
+ const dReal* m = dBodyGetRotation(mODEBody);
salt::Matrix rot;
ConvertRotationMatrix(m,rot);
return rot;
@@ -389,19 +363,19 @@
Vector3f ODERigidBody::GetAngularVelocity() const
{
- const dReal* vel = dBodyGetAngularVel((dBodyID) mBodyID);
+ const dReal* vel = dBodyGetAngularVel(mODEBody);
return Vector3f(vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetAngularVelocity(const Vector3f& vel)
{
- dBodySetAngularVel((dBodyID) mBodyID, vel[0], vel[1], vel[2]);
+ dBodySetAngularVel(mODEBody, vel[0], vel[1], vel[2]);
}
salt::Matrix ODERigidBody::GetSynchronisationMatrix()
{
- const dReal* pos = dBodyGetPosition((dBodyID) mBodyID);
- const dReal* rot = dBodyGetRotation((dBodyID) mBodyID);
+ const dReal* pos = dBodyGetPosition(mODEBody);
+ const dReal* rot = dBodyGetRotation(mODEBody);
Matrix mat;
mat.m[0] = rot[0];
@@ -426,37 +400,38 @@
RigidBody* ODERigidBody::BodyGetData(long bodyID)
{
+ dBodyID ODEBodyID = (dBodyID) bodyID;
RigidBody* bodyPtr =
- static_cast<RigidBody*>(dBodyGetData( (dBodyID) bodyID));
+ static_cast<RigidBody*>(dBodyGetData(ODEBodyID));
return bodyPtr;
}
void ODERigidBody::AddForce(const Vector3f& force)
{
- dBodyAddForce((dBodyID) mBodyID, force.x(), force.y(), force.z());
+ dBodyAddForce(mODEBody, force.x(), force.y(), force.z());
}
void ODERigidBody::AddTorque(const Vector3f& torque)
{
- dBodyAddTorque((dBodyID) mBodyID, torque.x(), torque.y(), torque.z());
+ dBodyAddTorque(mODEBody, torque.x(), torque.y(), torque.z());
}
void ODERigidBody::SetPosition(const Vector3f& pos)
{
- dBodySetPosition((dBodyID) mBodyID, pos.x(), pos.y(), pos.z());
+ dBodySetPosition(mODEBody, pos.x(), pos.y(), pos.z());
// the parent node will be updated in the next physics cycle
}
Vector3f ODERigidBody::GetPosition() const
{
- const dReal* pos = dBodyGetPosition((dBodyID) mBodyID);
+ const dReal* pos = dBodyGetPosition(mODEBody);
return Vector3f(pos[0], pos[1], pos[2]);
}
void ODERigidBody::TranslateMass(const Vector3f& v)
{
dMass m;
- dBodyGetMass((dBodyID) mBodyID, &m);
+ dBodyGetMass(mODEBody, &m);
dMassTranslate(&m,v[0],v[1],v[2]);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -27,7 +27,7 @@
namespace oxygen
{
-class OXYGEN_API ODERigidBody : public RigidBodyInt
+class OXYGEN_API ODERigidBody : public RigidBodyInt, public ODEBody
{
public:
ODERigidBody();
@@ -40,8 +40,6 @@
void SetMass(float mass);
void SetMassParameters(const float& mass);
float GetMass() const;
- void GetMassParameters(float& mass) const;
- void AddMass(const float& mass, const salt::Matrix& matrix);
void SetSphere(float density, float radius);
void AddSphere(float density, float radius, const salt::Matrix& matrix);
void SetSphereTotal(float total_mass, float radius);
@@ -71,7 +69,6 @@
salt::Vector3f GetPosition() const;
void DestroyPhysicsObject();
salt::Matrix GetSynchronisationMatrix();
- //salt::Vector3f GetMassCenter() const;
void BodySetData(RigidBody* rb);
RigidBody* BodyGetData(long bodyID);
@@ -82,15 +79,71 @@
void SetMassTransformed(bool f);
protected:
+ void AddMass(const dMass& mass, const salt::Matrix& matrix);
+
+ /** creates an ODE body within the given world
+ */
void CreateBody(long world);
- void PrepareBoxTotal(float& mass, float total_mass, const salt::Vector3f& size) const;
- void PrepareBox(float& mass, float density, const salt::Vector3f& size) const;
- void PrepareSphere(float& mass, float density, float radius) const;
- void PrepareSphereTotal(float& mass, float total_mass, float radius) const;
- void PrepareCylinder(float& mass, float density, float radius, float length) const;
- void PrepareCylinderTotal(float& mass, float total_mass, float radius, float length) const;
- void PrepareCapsule(float& mass, float density, float radius, float length) const;
- void PrepareCapsuleTotal(float& mass, float total_mass, float radius, float length) const;
+
+ /** sets up an ode mass struct representing a box of the given
+ size and total_mass
+ */
+ void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const;
+
+ /** sets up an ode mass struct representing a box of the given
+ density and size
+ */
+ void PrepareBox(dMass& mass, float density, const salt::Vector3f& size) const;
+
+ /** sets up an ode mass struct representing a sphere of the given
+ density and radius
+ */
+ void PrepareSphere(dMass& mass, float density, float radius) const;
+
+ /** sets up an ode mass struct representing a sphere of the given
+ radius and total_mass
+ */
+ void PrepareSphereTotal(dMass& mass, float total_mass, float radius) const;
+
+ /** sets up an ode mass struct representing a flat-ended cylinder
+ of the given parameters and density, with the center of mass
+ at (0,0,0) relative to the body. The radius of the cylinder is
+ radius. The length of the cylinder is length. The cylinder's
+ long axis is oriented along the body's z axis.
+ */
+ void PrepareCylinder(dMass& mass, float density, float radius, float length) const;
+
+ /** sets up an ode mass struct representing a flat-ended cylinder
+ of the given parameters and total mass, with the center of
+ mass at (0,0,0) relative to the body. The radius of the
+ cylinder is radius. The length of the cylinder is length. The
+ cylinder's long axis is oriented along the body's z axis.
+ */
+ void PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const;
+
+ /** sets up an ode mass struct representing a capsule of
+ the given parameters and density, with the center of mass at
+ (0,0,0) relative to the body. The radius of the capsule (and
+ the spherical cap) is radius. The length of the capsule (not
+ counting the spherical cap) is length. The capsule's long axis
+ is oriented along the body's z axis.
+ */
+ void PrepareCapsule(dMass& mass, float density, float radius, float length) const;
+
+ /** sets up an ode mass struct representing a capsule of
+ the given parameters and total mass, with the center of mass at
+ (0,0,0) relative to the body. The radius of the capsule (and
+ the spherical cap) is radius. The length of the capsule (not
+ counting the spherical cap) is length. The capsule's long axis
+ is oriented along the body's z axis.
+ */
+ void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const;
+
+private:
+ /** An ODE-specific body ID. This is used internally to call ODE-
+ specific methods that manipulate this body.
+ */
+ dBodyID mODEBody;
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -23,6 +23,6 @@
using namespace oxygen;
-ODESoftBody::ODESoftBody() : SoftBodyInt(){
+ODESoftBody::ODESoftBody() : ODEBody(){
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -27,7 +27,7 @@
namespace oxygen
{
-class OXYGEN_API ODESoftBody : public SoftBodyInt
+class OXYGEN_API ODESoftBody : public SoftBodyInt, public ODEBody
{
public:
ODESoftBody();
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -38,7 +38,7 @@
// space->HandleCollide(obj1, obj2);
//}
-ODESpace::ODESpace() : SpaceInt(), mODESpace(0), mODEContactGroup(0)
+ODESpace::ODESpace() : ODEPhysicsObject(), mODESpace(0), mODEContactGroup(0)
{
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -28,7 +28,7 @@
namespace oxygen
{
-class OXYGEN_API ODESpace : public SpaceInt
+class OXYGEN_API ODESpace : public SpaceInt, public ODEPhysicsObject
{
public:
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -23,6 +23,6 @@
using namespace oxygen;
-ODEStaticBody::ODEStaticBody() : StaticBodyInt(){
+ODEStaticBody::ODEStaticBody() : ODEBody(){
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -27,7 +27,7 @@
namespace oxygen
{
-class OXYGEN_API ODEStaticBody : public StaticBodyInt
+class OXYGEN_API ODEStaticBody : public StaticBodyInt, public ODEBody
{
public:
ODEStaticBody();
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -27,8 +27,8 @@
using namespace oxygen;
using namespace salt;
-ODEWorld::ODEWorld() : WorldInt()
-{
+ODEWorld::ODEWorld() : ODEPhysicsObject(){
+ mWorldID = 0;
}
long ODEWorld::GetWorldID() const
@@ -38,7 +38,7 @@
void ODEWorld::SetGravity(const Vector3f& gravity)
{
- dWorldSetGravity((dWorldID) mWorldID,
+ dWorldSetGravity(mODEWorld,
gravity.x(),
gravity.y(),
gravity.z()
@@ -48,62 +48,63 @@
salt::Vector3f ODEWorld::GetGravity() const
{
dVector3 dGravity;
- dWorldGetGravity((dWorldID) mWorldID,dGravity);
+ dWorldGetGravity(mODEWorld,dGravity);
return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
}
void ODEWorld::SetERP(float erp)
{
- dWorldSetERP((dWorldID) mWorldID, erp);
+ dWorldSetERP(mODEWorld, erp);
}
float ODEWorld::GetERP() const
{
- return dWorldGetERP((dWorldID) mWorldID);
+ return dWorldGetERP(mODEWorld);
}
void ODEWorld::SetCFM(float cfm)
{
- dWorldSetCFM((dWorldID) mWorldID, cfm);
+ dWorldSetCFM(mODEWorld, cfm);
}
float ODEWorld::GetCFM() const
{
- return dWorldGetCFM((dWorldID) mWorldID);
+ return dWorldGetCFM(mODEWorld);
}
void ODEWorld::Step(float deltaTime)
{
- dWorldStep((dWorldID) mWorldID, deltaTime);
+ dWorldStep(mODEWorld, deltaTime);
}
bool ODEWorld::GetAutoDisableFlag() const
{
- return (dWorldGetAutoDisableFlag((dWorldID) mWorldID) == 1);
+ return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
}
void ODEWorld::SetAutoDisableFlag(bool flag)
{
- dWorldSetAutoDisableFlag((dWorldID) mWorldID, static_cast<int>(flag));
+ dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
}
void ODEWorld::SetContactSurfaceLayer(float depth)
{
- dWorldSetContactSurfaceLayer((dWorldID) mWorldID, depth);
+ dWorldSetContactSurfaceLayer(mODEWorld, depth);
}
float ODEWorld::GetContactSurfaceLayer() const
{
- return dWorldGetContactSurfaceLayer((dWorldID) mWorldID);
+ return dWorldGetContactSurfaceLayer(mODEWorld);
}
void ODEWorld::CreateWorld()
{
- mWorldID = (long) dWorldCreate();
+ mODEWorld = dWorldCreate();
+ mWorldID = (long) mODEWorld;
}
void ODEWorld::DestroyWorld()
{
- dWorldDestroy((dWorldID) mWorldID);
+ dWorldDestroy(mODEWorld);
mWorldID = 0;
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -28,7 +28,7 @@
namespace oxygen
{
-class OXYGEN_API ODEWorld : public WorldInt
+class OXYGEN_API ODEWorld : public WorldInt, public ODEPhysicsObject
{
public:
@@ -48,6 +48,9 @@
float GetContactSurfaceLayer() const;
void CreateWorld();
void DestroyWorld();
+
+private:
+ dWorldID mODEWorld;
};
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -135,7 +135,7 @@
return 0;
}
-void PhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, int& matrix)
+void PhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, void* matrix)
{
mPhysicsObjectImp->ConvertRotationMatrix(rot, matrix);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -75,7 +75,7 @@
/** converts the rotation part of a salt::Matrix to an
engine-specific matrix, currently used for ODE's dMatrix3
*/
- void ConvertRotationMatrix(const salt::Matrix& rot, int& matrix);
+ void ConvertRotationMatrix(const salt::Matrix& rot, void* matrix);
/** coverts an engine-specific to the rotation part of a salt::Matrix,
currently used for ODE's dMatrix3
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-07 08:43:40 UTC (rev 115)
@@ -131,18 +131,7 @@
return mRigidBodyImp->GetMass();
}
-void RigidBody::AddMass(const float& mass, const Matrix& matrix)
-{
- mRigidBodyImp->AddMass(mass, matrix);
-}
-
-void RigidBody::GetMassParameters(float& mass) const
-{
- mRigidBodyImp->GetMassParameters(mass);
-}
-
-void RigidBody::SetMassParameters(const float& mass)
-{
+void RigidBody::SetMassParameters(const float& mass){
mRigidBodyImp->SetMassParameters(mass);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-04 09:18:52 UTC (rev 114)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-07 08:43:40 UTC (rev 115)
@@ -46,7 +46,7 @@
RigidBody();
virtual ~RigidBody();
- /** returns the ID of the mangaged ODE body */
+ /** returns the ID of the mangaged body */
long GetBodyID() const;
/** enables this body. Each body can be enabled or
@@ -77,19 +77,11 @@
/** sets the mass of this body */
void SetMass(float mass);
- /** set the ODE mass parameters of this body */
- void SetMassParameters(const float& mass);
-
/** returns the mass of this body */
float GetMass() const;
-
- /** returns the ODE mass parameters of this body */
- void GetMassParameters(float& mass) const;
- /** adds the given ode mass to this body. The given matrix is
- applied to the mass center
- */
- void AddMass(const float& mass, const salt::Matrix& matrix);
+ /** Sets the mass parameters of this body */
+ void SetMassParameters(const float& mass);
/** sets the mass parameters to represent a sphere of the given
radius and density, with the center of mass at (0,0,0)
@@ -217,16 +209,16 @@
/** sets the current angular velocity of this body */
void SetAngularVelocity(const salt::Vector3f& vel);
- /** returns the Body node corresponding to the given ODE body */
+ /** returns the Body node corresponding to the given body */
static boost::shared_ptr<RigidBody> GetBody(long id);
- /** applies a force to the managed ODE body */
+ /** applies a force to the managed body */
void AddForce(const salt::Vector3f& force);
- /** aplies a force to the managed ODE body */
+ /** aplies a force to the managed body */
void AddTorque(const salt::Vector3f& torque);
- /** sets the position of the managed ODE body */
+ /** sets the position of the managed body */
void SetPosition(const salt::Vector3f& pos);
/** returns the current poosition of this body */
@@ -240,15 +232,13 @@
*/
void SynchronizeParent() const;
- salt::Vector3f GetMassCenter() const;
-
protected:
- /** creates the managed ODE body and moves it to the position of
+ /** creates the managed body and moves it to the position of
it's scene-graph parent
*/
virtual void OnLink();
- /** create the managed ODE body; returns true on success */
+ /** create the managed body; returns true on success */
bool CreateBody();
private:
@@ -257,7 +247,7 @@
/** updates the the internal state after physics calculation,
i.e. synchronises this scene graph node and the corresponding
- ODE body.
+ body.
*/
virtual void PostPhysicsUpdateInternal();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-12-04 09:19:01
|
Revision: 114
http://simspark.svn.sourceforge.net/simspark/?rev=114&view=rev
Author: a-held
Date: 2009-12-04 09:18:52 +0000 (Fri, 04 Dec 2009)
Log Message:
-----------
Completed bridge pattern for the RigidBody class
Modified Paths:
--------------
branches/multiphys/spark/lib/oxygen/physicsserver/body.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody_c.cpp
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-12-03 09:04:19 UTC (rev 113)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-12-04 09:18:52 UTC (rev 114)
@@ -23,7 +23,6 @@
#define OXYGEN_BODY_H
#include <oxygen/physicsserver/physicsobject.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-03 09:04:19 UTC (rev 113)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-04 09:18:52 UTC (rev 114)
@@ -41,7 +41,7 @@
virtual bool UsesGravity() const = 0;
virtual void CreateBody(long world) = 0;
virtual void SetMass(float mass) = 0;
- virtual void SetMassParameters(const dMass& mass) = 0;
+ virtual void SetMassParameters(const float& mass) = 0;
virtual float GetMass() const = 0;
virtual void GetMassParameters(float& mass) const = 0;
virtual void SetSphere(float density, float radius) = 0;
@@ -73,7 +73,7 @@
virtual salt::Vector3f GetPosition() const = 0;
virtual void DestroyPhysicsObject() = 0;
virtual salt::Matrix GetSynchronisationMatrix() = 0;
- virtual void AddMass(const dMass& mass, const salt::Matrix& matrix) = 0;
+ virtual void AddMass(const float& mass, const salt::Matrix& matrix) = 0;
//virtual salt::Vector3f GetMassCenter() const = 0;
virtual void BodySetData(RigidBody* rb) = 0;
virtual RigidBody* BodyGetData(long bodyID) = 0;
@@ -102,22 +102,22 @@
/** sets up an ode mass struct representing a box of the given
size and total_mass
*/
- virtual void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const = 0;
+ virtual void PrepareBoxTotal(float& mass, float total_mass, const salt::Vector3f& size) const = 0;
/** sets up an ode mass struct representing a box of the given
density and size
*/
- virtual void PrepareBox(dMass& mass, float density, const salt::Vector3f& size) const = 0;
+ virtual void PrepareBox(float& mass, float density, const salt::Vector3f& size) const = 0;
/** sets up an ode mass struct representing a sphere of the given
density and radius
*/
- virtual void PrepareSphere(dMass& mass, float density, float radius) const = 0;
+ virtual void PrepareSphere(float& mass, float density, float radius) const = 0;
/** sets up an ode mass struct representing a sphere of the given
radius and total_mass
*/
- virtual void PrepareSphereTotal(dMass& mass, float total_mass, float radius) const = 0;
+ virtual void PrepareSphereTotal(float& mass, float total_mass, float radius) const = 0;
/** sets up an ode mass struct representing a flat-ended cylinder
of the given parameters and density, with the center of mass
@@ -125,7 +125,7 @@
radius. The length of the cylinder is length. The cylinder's
long axis is oriented along the body's z axis.
*/
- virtual void PrepareCylinder(dMass& mass, float density, float radius, float length) const = 0;
+ virtual void PrepareCylinder(float& mass, float density, float radius, float length) const = 0;
/** sets up an ode mass struct representing a flat-ended cylinder
of the given parameters and total mass, with the center of
@@ -133,7 +133,7 @@
cylinder is radius. The length of the cylinder is length. The
cylinder's long axis is oriented along the body's z axis.
*/
- virtual void PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const = 0;
+ virtual void PrepareCylinderTotal(float& mass, float total_mass, float radius, float length) const = 0;
/* sets up an ode mass struct representing a capsule of
the given parameters and density, with the center of mass at
@@ -142,7 +142,7 @@
counting the spherical cap) is length. The capsule's long axis
is oriented along the body's z axis.
*/
- virtual void PrepareCapsule(dMass& mass, float density, float radius, float length) const = 0;
+ virtual void PrepareCapsule(float& mass, float density, float radius, float length) const = 0;
/* sets up an ode mass struct representing a capsule of
the given parameters and total mass, with the center of mass at
@@ -151,7 +151,7 @@
counting the spherical cap) is length. The capsule's long axis
is oriented along the body's z axis.
*/
- virtual void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const = 0;
+ virtual void PrepareCapsuleTotal(float& mass, float total_mass, float radius, float length) const = 0;
protected:
long mBodyID;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-03 09:04:19 UTC (rev 113)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-04 09:18:52 UTC (rev 114)
@@ -124,9 +124,10 @@
return m.mass;
}
-void ODERigidBody::AddMass(const dMass& mass, const Matrix& matrix)
+void ODERigidBody::AddMass(const float& mass, const Matrix& matrix)
{
- dMass transMass(mass);
+ dMass ODEMass = (dMass&) mass;
+ dMass transMass(ODEMass);
dMatrix3 rot;
ConvertRotationMatrix(matrix,(int&) rot);
@@ -161,178 +162,203 @@
void ODERigidBody::GetMassParameters(float& mass) const
{
- dMass& odeMass = (dMass&) mass;
- dBodyGetMass((dBodyID) mBodyID, &odeMass);
- mass = (float&) odeMass;
+ dMass& ODEMass = (dMass&) mass;
+ dBodyGetMass((dBodyID) mBodyID, &ODEMass);
+ mass = (float&) ODEMass;
}
-void ODERigidBody::SetMassParameters(const dMass& mass)
+void ODERigidBody::SetMassParameters(const float& mass)
{
- dBodySetMass((dBodyID) mBodyID, &mass);
+ dMass& ODEMass = (dMass&) mass;
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
-void ODERigidBody::PrepareSphere(dMass& mass, float density, float radius) const
+void ODERigidBody::PrepareSphere(float& mass, float density, float radius) const
{
- dMassSetSphere(&mass, density, radius);
+ dMass& ODEMass = (dMass&) mass;
+ dMassSetSphere(&ODEMass, density, radius);
}
void ODERigidBody::SetSphere(float density, float radius)
{
dMass ODEMass;
- PrepareSphere(ODEMass, density, radius);
+ float& massRef = (float&) ODEMass;
+ PrepareSphere(massRef, density, radius);
dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddSphere(float density, float radius, const Matrix& matrix)
{
dMass ODEMass;
- PrepareSphere(ODEMass, density, radius);
- AddMass(ODEMass, matrix);
+ float& massRef = (float&) ODEMass;
+ PrepareSphere(massRef, density, radius);
+ AddMass(massRef, matrix);
}
-void ODERigidBody::PrepareSphereTotal(dMass& mass, float total_mass, float radius) const
+void ODERigidBody::PrepareSphereTotal(float& mass, float total_mass, float radius) const
{
- dMassSetSphereTotal(&mass, total_mass, radius);
+ dMass& ODEMass = (dMass&) mass;
+ dMassSetSphereTotal(&ODEMass, total_mass, radius);
}
void ODERigidBody::SetSphereTotal(float total_mass, float radius)
{
dMass ODEMass;
- PrepareSphereTotal(ODEMass, total_mass, radius);
+ float& massRef = (float&) ODEMass;
+ PrepareSphereTotal(massRef, total_mass, radius);
dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddSphereTotal(float total_mass, float radius, const Matrix& matrix)
{
dMass ODEMass;
- PrepareSphereTotal(ODEMass, total_mass, radius);
- AddMass(ODEMass, matrix);
+ float& massRef = (float&) ODEMass;
+ PrepareSphereTotal(massRef, total_mass, radius);
+ AddMass(massRef, matrix);
}
-void ODERigidBody::PrepareBox(dMass& mass, float density, const Vector3f& size) const
+void ODERigidBody::PrepareBox(float& mass, float density, const Vector3f& size) const
{
- dMassSetBox(&mass, density, size[0], size[1], size[2]);
+ dMass& ODEMass = (dMass&) mass;
+ dMassSetBox(&ODEMass, density, size[0], size[1], size[2]);
}
void ODERigidBody::SetBox(float density, const Vector3f& size)
{
dMass ODEMass;
- PrepareBox(ODEMass, density, size);
+ float& massRef = (float&) ODEMass;
+ PrepareBox(massRef, density, size);
dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddBox(float density, const Vector3f& size, const Matrix& matrix)
{
dMass ODEMass;
- PrepareBox(ODEMass, density, size);
- AddMass(ODEMass, matrix);
+ float& massRef = (float&) ODEMass;
+ PrepareBox(massRef, density, size);
+ AddMass(massRef, matrix);
}
-void ODERigidBody::PrepareBoxTotal(dMass& mass, float total_mass, const Vector3f& size) const
+void ODERigidBody::PrepareBoxTotal(float& mass, float total_mass, const Vector3f& size) const
{
- dMassSetBoxTotal(&mass, total_mass, size[0], size[1], size[2]);
+ dMass& ODEMass = (dMass&) mass;
+ dMassSetBoxTotal(&ODEMass, total_mass, size[0], size[1], size[2]);
}
void ODERigidBody::SetBoxTotal(float total_mass, const Vector3f& size)
{
dMass ODEMass;
- PrepareBoxTotal(ODEMass, total_mass, size);
+ float& massRef = (float&) ODEMass;
+ PrepareBoxTotal(massRef, total_mass, size);
dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddBoxTotal(float total_mass, const Vector3f& size, const Matrix& matrix)
{
dMass ODEMass;
- PrepareBoxTotal(ODEMass, total_mass, size);
- AddMass(ODEMass, matrix);
+ float& massRef = (float&) ODEMass;
+ PrepareBoxTotal(massRef, total_mass, size);
+ AddMass(massRef, matrix);
}
-void ODERigidBody::PrepareCylinder (dMass& mass, float density, float radius, float length) const
+void ODERigidBody::PrepareCylinder (float& mass, float density, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMassSetCylinder (&mass, density, direction, radius, length);
+ dMass& ODEMass = (dMass&) mass;
+ dMassSetCylinder (&ODEMass, density, direction, radius, length);
}
void ODERigidBody::SetCylinder (float density, float radius, float length)
{
dMass ODEMass;
- PrepareCylinder(ODEMass, density, radius, length);
+ float& massRef = (float&) ODEMass;
+ PrepareCylinder(massRef, density, radius, length);
dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddCylinder (float density, float radius, float length, const Matrix& matrix)
{
dMass ODEMass;
- PrepareCylinder(ODEMass, density, radius, length);
- AddMass(ODEMass, matrix);
+ float& massRef = (float&) ODEMass;
+ PrepareCylinder(massRef, density, radius, length);
+ AddMass(massRef, matrix);
}
-void ODERigidBody::PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const
+void ODERigidBody::PrepareCylinderTotal(float& mass, float total_mass, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMassSetCylinderTotal(&mass, total_mass, direction, radius, length);
+ dMass& ODEMass = (dMass&) mass;
+ dMassSetCylinderTotal(&ODEMass, total_mass, direction, radius, length);
}
void ODERigidBody::SetCylinderTotal(float total_mass, float radius, float length)
{
dMass ODEMass;
- PrepareCylinderTotal(ODEMass, total_mass, radius, length);
+ float& massRef = (float&) ODEMass;
+ PrepareCylinderTotal(massRef, total_mass, radius, length);
dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddCylinderTotal(float total_mass, float radius, float length, const Matrix& matrix)
{
dMass ODEMass;
- PrepareCylinderTotal(ODEMass, total_mass, radius, length);
- AddMass(ODEMass, matrix);
+ float& massRef = (float&) ODEMass;
+ PrepareCylinderTotal(massRef, total_mass, radius, length);
+ AddMass(massRef, matrix);
}
-void ODERigidBody::PrepareCapsule (dMass& mass, float density, float radius, float length) const
+void ODERigidBody::PrepareCapsule (float& mass, float density, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMassSetCapsule (&mass, density, direction, radius, length);
+ dMass ODEMass = (dMass&) mass;
+ dMassSetCapsule (&ODEMass, density, direction, radius, length);
}
void ODERigidBody::SetCapsule (float density, float radius, float length)
{
dMass ODEMass;
- PrepareCapsule(ODEMass, density, radius, length);
+ float& massRef = (float&) ODEMass;
+ PrepareCapsule(massRef, density, radius, length);
dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddCapsule (float density, float radius, float length, const Matrix& matrix)
{
dMass ODEMass;
- PrepareCapsule(ODEMass, density, radius, length);
- AddMass(ODEMass, matrix);
+ float& massRef = (float&) ODEMass;
+ PrepareCapsule(massRef, density, radius, length);
+ AddMass(massRef, matrix);
}
-void ODERigidBody::PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const
+void ODERigidBody::PrepareCapsuleTotal(float& mass, float total_mass, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMassSetCapsuleTotal(&mass, total_mass, direction, radius, length);
+ dMass& ODEMass = (dMass&) mass;
+ dMassSetCapsuleTotal(&ODEMass, total_mass, direction, radius, length);
}
void ODERigidBody::SetCapsuleTotal(float total_mass, float radius, float length)
{
dMass ODEMass;
- PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
+ float& massRef = (float&) ODEMass;
+ PrepareCapsuleTotal(massRef, total_mass, radius, length);
dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix)
{
dMass ODEMass;
- PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
- AddMass(ODEMass, matrix);
+ float& massRef = (float&) ODEMass;
+ PrepareCapsuleTotal(massRef, total_mass, radius, length);
+ AddMass(massRef, matrix);
}
Vector3f ODERigidBody::GetVelocity() const
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-03 09:04:19 UTC (rev 113)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-04 09:18:52 UTC (rev 114)
@@ -38,10 +38,10 @@
void UseGravity(bool f);
bool UsesGravity() const;
void SetMass(float mass);
- void SetMassParameters(const dMass& mass);
+ void SetMassParameters(const float& mass);
float GetMass() const;
void GetMassParameters(float& mass) const;
- void AddMass(const dMass& mass, const salt::Matrix& matrix);
+ void AddMass(const float& mass, const salt::Matrix& matrix);
void SetSphere(float density, float radius);
void AddSphere(float density, float radius, const salt::Matrix& matrix);
void SetSphereTotal(float total_mass, float radius);
@@ -83,14 +83,14 @@
protected:
void CreateBody(long world);
- void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const;
- void PrepareBox(dMass& mass, float density, const salt::Vector3f& size) const;
- void PrepareSphere(dMass& mass, float density, float radius) const;
- void PrepareSphereTotal(dMass& mass, float total_mass, float radius) const;
- void PrepareCylinder(dMass& mass, float density, float radius, float length) const;
- void PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const;
- void PrepareCapsule(dMass& mass, float density, float radius, float length) const;
- void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const;
+ void PrepareBoxTotal(float& mass, float total_mass, const salt::Vector3f& size) const;
+ void PrepareBox(float& mass, float density, const salt::Vector3f& size) const;
+ void PrepareSphere(float& mass, float density, float radius) const;
+ void PrepareSphereTotal(float& mass, float total_mass, float radius) const;
+ void PrepareCylinder(float& mass, float density, float radius, float length) const;
+ void PrepareCylinderTotal(float& mass, float total_mass, float radius, float length) const;
+ void PrepareCapsule(float& mass, float density, float radius, float length) const;
+ void PrepareCapsuleTotal(float& mass, float total_mass, float radius, float length) const;
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-03 09:04:19 UTC (rev 113)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-04 09:18:52 UTC (rev 114)
@@ -131,7 +131,7 @@
return mRigidBodyImp->GetMass();
}
-void RigidBody::AddMass(const dMass& mass, const Matrix& matrix)
+void RigidBody::AddMass(const float& mass, const Matrix& matrix)
{
mRigidBodyImp->AddMass(mass, matrix);
}
@@ -141,7 +141,7 @@
mRigidBodyImp->GetMassParameters(mass);
}
-void RigidBody::SetMassParameters(const dMass& mass)
+void RigidBody::SetMassParameters(const float& mass)
{
mRigidBodyImp->SetMassParameters(mass);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-03 09:04:19 UTC (rev 113)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-04 09:18:52 UTC (rev 114)
@@ -78,7 +78,7 @@
void SetMass(float mass);
/** set the ODE mass parameters of this body */
- void SetMassParameters(const dMass& mass);
+ void SetMassParameters(const float& mass);
/** returns the mass of this body */
float GetMass() const;
@@ -89,7 +89,7 @@
/** adds the given ode mass to this body. The given matrix is
applied to the mass center
*/
- void AddMass(const dMass& mass, const salt::Matrix& matrix);
+ void AddMass(const float& mass, const salt::Matrix& matrix);
/** sets the mass parameters to represent a sphere of the given
radius and density, with the center of mass at (0,0,0)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody_c.cpp 2009-12-03 09:04:19 UTC (rev 113)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody_c.cpp 2009-12-04 09:18:52 UTC (rev 114)
@@ -20,6 +20,7 @@
*/
#include <oxygen/physicsserver/rigidbody.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
using namespace boost;
using namespace oxygen;
@@ -100,7 +101,8 @@
}
}
- obj->SetMassParameters(mass);
+ float& massRef = (float&) mass;
+ obj->SetMassParameters(massRef);
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-12-03 09:04:33
|
Revision: 113
http://simspark.svn.sourceforge.net/simspark/?rev=113&view=rev
Author: a-held
Date: 2009-12-03 09:04:19 +0000 (Thu, 03 Dec 2009)
Log Message:
-----------
completed bridge pattern for PhysicsObject class
nearly done with RigidBody
changed some return types and parameters to engine-independent types
Modified Paths:
--------------
branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/space.h
branches/multiphys/spark/plugin/collisionperceptor/touchperceptorhandler.cpp
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -62,7 +62,7 @@
// our parent is an ODE transform geom that encapsulates
// this geom, so register ourself to it. This geom must
// not directly register to a space or a body.
- dGeomTransformSetGeom(tcParent->GetODEGeom(), mODEGeom);
+ dGeomTransformSetGeom((dGeomID) tcParent->GetGeomID(), mODEGeom);
return;
}
@@ -126,9 +126,9 @@
}
}
-dGeomID Collider::GetODEGeom()
+long Collider::GetGeomID()
{
- return mODEGeom;
+ return (long) mODEGeom;
}
bool Collider::AddCollisionHandler(const std::string& handlerName)
@@ -175,21 +175,21 @@
}
}
-shared_ptr<Collider> Collider::GetCollider(dGeomID id)
+shared_ptr<Collider> Collider::GetCollider(long geomID)
{
- if (id == 0)
+ if (geomID == 0)
{
return shared_ptr<Collider>();
}
Collider* collPtr =
- static_cast<Collider*>(dGeomGetData(id));
+ static_cast<Collider*>(dGeomGetData((dGeomID) geomID));
if (collPtr == 0)
{
// we cannot use the logserver here
- cerr << "ERROR: (Collider) no Collider found for dGeomID "
- << id << "\n";
+ cerr << "ERROR: (Collider) no Collider found for GeomID "
+ << geomID << "\n";
return shared_ptr<Collider>();
}
@@ -199,8 +199,8 @@
if (collider.get() == 0)
{
// we cannot use the logserver here
- cerr << "ERROR: (Collider) got no shared_ptr for dGeomID "
- << id << "\n";
+ cerr << "ERROR: (Collider) got no shared_ptr for GeomID "
+ << geomID << "\n";
}
return collider;
@@ -209,7 +209,7 @@
void Collider::SetRotation(const Matrix& rot)
{
dMatrix3 m;
- ConvertRotationMatrix(rot,m);
+ ConvertRotationMatrix(rot,(int&) m);
dGeomSetRotation(mODEGeom,m);
}
@@ -255,7 +255,7 @@
return dCollide
(
mODEGeom,
- collider->GetODEGeom(),
+ (dGeomID) collider->GetGeomID(),
1, /* ask for at most one collision point */
&contact,
sizeof(contact)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -94,10 +94,10 @@
bool AddCollisionHandler(const std::string& handlerName);
/** returns the Collider corresponding to the given ODE geom */
- static boost::shared_ptr<Collider> GetCollider(dGeomID id);
+ static boost::shared_ptr<Collider> GetCollider(long geomID);
/** returns the ID of managed ODE geom */
- dGeomID GetODEGeom();
+ long GetGeomID();
/** sets the relative position of the managed geom directly. If
the geom is connected to a body, the position of the body will
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -163,8 +163,8 @@
// to create a contact joint it we must have at least one body to
// attach it to.
- dBodyID myBody = dGeomGetBody(mCollider->GetODEGeom());
- dBodyID collideeBody = dGeomGetBody(collidee->GetODEGeom());
+ dBodyID myBody = dGeomGetBody((dGeomID) mCollider->GetGeomID());
+ dBodyID collideeBody = dGeomGetBody((dGeomID) collidee->GetGeomID());
if (
(myBody == 0) &&
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -35,8 +35,8 @@
{
public:
- virtual void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix) = 0;
- virtual void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const = 0;
+ virtual void ConvertRotationMatrix(const salt::Matrix& rot, int& matrix) = 0;
+ virtual void ConvertRotationMatrix(const void* matrix, salt::Matrix& rot) const = 0;
protected:
PhysicsObjectInt(){
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -43,7 +43,7 @@
virtual void SetMass(float mass) = 0;
virtual void SetMassParameters(const dMass& mass) = 0;
virtual float GetMass() const = 0;
- virtual void GetMassParameters(dMass& mass) const = 0;
+ virtual void GetMassParameters(float& mass) const = 0;
virtual void SetSphere(float density, float radius) = 0;
virtual void AddSphere(float density, float radius, const salt::Matrix& matrix) = 0;
virtual void SetSphereTotal(float total_mass, float radius) = 0;
@@ -84,6 +84,17 @@
virtual bool GetMassTransformed() = 0;
virtual void SetMassTransformed(bool f) = 0;
+ /** Here, we have to cheat with the preprocessor, since a static method
+ is required, and the bridge pattern requires member variables to
+ be used (so we cannot use the bridge pattern)
+ */
+ static RigidBody* GetBodyPointer(long bodyID){
+ //if ODE is used (currently not checked since ODE is the only supported engine)
+ return static_cast<RigidBody*>(dBodyGetData( (dBodyID) bodyID));
+ //if another engine is used
+ //do something else
+ }
+
protected:
RigidBodyInt() : ODEBody(), mBodyID(0), mMassTrans(0,0,0), mMassTransformed(false){
};
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -47,21 +47,21 @@
dJointSetData(mODEJoint, this);
}
-shared_ptr<Joint> Joint::GetJoint(dJointID id)
+shared_ptr<Joint> Joint::GetJoint(long jointID)
{
- if (id == 0)
+ if (jointID == 0)
{
return shared_ptr<Joint>();
}
Joint* jointPtr =
- static_cast<Joint*>(dJointGetData(id));
+ static_cast<Joint*>(dJointGetData((dJointID) jointID));
if (jointPtr == 0)
{
// we cannot use the logserver here
cerr << "ERROR: (Joint) no joint found for dJointID "
- << id << "\n";
+ << jointID << "\n";
return shared_ptr<Joint>();
}
@@ -72,7 +72,7 @@
{
// we cannot use the logserver here
cerr << "ERROR: (Joint) got no shared_ptr for dJointID "
- << id << "\n";
+ << jointID << "\n";
}
return joint;
@@ -165,7 +165,8 @@
boost::shared_ptr<RigidBody> Joint::GetBody(EBodyIndex idx)
{
- return RigidBody::GetBody(dJointGetBody(mODEJoint, idx));
+ long bodyID = (long) dJointGetBody(mODEJoint, idx);
+ return RigidBody::GetBody(bodyID);
}
bool Joint::AreConnected (shared_ptr<RigidBody> body1, shared_ptr<RigidBody> body2)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -91,8 +91,8 @@
*/
boost::shared_ptr<RigidBody> GetBody(EBodyIndex idx);
- /** returns the Joint node corresponding to the given ODE joint */
- static boost::shared_ptr<Joint> GetJoint(dJointID id);
+ /** returns the Joint node corresponding to the given joint */
+ static boost::shared_ptr<Joint> GetJoint(long jointID);
/** returns the type of the managed ODE joint, possible return
values are dJointTypeNone, dJointTypeBall, dJointTypeHinge,
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -33,36 +33,40 @@
{
}
-void ODEPhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+void ODEPhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, int& matrix)
{
- matrix[0] = rot.m[0];
- matrix[1] = rot.m[4];
- matrix[2] = rot.m[8];
- matrix[3] = 0;
- matrix[4] = rot.m[1];
- matrix[5] = rot.m[5];
- matrix[6] = rot.m[9];
- matrix[7] = 0;
- matrix[8] = rot.m[2];
- matrix[9] = rot.m[6];
- matrix[10] = rot.m[10];
- matrix[11] = 0;
+ dMatrix3& odeMatrix = (dMatrix3&) matrix;
+
+ odeMatrix[0] = rot.m[0];
+ odeMatrix[1] = rot.m[4];
+ odeMatrix[2] = rot.m[8];
+ odeMatrix[3] = 0;
+ odeMatrix[4] = rot.m[1];
+ odeMatrix[5] = rot.m[5];
+ odeMatrix[6] = rot.m[9];
+ odeMatrix[7] = 0;
+ odeMatrix[8] = rot.m[2];
+ odeMatrix[9] = rot.m[6];
+ odeMatrix[10] = rot.m[10];
+ odeMatrix[11] = 0;
}
-void ODEPhysicsObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+void ODEPhysicsObject::ConvertRotationMatrix(const void* matrix, salt::Matrix& rot) const
{
- rot.m[0] = matrix[0] ;
- rot.m[4] = matrix[1] ;
- rot.m[8] = matrix[2];
- rot.m[12] = matrix[3];
- rot.m[1] = matrix[4];
- rot.m[5] = matrix[5];
- rot.m[9] = matrix[6];
- rot.m[13] = matrix[7];
- rot.m[2] = matrix[8];
- rot.m[6] = matrix[9];
- rot.m[10] = matrix[10] ;
- rot.m[14] = matrix[11];
+ dReal* odeMatrix = (dReal*) matrix;
+
+ rot.m[0] = odeMatrix[0];
+ rot.m[4] = odeMatrix[1];
+ rot.m[8] = odeMatrix[2];
+ rot.m[12] = odeMatrix[3];
+ rot.m[1] = odeMatrix[4];
+ rot.m[5] = odeMatrix[5];
+ rot.m[9] = odeMatrix[6];
+ rot.m[13] = odeMatrix[7];
+ rot.m[2] = odeMatrix[8];
+ rot.m[6] = odeMatrix[9];
+ rot.m[10] = odeMatrix[10];
+ rot.m[14] = odeMatrix[11];
rot.m[3] = 0.0;
rot.m[7] = 0.0;
rot.m[11] = 0.0;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -34,8 +34,8 @@
{
public:
ODEPhysicsObject();
- void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
- void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+ void ConvertRotationMatrix(const salt::Matrix& rot, int& matrix);
+ void ConvertRotationMatrix(const void* matrix, salt::Matrix& rot) const;
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -35,10 +35,9 @@
ODERigidBody::ODERigidBody() : RigidBodyInt(){
}
-long ODERigidBody::GetBodyID()
-{
+long ODERigidBody::GetBodyID(){
return mBodyID;
-}
+}
salt::Vector3f ODERigidBody::GetMassTrans(){
return mMassTrans;
@@ -58,17 +57,17 @@
void ODERigidBody::Enable()
{
- dBodyEnable((dBodyID)mBodyID);
+ dBodyEnable((dBodyID) mBodyID);
}
void ODERigidBody::Disable()
{
- dBodyDisable((dBodyID)mBodyID);
+ dBodyDisable((dBodyID) mBodyID);
}
bool ODERigidBody::IsEnabled() const
{
- return (dBodyIsEnabled((dBodyID)mBodyID) != 0);
+ return (dBodyIsEnabled((dBodyID) mBodyID) != 0);
}
void ODERigidBody::UseGravity(bool f)
@@ -76,59 +75,52 @@
if (f == true)
{
// body is affected by gravity
- dBodySetGravityMode((dBodyID)mBodyID, 1);
+ dBodySetGravityMode((dBodyID) mBodyID, 1);
}
else
{
// body is not affected by gravity
- dBodySetGravityMode((dBodyID)mBodyID, 0);
+ dBodySetGravityMode((dBodyID) mBodyID, 0);
}
}
-bool ODERigidBody::UsesGravity() const
-{
- return (dBodyGetGravityMode((dBodyID)mBodyID) != 0);
+bool ODERigidBody::UsesGravity() const{
+ return (dBodyGetGravityMode((dBodyID) mBodyID) != 0);
}
void ODERigidBody::CreateBody(long world)
{
- if (mBodyID != 0)
- {
- return;
- }
-
// create the managed body
- mBodyID = (long) dBodyCreate( (dWorldID) world);
+ mBodyID = (long) dBodyCreate((dWorldID) world);
}
-void ODERigidBody::DestroyPhysicsObject()
-{
+void ODERigidBody::DestroyPhysicsObject(){
if (mBodyID == 0)
{
return;
}
- dBodyDestroy((dBodyID)mBodyID);
+ dBodyDestroy((dBodyID) mBodyID);
mBodyID = 0;
}
void ODERigidBody::BodySetData(RigidBody* rb)
{
- dBodySetData((dBodyID)mBodyID, rb);
+ dBodySetData((dBodyID) mBodyID, rb);
}
void ODERigidBody::SetMass(float mass)
{
dMass ODEMass;
- dBodyGetMass((dBodyID)mBodyID, &ODEMass);
+ dBodyGetMass((dBodyID) mBodyID, &ODEMass);
dMassAdjust(&ODEMass, mass);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
float ODERigidBody::GetMass() const
{
dMass m;
- dBodyGetMass((dBodyID)mBodyID, &m);
+ dBodyGetMass((dBodyID) mBodyID, &m);
return m.mass;
}
@@ -137,7 +129,7 @@
dMass transMass(mass);
dMatrix3 rot;
- ConvertRotationMatrix(matrix, rot);
+ ConvertRotationMatrix(matrix,(int&) rot);
dMassRotate(&transMass,rot);
const Vector3f& trans(matrix.Pos());
@@ -146,7 +138,7 @@
dMassTranslate(&transMass,mMassTrans[0],mMassTrans[1],mMassTrans[2]);
dMass bodyMass;
- dBodyGetMass((dBodyID)mBodyID, &bodyMass);
+ dBodyGetMass((dBodyID) mBodyID, &bodyMass);
dMassAdd(&bodyMass, &transMass);
/** ODE currently requires that the center mass is always in the
@@ -156,7 +148,7 @@
dMassTranslate(&bodyMass, -trans2[0], -trans2[1], -trans2[2]);
bodyMass.c[0] = bodyMass.c[1] = bodyMass.c[2] = 0.0f;
- dBodySetMass((dBodyID)mBodyID, (const dMass*)&bodyMass);
+ dBodySetMass((dBodyID) mBodyID, (const dMass*)&bodyMass);
// Move body so mass is at right position again
SetPosition(GetPosition() + trans2);
@@ -167,14 +159,16 @@
mMassTransformed = true;
}
-void ODERigidBody::GetMassParameters(dMass& mass) const
+void ODERigidBody::GetMassParameters(float& mass) const
{
- dBodyGetMass((dBodyID)mBodyID, &mass);
+ dMass& odeMass = (dMass&) mass;
+ dBodyGetMass((dBodyID) mBodyID, &odeMass);
+ mass = (float&) odeMass;
}
void ODERigidBody::SetMassParameters(const dMass& mass)
{
- dBodySetMass((dBodyID)mBodyID, &mass);
+ dBodySetMass((dBodyID) mBodyID, &mass);
}
void ODERigidBody::PrepareSphere(dMass& mass, float density, float radius) const
@@ -186,7 +180,7 @@
{
dMass ODEMass;
PrepareSphere(ODEMass, density, radius);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddSphere(float density, float radius, const Matrix& matrix)
@@ -205,7 +199,7 @@
{
dMass ODEMass;
PrepareSphereTotal(ODEMass, total_mass, radius);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddSphereTotal(float total_mass, float radius, const Matrix& matrix)
@@ -224,7 +218,7 @@
{
dMass ODEMass;
PrepareBox(ODEMass, density, size);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddBox(float density, const Vector3f& size, const Matrix& matrix)
@@ -243,7 +237,7 @@
{
dMass ODEMass;
PrepareBoxTotal(ODEMass, total_mass, size);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddBoxTotal(float total_mass, const Vector3f& size, const Matrix& matrix)
@@ -265,7 +259,7 @@
{
dMass ODEMass;
PrepareCylinder(ODEMass, density, radius, length);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddCylinder (float density, float radius, float length, const Matrix& matrix)
@@ -287,7 +281,7 @@
{
dMass ODEMass;
PrepareCylinderTotal(ODEMass, total_mass, radius, length);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddCylinderTotal(float total_mass, float radius, float length, const Matrix& matrix)
@@ -309,7 +303,7 @@
{
dMass ODEMass;
PrepareCapsule(ODEMass, density, radius, length);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddCapsule (float density, float radius, float length, const Matrix& matrix)
@@ -331,7 +325,7 @@
{
dMass ODEMass;
PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
- dBodySetMass((dBodyID)mBodyID, &ODEMass);
+ dBodySetMass((dBodyID) mBodyID, &ODEMass);
}
void ODERigidBody::AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix)
@@ -343,25 +337,25 @@
Vector3f ODERigidBody::GetVelocity() const
{
- const dReal* vel = dBodyGetLinearVel((dBodyID)mBodyID);
+ const dReal* vel = dBodyGetLinearVel((dBodyID) mBodyID);
return Vector3f(vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetVelocity(const Vector3f& vel)
{
- dBodySetLinearVel((dBodyID)mBodyID, vel[0], vel[1], vel[2]);
+ dBodySetLinearVel((dBodyID) mBodyID, vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetRotation(const Matrix& rot)
{
dMatrix3 m;
- ConvertRotationMatrix(rot,m);
- dBodySetRotation((dBodyID)mBodyID,m);
+ ConvertRotationMatrix(rot,(int&) m);
+ dBodySetRotation((dBodyID) mBodyID,m);
}
salt::Matrix ODERigidBody::GetRotation() const
{
- const dReal* m = dBodyGetRotation((dBodyID)mBodyID);
+ const dReal* m = dBodyGetRotation((dBodyID) mBodyID);
salt::Matrix rot;
ConvertRotationMatrix(m,rot);
return rot;
@@ -369,19 +363,19 @@
Vector3f ODERigidBody::GetAngularVelocity() const
{
- const dReal* vel = dBodyGetAngularVel((dBodyID)mBodyID);
+ const dReal* vel = dBodyGetAngularVel((dBodyID) mBodyID);
return Vector3f(vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetAngularVelocity(const Vector3f& vel)
{
- dBodySetAngularVel((dBodyID)mBodyID, vel[0], vel[1], vel[2]);
+ dBodySetAngularVel((dBodyID) mBodyID, vel[0], vel[1], vel[2]);
}
salt::Matrix ODERigidBody::GetSynchronisationMatrix()
{
- const dReal* pos = dBodyGetPosition((dBodyID)mBodyID);
- const dReal* rot = dBodyGetRotation((dBodyID)mBodyID);
+ const dReal* pos = dBodyGetPosition((dBodyID) mBodyID);
+ const dReal* rot = dBodyGetRotation((dBodyID) mBodyID);
Matrix mat;
mat.m[0] = rot[0];
@@ -414,29 +408,29 @@
void ODERigidBody::AddForce(const Vector3f& force)
{
- dBodyAddForce((dBodyID)mBodyID, force.x(), force.y(), force.z());
+ dBodyAddForce((dBodyID) mBodyID, force.x(), force.y(), force.z());
}
void ODERigidBody::AddTorque(const Vector3f& torque)
{
- dBodyAddTorque((dBodyID)mBodyID, torque.x(), torque.y(), torque.z());
+ dBodyAddTorque((dBodyID) mBodyID, torque.x(), torque.y(), torque.z());
}
void ODERigidBody::SetPosition(const Vector3f& pos)
{
- dBodySetPosition((dBodyID)mBodyID, pos.x(), pos.y(), pos.z());
+ dBodySetPosition((dBodyID) mBodyID, pos.x(), pos.y(), pos.z());
// the parent node will be updated in the next physics cycle
}
Vector3f ODERigidBody::GetPosition() const
{
- const dReal* pos = dBodyGetPosition((dBodyID)mBodyID);
+ const dReal* pos = dBodyGetPosition((dBodyID) mBodyID);
return Vector3f(pos[0], pos[1], pos[2]);
}
void ODERigidBody::TranslateMass(const Vector3f& v)
{
dMass m;
- dBodyGetMass((dBodyID)mBodyID, &m);
+ dBodyGetMass((dBodyID) mBodyID, &m);
dMassTranslate(&m,v[0],v[1],v[2]);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -40,7 +40,7 @@
void SetMass(float mass);
void SetMassParameters(const dMass& mass);
float GetMass() const;
- void GetMassParameters(dMass& mass) const;
+ void GetMassParameters(float& mass) const;
void AddMass(const dMass& mass, const salt::Matrix& matrix);
void SetSphere(float density, float radius);
void AddSphere(float density, float radius, const salt::Matrix& matrix);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -112,23 +112,9 @@
const dSpaceID s1 = dGeomGetSpace(obj1);
const dSpaceID s2 = dGeomGetSpace(obj2);
- // NOTICE: this should not happen since it is checked in Collide(dSpaceID)
-// if (
-// (s1 == s2) &&
-// (gDisabledInnerCollisionSet.find(s1) != gDisabledInnerCollisionSet.end())
-// )
-// {
-// return;
-// }
-
-
- // if obj1 and obj2 are in the same space, and
- // obj1 is in obj2's "mNotCollideWithSet" or ojb2 is in obj1's
- // reject the collision
-
// get shared pointers to the two corresponding Collider nodes first
- shared_ptr<Collider> collider = Collider::GetCollider(obj1);
- shared_ptr<Collider> collidee = Collider::GetCollider(obj2);
+ shared_ptr<Collider> collider = Collider::GetCollider((long) obj1);
+ shared_ptr<Collider> collidee = Collider::GetCollider((long) obj2);
if (
(collider.get() == 0) ||
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -135,12 +135,12 @@
return 0;
}
-void PhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+void PhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, int& matrix)
{
mPhysicsObjectImp->ConvertRotationMatrix(rot, matrix);
}
-void PhysicsObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+void PhysicsObject::ConvertRotationMatrix(const void* matrix, salt::Matrix& rot) const
{
mPhysicsObjectImp->ConvertRotationMatrix(matrix, rot);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -25,7 +25,6 @@
#include <oxygen/oxygen_defines.h>
#include <oxygen/sceneserver/basenode.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
namespace oxygen
{
@@ -73,12 +72,15 @@
/** finds the nearest parent space node */
boost::shared_ptr<Space> GetSpace();
- /** converts the rotation part of a salt::Matrix to an ODE
- dMatrix3 */
- void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
+ /** converts the rotation part of a salt::Matrix to an
+ engine-specific matrix, currently used for ODE's dMatrix3
+ */
+ void ConvertRotationMatrix(const salt::Matrix& rot, int& matrix);
- /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
- void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+ /** coverts an engine-specific to the rotation part of a salt::Matrix,
+ currently used for ODE's dMatrix3
+ */
+ void ConvertRotationMatrix(const void* matrix, salt::Matrix& rot) const;
private:
boost::shared_ptr<PhysicsObjectInt> mPhysicsObjectImp;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -25,7 +25,6 @@
#include <zeitgeist/class.h>
#include <zeitgeist/leaf.h>
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -30,7 +30,7 @@
using namespace salt;
using namespace std;
-RigidBody::RigidBody() : Body(), mODEBody(0), mMassTrans(0,0,0), mMassTransformed(false)
+RigidBody::RigidBody() : Body()
{
mRigidBodyImp = boost::shared_ptr<ODERigidBody>(new ODERigidBody());
}
@@ -86,8 +86,6 @@
mRigidBodyImp->CreateBody(world);
- mODEBody = (dBodyID) mRigidBodyImp->GetBodyID();
-
if (mRigidBodyImp->GetBodyID() == 0)
{
GetLog()->Error()
@@ -138,7 +136,7 @@
mRigidBodyImp->AddMass(mass, matrix);
}
-void RigidBody::GetMassParameters(dMass& mass) const
+void RigidBody::GetMassParameters(float& mass) const
{
mRigidBodyImp->GetMassParameters(mass);
}
@@ -273,6 +271,7 @@
// Check whether mass/body has been translated
if (mRigidBodyImp->GetMassTransformed())
{
+ Vector3f massTrans = mRigidBodyImp->GetMassTrans();
weak_ptr<Node> parent = GetParent();
// Update colliders (only those encapsulated in transform colliders)
@@ -286,7 +285,7 @@
if (collider.get())
{
Vector3f pos = collider->GetPosition();
- pos = pos + mMassTrans;
+ pos = pos + massTrans;
collider->SetLocalPosition(pos);
}
}
@@ -298,7 +297,7 @@
{
shared_ptr<Transform> transform = shared_dynamic_cast<Transform>(*iter);
Matrix worldTransform = transform->GetWorldTransform();
- worldTransform.Pos() = worldTransform.Pos() + mMassTrans;
+ worldTransform.Pos() = worldTransform.Pos() + massTrans;
transform->SetWorldTransform(worldTransform);
}
@@ -313,7 +312,7 @@
SynchronizeParent();
}
-shared_ptr<RigidBody> RigidBody::GetBody(dBodyID id)
+shared_ptr<RigidBody> RigidBody::GetBody(long id)
{
long bodyID = (long) id;
if (bodyID == 0)
@@ -321,8 +320,7 @@
return shared_ptr<RigidBody>();
}
- RigidBody* bodyPtr =
- static_cast<RigidBody*>(dBodyGetData( (dBodyID) bodyID));
+ RigidBody* bodyPtr = RigidBodyInt::GetBodyPointer(bodyID);
if (bodyPtr == 0)
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -84,7 +84,7 @@
float GetMass() const;
/** returns the ODE mass parameters of this body */
- void GetMassParameters(dMass& mass) const;
+ void GetMassParameters(float& mass) const;
/** adds the given ode mass to this body. The given matrix is
applied to the mass center
@@ -218,7 +218,7 @@
void SetAngularVelocity(const salt::Vector3f& vel);
/** returns the Body node corresponding to the given ODE body */
- static boost::shared_ptr<RigidBody> GetBody(dBodyID id);
+ static boost::shared_ptr<RigidBody> GetBody(long id);
/** applies a force to the managed ODE body */
void AddForce(const salt::Vector3f& force);
@@ -266,15 +266,6 @@
//
protected:
boost::shared_ptr<RigidBodyInt> mRigidBodyImp;
-
- /** the managed ode body */
- dBodyID mODEBody;
-
- /** the total mass translation */
- salt::Vector3f mMassTrans;
-
- /** flag whether mass has been transformed */
- bool mMassTransformed;
};
DECLARE_CLASS(RigidBody);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -35,7 +35,7 @@
void Space::collisionNearCallback (void *data, dGeomID obj1, dGeomID obj2)
{
Space *space = (Space*)data;
- space->HandleCollide(obj1, obj2);
+ space->HandleCollide((long) obj1, (long) obj2);
}
Space::Space() : PhysicsObject(), mODESpace(0)
@@ -89,24 +89,27 @@
}
}
-void Space::HandleCollide(dGeomID obj1, dGeomID obj2)
+void Space::HandleCollide(long obj1, long obj2)
{
//mSpaceImp->HandleCollide(obj1, obj2);
+
+ dGeomID geom1 = (dGeomID) obj1;
+ dGeomID geom2 = (dGeomID) obj2;
if (
- (dGeomIsSpace (obj1)) ||
- (dGeomIsSpace (obj2))
+ (dGeomIsSpace (geom1)) ||
+ (dGeomIsSpace (geom2))
)
{
// colliding a space with something
- HandleSpaceCollide(obj1, obj2);
+ HandleSpaceCollide(geom1, geom2);
return;
}
// colliding two non-space geoms; reject collisions
// between bodies that are connected with joints
- const dBodyID b1 = dGeomGetBody(obj1);
- const dBodyID b2 = dGeomGetBody(obj2);
+ const dBodyID b1 = dGeomGetBody(geom1);
+ const dBodyID b2 = dGeomGetBody(geom2);
if (
(b1) && (b2) &&
@@ -118,23 +121,9 @@
// if obj1 and obj2 are in a space that disabled inner collision,
// reject the collision
- const dSpaceID s1 = dGeomGetSpace(obj1);
- const dSpaceID s2 = dGeomGetSpace(obj2);
+ const dSpaceID s1 = dGeomGetSpace(geom1);
+ const dSpaceID s2 = dGeomGetSpace(geom2);
- // NOTICE: this should not happen since it is checked in Collide(dSpaceID)
-// if (
-// (s1 == s2) &&
-// (gDisabledInnerCollisionSet.find(s1) != gDisabledInnerCollisionSet.end())
-// )
-// {
-// return;
-// }
-
-
- // if obj1 and obj2 are in the same space, and
- // obj1 is in obj2's "mNotCollideWithSet" or ojb2 is in obj1's
- // reject the collision
-
// get shared pointers to the two corresponding Collider nodes first
shared_ptr<Collider> collider = Collider::GetCollider(obj1);
shared_ptr<Collider> collidee = Collider::GetCollider(obj2);
@@ -169,7 +158,7 @@
static const int nContacts = 4;
static dContact contacts[nContacts];
- int n = dCollide (obj1, obj2, nContacts,
+ int n = dCollide (geom1, geom2, nContacts,
&contacts[0].geom, sizeof(dContact));
if (n == 0)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/space.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/space.h 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/space.h 2009-12-03 09:04:19 UTC (rev 113)
@@ -95,7 +95,7 @@
geoms. It will look up and notify the corresponding colliders
for a potential collision.
*/
- void HandleCollide(dGeomID obj1, dGeomID obj2);
+ void HandleCollide(long obj1, long obj2);
/** handle the collision between two geoms from which at least one
is a space geom
Modified: branches/multiphys/spark/plugin/collisionperceptor/touchperceptorhandler.cpp
===================================================================
--- branches/multiphys/spark/plugin/collisionperceptor/touchperceptorhandler.cpp 2009-12-02 10:06:02 UTC (rev 112)
+++ branches/multiphys/spark/plugin/collisionperceptor/touchperceptorhandler.cpp 2009-12-03 09:04:19 UTC (rev 113)
@@ -65,8 +65,8 @@
// to create a contact joint it we must have at least one body to
// attach it to.
- dBodyID myBody = dGeomGetBody(mCollider->GetODEGeom());
- dBodyID collideeBody = dGeomGetBody(collidee->GetODEGeom());
+ dBodyID myBody = dGeomGetBody((dGeomID) mCollider->GetGeomID());
+ dBodyID collideeBody = dGeomGetBody((dGeomID) collidee->GetGeomID());
if (myBody == 0 && collideeBody == 0)
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-12-02 10:06:12
|
Revision: 112
http://simspark.svn.sourceforge.net/simspark/?rev=112&view=rev
Author: a-held
Date: 2009-12-02 10:06:02 +0000 (Wed, 02 Dec 2009)
Log Message:
-----------
Improved bridge pattern for World class
nearly completed bridge pattern for PhysicsObject
did some more work on the RigidBody class, too
Modified Paths:
--------------
branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/body.h
branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/fixedjoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/hinge2joint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/hingejoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h
branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/space.h
branches/multiphys/spark/lib/oxygen/physicsserver/universaljoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.h
branches/multiphys/spark/plugin/collisionperceptor/touchperceptorhandler.cpp
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -34,13 +34,13 @@
void AngularMotor::OnLink()
{
- dWorldID world = GetWorldID();
+ long world = GetWorldID();
if (world == 0)
{
return;
}
- mODEJoint = dJointCreateAMotor(world, 0);
+ mODEJoint = dJointCreateAMotor((dWorldID) world, 0);
}
void AngularMotor::SetMode(EMotorMode mode)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -33,13 +33,13 @@
void BallJoint::OnLink()
{
- dWorldID world = GetWorldID();
+ long world = GetWorldID();
if (world == 0)
{
return;
}
- mODEJoint = dJointCreateBall(world, 0);
+ mODEJoint = dJointCreateBall((dWorldID) world, 0);
}
void BallJoint::SetAnchor(const Vector3f& anchor)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -23,6 +23,7 @@
#define OXYGEN_BODY_H
#include <oxygen/physicsserver/physicsobject.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -68,14 +68,14 @@
// this geom is independent, so register to space and body
// if we have a space add the geom to it
- dSpaceID space = FindSpaceID();
+ long spaceID = FindSpaceID();
if (
- (space) &&
- (! dSpaceQuery(space, mODEGeom))
+ (spaceID) &&
+ (! dSpaceQuery((dSpaceID) spaceID, mODEGeom))
)
{
dGeomSetData(mODEGeom, this);
- dSpaceAdd(space, mODEGeom);
+ dSpaceAdd((dSpaceID) spaceID, mODEGeom);
}
// if there is a Body below our parent, link to it
shared_ptr<RigidBody> body = shared_static_cast<RigidBody>
@@ -83,7 +83,7 @@
if (body.get() != 0)
{
- dGeomSetBody (mODEGeom, body->GetODEBody());
+ dGeomSetBody (mODEGeom, (dBodyID) body->GetBodyID());
} else
{
// no body node found, setup initial position and
@@ -98,7 +98,7 @@
PhysicsObject::OnUnlink();
// remove collision geometry from space
- dSpaceID space = GetParentSpaceID();
+ long space = GetParentSpaceID();
if (
(mODEGeom == 0) ||
@@ -110,7 +110,7 @@
if (space)
{
- dSpaceRemove(space, mODEGeom);
+ dSpaceRemove((dSpaceID) space, mODEGeom);
}
}
@@ -230,14 +230,14 @@
return Vector3f(pos[0],pos[1],pos[2]);
}
-dSpaceID Collider::GetParentSpaceID()
+long Collider::GetParentSpaceID()
{
if (mODEGeom == 0)
{
return 0;
}
- return dGeomGetSpace(mODEGeom);
+ return (long) dGeomGetSpace(mODEGeom);
}
bool Collider::Intersects(boost::shared_ptr<Collider> collider)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -22,6 +22,7 @@
#ifndef OXYGEN_COLLIDER_H
#define OXYGEN_COLLIDER_H
+#include <oxygen/physicsserver/ode/odewrapper.h>
#include <oxygen/physicsserver/physicsobject.h>
#include <oxygen/oxygen_defines.h>
#include <string>
@@ -124,7 +125,7 @@
bool Intersects(boost::shared_ptr<Collider> collider);
/** returns the ODE handle ID of the containing parent space */
- virtual dSpaceID GetParentSpaceID();
+ virtual long GetParentSpaceID();
/** Add/Reomve a collider name that not collide with */
void AddNotCollideWithColliderName(const std::string & colliderName, bool isAdd);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -188,7 +188,7 @@
// create the contact joint and attach it to the body
dJointID joint = dJointCreateContact
- (mWorld->GetODEWorld(), mSpace->GetODEJointGroup(), &contact);
+ ((dWorldID) mWorld->GetWorldID(), mSpace->GetODEJointGroup(), &contact);
dJointAttach (joint, myBody, collideeBody);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/fixedjoint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/fixedjoint.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/fixedjoint.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -34,13 +34,13 @@
void FixedJoint::OnLink()
{
- dWorldID world = GetWorldID();
+ long world = GetWorldID();
if (world == 0)
{
return;
}
- mODEJoint = dJointCreateFixed(world, 0);
+ mODEJoint = dJointCreateFixed((dWorldID) world, 0);
}
void FixedJoint::SetParameter(int /*parameter*/, float /*value*/)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/hinge2joint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/hinge2joint.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/hinge2joint.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -34,13 +34,13 @@
void Hinge2Joint::OnLink()
{
- dWorldID world = GetWorldID();
+ long world = GetWorldID();
if (world == 0)
{
return;
}
- mODEJoint = dJointCreateHinge2(world, 0);
+ mODEJoint = dJointCreateHinge2((dWorldID) world, 0);
}
void Hinge2Joint::SetAnchor(const Vector3f& anchor)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/hingejoint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/hingejoint.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/hingejoint.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -34,13 +34,13 @@
void HingeJoint::OnLink()
{
- dWorldID world = GetWorldID();
+ long world = GetWorldID();
if (world == 0)
{
return;
}
- mODEJoint = dJointCreateHinge(world, 0);
+ mODEJoint = dJointCreateHinge((dWorldID) world, 0);
}
void HingeJoint::SetAnchor(const Vector3f& anchor)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -32,9 +32,9 @@
class OXYGEN_API BodyInt : public ODEPhysicsObject
{
-public:
- BodyInt() : ODEPhysicsObject(){};
- virtual ~BodyInt(){};
+protected:
+ BodyInt() : ODEPhysicsObject(){
+ };
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -32,9 +32,8 @@
class OXYGEN_API DynamicBodyInt : public ODEBody
{
-public:
+protected:
DynamicBodyInt() : ODEBody(){};
- virtual ~DynamicBodyInt(){};
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -30,26 +30,17 @@
namespace oxygen
{
-class World;
-class Space;
-class OXYGEN_API PhysicsObjectInt : public BaseNode
+class OXYGEN_API PhysicsObjectInt
{
-public:
- PhysicsObjectInt(){};
- virtual ~PhysicsObjectInt(){};
-
- virtual dWorldID GetWorldID() = 0;
- virtual dSpaceID FindSpaceID() = 0;
- virtual dSpaceID GetParentSpaceID() = 0;
+public:
virtual void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix) = 0;
virtual void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const = 0;
- virtual void DestroyPhysicsObject() = 0;
- boost::shared_ptr<Scene> scene;
- boost::shared_ptr<Space> space;
- boost::shared_ptr<World> world;
+protected:
+ PhysicsObjectInt(){
+ };
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -31,9 +31,8 @@
class OXYGEN_API PhysicsServerInt
{
-public:
+protected:
PhysicsServerInt(){};
- virtual ~PhysicsServerInt(){};
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -34,10 +34,6 @@
{
public:
- RigidBodyInt() : ODEBody(){};
- virtual ~RigidBodyInt(){};
-
- virtual dBodyID GetODEBody() const = 0;
virtual void Enable() = 0;
virtual void Disable() = 0;
virtual bool IsEnabled() const = 0;
@@ -82,7 +78,16 @@
virtual void BodySetData(RigidBody* rb) = 0;
virtual RigidBody* BodyGetData(long bodyID) = 0;
+ virtual long GetBodyID() = 0;
+ virtual salt::Vector3f GetMassTrans() = 0;
+ virtual void SetMassTrans(salt::Vector3f massTrans) = 0;
+ virtual bool GetMassTransformed() = 0;
+ virtual void SetMassTransformed(bool f) = 0;
+
protected:
+ RigidBodyInt() : ODEBody(), mBodyID(0), mMassTrans(0,0,0), mMassTransformed(false){
+ };
+
/** sets up an ode mass struct representing a box of the given
size and total_mass
*/
@@ -137,10 +142,7 @@
*/
virtual void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const = 0;
-private:
- virtual void PrePhysicsUpdateInternal(float deltaTime) = 0;
-
-public:
+protected:
long mBodyID;
salt::Vector3f mMassTrans;
bool mMassTransformed;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -32,9 +32,8 @@
class OXYGEN_API SoftBodyInt : public ODEBody
{
-public:
+protected:
SoftBodyInt() : ODEBody(){};
- virtual ~SoftBodyInt(){};
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -39,15 +39,12 @@
public:
typedef std::set<dSpaceID> TSpaceIdSet;
- SpaceInt() : ODEPhysicsObject(){};
- virtual ~SpaceInt(){};
-
//virtual void collisionNearCallback (void *data, dGeomID obj1, dGeomID obj2) = 0;
- virtual dSpaceID GetODESpace() const = 0;
+ virtual long GetSpaceID() const = 0;
virtual dJointGroupID GetODEJointGroup() const = 0;
virtual void Collide() = 0;
virtual void DestroyPhysicsObject() = 0;
- virtual dSpaceID GetParentSpaceID() = 0;
+ virtual long GetParentSpaceID() = 0;
virtual bool IsGlobalSpace() = 0;
virtual void DisableInnerCollision(bool disable) = 0;
virtual bool GetDisableInnerCollision() const = 0;
@@ -61,6 +58,10 @@
virtual void DestroySpaceObjects() = 0;
boost::shared_ptr<Scene> scene;
+
+protected:
+ SpaceInt() : ODEPhysicsObject(){
+ };
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -32,9 +32,8 @@
class OXYGEN_API StaticBodyInt : public ODEBody
{
-public:
+protected:
StaticBodyInt() : ODEBody(){};
- virtual ~StaticBodyInt(){};
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -32,10 +32,7 @@
{
public:
- WorldInt() : ODEPhysicsObject(){};
- virtual ~WorldInt(){};
-
- virtual dWorldID GetODEWorld() const = 0;
+ virtual long GetWorldID() const = 0;
virtual void SetGravity(const salt::Vector3f& gravity) = 0;
virtual salt::Vector3f GetGravity() const = 0;
virtual void SetERP(float erp) = 0;
@@ -47,8 +44,14 @@
virtual void SetAutoDisableFlag(bool flag) = 0;
virtual void SetContactSurfaceLayer(float depth) = 0;
virtual float GetContactSurfaceLayer() const = 0;
- virtual void DestroyPhysicsObject() = 0;
- virtual bool ConstructInternal() = 0;
+ virtual void CreateWorld() = 0;
+ virtual void DestroyWorld() = 0;
+
+protected:
+ WorldInt() : ODEPhysicsObject(), mWorldID(0){
+ };
+
+ long mWorldID;
};
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -88,7 +88,7 @@
}
string path1,path2;
- dBodyID id1,id2;
+ long id1,id2;
static const char strStaticEnv[] = "<static environment>";
@@ -98,7 +98,7 @@
path1 = strStaticEnv;
} else
{
- id1 = body1->GetODEBody();
+ id1 = body1->GetBodyID();
path1 = body1->GetFullPath();
}
@@ -108,14 +108,14 @@
path2 = strStaticEnv;
} else
{
- id2 = body2->GetODEBody();
+ id2 = body2->GetBodyID();
path2 = body2->GetFullPath();
}
GetLog()->Debug() << "(Joint) Attaching '" << path1 << "' to '"
<< path2 << '\n';
- dJointAttach(mODEJoint, id1, id2);
+ dJointAttach(mODEJoint, (dBodyID) id1, (dBodyID) id2);
}
shared_ptr<RigidBody> Joint::GetBody(const std::string& path)
@@ -179,7 +179,7 @@
}
const bool connected =
- (dAreConnected(body1->GetODEBody(),body2->GetODEBody())
+ (dAreConnected((dBodyID) body1->GetBodyID(), (dBodyID) body2->GetBodyID())
== 1);
return connected;
@@ -198,8 +198,8 @@
}
const bool connected =
- (dAreConnectedExcluding(body1->GetODEBody(),
- body2->GetODEBody(),
+ (dAreConnectedExcluding((dBodyID) body1->GetBodyID(),
+ (dBodyID) body2->GetBodyID(),
joint_type
)
== 1);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -23,6 +23,7 @@
#define OXYGEN_JOINT_H
#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
#include <oxygen/physicsserver/physicsobject.h>
namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -26,7 +26,3 @@
ODEBody::ODEBody() : BodyInt(){
}
-
-ODEBody::~ODEBody(){
-
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -31,7 +31,6 @@
{
public:
ODEBody();
- virtual ~ODEBody();
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -26,7 +26,3 @@
ODEDynamicBody::ODEDynamicBody() : DynamicBodyInt(){
}
-
-ODEDynamicBody::~ODEDynamicBody(){
-
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -31,7 +31,6 @@
{
public:
ODEDynamicBody();
- virtual ~ODEDynamicBody();
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -33,48 +33,6 @@
{
}
-ODEPhysicsObject::~ODEPhysicsObject()
-{
-}
-
-dWorldID ODEPhysicsObject::GetWorldID()
-{
- if (world.get() == 0)
- {
- return 0;
- }
-
- dWorldID worldId = world->GetODEWorld();
- if (worldId == 0)
- {
- cerr << "(ODEObject) ERROR: World returned empty ODE handle\n";
- }
-
- return worldId;
-}
-
-dSpaceID ODEPhysicsObject::FindSpaceID()
-{
- if (space.get() == 0)
- {
- return 0;
- }
-
- dSpaceID spaceId = space->GetODESpace();
-
- if (spaceId == 0)
- {
- cerr << "(ODEObject) ERROR: Space returned empty ODE handle\n";
- }
-
- return spaceId;
-}
-
-dSpaceID ODEPhysicsObject::GetParentSpaceID()
-{
- return 0;
-}
-
void ODEPhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
{
matrix[0] = rot.m[0];
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -29,21 +29,11 @@
namespace oxygen
{
-class Space;
-class World;
class OXYGEN_API ODEPhysicsObject : public PhysicsObjectInt
{
public:
ODEPhysicsObject();
- virtual ~ODEPhysicsObject();
-
- dWorldID GetWorldID();
- dSpaceID FindSpaceID();
- virtual dSpaceID GetParentSpaceID();
- virtual void DestroyPhysicsObject(){};
-
-protected:
void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
};
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -32,19 +32,30 @@
using namespace salt;
using namespace std;
-ODERigidBody::ODERigidBody() : RigidBodyInt(), mMassTrans(0,0,0), mMassTransformed(false){
- mBodyID = 0;
+ODERigidBody::ODERigidBody() : RigidBodyInt(){
}
-ODERigidBody::~ODERigidBody(){
+long ODERigidBody::GetBodyID()
+{
+ return mBodyID;
+}
+salt::Vector3f ODERigidBody::GetMassTrans(){
+ return mMassTrans;
}
-dBodyID ODERigidBody::GetODEBody() const
-{
- return (dBodyID)mBodyID;
+void ODERigidBody::SetMassTrans(Vector3f massTrans){
+ mMassTrans = massTrans;
}
+bool ODERigidBody::GetMassTransformed(){
+ return mMassTransformed;
+}
+
+void ODERigidBody::SetMassTransformed(bool f){
+ mMassTransformed = f;
+}
+
void ODERigidBody::Enable()
{
dBodyEnable((dBodyID)mBodyID);
@@ -393,45 +404,6 @@
return mat;
}
-void ODERigidBody::PrePhysicsUpdateInternal(float /*deltaTime*/)
-{
- // Check whether mass/body has been translated
- if (mMassTransformed)
- {
- weak_ptr<Node> parent = GetParent();
-
- // Update colliders (only those encapsulated in transform colliders)
- TLeafList transformColliders;
- parent.lock()->ListChildrenSupportingClass<TransformCollider>(transformColliders);
-
- for (TLeafList::iterator iter = transformColliders.begin(); iter != transformColliders.end(); ++iter)
- {
- // Only move non-transform colliders
- shared_ptr<Collider> collider = shared_static_cast<TransformCollider>(*iter)->FindChildSupportingClass<Collider>();
- if (collider.get())
- {
- Vector3f pos = collider->GetPosition();
- pos = pos + mMassTrans;
- collider->SetLocalPosition(pos);
- }
- }
-
- // Update visuals (or other transforms in the tree)
- TLeafList transforms;
- parent.lock()->ListShallowChildrenSupportingClass<Transform>(transforms);
- for (TLeafList::iterator iter = transforms.begin(); iter != transforms.end(); ++iter)
- {
- shared_ptr<Transform> transform = shared_dynamic_cast<Transform>(*iter);
- Matrix worldTransform = transform->GetWorldTransform();
- worldTransform.Pos() = worldTransform.Pos() + mMassTrans;
- transform->SetWorldTransform(worldTransform);
- }
-
- mMassTrans = Vector3f(0,0,0);
- mMassTransformed = false;
- }
-}
-
RigidBody* ODERigidBody::BodyGetData(long bodyID)
{
RigidBody* bodyPtr =
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -31,9 +31,7 @@
{
public:
ODERigidBody();
- virtual ~ODERigidBody();
- dBodyID GetODEBody() const;
void Enable();
void Disable();
bool IsEnabled() const;
@@ -77,6 +75,12 @@
void BodySetData(RigidBody* rb);
RigidBody* BodyGetData(long bodyID);
+ long GetBodyID();
+ salt::Vector3f GetMassTrans();
+ void SetMassTrans(salt::Vector3f massTrans);
+ bool GetMassTransformed();
+ void SetMassTransformed(bool f);
+
protected:
void CreateBody(long world);
void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const;
@@ -87,13 +91,6 @@
void PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const;
void PrepareCapsule(dMass& mass, float density, float radius, float length) const;
void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const;
-
-private:
- void PrePhysicsUpdateInternal(float deltaTime);
-
-protected:
- salt::Vector3f mMassTrans;
- bool mMassTransformed;
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -26,7 +26,3 @@
ODESoftBody::ODESoftBody() : SoftBodyInt(){
}
-
-ODESoftBody::~ODESoftBody(){
-
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -31,7 +31,6 @@
{
public:
ODESoftBody();
- virtual ~ODESoftBody();
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -42,15 +42,11 @@
{
}
-ODESpace::~ODESpace()
+long ODESpace::GetSpaceID() const
{
+ return (long) mODESpace;
}
-dSpaceID ODESpace::GetODESpace() const
-{
- return mODESpace;
-}
-
dJointGroupID ODESpace::GetODEJointGroup() const
{
return mODEContactGroup;
@@ -184,32 +180,29 @@
void ODESpace::OnUnlink()
{
DisableInnerCollision(false);
- ODEPhysicsObject::OnUnlink();
}
void ODESpace::OnLink()
{
- ODEPhysicsObject::OnLink();
+ /*shared_ptr<Space> space = GetSpace();
+ dSpaceID spaceID = 0;
- //shared_ptr<Space> space = GetSpace();
- dSpaceID spaceId = 0;
-
if (space.get() != 0)
{
- spaceId = space->GetODESpace();
+ spaceID = (dSpaceID) space->GetSpaceID();
}
- mODESpace = dHashSpaceCreate(spaceId);
+ mODESpace = dHashSpaceCreate(spaceID);*/
}
-dSpaceID ODESpace::GetParentSpaceID()
+long ODESpace::GetParentSpaceID()
{
if (mODESpace == 0)
{
return 0;
}
- return dGeomGetSpace((dGeomID)mODESpace);
+ return (long) dGeomGetSpace((dGeomID)mODESpace);
}
bool ODESpace::IsGlobalSpace()
@@ -235,8 +228,8 @@
dJointGroupEmpty (mODEContactGroup);
}
-void ODESpace::DestroySpaceObjects()
-{
+void ODESpace::DestroySpaceObjects(){}
+/*{
if (scene.get() == 0)
{
return;
@@ -263,19 +256,19 @@
// destroy objects registered to this space; the top level
// space object also destroy any other ODE object
- const dSpaceID parentSpace = object->GetParentSpaceID();
+ const long parentSpace = object->GetParentSpaceID();
if (
(
(globalSpace) &&
(parentSpace == 0)
) ||
- (parentSpace == mODESpace)
+ (parentSpace == (long) mODESpace)
)
{
object->DestroyPhysicsObject();
}
}
-}
+}*/
void ODESpace::DestroyPhysicsObject()
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -36,13 +36,12 @@
public:
ODESpace();
- virtual ~ODESpace();
- dSpaceID GetODESpace() const;
+ long GetSpaceID() const;
dJointGroupID GetODEJointGroup() const;
void Collide();
virtual void DestroyPhysicsObject();
- virtual dSpaceID GetParentSpaceID();
+ virtual long GetParentSpaceID();
bool IsGlobalSpace();
void DisableInnerCollision(bool disable);
bool GetDisableInnerCollision() const;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -26,7 +26,3 @@
ODEStaticBody::ODEStaticBody() : StaticBodyInt(){
}
-
-ODEStaticBody::~ODEStaticBody(){
-
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -31,7 +31,6 @@
{
public:
ODEStaticBody();
- virtual ~ODEStaticBody();
};
} //namespace oxygen
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -27,22 +27,18 @@
using namespace oxygen;
using namespace salt;
-ODEWorld::ODEWorld() : WorldInt(), mODEWorld(0)
+ODEWorld::ODEWorld() : WorldInt()
{
}
-ODEWorld::~ODEWorld()
+long ODEWorld::GetWorldID() const
{
+ return mWorldID;
}
-dWorldID ODEWorld::GetODEWorld() const
-{
- return mODEWorld;
-}
-
void ODEWorld::SetGravity(const Vector3f& gravity)
{
- dWorldSetGravity(mODEWorld,
+ dWorldSetGravity((dWorldID) mWorldID,
gravity.x(),
gravity.y(),
gravity.z()
@@ -52,87 +48,62 @@
salt::Vector3f ODEWorld::GetGravity() const
{
dVector3 dGravity;
- dWorldGetGravity(mODEWorld,dGravity);
+ dWorldGetGravity((dWorldID) mWorldID,dGravity);
return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
}
void ODEWorld::SetERP(float erp)
{
- dWorldSetERP(mODEWorld, erp);
+ dWorldSetERP((dWorldID) mWorldID, erp);
}
float ODEWorld::GetERP() const
{
- return dWorldGetERP(mODEWorld);
+ return dWorldGetERP((dWorldID) mWorldID);
}
void ODEWorld::SetCFM(float cfm)
{
- dWorldSetCFM(mODEWorld, cfm);
+ dWorldSetCFM((dWorldID) mWorldID, cfm);
}
float ODEWorld::GetCFM() const
{
- return dWorldGetCFM(mODEWorld);
+ return dWorldGetCFM((dWorldID) mWorldID);
}
void ODEWorld::Step(float deltaTime)
{
- dWorldStep(mODEWorld, deltaTime);
+ dWorldStep((dWorldID) mWorldID, deltaTime);
}
bool ODEWorld::GetAutoDisableFlag() const
{
- return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
+ return (dWorldGetAutoDisableFlag((dWorldID) mWorldID) == 1);
}
void ODEWorld::SetAutoDisableFlag(bool flag)
{
- dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
+ dWorldSetAutoDisableFlag((dWorldID) mWorldID, static_cast<int>(flag));
}
void ODEWorld::SetContactSurfaceLayer(float depth)
{
- dWorldSetContactSurfaceLayer(mODEWorld, depth);
+ dWorldSetContactSurfaceLayer((dWorldID) mWorldID, depth);
}
float ODEWorld::GetContactSurfaceLayer() const
{
- return dWorldGetContactSurfaceLayer(mODEWorld);
+ return dWorldGetContactSurfaceLayer((dWorldID) mWorldID);
}
-bool ODEWorld::ConstructInternal()
+void ODEWorld::CreateWorld()
{
- // create an ode world
- mODEWorld = dWorldCreate();
-
- return (mODEWorld != 0);
+ mWorldID = (long) dWorldCreate();
}
-void ODEWorld::DestroyPhysicsObject()
+void ODEWorld::DestroyWorld()
{
- static bool recurseLock = false;
- if (recurseLock)
- {
- return;
- }
-
- recurseLock = true;
-
- //shared_ptr<Space> space = GetSpace();
- if (space.get() != 0)
- {
- space->DestroyPhysicsObject();
- }
-
- if (mODEWorld == 0)
- {
- return;
- }
-
- // release the ODE world
- dWorldDestroy(mODEWorld);
- mODEWorld = 0;
-
- recurseLock = false;
+ dWorldDestroy((dWorldID) mWorldID);
+ mWorldID = 0;
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -33,9 +33,8 @@
public:
ODEWorld();
- virtual ~ODEWorld();
- dWorldID GetODEWorld() const;
+ long GetWorldID() const;
void SetGravity(const salt::Vector3f& gravity);
salt::Vector3f GetGravity() const;
void SetERP(float erp);
@@ -47,13 +46,8 @@
void SetAutoDisableFlag(bool flag);
void SetContactSurfaceLayer(float depth);
float GetContactSurfaceLayer() const;
- virtual void DestroyPhysicsObject();
-
-protected:
- virtual bool ConstructInternal();
-
-private:
- dWorldID mODEWorld;
+ void CreateWorld();
+ void DestroyWorld();
};
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -41,7 +41,7 @@
void PhysicsObject::OnUnlink()
{
- mPhysicsObjectImp->DestroyPhysicsObject();
+ DestroyPhysicsObject();
}
/** returns the world node */
@@ -91,38 +91,48 @@
return spaceNode;
}
-dWorldID PhysicsObject::GetWorldID()
-{
- mPhysicsObjectImp->world = GetWorld();
-
+long PhysicsObject::GetWorldID()
+{
shared_ptr<World> world = GetWorld();
- //mPhysicsObjectImp->GetWorld();
if (world.get() == 0)
{
return 0;
}
- dWorldID worldId = world->GetODEWorld();
- if (worldId == 0)
+ long worldID = world->GetWorldID();
+
+ if (worldID == 0)
{
GetLog()->Error()
<< "(ODEObject) ERROR: World returned empty ODE handle\n";
}
- return worldId;
+ return worldID;
}
-dSpaceID PhysicsObject::FindSpaceID()
+long PhysicsObject::FindSpaceID()
{
- mPhysicsObjectImp->space = GetSpace();
-
- return mPhysicsObjectImp->FindSpaceID();
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() == 0)
+ {
+ return 0;
+ }
+
+ long spaceID = space->GetSpaceID();
+
+ if (spaceID == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: Space returned empty ODE handle\n";
+ }
+
+ return spaceID;
}
-dSpaceID PhysicsObject::GetParentSpaceID()
+long PhysicsObject::GetParentSpaceID()
{
- return mPhysicsObjectImp->GetParentSpaceID();
+ return 0;
}
void PhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -51,13 +51,13 @@
virtual void OnUnlink();
/** returns the ODE world handle */
- dWorldID GetWorldID();
+ long GetWorldID();
/** returns the nearest parent space ODE handle */
- dSpaceID FindSpaceID();
+ long FindSpaceID();
/** returns the ODE handle ID of the containing parent space */
- virtual dSpaceID GetParentSpaceID();
+ virtual long GetParentSpaceID();
/** this method is not implemented here because PhysicsObject is an
abstract class. However, it is declared here so that it can be
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -39,9 +39,9 @@
{
}
-dBodyID RigidBody::GetODEBody() const
+long RigidBody::GetBodyID() const
{
- return (dBodyID) mRigidBodyImp->mBodyID;
+ return mRigidBodyImp->GetBodyID();
}
void RigidBody::Enable()
@@ -71,7 +71,7 @@
bool RigidBody::CreateBody()
{
- long bodyID = mRigidBodyImp->mBodyID;
+ long bodyID = mRigidBodyImp->GetBodyID();
if (bodyID != 0)
{
@@ -86,9 +86,9 @@
mRigidBodyImp->CreateBody(world);
- mODEBody = (dBodyID) mRigidBodyImp->mBodyID;
+ mODEBody = (dBodyID) mRigidBodyImp->GetBodyID();
- if (mRigidBodyImp->mBodyID == 0)
+ if (mRigidBodyImp->GetBodyID() == 0)
{
GetLog()->Error()
<< "(Body) ERROR: could not create new ODE body\n";
@@ -140,12 +140,12 @@
void RigidBody::GetMassParameters(dMass& mass) const
{
- dBodyGetMass(mODEBody, &mass);
+ mRigidBodyImp->GetMassParameters(mass);
}
void RigidBody::SetMassParameters(const dMass& mass)
{
- dBodySetMass(mODEBody, &mass);
+ mRigidBodyImp->SetMassParameters(mass);
}
void RigidBody::SetSphere(float density, float radius)
@@ -271,7 +271,7 @@
void RigidBody::PrePhysicsUpdateInternal(float /*deltaTime*/)
{
// Check whether mass/body has been translated
- if (mRigidBodyImp->mMassTransformed)
+ if (mRigidBodyImp->GetMassTransformed())
{
weak_ptr<Node> parent = GetParent();
@@ -302,8 +302,8 @@
transform->SetWorldTransform(worldTransform);
}
- mRigidBodyImp->mMassTrans = Vector3f(0,0,0);
- mRigidBodyImp->mMassTransformed = false;
+ mRigidBodyImp->SetMassTrans(Vector3f(0,0,0));
+ mRigidBodyImp->SetMassTransformed(false);
}
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -47,7 +47,7 @@
virtual ~RigidBody();
/** returns the ID of the mangaged ODE body */
- dBodyID GetODEBody() const;
+ long GetBodyID() const;
/** enables this body. Each body can be enabled or
disabled. Disabled bodies are effectively turned off and are
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -34,13 +34,13 @@
void SliderJoint::OnLink()
{
- dWorldID world = GetWorldID();
+ long world = GetWorldID();
if (world == 0)
{
return;
}
- mODEJoint = dJointCreateSlider(world, 0);
+ mODEJoint = dJointCreateSlider((dWorldID) world, 0);
}
void SliderJoint::Attach(shared_ptr<RigidBody> body1, shared_ptr<RigidBody> body2)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -47,9 +47,9 @@
{
}
-dSpaceID Space::GetODESpace() const
+long Space::GetSpaceID() const
{
- return mSpaceImp->GetODESpace();
+ return mSpaceImp->GetSpaceID();
}
dJointGroupID Space::GetODEJointGroup() const
@@ -197,20 +197,20 @@
PhysicsObject::OnLink();
shared_ptr<Space> space = GetSpace();
- dSpaceID spaceId = 0;
+ long spaceID = 0;
if (space.get() != 0)
{
- spaceId = space->GetODESpace();
+ spaceID = space->GetSpaceID();
}
- mODESpace = dHashSpaceCreate(spaceId);
+ mODESpace = dHashSpaceCreate((dSpaceID) spaceID);
shared_ptr<ODESpace> odespace = shared_static_cast<ODESpace>(mSpaceImp);
odespace->mODESpace = mODESpace;
}
-dSpaceID Space::GetParentSpaceID()
+long Space::GetParentSpaceID()
{
return mSpaceImp->GetParentSpaceID();
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/space.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/space.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/space.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -23,6 +23,7 @@
#define OXYGEN_SPACE_H
#include <oxygen/physicsserver/physicsobject.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
#include <set>
#include <oxygen/oxygen_defines.h>
@@ -47,8 +48,8 @@
Space();
virtual ~Space();
- /** returns the ID of the managed ODE space */
- dSpaceID GetODESpace() const;
+ /** returns the ID of the managed space */
+ long GetSpaceID() const;
/** retuns the ID of joint group for all created contact joints */
dJointGroupID GetODEJointGroup() const;
@@ -65,7 +66,7 @@
virtual void DestroyPhysicsObject();
/** returns the ODE handle ID of the containing parent space */
- virtual dSpaceID GetParentSpaceID();
+ virtual long GetParentSpaceID();
/** returns true if this is the top global, i.e. top level space object */
bool IsGlobalSpace();
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/universaljoint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/universaljoint.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/universaljoint.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -34,14 +34,14 @@
void UniversalJoint::OnLink()
{
- dWorldID world = GetWorldID();
+ long world = GetWorldID();
if (world == 0)
{
return;
}
- mODEJoint = dJointCreateUniversal(world, 0);
+ mODEJoint = dJointCreateUniversal((dWorldID) world, 0);
}
void UniversalJoint::SetAnchor(const Vector3f& anchor)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -20,8 +20,8 @@
*/
#include <oxygen/physicsserver/ode/odeworld.h>
+#include <oxygen/physicsserver/space.h>
#include <oxygen/physicsserver/world.h>
-#include <oxygen/physicsserver/space.h>
#include <oxygen/sceneserver/scene.h>
using namespace boost;
@@ -37,72 +37,95 @@
{
}
-dWorldID World::GetODEWorld() const
+long World::GetWorldID() const
{
- return mWorldImp->GetODEWorld();
+ return mWorldImp->GetWorldID();
}
void World::SetGravity(const Vector3f& gravity)
{
- mWorldImp->SetGravity(gravity);
+ mWorldImp->SetGravity(gravity);
}
salt::Vector3f World::GetGravity() const
{
- return mWorldImp->GetGravity();
+ return mWorldImp->GetGravity();
}
void World::SetERP(float erp)
{
- mWorldImp->SetERP(erp);
+ mWorldImp->SetERP(erp);
}
float World::GetERP() const
{
- return mWorldImp->GetERP();
+ return mWorldImp->GetERP();
}
void World::SetCFM(float cfm)
{
- mWorldImp->SetCFM(cfm);
+ mWorldImp->SetCFM(cfm);
}
float World::GetCFM() const
{
- return mWorldImp->GetCFM();
+ return mWorldImp->GetCFM();
}
void World::Step(float deltaTime)
{
- mWorldImp->Step(deltaTime);
+ mWorldImp->Step(deltaTime);
}
bool World::GetAutoDisableFlag() const
{
- return mWorldImp->GetAutoDisableFlag();
+ return mWorldImp->GetAutoDisableFlag();
}
void World::SetAutoDisableFlag(bool flag)
{
- mWorldImp->SetAutoDisableFlag(flag);
+ mWorldImp->SetAutoDisableFlag(flag);
}
void World::SetContactSurfaceLayer(float depth)
{
- mWorldImp->SetContactSurfaceLayer(depth);
+ mWorldImp->SetContactSurfaceLayer(depth);
}
float World::GetContactSurfaceLayer() const
{
- return mWorldImp->GetContactSurfaceLayer();
+ return mWorldImp->GetContactSurfaceLayer();
}
bool World::ConstructInternal()
{
- return mWorldImp->ConstructInternal();
+ mWorldImp->CreateWorld();
+
+ return (mWorldImp->GetWorldID() != 0);
}
void World::DestroyPhysicsObject()
{
- mWorldImp->DestroyPhysicsObject();
+ static bool recurseLock = false;
+ if (recurseLock)
+ {
+ return;
+ }
+
+ recurseLock = true;
+
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() != 0)
+ {
+ space->DestroyPhysicsObject();
+ }
+
+ if (mWorldImp->GetWorldID() == 0)
+ {
+ return;
+ }
+
+ mWorldImp->DestroyWorld();
+
+ recurseLock = false;
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-12-02 10:06:02 UTC (rev 112)
@@ -23,15 +23,15 @@
#define OXYGEN_WORLD_H
#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
#include <oxygen/physicsserver/physicsobject.h>
namespace oxygen
{
class WorldInt;
-class ODEWorld;
-/** World encapsulates an ODE world object. It is a container for
+/** World encapsulates a world object. It is a container for
rigid bodies and joints. Objects in different worlds can not
interact, for example rigid bodies from two different worlds can
not collide. All the objects in a world exist at the same point in
@@ -47,10 +47,10 @@
World();
virtual ~World();
- /** returns the ID of the managed ODE world */
- dWorldID GetODEWorld() const;
+ /** returns the ID of the managed world */
+ long GetWorldID() const;
- /** sets the gravity vector of this vorld */
+ /** sets the gravity vector of this world */
void SetGravity(const salt::Vector3f& gravity);
/** gets the gravity vector of this world */
@@ -105,17 +105,22 @@
void SetContactSurfaceLayer(float depth);
float GetContactSurfaceLayer() const;
- /** destroy the managed ODE object */
+ /** destroy the managed world and all objects in it */
virtual void DestroyPhysicsObject();
protected:
- /** creates them managed ODE world */
+ /** creates a new physics world */
virtual bool ConstructInternal();
//
// Members
//
private:
+ /** Pointer to the implementation of this class.
+ If a method contains engine-specific commands, these commands are
+ carried out in a subclass of WorldInt that has the right calls for
+ the desired physics engine.
+ */
boost::shared_ptr<WorldInt> mWorldImp;
};
Modified: branches/multiphys/spark/plugin/collisionperceptor/touchperceptorhandler.cpp
===================================================================
--- branches/multiphys/spark/plugin/collisionperceptor/touchperceptorhandler.cpp 2009-12-01 09:08:17 UTC (rev 111)
+++ branches/multiphys/spark/plugin/collisionperceptor/touchperceptorhandler.cpp 2009-12-02 10:06:02 UTC (rev 112)
@@ -79,7 +79,7 @@
CalcSurfaceParam(contact.surface,handler->GetSurfaceParameter());
- dJointID joint = dJointCreateContact(mWorld->GetODEWorld(),
+ dJointID joint = dJointCreateContact((dWorldID) mWorld->GetWorldID(),
mSpace->GetODEJointGroup(), &contact);
dJointAttach (joint, myBody, collideeBody);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-12-01 09:08:25
|
Revision: 111
http://simspark.svn.sourceforge.net/simspark/?rev=111&view=rev
Author: a-held
Date: 2009-12-01 09:08:17 +0000 (Tue, 01 Dec 2009)
Log Message:
-----------
Tackled bridge pattern for RigidBody class
Modified Paths:
--------------
branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-11-30 08:31:04 UTC (rev 110)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-12-01 09:08:17 UTC (rev 111)
@@ -25,6 +25,7 @@
#include <oxygen/oxygen_defines.h>
#include <oxygen/physicsserver/ode/odebody.h>
+#include <iostream>
namespace oxygen
{
@@ -42,6 +43,7 @@
virtual bool IsEnabled() const = 0;
virtual void UseGravity(bool f) = 0;
virtual bool UsesGravity() const = 0;
+ virtual void CreateBody(long world) = 0;
virtual void SetMass(float mass) = 0;
virtual void SetMassParameters(const dMass& mass) = 0;
virtual float GetMass() const = 0;
@@ -74,28 +76,72 @@
virtual void SetPosition(const salt::Vector3f& pos) = 0;
virtual salt::Vector3f GetPosition() const = 0;
virtual void DestroyPhysicsObject() = 0;
- virtual void SynchronizeParent() const = 0;
+ virtual salt::Matrix GetSynchronisationMatrix() = 0;
virtual void AddMass(const dMass& mass, const salt::Matrix& matrix) = 0;
//virtual salt::Vector3f GetMassCenter() const = 0;
+ virtual void BodySetData(RigidBody* rb) = 0;
+ virtual RigidBody* BodyGetData(long bodyID) = 0;
protected:
- virtual void OnLink() = 0;
- virtual bool CreateBody() = 0;
+ /** sets up an ode mass struct representing a box of the given
+ size and total_mass
+ */
virtual void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const = 0;
+
+ /** sets up an ode mass struct representing a box of the given
+ density and size
+ */
virtual void PrepareBox(dMass& mass, float density, const salt::Vector3f& size) const = 0;
+
+ /** sets up an ode mass struct representing a sphere of the given
+ density and radius
+ */
virtual void PrepareSphere(dMass& mass, float density, float radius) const = 0;
+
+ /** sets up an ode mass struct representing a sphere of the given
+ radius and total_mass
+ */
virtual void PrepareSphereTotal(dMass& mass, float total_mass, float radius) const = 0;
+
+ /** sets up an ode mass struct representing a flat-ended cylinder
+ of the given parameters and density, with the center of mass
+ at (0,0,0) relative to the body. The radius of the cylinder is
+ radius. The length of the cylinder is length. The cylinder's
+ long axis is oriented along the body's z axis.
+ */
virtual void PrepareCylinder(dMass& mass, float density, float radius, float length) const = 0;
+
+ /** sets up an ode mass struct representing a flat-ended cylinder
+ of the given parameters and total mass, with the center of
+ mass at (0,0,0) relative to the body. The radius of the
+ cylinder is radius. The length of the cylinder is length. The
+ cylinder's long axis is oriented along the body's z axis.
+ */
virtual void PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const = 0;
+
+ /* sets up an ode mass struct representing a capsule of
+ the given parameters and density, with the center of mass at
+ (0,0,0) relative to the body. The radius of the capsule (and
+ the spherical cap) is radius. The length of the capsule (not
+ counting the spherical cap) is length. The capsule's long axis
+ is oriented along the body's z axis.
+ */
virtual void PrepareCapsule(dMass& mass, float density, float radius, float length) const = 0;
+
+ /* sets up an ode mass struct representing a capsule of
+ the given parameters and total mass, with the center of mass at
+ (0,0,0) relative to the body. The radius of the capsule (and
+ the spherical cap) is radius. The length of the capsule (not
+ counting the spherical cap) is length. The capsule's long axis
+ is oriented along the body's z axis.
+ */
virtual void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const = 0;
private:
virtual void PrePhysicsUpdateInternal(float deltaTime) = 0;
- virtual void PostPhysicsUpdateInternal() = 0;
-protected:
- dBodyID mODEBody;
+public:
+ long mBodyID;
salt::Vector3f mMassTrans;
bool mMassTransformed;
};
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-12-01 09:08:17 UTC (rev 111)
@@ -32,8 +32,8 @@
using namespace salt;
using namespace std;
-ODERigidBody::ODERigidBody() : RigidBodyInt(){
-
+ODERigidBody::ODERigidBody() : RigidBodyInt(), mMassTrans(0,0,0), mMassTransformed(false){
+ mBodyID = 0;
}
ODERigidBody::~ODERigidBody(){
@@ -42,22 +42,22 @@
dBodyID ODERigidBody::GetODEBody() const
{
- return mODEBody;
+ return (dBodyID)mBodyID;
}
void ODERigidBody::Enable()
{
- dBodyEnable(mODEBody);
+ dBodyEnable((dBodyID)mBodyID);
}
void ODERigidBody::Disable()
{
- dBodyDisable(mODEBody);
+ dBodyDisable((dBodyID)mBodyID);
}
bool ODERigidBody::IsEnabled() const
{
- return (dBodyIsEnabled(mODEBody) != 0);
+ return (dBodyIsEnabled((dBodyID)mBodyID) != 0);
}
void ODERigidBody::UseGravity(bool f)
@@ -65,99 +65,105 @@
if (f == true)
{
// body is affected by gravity
- dBodySetGravityMode(mODEBody, 1);
+ dBodySetGravityMode((dBodyID)mBodyID, 1);
}
else
{
// body is not affected by gravity
- dBodySetGravityMode(mODEBody, 0);
+ dBodySetGravityMode((dBodyID)mBodyID, 0);
}
}
bool ODERigidBody::UsesGravity() const
{
- return (dBodyGetGravityMode(mODEBody) != 0);
+ return (dBodyGetGravityMode((dBodyID)mBodyID) != 0);
}
-bool ODERigidBody::CreateBody()
+void ODERigidBody::CreateBody(long world)
{
- if (mODEBody != 0)
+ if (mBodyID != 0)
{
- return true;
+ return;
}
- dWorldID world = GetWorldID();
- if (world == 0)
- {
- return false;
- }
-
// create the managed body
- mODEBody = dBodyCreate(world);
- if (mODEBody == 0)
- {
- GetLog()->Error()
- << "(Body) ERROR: could not create new ODE body\n";
- return false;
- }
-
- return true;
+ mBodyID = (long) dBodyCreate( (dWorldID) world);
}
void ODERigidBody::DestroyPhysicsObject()
{
- if (mODEBody == 0)
+ if (mBodyID == 0)
{
return;
}
- dBodyDestroy(mODEBody);
- mODEBody = 0;
+ dBodyDestroy((dBodyID)mBodyID);
+ mBodyID = 0;
}
-void ODERigidBody::OnLink()
+void ODERigidBody::BodySetData(RigidBody* rb)
{
- ODEPhysicsObject::OnLink();
-
- if (! CreateBody())
- {
- return;
- }
-
- // let the body, take on the world space position of the parent
- dBodySetData(mODEBody, this);
-
- shared_ptr<BaseNode> baseNode = shared_static_cast<BaseNode>
- (GetParent().lock());
-
- const Matrix& mat = baseNode->GetWorldTransform();
- SetRotation(mat);
- SetPosition(mat.Pos());
+ dBodySetData((dBodyID)mBodyID, rb);
}
void ODERigidBody::SetMass(float mass)
{
dMass ODEMass;
- dBodyGetMass(mODEBody, &ODEMass);
+ dBodyGetMass((dBodyID)mBodyID, &ODEMass);
dMassAdjust(&ODEMass, mass);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
float ODERigidBody::GetMass() const
{
dMass m;
- dBodyGetMass(mODEBody, &m);
+ dBodyGetMass((dBodyID)mBodyID, &m);
return m.mass;
}
+void ODERigidBody::AddMass(const dMass& mass, const Matrix& matrix)
+{
+ dMass transMass(mass);
+
+ dMatrix3 rot;
+ ConvertRotationMatrix(matrix, rot);
+ dMassRotate(&transMass,rot);
+
+ const Vector3f& trans(matrix.Pos());
+ dMassTranslate(&transMass,trans[0],trans[1],trans[2]);
+
+ dMassTranslate(&transMass,mMassTrans[0],mMassTrans[1],mMassTrans[2]);
+
+ dMass bodyMass;
+ dBodyGetMass((dBodyID)mBodyID, &bodyMass);
+ dMassAdd(&bodyMass, &transMass);
+
+ /** ODE currently requires that the center mass is always in the
+ origin of the body
+ */
+ Vector3f trans2(bodyMass.c[0], bodyMass.c[1], bodyMass.c[2]);
+
+ dMassTranslate(&bodyMass, -trans2[0], -trans2[1], -trans2[2]);
+ bodyMass.c[0] = bodyMass.c[1] = bodyMass.c[2] = 0.0f;
+ dBodySetMass((dBodyID)mBodyID, (const dMass*)&bodyMass);
+
+ // Move body so mass is at right position again
+ SetPosition(GetPosition() + trans2);
+
+ // Keep track of total translation of mass
+ mMassTrans = mMassTrans - trans2;
+
+ mMassTransformed = true;
+}
+
void ODERigidBody::GetMassParameters(dMass& mass) const
{
- dBodyGetMass(mODEBody, &mass);
+ dBodyGetMass((dBodyID)mBodyID, &mass);
}
void ODERigidBody::SetMassParameters(const dMass& mass)
{
- dBodySetMass(mODEBody, &mass);
+ dBodySetMass((dBodyID)mBodyID, &mass);
}
void ODERigidBody::PrepareSphere(dMass& mass, float density, float radius) const
@@ -169,7 +175,7 @@
{
dMass ODEMass;
PrepareSphere(ODEMass, density, radius);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
void ODERigidBody::AddSphere(float density, float radius, const Matrix& matrix)
@@ -188,7 +194,7 @@
{
dMass ODEMass;
PrepareSphereTotal(ODEMass, total_mass, radius);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
void ODERigidBody::AddSphereTotal(float total_mass, float radius, const Matrix& matrix)
@@ -207,7 +213,7 @@
{
dMass ODEMass;
PrepareBox(ODEMass, density, size);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
void ODERigidBody::AddBox(float density, const Vector3f& size, const Matrix& matrix)
@@ -226,7 +232,7 @@
{
dMass ODEMass;
PrepareBoxTotal(ODEMass, total_mass, size);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
void ODERigidBody::AddBoxTotal(float total_mass, const Vector3f& size, const Matrix& matrix)
@@ -236,41 +242,6 @@
AddMass(ODEMass, matrix);
}
-void ODERigidBody::AddMass(const dMass& mass, const Matrix& matrix)
-{
- dMass transMass(mass);
-
- dMatrix3 rot;
- ConvertRotationMatrix(matrix, rot);
- dMassRotate(&transMass,rot);
-
- const Vector3f& trans(matrix.Pos());
- dMassTranslate(&transMass,trans[0],trans[1],trans[2]);
-
- dMassTranslate(&transMass,mMassTrans[0],mMassTrans[1],mMassTrans[2]);
-
- dMass bodyMass;
- dBodyGetMass(mODEBody, &bodyMass);
- dMassAdd(&bodyMass, &transMass);
-
- /** ODE currently requires that the center mass is always in the
- origin of the body
- */
- Vector3f trans2(bodyMass.c[0], bodyMass.c[1], bodyMass.c[2]);
-
- dMassTranslate(&bodyMass, -trans2[0], -trans2[1], -trans2[2]);
- bodyMass.c[0] = bodyMass.c[1] = bodyMass.c[2] = 0.0f;
- dBodySetMass(mODEBody, (const dMass*)&bodyMass);
-
- // Move body so mass is at right position again
- SetPosition(GetPosition() + trans2);
-
- // Keep track of total translation of mass
- mMassTrans = mMassTrans - trans2;
-
- mMassTransformed = true;
-}
-
void ODERigidBody::PrepareCylinder (dMass& mass, float density, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
@@ -283,7 +254,7 @@
{
dMass ODEMass;
PrepareCylinder(ODEMass, density, radius, length);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
void ODERigidBody::AddCylinder (float density, float radius, float length, const Matrix& matrix)
@@ -305,7 +276,7 @@
{
dMass ODEMass;
PrepareCylinderTotal(ODEMass, total_mass, radius, length);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
void ODERigidBody::AddCylinderTotal(float total_mass, float radius, float length, const Matrix& matrix)
@@ -327,7 +298,7 @@
{
dMass ODEMass;
PrepareCapsule(ODEMass, density, radius, length);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
void ODERigidBody::AddCapsule (float density, float radius, float length, const Matrix& matrix)
@@ -349,7 +320,7 @@
{
dMass ODEMass;
PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
- dBodySetMass(mODEBody, &ODEMass);
+ dBodySetMass((dBodyID)mBodyID, &ODEMass);
}
void ODERigidBody::AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix)
@@ -361,25 +332,25 @@
Vector3f ODERigidBody::GetVelocity() const
{
- const dReal* vel = dBodyGetLinearVel(mODEBody);
+ const dReal* vel = dBodyGetLinearVel((dBodyID)mBodyID);
return Vector3f(vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetVelocity(const Vector3f& vel)
{
- dBodySetLinearVel(mODEBody, vel[0], vel[1], vel[2]);
+ dBodySetLinearVel((dBodyID)mBodyID, vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetRotation(const Matrix& rot)
{
dMatrix3 m;
ConvertRotationMatrix(rot,m);
- dBodySetRotation(mODEBody,m);
+ dBodySetRotation((dBodyID)mBodyID,m);
}
salt::Matrix ODERigidBody::GetRotation() const
{
- const dReal* m = dBodyGetRotation(mODEBody);
+ const dReal* m = dBodyGetRotation((dBodyID)mBodyID);
salt::Matrix rot;
ConvertRotationMatrix(m,rot);
return rot;
@@ -387,23 +358,19 @@
Vector3f ODERigidBody::GetAngularVelocity() const
{
- const dReal* vel = dBodyGetAngularVel(mODEBody);
+ const dReal* vel = dBodyGetAngularVel((dBodyID)mBodyID);
return Vector3f(vel[0], vel[1], vel[2]);
}
void ODERigidBody::SetAngularVelocity(const Vector3f& vel)
{
- dBodySetAngularVel(mODEBody, vel[0], vel[1], vel[2]);
+ dBodySetAngularVel((dBodyID)mBodyID, vel[0], vel[1], vel[2]);
}
-void ODERigidBody::SynchronizeParent() const
+salt::Matrix ODERigidBody::GetSynchronisationMatrix()
{
- const dReal* pos = dBodyGetPosition(mODEBody);
- const dReal* rot = dBodyGetRotation(mODEBody);
-
- shared_ptr<BaseNode> baseNode = shared_static_cast<BaseNode>
- (GetParent().lock());
-
+ const dReal* pos = dBodyGetPosition((dBodyID)mBodyID);
+ const dReal* rot = dBodyGetRotation((dBodyID)mBodyID);
Matrix mat;
mat.m[0] = rot[0];
@@ -423,7 +390,7 @@
mat.m[14] = pos[2];
mat.m[15] = 1;
- baseNode->SetWorldTransform(mat);
+ return mat;
}
void ODERigidBody::PrePhysicsUpdateInternal(float /*deltaTime*/)
@@ -465,68 +432,39 @@
}
}
-
-void ODERigidBody::PostPhysicsUpdateInternal()
+RigidBody* ODERigidBody::BodyGetData(long bodyID)
{
- SynchronizeParent();
-}
-
-shared_ptr<RigidBody> ODERigidBody::GetBody(dBodyID id)
-{
- if (id == 0)
- {
- return shared_ptr<RigidBody>();
- }
-
RigidBody* bodyPtr =
- static_cast<RigidBody*>(dBodyGetData(id));
+ static_cast<RigidBody*>(dBodyGetData( (dBodyID) bodyID));
- if (bodyPtr == 0)
- {
- // we cannot use the logserver here
- cerr << "ERROR: (ODERigidBody) no body found for dBodyID "
- << id << "\n";
- return shared_ptr<RigidBody>();
- }
-
- shared_ptr<RigidBody> body = shared_static_cast<RigidBody>
- (bodyPtr->GetSelf().lock());
-
- if (body.get() == 0)
- {
- // we cannot use the logserver here
- cerr << "ERROR: (ODERigidBody) got no shared_ptr for dBodyID "
- << id << "\n";
- }
-
- return body;
+ return bodyPtr;
}
void ODERigidBody::AddForce(const Vector3f& force)
{
- dBodyAddForce(mODEBody, force.x(), force.y(), force.z());
+ dBodyAddForce((dBodyID)mBodyID, force.x(), force.y(), force.z());
}
void ODERigidBody::AddTorque(const Vector3f& torque)
{
- dBodyAddTorque(mODEBody, torque.x(), torque.y(), torque.z());
+ dBodyAddTorque((dBodyID)mBodyID, torque.x(), torque.y(), torque.z());
}
void ODERigidBody::SetPosition(const Vector3f& pos)
{
- dBodySetPosition(mODEBody, pos.x(), pos.y(), pos.z());
+ dBodySetPosition((dBodyID)mBodyID, pos.x(), pos.y(), pos.z());
// the parent node will be updated in the next physics cycle
}
Vector3f ODERigidBody::GetPosition() const
{
- const dReal* pos = dBodyGetPosition(mODEBody);
+ const dReal* pos = dBodyGetPosition((dBodyID)mBodyID);
return Vector3f(pos[0], pos[1], pos[2]);
}
void ODERigidBody::TranslateMass(const Vector3f& v)
{
dMass m;
- dBodyGetMass(mODEBody, &m);
+ dBodyGetMass((dBodyID)mBodyID, &m);
dMassTranslate(&m,v[0],v[1],v[2]);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-11-30 08:31:04 UTC (rev 110)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-12-01 09:08:17 UTC (rev 111)
@@ -43,6 +43,7 @@
void SetMassParameters(const dMass& mass);
float GetMass() const;
void GetMassParameters(dMass& mass) const;
+ void AddMass(const dMass& mass, const salt::Matrix& matrix);
void SetSphere(float density, float radius);
void AddSphere(float density, float radius, const salt::Matrix& matrix);
void SetSphereTotal(float total_mass, float radius);
@@ -71,14 +72,13 @@
void SetPosition(const salt::Vector3f& pos);
salt::Vector3f GetPosition() const;
void DestroyPhysicsObject();
- void SynchronizeParent() const;
- void AddMass(const dMass& mass, const salt::Matrix& matrix);
+ salt::Matrix GetSynchronisationMatrix();
//salt::Vector3f GetMassCenter() const;
- boost::shared_ptr<RigidBody> GetBody(dBodyID id); //static in rigidbody.h
+ void BodySetData(RigidBody* rb);
+ RigidBody* BodyGetData(long bodyID);
protected:
- void OnLink();
- bool CreateBody();
+ void CreateBody(long world);
void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const;
void PrepareBox(dMass& mass, float density, const salt::Vector3f& size) const;
void PrepareSphere(dMass& mass, float density, float radius) const;
@@ -90,10 +90,8 @@
private:
void PrePhysicsUpdateInternal(float deltaTime);
- void PostPhysicsUpdateInternal();
protected:
- dBodyID mODEBody;
salt::Vector3f mMassTrans;
bool mMassTransformed;
};
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-12-01 09:08:17 UTC (rev 111)
@@ -41,59 +41,54 @@
dBodyID RigidBody::GetODEBody() const
{
- return mODEBody;
+ return (dBodyID) mRigidBodyImp->mBodyID;
}
void RigidBody::Enable()
{
- dBodyEnable(mODEBody);
+ mRigidBodyImp->Enable();
}
void RigidBody::Disable()
{
- dBodyDisable(mODEBody);
+ mRigidBodyImp->Disable();
}
bool RigidBody::IsEnabled() const
{
- return (dBodyIsEnabled(mODEBody) != 0);
+ return mRigidBodyImp->IsEnabled();
}
void RigidBody::UseGravity(bool f)
{
- if (f == true)
- {
- // body is affected by gravity
- dBodySetGravityMode(mODEBody, 1);
- }
- else
- {
- // body is not affected by gravity
- dBodySetGravityMode(mODEBody, 0);
- }
+ mRigidBodyImp->UseGravity(f);
}
bool RigidBody::UsesGravity() const
{
- return (dBodyGetGravityMode(mODEBody) != 0);
+ return mRigidBodyImp->UsesGravity();
}
bool RigidBody::CreateBody()
{
- if (mODEBody != 0)
+ long bodyID = mRigidBodyImp->mBodyID;
+
+ if (bodyID != 0)
{
return true;
}
- dWorldID world = GetWorldID();
+ long world = (long) GetWorldID();
if (world == 0)
{
return false;
}
-
- // create the managed body
- mODEBody = dBodyCreate(world);
- if (mODEBody == 0)
+
+ mRigidBodyImp->CreateBody(world);
+
+ mODEBody = (dBodyID) mRigidBodyImp->mBodyID;
+
+ if (mRigidBodyImp->mBodyID == 0)
{
GetLog()->Error()
<< "(Body) ERROR: could not create new ODE body\n";
@@ -105,13 +100,7 @@
void RigidBody::DestroyPhysicsObject()
{
- if (mODEBody == 0)
- {
- return;
- }
-
- dBodyDestroy(mODEBody);
- mODEBody = 0;
+ mRigidBodyImp->DestroyPhysicsObject();
}
void RigidBody::OnLink()
@@ -124,31 +113,31 @@
}
// let the body, take on the world space position of the parent
- dBodySetData(mODEBody, this);
+ mRigidBodyImp->BodySetData(this);
shared_ptr<BaseNode> baseNode = shared_static_cast<BaseNode>
(GetParent().lock());
const Matrix& mat = baseNode->GetWorldTransform();
- SetRotation(mat);
- SetPosition(mat.Pos());
+ mRigidBodyImp->SetRotation(mat);
+ mRigidBodyImp->SetPosition(mat.Pos());
}
void RigidBody::SetMass(float mass)
{
- dMass ODEMass;
- dBodyGetMass(mODEBody, &ODEMass);
- dMassAdjust(&ODEMass, mass);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetMass(mass);
}
float RigidBody::GetMass() const
{
- dMass m;
- dBodyGetMass(mODEBody, &m);
- return m.mass;
+ return mRigidBodyImp->GetMass();
}
+void RigidBody::AddMass(const dMass& mass, const Matrix& matrix)
+{
+ mRigidBodyImp->AddMass(mass, matrix);
+}
+
void RigidBody::GetMassParameters(dMass& mass) const
{
dBodyGetMass(mODEBody, &mass);
@@ -159,268 +148,122 @@
dBodySetMass(mODEBody, &mass);
}
-void RigidBody::PrepareSphere(dMass& mass, float density, float radius) const
-{
- dMassSetSphere(&mass, density, radius);
-}
-
void RigidBody::SetSphere(float density, float radius)
{
- dMass ODEMass;
- PrepareSphere(ODEMass, density, radius);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetSphere(density, radius);
}
void RigidBody::AddSphere(float density, float radius, const Matrix& matrix)
{
- dMass ODEMass;
- PrepareSphere(ODEMass, density, radius);
- AddMass(ODEMass, matrix);
+ mRigidBodyImp->AddSphere(density, radius, matrix);
}
-void RigidBody::PrepareSphereTotal(dMass& mass, float total_mass, float radius) const
-{
- dMassSetSphereTotal(&mass, total_mass, radius);
-}
-
void RigidBody::SetSphereTotal(float total_mass, float radius)
{
- dMass ODEMass;
- PrepareSphereTotal(ODEMass, total_mass, radius);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetSphereTotal(total_mass, radius);
}
void RigidBody::AddSphereTotal(float total_mass, float radius, const Matrix& matrix)
{
- dMass ODEMass;
- PrepareSphereTotal(ODEMass, total_mass, radius);
- AddMass(ODEMass, matrix);
+ mRigidBodyImp->AddSphereTotal(total_mass, radius, matrix);
}
-void RigidBody::PrepareBox(dMass& mass, float density, const Vector3f& size) const
-{
- dMassSetBox(&mass, density, size[0], size[1], size[2]);
-}
-
void RigidBody::SetBox(float density, const Vector3f& size)
{
- dMass ODEMass;
- PrepareBox(ODEMass, density, size);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetBox(density, size);
}
void RigidBody::AddBox(float density, const Vector3f& size, const Matrix& matrix)
{
- dMass ODEMass;
- PrepareBox(ODEMass, density, size);
- AddMass(ODEMass, matrix);
+ mRigidBodyImp->AddBox(density, size, matrix);
}
-void RigidBody::PrepareBoxTotal(dMass& mass, float total_mass, const Vector3f& size) const
-{
- dMassSetBoxTotal(&mass, total_mass, size[0], size[1], size[2]);
-}
-
void RigidBody::SetBoxTotal(float total_mass, const Vector3f& size)
{
- dMass ODEMass;
- PrepareBoxTotal(ODEMass, total_mass, size);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetBoxTotal(total_mass, size);
}
void RigidBody::AddBoxTotal(float total_mass, const Vector3f& size, const Matrix& matrix)
{
- dMass ODEMass;
- PrepareBoxTotal(ODEMass, total_mass, size);
- AddMass(ODEMass, matrix);
+ mRigidBodyImp->AddBoxTotal(total_mass, size, matrix);
}
-void RigidBody::AddMass(const dMass& mass, const Matrix& matrix)
-{
- dMass transMass(mass);
-
- dMatrix3 rot;
- ConvertRotationMatrix(matrix, rot);
- dMassRotate(&transMass,rot);
-
- const Vector3f& trans(matrix.Pos());
- dMassTranslate(&transMass,trans[0],trans[1],trans[2]);
-
- dMassTranslate(&transMass,mMassTrans[0],mMassTrans[1],mMassTrans[2]);
-
- dMass bodyMass;
- dBodyGetMass(mODEBody, &bodyMass);
- dMassAdd(&bodyMass, &transMass);
-
- /** ODE currently requires that the center mass is always in the
- origin of the body
- */
- Vector3f trans2(bodyMass.c[0], bodyMass.c[1], bodyMass.c[2]);
-
- dMassTranslate(&bodyMass, -trans2[0], -trans2[1], -trans2[2]);
- bodyMass.c[0] = bodyMass.c[1] = bodyMass.c[2] = 0.0f;
- dBodySetMass(mODEBody, (const dMass*)&bodyMass);
-
- // Move body so mass is at right position again
- SetPosition(GetPosition() + trans2);
-
- // Keep track of total translation of mass
- mMassTrans = mMassTrans - trans2;
-
- mMassTransformed = true;
-}
-
-void RigidBody::PrepareCylinder (dMass& mass, float density, float radius, float length) const
-{
- // direction: (1=x, 2=y, 3=z)
- int direction = 3;
-
- dMassSetCylinder (&mass, density, direction, radius, length);
-}
-
void RigidBody::SetCylinder (float density, float radius, float length)
{
- dMass ODEMass;
- PrepareCylinder(ODEMass, density, radius, length);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetCylinder(density, radius, length);
}
void RigidBody::AddCylinder (float density, float radius, float length, const Matrix& matrix)
{
- dMass ODEMass;
- PrepareCylinder(ODEMass, density, radius, length);
- AddMass(ODEMass, matrix);
+ mRigidBodyImp->AddCylinder(density, radius, length, matrix);
}
-void RigidBody::PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const
-{
- // direction: (1=x, 2=y, 3=z)
- int direction = 3;
-
- dMassSetCylinderTotal(&mass, total_mass, direction, radius, length);
-}
-
void RigidBody::SetCylinderTotal(float total_mass, float radius, float length)
{
- dMass ODEMass;
- PrepareCylinderTotal(ODEMass, total_mass, radius, length);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetCylinderTotal(total_mass, radius, length);
}
void RigidBody::AddCylinderTotal(float total_mass, float radius, float length, const Matrix& matrix)
{
- dMass ODEMass;
- PrepareCylinderTotal(ODEMass, total_mass, radius, length);
- AddMass(ODEMass, matrix);
+ mRigidBodyImp->AddCylinderTotal(total_mass, radius, length, matrix);
}
-void RigidBody::PrepareCappedCylinder (dMass& mass, float density, float radius, float length) const
-{
- // direction: (1=x, 2=y, 3=z)
- int direction = 3;
-
- dMassSetCapsule (&mass, density, direction, radius, length);
-}
-
void RigidBody::SetCappedCylinder (float density, float radius, float length)
{
- dMass ODEMass;
- PrepareCappedCylinder(ODEMass, density, radius, length);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetCapsule(density, radius, length);
}
void RigidBody::AddCappedCylinder (float density, float radius, float length, const Matrix& matrix)
{
- dMass ODEMass;
- PrepareCappedCylinder(ODEMass, density, radius, length);
- AddMass(ODEMass, matrix);
+ mRigidBodyImp->AddCapsule(density, radius, length, matrix);
}
-void RigidBody::PrepareCappedCylinderTotal(dMass& mass, float total_mass, float radius, float length) const
-{
- // direction: (1=x, 2=y, 3=z)
- int direction = 3;
-
- dMassSetCapsuleTotal(&mass, total_mass, direction, radius, length);
-}
-
void RigidBody::SetCappedCylinderTotal(float total_mass, float radius, float length)
{
- dMass ODEMass;
- PrepareCappedCylinderTotal(ODEMass, total_mass, radius, length);
- dBodySetMass(mODEBody, &ODEMass);
+ mRigidBodyImp->SetCapsuleTotal(total_mass, radius, length);
}
void RigidBody::AddCappedCylinderTotal(float total_mass, float radius, float length, const salt::Matrix& matrix)
{
- dMass ODEMass;
- PrepareCappedCylinderTotal(ODEMass, total_mass, radius, length);
- AddMass(ODEMass, matrix);
+ mRigidBodyImp->AddCapsuleTotal(total_mass, radius, length, matrix);
}
Vector3f RigidBody::GetVelocity() const
{
- const dReal* vel = dBodyGetLinearVel(mODEBody);
- return Vector3f(vel[0], vel[1], vel[2]);
+ return mRigidBodyImp->GetVelocity();
}
void RigidBody::SetVelocity(const Vector3f& vel)
{
- dBodySetLinearVel(mODEBody, vel[0], vel[1], vel[2]);
+ mRigidBodyImp->SetVelocity(vel);
}
void RigidBody::SetRotation(const Matrix& rot)
{
- dMatrix3 m;
- ConvertRotationMatrix(rot,m);
- dBodySetRotation(mODEBody,m);
+ mRigidBodyImp->SetRotation(rot);
}
salt::Matrix RigidBody::GetRotation() const
{
- const dReal* m = dBodyGetRotation(mODEBody);
- salt::Matrix rot;
- ConvertRotationMatrix(m,rot);
- return rot;
+ return mRigidBodyImp->GetRotation();
}
Vector3f RigidBody::GetAngularVelocity() const
{
- const dReal* vel = dBodyGetAngularVel(mODEBody);
- return Vector3f(vel[0], vel[1], vel[2]);
+ return mRigidBodyImp->GetAngularVelocity();
}
void RigidBody::SetAngularVelocity(const Vector3f& vel)
{
- dBodySetAngularVel(mODEBody, vel[0], vel[1], vel[2]);
+ mRigidBodyImp->SetAngularVelocity(vel);
}
void RigidBody::SynchronizeParent() const
{
- const dReal* pos = dBodyGetPosition(mODEBody);
- const dReal* rot = dBodyGetRotation(mODEBody);
-
shared_ptr<BaseNode> baseNode = shared_static_cast<BaseNode>
(GetParent().lock());
-
- Matrix mat;
- mat.m[0] = rot[0];
- mat.m[1] = rot[4];
- mat.m[2] = rot[8];
- mat.m[3] = 0;
- mat.m[4] = rot[1];
- mat.m[5] = rot[5];
- mat.m[6] = rot[9];
- mat.m[7] = 0;
- mat.m[8] = rot[2];
- mat.m[9] = rot[6];
- mat.m[10] = rot[10];
- mat.m[11] = 0;
- mat.m[12] = pos[0];
- mat.m[13] = pos[1];
- mat.m[14] = pos[2];
- mat.m[15] = 1;
+ Matrix mat = mRigidBodyImp->GetSynchronisationMatrix();
baseNode->SetWorldTransform(mat);
}
@@ -428,7 +271,7 @@
void RigidBody::PrePhysicsUpdateInternal(float /*deltaTime*/)
{
// Check whether mass/body has been translated
- if (mMassTransformed)
+ if (mRigidBodyImp->mMassTransformed)
{
weak_ptr<Node> parent = GetParent();
@@ -459,8 +302,8 @@
transform->SetWorldTransform(worldTransform);
}
- mMassTrans = Vector3f(0,0,0);
- mMassTransformed = false;
+ mRigidBodyImp->mMassTrans = Vector3f(0,0,0);
+ mRigidBodyImp->mMassTransformed = false;
}
}
@@ -472,18 +315,19 @@
shared_ptr<RigidBody> RigidBody::GetBody(dBodyID id)
{
- if (id == 0)
+ long bodyID = (long) id;
+ if (bodyID == 0)
{
return shared_ptr<RigidBody>();
}
RigidBody* bodyPtr =
- static_cast<RigidBody*>(dBodyGetData(id));
+ static_cast<RigidBody*>(dBodyGetData( (dBodyID) bodyID));
if (bodyPtr == 0)
{
// we cannot use the logserver here
- cerr << "ERROR: (RigidBody) no body found for dBodyID "
+ cerr << "ERROR: (RigidBody) no body found for BodyID "
<< id << "\n";
return shared_ptr<RigidBody>();
}
@@ -503,29 +347,25 @@
void RigidBody::AddForce(const Vector3f& force)
{
- dBodyAddForce(mODEBody, force.x(), force.y(), force.z());
+ mRigidBodyImp->AddForce(force);
}
void RigidBody::AddTorque(const Vector3f& torque)
{
- dBodyAddTorque(mODEBody, torque.x(), torque.y(), torque.z());
+ mRigidBodyImp->AddTorque(torque);
}
void RigidBody::SetPosition(const Vector3f& pos)
{
- dBodySetPosition(mODEBody, pos.x(), pos.y(), pos.z());
- // the parent node will be updated in the next physics cycle
+ mRigidBodyImp->SetPosition(pos);
}
Vector3f RigidBody::GetPosition() const
{
- const dReal* pos = dBodyGetPosition(mODEBody);
- return Vector3f(pos[0], pos[1], pos[2]);
+ return mRigidBodyImp->GetPosition();
}
void RigidBody::TranslateMass(const Vector3f& v)
{
- dMass m;
- dBodyGetMass(mODEBody, &m);
- dMassTranslate(&m,v[0],v[1],v[2]);
+ mRigidBodyImp->TranslateMass(v);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-11-30 08:31:04 UTC (rev 110)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-12-01 09:08:17 UTC (rev 111)
@@ -85,6 +85,11 @@
/** returns the ODE mass parameters of this body */
void GetMassParameters(dMass& mass) const;
+
+ /** adds the given ode mass to this body. The given matrix is
+ applied to the mass center
+ */
+ void AddMass(const dMass& mass, const salt::Matrix& matrix);
/** sets the mass parameters to represent a sphere of the given
radius and density, with the center of mass at (0,0,0)
@@ -235,11 +240,6 @@
*/
void SynchronizeParent() const;
- /** adds the given ode mass to this body. The given matrix is
- applied to the mass center
- */
- void AddMass(const dMass& mass, const salt::Matrix& matrix);
-
salt::Vector3f GetMassCenter() const;
protected:
@@ -251,60 +251,6 @@
/** create the managed ODE body; returns true on success */
bool CreateBody();
- /** sets up an ode mass struct representing a box of the given
- size and total_mass
- */
- void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const;
-
- /** sets up an ode mass struct representing a box of the given
- density and size
- */
- void PrepareBox(dMass& mass, float density, const salt::Vector3f& size) const;
-
- /** sets up an ode mass struct representing a sphere of the given
- density and radius
- */
- void PrepareSphere(dMass& mass, float density, float radius) const;
-
- /** sets up an ode mass struct representing a sphere of the given
- radius and total_mass
- */
- void PrepareSphereTotal(dMass& mass, float total_mass, float radius) const;
-
- /** sets up an ode mass struct representing a flat-ended cylinder
- of the given parameters and density, with the center of mass
- at (0,0,0) relative to the body. The radius of the cylinder is
- radius. The length of the cylinder is length. The cylinder's
- long axis is oriented along the body's z axis.
- */
- void PrepareCylinder (dMass& mass, float density, float radius, float length) const;
-
- /** sets up an ode mass struct representing a flat-ended cylinder
- of the given parameters and total mass, with the center of
- mass at (0,0,0) relative to the body. The radius of the
- cylinder is radius. The length of the cylinder is length. The
- cylinder's long axis is oriented along the body's z axis.
- */
- void PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const;
-
- /* sets up an ode mass struct representing a capped cylinder of
- the given parameters and density, with the center of mass at
- (0,0,0) relative to the body. The radius of the cylinder (and
- the spherical cap) is radius. The length of the cylinder (not
- 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;
-
- /* sets up an ode mass struct representing a capped cylinder of
- the given parameters and total mass, with the center of mass at
- (0,0,0) relative to the body. The radius of the cylinder (and
- the spherical cap) is radius. The length of the cylinder (not
- 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;
-
private:
/** updates internal state before physics calculation */
virtual void PrePhysicsUpdateInternal(float deltaTime);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-11-30 08:31:13
|
Revision: 110
http://simspark.svn.sourceforge.net/simspark/?rev=110&view=rev
Author: a-held
Date: 2009-11-30 08:31:04 +0000 (Mon, 30 Nov 2009)
Log Message:
-----------
provided bridge pattern for all non-implemented body classes
prepared bridge pattern for RigidBody class
Modified Paths:
--------------
branches/multiphys/spark/lib/oxygen/CMakeLists.txt
branches/multiphys/spark/lib/oxygen/physicsserver/body.h
branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/softbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.h
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/softbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.cpp
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-26 10:30:24 UTC (rev 109)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-30 08:31:04 UTC (rev 110)
@@ -54,15 +54,25 @@
physicsserver/angularmotor.h
#interfaces
+ physicsserver/int/bodyint.h
+ physicsserver/int/dynamicbodyint.h
physicsserver/int/physicsobjectint.h
physicsserver/int/physicsserverint.h
+ physicsserver/int/rigidbodyint.h
+ physicsserver/int/softbodyint.h
physicsserver/int/spaceint.h
+ physicsserver/int/staticbodyint.h
physicsserver/int/worldint.h
#ode-specific files
+ physicsserver/ode/odebody.h
+ physicsserver/ode/odedynamicbody.h
physicsserver/ode/odephysicsobject.h
physicsserver/ode/odephysicsserver.h
+ physicsserver/ode/oderigidbody.h
+ physicsserver/ode/odesoftbody.h
physicsserver/ode/odespace.h
+ physicsserver/ode/odestaticbody.h
physicsserver/ode/odeworld.h
physicsserver/ode/odewrapper.h
@@ -127,11 +137,15 @@
oxygen.cpp
physicsserver/physicsobject.cpp
physicsserver/physicsobject_c.cpp
+ physicsserver/body.cpp
physicsserver/body_c.cpp
physicsserver/rigidbody.cpp
physicsserver/rigidbody_c.cpp
+ physicsserver/staticbody.cpp
physicsserver/staticbody_c.cpp
+ physicsserver/dynamicbody.cpp
physicsserver/dynamicbody_c.cpp
+ physicsserver/softbody.cpp
physicsserver/softbody_c.cpp
physicsserver/bodycontroller.cpp
physicsserver/bodycontroller_c.cpp
@@ -191,9 +205,14 @@
physicsserver/angularmotor_c.cpp
#ODE-specific files
+ physicsserver/ode/odebody.cpp
+ physicsserver/ode/odedynamicbody.cpp
physicsserver/ode/odephysicsobject.cpp
physicsserver/ode/odephysicsserver.cpp
+ physicsserver/ode/oderigidbody.cpp
+ physicsserver/ode/odesoftbody.cpp
physicsserver/ode/odespace.cpp
+ physicsserver/ode/odestaticbody.cpp
physicsserver/ode/odeworld.cpp
sceneserver/basenode.cpp
Added: branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,33 @@
+/* -*- 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: body.h 108 2009-11-25 10:20:10Z a-held $
+
+ 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/body.h>
+#include <oxygen/physicsserver/ode/odebody.h>
+
+using namespace oxygen;
+
+Body::Body() : PhysicsObject(){
+ mBodyImp = boost::shared_ptr<ODEBody>(new ODEBody());
+}
+
+Body::~Body(){
+
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-26 10:30:24 UTC (rev 109)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -26,6 +26,8 @@
namespace oxygen
{
+class BodyInt;
+
/** This is currently a placeholder class to comply with the
inheritance tree. Once a Body class other than RigidBody has
been implemented, common functionality should be moved to this
@@ -35,8 +37,10 @@
class OXYGEN_API Body : public PhysicsObject
{
public:
- Body() : PhysicsObject(){};
- virtual ~Body (){};
+ Body();
+ virtual ~Body();
+
+ boost::shared_ptr<BodyInt> mBodyImp;
};
DECLARE_CLASS(Body);
Added: branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,33 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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/dynamicbody.h>
+#include <oxygen/physicsserver/ode/odedynamicbody.h>
+
+using namespace oxygen;
+
+DynamicBody::DynamicBody() : Body(){
+ mDynamicBodyImp = boost::shared_ptr<ODEDynamicBody>(new ODEDynamicBody());
+}
+
+DynamicBody::~DynamicBody(){
+
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.h 2009-11-26 10:30:24 UTC (rev 109)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -27,6 +27,7 @@
namespace oxygen
{
+class DynamicBodyInt;
/**
DynamicBody is not yet implemented.
*/
@@ -37,8 +38,10 @@
// Functions
//
public:
- DynamicBody() : Body(){};
- virtual ~DynamicBody(){};
+ DynamicBody();
+ virtual ~DynamicBody();
+
+ boost::shared_ptr<DynamicBodyInt> mDynamicBodyImp;
};
DECLARE_CLASS(DynamicBody);
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/bodyint.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,42 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_BODYINT_H
+#define OXYGEN_BODYINT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odephysicsobject.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API BodyInt : public ODEPhysicsObject
+{
+
+public:
+ BodyInt() : ODEPhysicsObject(){};
+ virtual ~BodyInt(){};
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_BODYINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/dynamicbodyint.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,42 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_DYNAMICBODYINT_H
+#define OXYGEN_DYNAMICBODYINT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odebody.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API DynamicBodyInt : public ODEBody
+{
+
+public:
+ DynamicBodyInt() : ODEBody(){};
+ virtual ~DynamicBodyInt(){};
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_DYNAMICBODYINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,105 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_RIGIDBODYINT_H
+#define OXYGEN_RIGIDBODYINT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odebody.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API RigidBodyInt : public ODEBody
+{
+
+public:
+ RigidBodyInt() : ODEBody(){};
+ virtual ~RigidBodyInt(){};
+
+ virtual dBodyID GetODEBody() const = 0;
+ virtual void Enable() = 0;
+ virtual void Disable() = 0;
+ virtual bool IsEnabled() const = 0;
+ virtual void UseGravity(bool f) = 0;
+ virtual bool UsesGravity() const = 0;
+ virtual void SetMass(float mass) = 0;
+ virtual void SetMassParameters(const dMass& mass) = 0;
+ virtual float GetMass() const = 0;
+ virtual void GetMassParameters(dMass& mass) const = 0;
+ virtual void SetSphere(float density, float radius) = 0;
+ virtual void AddSphere(float density, float radius, const salt::Matrix& matrix) = 0;
+ virtual void SetSphereTotal(float total_mass, float radius) = 0;
+ virtual void AddSphereTotal(float total_mass, float radius, const salt::Matrix& matrix) = 0;
+ virtual void SetBox(float density, const salt::Vector3f& size) = 0;
+ virtual void AddBox(float density, const salt::Vector3f& size, const salt::Matrix& matrix) = 0;
+ virtual void SetBoxTotal(float total_mass, const salt::Vector3f& size) = 0;
+ virtual void AddBoxTotal(float total_mass, const salt::Vector3f& size, const salt::Matrix& matrix) = 0;
+ virtual void SetCylinder(float density, float radius, float length) = 0;
+ virtual void AddCylinder(float density, float radius, float length, const salt::Matrix& matrix) = 0;
+ virtual void SetCylinderTotal(float total_mass, float radius, float length) = 0;
+ virtual void AddCylinderTotal(float total_mass, float radius, float length, const salt::Matrix& matrix) = 0;
+ virtual void SetCapsule(float density, float radius, float length) = 0;
+ virtual void AddCapsule(float density, float radius, float length, const salt::Matrix& matrix) = 0;
+ virtual void SetCapsuleTotal(float total_mass, float radius, float length) = 0;
+ virtual void AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix) = 0;
+ virtual void TranslateMass(const salt::Vector3f& v) = 0;
+ virtual salt::Vector3f GetVelocity() const = 0;
+ virtual void SetVelocity(const salt::Vector3f& vel) = 0;
+ virtual void SetRotation(const salt::Matrix& rot) = 0;
+ virtual salt::Matrix GetRotation() const = 0;
+ virtual salt::Vector3f GetAngularVelocity() const = 0;
+ virtual void SetAngularVelocity(const salt::Vector3f& vel) = 0;
+ virtual void AddForce(const salt::Vector3f& force) = 0;
+ virtual void AddTorque(const salt::Vector3f& torque) = 0;
+ virtual void SetPosition(const salt::Vector3f& pos) = 0;
+ virtual salt::Vector3f GetPosition() const = 0;
+ virtual void DestroyPhysicsObject() = 0;
+ virtual void SynchronizeParent() const = 0;
+ virtual void AddMass(const dMass& mass, const salt::Matrix& matrix) = 0;
+ //virtual salt::Vector3f GetMassCenter() const = 0;
+
+protected:
+ virtual void OnLink() = 0;
+ virtual bool CreateBody() = 0;
+ virtual void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const = 0;
+ virtual void PrepareBox(dMass& mass, float density, const salt::Vector3f& size) const = 0;
+ virtual void PrepareSphere(dMass& mass, float density, float radius) const = 0;
+ virtual void PrepareSphereTotal(dMass& mass, float total_mass, float radius) const = 0;
+ virtual void PrepareCylinder(dMass& mass, float density, float radius, float length) const = 0;
+ virtual void PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const = 0;
+ virtual void PrepareCapsule(dMass& mass, float density, float radius, float length) const = 0;
+ virtual void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const = 0;
+
+private:
+ virtual void PrePhysicsUpdateInternal(float deltaTime) = 0;
+ virtual void PostPhysicsUpdateInternal() = 0;
+
+protected:
+ dBodyID mODEBody;
+ salt::Vector3f mMassTrans;
+ bool mMassTransformed;
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_RIGIDBODYINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/softbodyint.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,42 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_SOFTBODYINT_H
+#define OXYGEN_SOFTBODYINT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odebody.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API SoftBodyInt : public ODEBody
+{
+
+public:
+ SoftBodyInt() : ODEBody(){};
+ virtual ~SoftBodyInt(){};
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_SOFTBODYINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/staticbodyint.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,42 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_STATICBODYINT_H
+#define OXYGEN_STATICBODYINT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odebody.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API StaticBodyInt : public ODEBody
+{
+
+public:
+ StaticBodyInt() : ODEBody(){};
+ virtual ~StaticBodyInt(){};
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_STATICBODYINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,32 @@
+/* -*- 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.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/ode/odebody.h>
+
+using namespace oxygen;
+
+ODEBody::ODEBody() : BodyInt(){
+
+}
+
+ODEBody::~ODEBody(){
+
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odebody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,39 @@
+/* -*- 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.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.
+*/
+#ifndef OXYGEN_ODEBODY_H
+#define OXYGEN_ODEBODY_H
+
+#include <oxygen/physicsserver/int/bodyint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODEBody : public BodyInt
+{
+public:
+ ODEBody();
+ virtual ~ODEBody();
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEBODY_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,32 @@
+/* -*- 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.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/ode/odedynamicbody.h>
+
+using namespace oxygen;
+
+ODEDynamicBody::ODEDynamicBody() : DynamicBodyInt(){
+
+}
+
+ODEDynamicBody::~ODEDynamicBody(){
+
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odedynamicbody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,39 @@
+/* -*- 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.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.
+*/
+#ifndef OXYGEN_ODEDYNAMICBODY_H
+#define OXYGEN_ODEDYNAMICBODY_H
+
+#include <oxygen/physicsserver/int/dynamicbodyint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODEDynamicBody : public DynamicBodyInt
+{
+public:
+ ODEDynamicBody();
+ virtual ~ODEDynamicBody();
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEDYNAMICBODY_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,532 @@
+/* -*- 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.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/rigidbody.h>
+#include <oxygen/physicsserver/transformcollider.h>
+#include <oxygen/physicsserver/world.h>
+#include <oxygen/physicsserver/ode/oderigidbody.h>
+#include <oxygen/sceneserver/scene.h>
+#include <oxygen/sceneserver/transform.h>
+#include <zeitgeist/logserver/logserver.h>
+
+using namespace oxygen;
+using namespace boost;
+using namespace salt;
+using namespace std;
+
+ODERigidBody::ODERigidBody() : RigidBodyInt(){
+
+}
+
+ODERigidBody::~ODERigidBody(){
+
+}
+
+dBodyID ODERigidBody::GetODEBody() const
+{
+ return mODEBody;
+}
+
+void ODERigidBody::Enable()
+{
+ dBodyEnable(mODEBody);
+}
+
+void ODERigidBody::Disable()
+{
+ dBodyDisable(mODEBody);
+}
+
+bool ODERigidBody::IsEnabled() const
+{
+ return (dBodyIsEnabled(mODEBody) != 0);
+}
+
+void ODERigidBody::UseGravity(bool f)
+{
+ if (f == true)
+ {
+ // body is affected by gravity
+ dBodySetGravityMode(mODEBody, 1);
+ }
+ else
+ {
+ // body is not affected by gravity
+ dBodySetGravityMode(mODEBody, 0);
+ }
+}
+
+bool ODERigidBody::UsesGravity() const
+{
+ return (dBodyGetGravityMode(mODEBody) != 0);
+}
+
+bool ODERigidBody::CreateBody()
+{
+ if (mODEBody != 0)
+ {
+ return true;
+ }
+
+ dWorldID world = GetWorldID();
+ if (world == 0)
+ {
+ return false;
+ }
+
+ // create the managed body
+ mODEBody = dBodyCreate(world);
+ if (mODEBody == 0)
+ {
+ GetLog()->Error()
+ << "(Body) ERROR: could not create new ODE body\n";
+ return false;
+ }
+
+ return true;
+}
+
+void ODERigidBody::DestroyPhysicsObject()
+{
+ if (mODEBody == 0)
+ {
+ return;
+ }
+
+ dBodyDestroy(mODEBody);
+ mODEBody = 0;
+}
+
+void ODERigidBody::OnLink()
+{
+ ODEPhysicsObject::OnLink();
+
+ if (! CreateBody())
+ {
+ return;
+ }
+
+ // let the body, take on the world space position of the parent
+ dBodySetData(mODEBody, this);
+
+ shared_ptr<BaseNode> baseNode = shared_static_cast<BaseNode>
+ (GetParent().lock());
+
+ const Matrix& mat = baseNode->GetWorldTransform();
+ SetRotation(mat);
+ SetPosition(mat.Pos());
+}
+
+void ODERigidBody::SetMass(float mass)
+{
+ dMass ODEMass;
+ dBodyGetMass(mODEBody, &ODEMass);
+ dMassAdjust(&ODEMass, mass);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+float ODERigidBody::GetMass() const
+{
+ dMass m;
+ dBodyGetMass(mODEBody, &m);
+ return m.mass;
+}
+
+void ODERigidBody::GetMassParameters(dMass& mass) const
+{
+ dBodyGetMass(mODEBody, &mass);
+}
+
+void ODERigidBody::SetMassParameters(const dMass& mass)
+{
+ dBodySetMass(mODEBody, &mass);
+}
+
+void ODERigidBody::PrepareSphere(dMass& mass, float density, float radius) const
+{
+ dMassSetSphere(&mass, density, radius);
+}
+
+void ODERigidBody::SetSphere(float density, float radius)
+{
+ dMass ODEMass;
+ PrepareSphere(ODEMass, density, radius);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+void ODERigidBody::AddSphere(float density, float radius, const Matrix& matrix)
+{
+ dMass ODEMass;
+ PrepareSphere(ODEMass, density, radius);
+ AddMass(ODEMass, matrix);
+}
+
+void ODERigidBody::PrepareSphereTotal(dMass& mass, float total_mass, float radius) const
+{
+ dMassSetSphereTotal(&mass, total_mass, radius);
+}
+
+void ODERigidBody::SetSphereTotal(float total_mass, float radius)
+{
+ dMass ODEMass;
+ PrepareSphereTotal(ODEMass, total_mass, radius);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+void ODERigidBody::AddSphereTotal(float total_mass, float radius, const Matrix& matrix)
+{
+ dMass ODEMass;
+ PrepareSphereTotal(ODEMass, total_mass, radius);
+ AddMass(ODEMass, matrix);
+}
+
+void ODERigidBody::PrepareBox(dMass& mass, float density, const Vector3f& size) const
+{
+ dMassSetBox(&mass, density, size[0], size[1], size[2]);
+}
+
+void ODERigidBody::SetBox(float density, const Vector3f& size)
+{
+ dMass ODEMass;
+ PrepareBox(ODEMass, density, size);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+void ODERigidBody::AddBox(float density, const Vector3f& size, const Matrix& matrix)
+{
+ dMass ODEMass;
+ PrepareBox(ODEMass, density, size);
+ AddMass(ODEMass, matrix);
+}
+
+void ODERigidBody::PrepareBoxTotal(dMass& mass, float total_mass, const Vector3f& size) const
+{
+ dMassSetBoxTotal(&mass, total_mass, size[0], size[1], size[2]);
+}
+
+void ODERigidBody::SetBoxTotal(float total_mass, const Vector3f& size)
+{
+ dMass ODEMass;
+ PrepareBoxTotal(ODEMass, total_mass, size);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+void ODERigidBody::AddBoxTotal(float total_mass, const Vector3f& size, const Matrix& matrix)
+{
+ dMass ODEMass;
+ PrepareBoxTotal(ODEMass, total_mass, size);
+ AddMass(ODEMass, matrix);
+}
+
+void ODERigidBody::AddMass(const dMass& mass, const Matrix& matrix)
+{
+ dMass transMass(mass);
+
+ dMatrix3 rot;
+ ConvertRotationMatrix(matrix, rot);
+ dMassRotate(&transMass,rot);
+
+ const Vector3f& trans(matrix.Pos());
+ dMassTranslate(&transMass,trans[0],trans[1],trans[2]);
+
+ dMassTranslate(&transMass,mMassTrans[0],mMassTrans[1],mMassTrans[2]);
+
+ dMass bodyMass;
+ dBodyGetMass(mODEBody, &bodyMass);
+ dMassAdd(&bodyMass, &transMass);
+
+ /** ODE currently requires that the center mass is always in the
+ origin of the body
+ */
+ Vector3f trans2(bodyMass.c[0], bodyMass.c[1], bodyMass.c[2]);
+
+ dMassTranslate(&bodyMass, -trans2[0], -trans2[1], -trans2[2]);
+ bodyMass.c[0] = bodyMass.c[1] = bodyMass.c[2] = 0.0f;
+ dBodySetMass(mODEBody, (const dMass*)&bodyMass);
+
+ // Move body so mass is at right position again
+ SetPosition(GetPosition() + trans2);
+
+ // Keep track of total translation of mass
+ mMassTrans = mMassTrans - trans2;
+
+ mMassTransformed = true;
+}
+
+void ODERigidBody::PrepareCylinder (dMass& mass, float density, float radius, float length) const
+{
+ // direction: (1=x, 2=y, 3=z)
+ int direction = 3;
+
+ dMassSetCylinder (&mass, density, direction, radius, length);
+}
+
+void ODERigidBody::SetCylinder (float density, float radius, float length)
+{
+ dMass ODEMass;
+ PrepareCylinder(ODEMass, density, radius, length);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+void ODERigidBody::AddCylinder (float density, float radius, float length, const Matrix& matrix)
+{
+ dMass ODEMass;
+ PrepareCylinder(ODEMass, density, radius, length);
+ AddMass(ODEMass, matrix);
+}
+
+void ODERigidBody::PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const
+{
+ // direction: (1=x, 2=y, 3=z)
+ int direction = 3;
+
+ dMassSetCylinderTotal(&mass, total_mass, direction, radius, length);
+}
+
+void ODERigidBody::SetCylinderTotal(float total_mass, float radius, float length)
+{
+ dMass ODEMass;
+ PrepareCylinderTotal(ODEMass, total_mass, radius, length);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+void ODERigidBody::AddCylinderTotal(float total_mass, float radius, float length, const Matrix& matrix)
+{
+ dMass ODEMass;
+ PrepareCylinderTotal(ODEMass, total_mass, radius, length);
+ AddMass(ODEMass, matrix);
+}
+
+void ODERigidBody::PrepareCapsule (dMass& mass, float density, float radius, float length) const
+{
+ // direction: (1=x, 2=y, 3=z)
+ int direction = 3;
+
+ dMassSetCapsule (&mass, density, direction, radius, length);
+}
+
+void ODERigidBody::SetCapsule (float density, float radius, float length)
+{
+ dMass ODEMass;
+ PrepareCapsule(ODEMass, density, radius, length);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+void ODERigidBody::AddCapsule (float density, float radius, float length, const Matrix& matrix)
+{
+ dMass ODEMass;
+ PrepareCapsule(ODEMass, density, radius, length);
+ AddMass(ODEMass, matrix);
+}
+
+void ODERigidBody::PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const
+{
+ // direction: (1=x, 2=y, 3=z)
+ int direction = 3;
+
+ dMassSetCapsuleTotal(&mass, total_mass, direction, radius, length);
+}
+
+void ODERigidBody::SetCapsuleTotal(float total_mass, float radius, float length)
+{
+ dMass ODEMass;
+ PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
+ dBodySetMass(mODEBody, &ODEMass);
+}
+
+void ODERigidBody::AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix)
+{
+ dMass ODEMass;
+ PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
+ AddMass(ODEMass, matrix);
+}
+
+Vector3f ODERigidBody::GetVelocity() const
+{
+ const dReal* vel = dBodyGetLinearVel(mODEBody);
+ return Vector3f(vel[0], vel[1], vel[2]);
+}
+
+void ODERigidBody::SetVelocity(const Vector3f& vel)
+{
+ dBodySetLinearVel(mODEBody, vel[0], vel[1], vel[2]);
+}
+
+void ODERigidBody::SetRotation(const Matrix& rot)
+{
+ dMatrix3 m;
+ ConvertRotationMatrix(rot,m);
+ dBodySetRotation(mODEBody,m);
+}
+
+salt::Matrix ODERigidBody::GetRotation() const
+{
+ const dReal* m = dBodyGetRotation(mODEBody);
+ salt::Matrix rot;
+ ConvertRotationMatrix(m,rot);
+ return rot;
+}
+
+Vector3f ODERigidBody::GetAngularVelocity() const
+{
+ const dReal* vel = dBodyGetAngularVel(mODEBody);
+ return Vector3f(vel[0], vel[1], vel[2]);
+}
+
+void ODERigidBody::SetAngularVelocity(const Vector3f& vel)
+{
+ dBodySetAngularVel(mODEBody, vel[0], vel[1], vel[2]);
+}
+
+void ODERigidBody::SynchronizeParent() const
+{
+ const dReal* pos = dBodyGetPosition(mODEBody);
+ const dReal* rot = dBodyGetRotation(mODEBody);
+
+ shared_ptr<BaseNode> baseNode = shared_static_cast<BaseNode>
+ (GetParent().lock());
+
+
+ Matrix mat;
+ mat.m[0] = rot[0];
+ mat.m[1] = rot[4];
+ mat.m[2] = rot[8];
+ mat.m[3] = 0;
+ mat.m[4] = rot[1];
+ mat.m[5] = rot[5];
+ mat.m[6] = rot[9];
+ mat.m[7] = 0;
+ mat.m[8] = rot[2];
+ mat.m[9] = rot[6];
+ mat.m[10] = rot[10];
+ mat.m[11] = 0;
+ mat.m[12] = pos[0];
+ mat.m[13] = pos[1];
+ mat.m[14] = pos[2];
+ mat.m[15] = 1;
+
+ baseNode->SetWorldTransform(mat);
+}
+
+void ODERigidBody::PrePhysicsUpdateInternal(float /*deltaTime*/)
+{
+ // Check whether mass/body has been translated
+ if (mMassTransformed)
+ {
+ weak_ptr<Node> parent = GetParent();
+
+ // Update colliders (only those encapsulated in transform colliders)
+ TLeafList transformColliders;
+ parent.lock()->ListChildrenSupportingClass<TransformCollider>(transformColliders);
+
+ for (TLeafList::iterator iter = transformColliders.begin(); iter != transformColliders.end(); ++iter)
+ {
+ // Only move non-transform colliders
+ shared_ptr<Collider> collider = shared_static_cast<TransformCollider>(*iter)->FindChildSupportingClass<Collider>();
+ if (collider.get())
+ {
+ Vector3f pos = collider->GetPosition();
+ pos = pos + mMassTrans;
+ collider->SetLocalPosition(pos);
+ }
+ }
+
+ // Update visuals (or other transforms in the tree)
+ TLeafList transforms;
+ parent.lock()->ListShallowChildrenSupportingClass<Transform>(transforms);
+ for (TLeafList::iterator iter = transforms.begin(); iter != transforms.end(); ++iter)
+ {
+ shared_ptr<Transform> transform = shared_dynamic_cast<Transform>(*iter);
+ Matrix worldTransform = transform->GetWorldTransform();
+ worldTransform.Pos() = worldTransform.Pos() + mMassTrans;
+ transform->SetWorldTransform(worldTransform);
+ }
+
+ mMassTrans = Vector3f(0,0,0);
+ mMassTransformed = false;
+ }
+}
+
+
+void ODERigidBody::PostPhysicsUpdateInternal()
+{
+ SynchronizeParent();
+}
+
+shared_ptr<RigidBody> ODERigidBody::GetBody(dBodyID id)
+{
+ if (id == 0)
+ {
+ return shared_ptr<RigidBody>();
+ }
+
+ RigidBody* bodyPtr =
+ static_cast<RigidBody*>(dBodyGetData(id));
+
+ if (bodyPtr == 0)
+ {
+ // we cannot use the logserver here
+ cerr << "ERROR: (ODERigidBody) no body found for dBodyID "
+ << id << "\n";
+ return shared_ptr<RigidBody>();
+ }
+
+ shared_ptr<RigidBody> body = shared_static_cast<RigidBody>
+ (bodyPtr->GetSelf().lock());
+
+ if (body.get() == 0)
+ {
+ // we cannot use the logserver here
+ cerr << "ERROR: (ODERigidBody) got no shared_ptr for dBodyID "
+ << id << "\n";
+ }
+
+ return body;
+}
+
+void ODERigidBody::AddForce(const Vector3f& force)
+{
+ dBodyAddForce(mODEBody, force.x(), force.y(), force.z());
+}
+
+void ODERigidBody::AddTorque(const Vector3f& torque)
+{
+ dBodyAddTorque(mODEBody, torque.x(), torque.y(), torque.z());
+}
+
+void ODERigidBody::SetPosition(const Vector3f& pos)
+{
+ dBodySetPosition(mODEBody, pos.x(), pos.y(), pos.z());
+ // the parent node will be updated in the next physics cycle
+}
+
+Vector3f ODERigidBody::GetPosition() const
+{
+ const dReal* pos = dBodyGetPosition(mODEBody);
+ return Vector3f(pos[0], pos[1], pos[2]);
+}
+
+void ODERigidBody::TranslateMass(const Vector3f& v)
+{
+ dMass m;
+ dBodyGetMass(mODEBody, &m);
+ dMassTranslate(&m,v[0],v[1],v[2]);
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,103 @@
+/* -*- 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.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.
+*/
+#ifndef OXYGEN_ODERIGIDBODY_H
+#define OXYGEN_ODERIGIDBODY_H
+
+#include <oxygen/physicsserver/int/rigidbodyint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODERigidBody : public RigidBodyInt
+{
+public:
+ ODERigidBody();
+ virtual ~ODERigidBody();
+
+ dBodyID GetODEBody() const;
+ void Enable();
+ void Disable();
+ bool IsEnabled() const;
+ void UseGravity(bool f);
+ bool UsesGravity() const;
+ void SetMass(float mass);
+ void SetMassParameters(const dMass& mass);
+ float GetMass() const;
+ void GetMassParameters(dMass& mass) const;
+ void SetSphere(float density, float radius);
+ void AddSphere(float density, float radius, const salt::Matrix& matrix);
+ void SetSphereTotal(float total_mass, float radius);
+ void AddSphereTotal(float total_mass, float radius, const salt::Matrix& matrix);
+ void SetBox(float density, const salt::Vector3f& size);
+ void AddBox(float density, const salt::Vector3f& size, const salt::Matrix& matrix);
+ void SetBoxTotal(float total_mass, const salt::Vector3f& size);
+ void AddBoxTotal(float total_mass, const salt::Vector3f& size, const salt::Matrix& matrix);
+ void SetCylinder(float density, float radius, float length);
+ void AddCylinder(float density, float radius, float length, const salt::Matrix& matrix);
+ void SetCylinderTotal(float total_mass, float radius, float length);
+ void AddCylinderTotal(float total_mass, float radius, float length, const salt::Matrix& matrix);
+ void SetCapsule(float density, float radius, float length);
+ void AddCapsule(float density, float radius, float length, const salt::Matrix& matrix);
+ void SetCapsuleTotal(float total_mass, float radius, float length);
+ void AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix);
+ void TranslateMass(const salt::Vector3f& v);
+ salt::Vector3f GetVelocity() const;
+ void SetVelocity(const salt::Vector3f& vel);
+ void SetRotation(const salt::Matrix& rot);
+ salt::Matrix GetRotation() const;
+ salt::Vector3f GetAngularVelocity() const;
+ void SetAngularVelocity(const salt::Vector3f& vel);
+ void AddForce(const salt::Vector3f& force);
+ void AddTorque(const salt::Vector3f& torque);
+ void SetPosition(const salt::Vector3f& pos);
+ salt::Vector3f GetPosition() const;
+ void DestroyPhysicsObject();
+ void SynchronizeParent() const;
+ void AddMass(const dMass& mass, const salt::Matrix& matrix);
+ //salt::Vector3f GetMassCenter() const;
+ boost::shared_ptr<RigidBody> GetBody(dBodyID id); //static in rigidbody.h
+
+protected:
+ void OnLink();
+ bool CreateBody();
+ void PrepareBoxTotal(dMass& mass, float total_mass, const salt::Vector3f& size) const;
+ void PrepareBox(dMass& mass, float density, const salt::Vector3f& size) const;
+ void PrepareSphere(dMass& mass, float density, float radius) const;
+ void PrepareSphereTotal(dMass& mass, float total_mass, float radius) const;
+ void PrepareCylinder(dMass& mass, float density, float radius, float length) const;
+ void PrepareCylinderTotal(dMass& mass, float total_mass, float radius, float length) const;
+ void PrepareCapsule(dMass& mass, float density, float radius, float length) const;
+ void PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const;
+
+private:
+ void PrePhysicsUpdateInternal(float deltaTime);
+ void PostPhysicsUpdateInternal();
+
+protected:
+ dBodyID mODEBody;
+ salt::Vector3f mMassTrans;
+ bool mMassTransformed;
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODERIGIDBODY_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,32 @@
+/* -*- 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.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/ode/odesoftbody.h>
+
+using namespace oxygen;
+
+ODESoftBody::ODESoftBody() : SoftBodyInt(){
+
+}
+
+ODESoftBody::~ODESoftBody(){
+
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odesoftbody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,39 @@
+/* -*- 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.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.
+*/
+#ifndef OXYGEN_ODESOFTBODY_H
+#define OXYGEN_ODESOFTBODY_H
+
+#include <oxygen/physicsserver/int/softbodyint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODESoftBody : public SoftBodyInt
+{
+public:
+ ODESoftBody();
+ virtual ~ODESoftBody();
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODESOFTBODY_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,32 @@
+/* -*- 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.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/ode/odestaticbody.h>
+
+using namespace oxygen;
+
+ODEStaticBody::ODEStaticBody() : StaticBodyInt(){
+
+}
+
+ODEStaticBody::~ODEStaticBody(){
+
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odestaticbody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,39 @@
+/* -*- 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.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.
+*/
+#ifndef OXYGEN_ODESTATICBODY_H
+#define OXYGEN_ODESTATICBODY_H
+
+#include <oxygen/physicsserver/int/staticbodyint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODEStaticBody : public StaticBodyInt
+{
+public:
+ ODEStaticBody();
+ virtual ~ODEStaticBody();
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODESTATICBODY_H
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-11-26 10:30:24 UTC (rev 109)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -17,13 +17,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/physicsserver/transformcollider.h>
#include <oxygen/physicsserver/world.h>
+#include <oxygen/physicsserver/ode/oderigidbody.h>
#include <oxygen/sceneserver/scene.h>
-#include "zeitgeist/logserver/logserver.h"
#include <oxygen/sceneserver/transform.h>
+#include <zeitgeist/logserver/logserver.h>
using namespace boost;
using namespace oxygen;
@@ -32,6 +32,7 @@
RigidBody::RigidBody() : Body(), mODEBody(0), mMassTrans(0,0,0), mMassTransformed(false)
{
+ mRigidBodyImp = boost::shared_ptr<ODERigidBody>(new ODERigidBody());
}
RigidBody::~RigidBody()
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-11-26 10:30:24 UTC (rev 109)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -28,6 +28,7 @@
namespace oxygen
{
class World;
+class RigidBodyInt;
/** Body encapsulates an ODE rigid body object. A rigid body has
various properties from the point of view of the simulation. Some
@@ -318,6 +319,8 @@
// Members
//
protected:
+ boost::shared_ptr<RigidBodyInt> mRigidBodyImp;
+
/** the managed ode body */
dBodyID mODEBody;
Added: branches/multiphys/spark/lib/oxygen/physicsserver/softbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/softbody.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/softbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,33 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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/softbody.h>
+#include <oxygen/physicsserver/ode/odesoftbody.h>
+
+using namespace oxygen;
+
+SoftBody::SoftBody() : Body(){
+ mSoftBodyImp = boost::shared_ptr<ODESoftBody>(new ODESoftBody());
+}
+
+SoftBody::~SoftBody(){
+
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/softbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/softbody.h 2009-11-26 10:30:24 UTC (rev 109)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/softbody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -27,6 +27,7 @@
namespace oxygen
{
+class SoftBodyInt;
/**
SoftBody is not yet implemented.
*/
@@ -37,8 +38,10 @@
// Functions
//
public:
- SoftBody() : Body(){};
- virtual ~SoftBody(){};
+ SoftBody();
+ virtual ~SoftBody();
+
+ boost::shared_ptr<SoftBodyInt> mSoftBodyImp;
};
DECLARE_CLASS(SoftBody);
Added: branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.cpp 2009-11-30 08:31:04 UTC (rev 110)
@@ -0,0 +1,33 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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/staticbody.h>
+#include <oxygen/physicsserver/ode/odestaticbody.h>
+
+using namespace oxygen;
+
+StaticBody::StaticBody() : Body(){
+ mStaticBodyImp = boost::shared_ptr<ODEStaticBody>(new ODEStaticBody());
+}
+
+StaticBody::~StaticBody(){
+
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.h 2009-11-26 10:30:24 UTC (rev 109)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.h 2009-11-30 08:31:04 UTC (rev 110)
@@ -27,6 +27,7 @@
namespace oxygen
{
+class StaticBodyInt;
/**
StaticBody is not yet implemented.
*/
@@ -37,8 +38,10 @@
// Functions
//
public:
- StaticBody() : Body(){};
- virtual ~StaticBody(){};
+ StaticBody();
+ virtual ~StaticBody();
+
+ boost::shared_ptr<StaticBodyInt> mStaticBodyImp;
};
DECLARE_CLASS(StaticBody);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-11-26 10:30:39
|
Revision: 109
http://simspark.svn.sourceforge.net/simspark/?rev=109&view=rev
Author: a-held
Date: 2009-11-26 10:30:24 +0000 (Thu, 26 Nov 2009)
Log Message:
-----------
implemented bridge Pattern for PhysicsServer and all but one method in PhysicsObject
removed some unneeded files
Modified Paths:
--------------
branches/multiphys/spark/lib/oxygen/CMakeLists.txt
branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.h
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsserver.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsserver.h
Removed Paths:
-------------
branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-26 10:30:24 UTC (rev 109)
@@ -54,9 +54,15 @@
physicsserver/angularmotor.h
#interfaces
+ physicsserver/int/physicsobjectint.h
+ physicsserver/int/physicsserverint.h
+ physicsserver/int/spaceint.h
physicsserver/int/worldint.h
#ode-specific files
+ physicsserver/ode/odephysicsobject.h
+ physicsserver/ode/odephysicsserver.h
+ physicsserver/ode/odespace.h
physicsserver/ode/odeworld.h
physicsserver/ode/odewrapper.h
@@ -184,15 +190,11 @@
physicsserver/angularmotor.cpp
physicsserver/angularmotor_c.cpp
- #interfaces
- physicsserver/int/worldint_c.cpp
- physicsserver/int/spaceint_c.cpp
-
#ODE-specific files
+ physicsserver/ode/odephysicsobject.cpp
+ physicsserver/ode/odephysicsserver.cpp
physicsserver/ode/odespace.cpp
- physicsserver/ode/odespace_c.cpp
physicsserver/ode/odeworld.cpp
- physicsserver/ode/odeworld_c.cpp
sceneserver/basenode.cpp
sceneserver/basenode_c.cpp
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -262,7 +262,7 @@
) > 0;
}
-void Collider::DestroyODEObject()
+void Collider::DestroyPhysicsObject()
{
if (! mODEGeom)
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -148,8 +148,8 @@
*/
virtual void PrePhysicsUpdateInternal(float deltaTime);
- /** destroy the managed ODE object */
- virtual void DestroyODEObject();
+ /** destroy the managed physicsobject */
+ virtual void DestroyPhysicsObject();
//
// Members
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsobjectint.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -0,0 +1,57 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_PHYSICSOBJECTINT_H
+#define OXYGEN_PHYSICSOBJECTINT_H
+
+#include <boost/smart_ptr/shared_ptr.hpp>
+#include <oxygen/physicsserver/ode/odewrapper.h>
+#include <oxygen/sceneserver/basenode.h>
+#include <oxygen/oxygen_defines.h>
+
+namespace oxygen
+{
+class World;
+class Space;
+
+class OXYGEN_API PhysicsObjectInt : public BaseNode
+{
+
+public:
+ PhysicsObjectInt(){};
+ virtual ~PhysicsObjectInt(){};
+
+ virtual dWorldID GetWorldID() = 0;
+ virtual dSpaceID FindSpaceID() = 0;
+ virtual dSpaceID GetParentSpaceID() = 0;
+ virtual void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix) = 0;
+ virtual void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const = 0;
+ virtual void DestroyPhysicsObject() = 0;
+
+ boost::shared_ptr<Scene> scene;
+ boost::shared_ptr<Space> space;
+ boost::shared_ptr<World> world;
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_PHYSICSOBJECTINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/physicsserverint.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -0,0 +1,41 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_PHYSICSSERVERINT_H
+#define OXYGEN_PHYSICSSERVERINT_H
+
+#include <oxygen/oxygen_defines.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API PhysicsServerInt
+{
+
+public:
+ PhysicsServerInt(){};
+ virtual ~PhysicsServerInt(){};
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_PHYSICSSERVERINT_H
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -23,7 +23,7 @@
#ifndef OXYGEN_SPACEINT_H
#define OXYGEN_SPACEINT_H
-#include <oxygen/physicsserver/physicsobject.h>
+#include <oxygen/physicsserver/ode/odephysicsobject.h>
#include <set>
#include <oxygen/oxygen_defines.h>
@@ -33,13 +33,13 @@
class RigidBody;
class Collider;
-class OXYGEN_API SpaceInt : public PhysicsObject
+class OXYGEN_API SpaceInt : public ODEPhysicsObject
{
public:
typedef std::set<dSpaceID> TSpaceIdSet;
- SpaceInt() : PhysicsObject(){};
+ SpaceInt() : ODEPhysicsObject(){};
virtual ~SpaceInt(){};
//virtual void collisionNearCallback (void *data, dGeomID obj1, dGeomID obj2) = 0;
@@ -63,8 +63,6 @@
boost::shared_ptr<Scene> scene;
};
-DECLARE_ABSTRACTCLASS(SpaceInt);
-
} //namespace oxygen
#endif //OXYGEN_SPACEINT_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint_c.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -1,29 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
-
-this file is part of rcssserver3D
-Fri May 9 2003
-Copyright (C) 2003 Koblenz University
-$Id: world_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/int/spaceint.h>
-
-using namespace oxygen;
-
-void CLASS(SpaceInt)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/ODEObject);
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -23,16 +23,16 @@
#define OXYGEN_WORLDINT_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/ode/odephysicsobject.h>
namespace oxygen
{
-class OXYGEN_API WorldInt : public ODEObject
+class OXYGEN_API WorldInt : public ODEPhysicsObject
{
public:
- WorldInt() : ODEObject(){};
+ WorldInt() : ODEPhysicsObject(){};
virtual ~WorldInt(){};
virtual dWorldID GetODEWorld() const = 0;
@@ -47,12 +47,10 @@
virtual void SetAutoDisableFlag(bool flag) = 0;
virtual void SetContactSurfaceLayer(float depth) = 0;
virtual float GetContactSurfaceLayer() const = 0;
- virtual void DestroyODEObject() = 0;
+ virtual void DestroyPhysicsObject() = 0;
virtual bool ConstructInternal() = 0;
};
-DECLARE_ABSTRACTCLASS(WorldInt);
-
}
#endif //OXYGEN_WORLDINT_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/worldint_c.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -1,29 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
-
-this file is part of rcssserver3D
-Fri May 9 2003
-Copyright (C) 2003 Koblenz University
-$Id: world_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/int/worldint.h>
-
-using namespace oxygen;
-
-void CLASS(WorldInt)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/ODEObject);
-}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -1,167 +0,0 @@
-/* -*- 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.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/ode/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()
-{
-}
-
-void ODEObject::OnUnlink()
-{
- DestroyODEObject();
-}
-
-/** returns the world node */
-shared_ptr<World> ODEObject::GetWorld()
-{
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
- return shared_ptr<World>();
- }
-
- shared_ptr<World> worldNode = shared_dynamic_cast<World>
- (scene->GetChildOfClass("World"));
- if (worldNode.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
- }
-
- return worldNode;
-}
-
-shared_ptr<Space> ODEObject::GetSpace()
-{
- // try to find the nearest parent space object
- weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
- if (! parentSpace.expired())
- {
- return parentSpace.lock();
- }
-
- // return the global space instance
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
- return shared_ptr<Space>();
- }
-
- shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
- (scene->GetChildOfClass("Space"));
- if (spaceNode.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
- }
-
- return spaceNode;
-}
-
-dWorldID ODEObject::GetWorldID()
-{
- shared_ptr<World> world = GetWorld();
- if (world.get() == 0)
- {
- return 0;
- }
-
- dWorldID worldId = world->GetODEWorld();
- if (worldId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: World returned empty ODE handle\n";
- }
-
- return worldId;
-}
-
-dSpaceID ODEObject::FindSpaceID()
-{
- shared_ptr<Space> space = GetSpace();
- if (space.get() == 0)
- {
- return 0;
- }
-
- dSpaceID spaceId = space->GetODESpace();
-
- if (spaceId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: Space returned empty ODE handle\n";
- }
-
- return spaceId;
-}
-
-dSpaceID ODEObject::GetParentSpaceID()
-{
- return 0;
-}
-
-void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
-{
- matrix[0] = rot.m[0];
- matrix[1] = rot.m[4];
- matrix[2] = rot.m[8];
- matrix[3] = 0;
- matrix[4] = rot.m[1];
- matrix[5] = rot.m[5];
- matrix[6] = rot.m[9];
- matrix[7] = 0;
- matrix[8] = rot.m[2];
- matrix[9] = rot.m[6];
- matrix[10] = rot.m[10];
- matrix[11] = 0;
-}
-
-void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
-{
- rot.m[0] = matrix[0] ;
- rot.m[4] = matrix[1] ;
- rot.m[8] = matrix[2];
- rot.m[12] = matrix[3];
- rot.m[1] = matrix[4];
- rot.m[5] = matrix[5];
- rot.m[9] = matrix[6];
- rot.m[13] = matrix[7];
- rot.m[2] = matrix[8];
- rot.m[6] = matrix[9];
- rot.m[10] = matrix[10] ;
- rot.m[14] = matrix[11];
- rot.m[3] = 0.0;
- rot.m[7] = 0.0;
- rot.m[11] = 0.0;
- rot.m[15] = 1.0;
-}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -1,83 +0,0 @@
-/* -*- 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_ODEOBJECT_H
-#define OXYGEN_ODEOBJECT_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/sceneserver/basenode.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
-
-namespace oxygen
-{
-class Space;
-class World;
-
-/** ODEObject is the base of all classes encapsulating ODE concepts
- */
-class OXYGEN_API ODEObject : public BaseNode
-{
-public:
- //
- // Functions
- //
- ODEObject(){};
- virtual ~ODEObject(){};
-
- /** 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(){};
-
- /** returns the ODE world handle */
- dWorldID GetWorldID(){};
-
- /** returns the nearest parent space ODE handle */
- dSpaceID FindSpaceID(){};
-
- /** returns the ODE handle ID of the containing parent space */
- virtual dSpaceID GetParentSpaceID(){};
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObject(){};
-
-protected:
- /** returns the world node */
- boost::shared_ptr<World> GetWorld();
-
- /** finds the nearest parent space node */
- boost::shared_ptr<Space> GetSpace(){};
-
- /** converts the rotation part of a salt::Matrix to an ODE
- dMatrix3 */
- void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
-
- /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
- void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
-};
-
-DECLARE_ABSTRACTCLASS(ODEObject);
-
-} //namespace oxygen
-
-#endif //OXYGEN_ODEOBJECT_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -1,29 +0,0 @@
-/* -*- 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/ode/odeobject.h>
-
-using namespace oxygen;
-
-void CLASS(ODEObject)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/BaseNode);
-}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -0,0 +1,112 @@
+/* -*- 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.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/ode/odephysicsobject.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/physicsserver/world.h>
+#include <oxygen/sceneserver/scene.h>
+#include <iostream>
+
+using namespace oxygen;
+using namespace boost;
+using namespace std;
+
+ODEPhysicsObject::ODEPhysicsObject() : PhysicsObjectInt()
+{
+}
+
+ODEPhysicsObject::~ODEPhysicsObject()
+{
+}
+
+dWorldID ODEPhysicsObject::GetWorldID()
+{
+ if (world.get() == 0)
+ {
+ return 0;
+ }
+
+ dWorldID worldId = world->GetODEWorld();
+ if (worldId == 0)
+ {
+ cerr << "(ODEObject) ERROR: World returned empty ODE handle\n";
+ }
+
+ return worldId;
+}
+
+dSpaceID ODEPhysicsObject::FindSpaceID()
+{
+ if (space.get() == 0)
+ {
+ return 0;
+ }
+
+ dSpaceID spaceId = space->GetODESpace();
+
+ if (spaceId == 0)
+ {
+ cerr << "(ODEObject) ERROR: Space returned empty ODE handle\n";
+ }
+
+ return spaceId;
+}
+
+dSpaceID ODEPhysicsObject::GetParentSpaceID()
+{
+ return 0;
+}
+
+void ODEPhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+{
+ matrix[0] = rot.m[0];
+ matrix[1] = rot.m[4];
+ matrix[2] = rot.m[8];
+ matrix[3] = 0;
+ matrix[4] = rot.m[1];
+ matrix[5] = rot.m[5];
+ matrix[6] = rot.m[9];
+ matrix[7] = 0;
+ matrix[8] = rot.m[2];
+ matrix[9] = rot.m[6];
+ matrix[10] = rot.m[10];
+ matrix[11] = 0;
+}
+
+void ODEPhysicsObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+{
+ rot.m[0] = matrix[0] ;
+ rot.m[4] = matrix[1] ;
+ rot.m[8] = matrix[2];
+ rot.m[12] = matrix[3];
+ rot.m[1] = matrix[4];
+ rot.m[5] = matrix[5];
+ rot.m[9] = matrix[6];
+ rot.m[13] = matrix[7];
+ rot.m[2] = matrix[8];
+ rot.m[6] = matrix[9];
+ rot.m[10] = matrix[10] ;
+ rot.m[14] = matrix[11];
+ rot.m[3] = 0.0;
+ rot.m[7] = 0.0;
+ rot.m[11] = 0.0;
+ rot.m[15] = 1.0;
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsobject.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -0,0 +1,53 @@
+/* -*- 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_ODEOBJECT_H
+#define OXYGEN_ODEOBJECT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/int/physicsobjectint.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
+
+namespace oxygen
+{
+class Space;
+class World;
+
+class OXYGEN_API ODEPhysicsObject : public PhysicsObjectInt
+{
+public:
+ ODEPhysicsObject();
+ virtual ~ODEPhysicsObject();
+
+ dWorldID GetWorldID();
+ dSpaceID FindSpaceID();
+ virtual dSpaceID GetParentSpaceID();
+ virtual void DestroyPhysicsObject(){};
+
+protected:
+ void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
+ void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEPHYSICSOBJECT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsserver.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsserver.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsserver.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -0,0 +1,33 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id: space.cpp 80 2009-07-30 17:25:42Z 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/ode/odewrapper.h>
+#include <oxygen/physicsserver/ode/odephysicsserver.h>
+
+using namespace oxygen;
+
+ODEPhysicsServer::ODEPhysicsServer(){
+ dInitODE();
+}
+
+ODEPhysicsServer::~ODEPhysicsServer(){
+ dCloseODE();
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsserver.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsserver.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odephysicsserver.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -0,0 +1,41 @@
+/* -*- 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_ODEPHYSICSSERVER_H
+#define OXYGEN_ODEPHYSICSSERVER_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/int/physicsserverint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODEPhysicsServer : public PhysicsServerInt
+{
+public:
+ ODEPhysicsServer();
+ virtual ~ODEPhysicsServer();
+};
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEPHYSICSSERVER_H
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -184,14 +184,14 @@
void ODESpace::OnUnlink()
{
DisableInnerCollision(false);
- PhysicsObject::OnUnlink();
+ ODEPhysicsObject::OnUnlink();
}
void ODESpace::OnLink()
{
- PhysicsObject::OnLink();
+ ODEPhysicsObject::OnLink();
- shared_ptr<Space> space = GetSpace();
+ //shared_ptr<Space> space = GetSpace();
dSpaceID spaceId = 0;
if (space.get() != 0)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -67,8 +67,6 @@
static TSpaceIdSet gDisabledInnerCollisionSet;
};
-DECLARE_CLASS(ODESpace);
-
}
#endif //OXYGEN_ODESPACE_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace_c.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -1,29 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
-
-this file is part of rcssserver3D
-Fri May 9 2003
-Copyright (C) 2003 Koblenz University
-$Id: world_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/ode/odespace.h>
-
-using namespace oxygen;
-
-void CLASS(ODESpace)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/SpaceInt);
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -109,7 +109,7 @@
return (mODEWorld != 0);
}
-void ODEWorld::DestroyODEObject()
+void ODEWorld::DestroyPhysicsObject()
{
static bool recurseLock = false;
if (recurseLock)
@@ -119,7 +119,7 @@
recurseLock = true;
- shared_ptr<Space> space = GetSpace();
+ //shared_ptr<Space> space = GetSpace();
if (space.get() != 0)
{
space->DestroyPhysicsObject();
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -47,7 +47,7 @@
void SetAutoDisableFlag(bool flag);
void SetContactSurfaceLayer(float depth);
float GetContactSurfaceLayer() const;
- virtual void DestroyODEObject();
+ virtual void DestroyPhysicsObject();
protected:
virtual bool ConstructInternal();
@@ -56,8 +56,6 @@
dWorldID mODEWorld;
};
-DECLARE_CLASS(ODEWorld);
-
}
#endif //OXYGEN_ODEWORLD_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -1,29 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
-
-this file is part of rcssserver3D
-Fri May 9 2003
-Copyright (C) 2003 Koblenz University
-$Id: world_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/ode/odeworld.h>
-
-using namespace oxygen;
-
-void CLASS(ODEWorld)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/WorldImp);
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -19,9 +19,11 @@
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>
#include <oxygen/physicsserver/space.h>
#include <oxygen/physicsserver/world.h>
+#include <oxygen/physicsserver/ode/odephysicsobject.h>
#include <oxygen/sceneserver/scene.h>
#include <zeitgeist/logserver/logserver.h>
@@ -30,6 +32,7 @@
PhysicsObject::PhysicsObject() : BaseNode()
{
+ mPhysicsObjectImp = shared_ptr<ODEPhysicsObject>(new ODEPhysicsObject());
}
PhysicsObject::~PhysicsObject()
@@ -38,7 +41,7 @@
void PhysicsObject::OnUnlink()
{
- DestroyPhysicsObject();
+ mPhysicsObjectImp->DestroyPhysicsObject();
}
/** returns the world node */
@@ -90,7 +93,11 @@
dWorldID PhysicsObject::GetWorldID()
{
+ mPhysicsObjectImp->world = GetWorld();
+
shared_ptr<World> world = GetWorld();
+
+ //mPhysicsObjectImp->GetWorld();
if (world.get() == 0)
{
return 0;
@@ -108,60 +115,22 @@
dSpaceID PhysicsObject::FindSpaceID()
{
- shared_ptr<Space> space = GetSpace();
- if (space.get() == 0)
- {
- return 0;
- }
-
- dSpaceID spaceId = space->GetODESpace();
-
- if (spaceId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: Space returned empty ODE handle\n";
- }
-
- return spaceId;
+ mPhysicsObjectImp->space = GetSpace();
+
+ return mPhysicsObjectImp->FindSpaceID();
}
dSpaceID PhysicsObject::GetParentSpaceID()
{
- return 0;
+ return mPhysicsObjectImp->GetParentSpaceID();
}
void PhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
{
- matrix[0] = rot.m[0];
- matrix[1] = rot.m[4];
- matrix[2] = rot.m[8];
- matrix[3] = 0;
- matrix[4] = rot.m[1];
- matrix[5] = rot.m[5];
- matrix[6] = rot.m[9];
- matrix[7] = 0;
- matrix[8] = rot.m[2];
- matrix[9] = rot.m[6];
- matrix[10] = rot.m[10];
- matrix[11] = 0;
+ mPhysicsObjectImp->ConvertRotationMatrix(rot, matrix);
}
void PhysicsObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
{
- rot.m[0] = matrix[0] ;
- rot.m[4] = matrix[1] ;
- rot.m[8] = matrix[2];
- rot.m[12] = matrix[3];
- rot.m[1] = matrix[4];
- rot.m[5] = matrix[5];
- rot.m[9] = matrix[6];
- rot.m[13] = matrix[7];
- rot.m[2] = matrix[8];
- rot.m[6] = matrix[9];
- rot.m[10] = matrix[10] ;
- rot.m[14] = matrix[11];
- rot.m[3] = 0.0;
- rot.m[7] = 0.0;
- rot.m[11] = 0.0;
- rot.m[15] = 1.0;
+ mPhysicsObjectImp->ConvertRotationMatrix(matrix, rot);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -31,6 +31,7 @@
{
class Space;
class World;
+class PhysicsObjectInt;
/** ODEObject is the base of all classes encapsulating ODE concepts
*/
@@ -57,8 +58,12 @@
/** returns the ODE handle ID of the containing parent space */
virtual dSpaceID GetParentSpaceID();
-
- /** destroy the managed ODE object */
+
+ /** this method is not implemented here because PhysicsObject is an
+ abstract class. However, it is declared here so that it can be
+ called as a member of this class, which is necessary in some
+ cases (like destroying all objects in a space, where bodies,
+ colliders and joints have to be treated in one go).*/
virtual void DestroyPhysicsObject(){};
protected:
@@ -74,6 +79,9 @@
/** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+
+private:
+ boost::shared_ptr<PhysicsObjectInt> mPhysicsObjectImp;
};
DECLARE_ABSTRACTCLASS(PhysicsObject);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -20,17 +20,11 @@
*/
#include <oxygen/physicsserver/physicsserver.h>
+#include <oxygen/physicsserver/ode/odephysicsserver.h>
using namespace oxygen;
-PhysicsServer::PhysicsServer()
- : Leaf()
+PhysicsServer::PhysicsServer() : Leaf()
{
- dInitODE();
+ mPhysicsServerImp = boost::shared_ptr<ODEPhysicsServer>(new ODEPhysicsServer());
}
-
-PhysicsServer::~PhysicsServer()
-{
- // release memory associated with ode
- dCloseODE();
-}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -29,6 +29,7 @@
namespace oxygen
{
+class PhysicsServerInt;
class OXYGEN_API PhysicsServer : public zeitgeist::Leaf
{
@@ -37,7 +38,10 @@
//
public:
PhysicsServer();
- ~PhysicsServer();
+ virtual ~PhysicsServer(){};
+
+private:
+ boost::shared_ptr<PhysicsServerInt> mPhysicsServerImp;
};
DECLARE_CLASS(PhysicsServer);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -102,7 +102,7 @@
return true;
}
-void RigidBody::DestroyODEObject()
+void RigidBody::DestroyPhysicsObject()
{
if (mODEBody == 0)
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -226,8 +226,8 @@
/** returns the current poosition of this body */
salt::Vector3f GetPosition() const;
- /** destroy the managed ODE object */
- virtual void DestroyODEObject();
+ /** destroy the managed physicsobject */
+ virtual void DestroyPhysicsObject();
/** synchronize parent node with the bodies position and
orientation
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-11-26 10:30:24 UTC (rev 109)
@@ -102,7 +102,7 @@
return mWorldImp->ConstructInternal();
}
-void World::DestroyODEObject()
+void World::DestroyPhysicsObject()
{
- mWorldImp->DestroyODEObject();
+ mWorldImp->DestroyPhysicsObject();
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-11-25 10:20:10 UTC (rev 108)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-11-26 10:30:24 UTC (rev 109)
@@ -106,7 +106,7 @@
float GetContactSurfaceLayer() const;
/** destroy the managed ODE object */
- virtual void DestroyODEObject();
+ virtual void DestroyPhysicsObject();
protected:
/** creates them managed ODE world */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-11-25 10:20:20
|
Revision: 108
http://simspark.svn.sourceforge.net/simspark/?rev=108&view=rev
Author: a-held
Date: 2009-11-25 10:20:10 +0000 (Wed, 25 Nov 2009)
Log Message:
-----------
improved way for including files
removed some unneeded class declarations in some header files
completed the new inheritance tree
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/angularmotor.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h
branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/balljoint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/body.h
branches/multiphys/spark/lib/oxygen/physicsserver/bodycontroller_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/collider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.h
branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/dragcontroller_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/fixedjoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/fixedjoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/fixedjoint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/hinge2joint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/hinge2joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/hinge2joint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/hingejoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/hingejoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/hingejoint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/joint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/planecollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/planecollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/planecollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/raycollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/raycollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/raycollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/recorderhandler.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/recorderhandler.h
branches/multiphys/spark/lib/oxygen/physicsserver/recorderhandler_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/spherecollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/spherecollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/spherecollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/transformcollider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/transformcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/transformcollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/universaljoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/universaljoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/universaljoint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/velocitycontroller_c.cpp
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/conecollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/conecollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/conetwistjoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/conetwistjoint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/convexcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/convexcollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/cylindercollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/cylindercollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/generic6dofjoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/generic6dofjoint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/softbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/softbody_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/staticbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/staticbody_c.cpp
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-25 10:20:10 UTC (rev 108)
@@ -17,12 +17,21 @@
physicsserver/physicsobject.h
physicsserver/body.h
physicsserver/rigidbody.h
+ physicsserver/staticbody.h
+ physicsserver/dynamicbody.h
+ physicsserver/softbody.h
physicsserver/bodycontroller.h
physicsserver/boxcollider.h
physicsserver/ccylindercollider.h
+ physicsserver/cylindercollider.h
physicsserver/collider.h
+ physicsserver/compoundcollider.h
+ physicsserver/concavecollider.h
+ physicsserver/conecollider.h
+ physicsserver/convexcollider.h
physicsserver/collisionhandler.h
physicsserver/contactjointhandler.h
+ physicsserver/emptycollider.h
physicsserver/physicsserver.h
physicsserver/planecollider.h
physicsserver/raycollider.h
@@ -34,7 +43,9 @@
physicsserver/dragcontroller.h
physicsserver/velocitycontroller.h
physicsserver/joint.h
+ physicsserver/generic6dofjoint.h
physicsserver/balljoint.h
+ physicsserver/conetwistjoint.h
physicsserver/hingejoint.h
physicsserver/fixedjoint.h
physicsserver/sliderjoint.h
@@ -113,6 +124,9 @@
physicsserver/body_c.cpp
physicsserver/rigidbody.cpp
physicsserver/rigidbody_c.cpp
+ physicsserver/staticbody_c.cpp
+ physicsserver/dynamicbody_c.cpp
+ physicsserver/softbody_c.cpp
physicsserver/bodycontroller.cpp
physicsserver/bodycontroller_c.cpp
physicsserver/transformcollider.cpp
@@ -121,12 +135,18 @@
physicsserver/boxcollider_c.cpp
physicsserver/ccylindercollider.cpp
physicsserver/ccylindercollider_c.cpp
+ physicsserver/cylindercollider_c.cpp
physicsserver/collider.cpp
physicsserver/collider_c.cpp
+ physicsserver/compoundcollider_c.cpp
+ physicsserver/concavecollider_c.cpp
+ physicsserver/conecollider_c.cpp
+ physicsserver/convexcollider_c.cpp
physicsserver/collisionhandler.cpp
physicsserver/collisionhandler_c.cpp
physicsserver/contactjointhandler.cpp
physicsserver/contactjointhandler_c.cpp
+ physicsserver/emptycollider_c.cpp
physicsserver/physicsserver.cpp
physicsserver/physicsserver_c.cpp
physicsserver/planecollider.cpp
@@ -147,8 +167,10 @@
physicsserver/velocitycontroller_c.cpp
physicsserver/joint.cpp
physicsserver/joint_c.cpp
+ physicsserver/generic6dofjoint_c.cpp
physicsserver/balljoint.cpp
physicsserver/balljoint_c.cpp
+ physicsserver/conetwistjoint_c.cpp
physicsserver/hingejoint.cpp
physicsserver/hingejoint_c.cpp
physicsserver/fixedjoint.cpp
Modified: branches/multiphys/spark/lib/oxygen/oxygen.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "oxygen.h"
+#include <oxygen/oxygen.h>
using namespace oxygen;
using namespace zeitgeist;
@@ -56,13 +56,18 @@
zg.GetCore()->RegisterClassObject(new CLASS(PhysicsObject), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Body), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(RigidBody), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(StaticBody), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(DynamicBody), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(SoftBody), "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(Space), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(World), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Joint), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(Generic6DOFJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(BallJoint), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(ConeTwistJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(HingeJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(FixedJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(SliderJoint), "oxygen/");
@@ -71,9 +76,15 @@
// collider
zg.GetCore()->RegisterClassObject(new CLASS(Collider), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(CompoundCollider), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(ConcaveCollider), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(ConeCollider), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(ConvexCollider), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(EmptyCollider), "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(CylinderCollider), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(PlaneCollider), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(RayCollider), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(SphereCollider), "oxygen/");
Modified: branches/multiphys/spark/lib/oxygen/oxygen.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -22,78 +22,89 @@
#ifndef OXYGEN_OXYGEN_H
#define OXYGEN_OXYGEN_H
-#include "oxygen_defines.h"
-#include "agentaspect/agentaspect.h"
-#include "agentaspect/effector.h"
-#include "agentaspect/perceptor.h"
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/agentaspect/agentaspect.h>
+#include <oxygen/agentaspect/effector.h>
+#include <oxygen/agentaspect/perceptor.h>
-#include "controlaspect/controlaspect.h"
+#include <oxygen/controlaspect/controlaspect.h>
-#include "gamecontrolserver/baseparser.h"
-#include "gamecontrolserver/gamecontrolserver.h"
-#include "gamecontrolserver/actionobject.h"
-#include "gamecontrolserver/behavior.h"
+#include <oxygen/gamecontrolserver/baseparser.h>
+#include <oxygen/gamecontrolserver/gamecontrolserver.h>
+#include <oxygen/gamecontrolserver/actionobject.h>
+#include <oxygen/gamecontrolserver/behavior.h>
//abstract physics classes
#include <oxygen/physicsserver/physicsobject.h>
-#include "physicsserver/body.h"
-#include "physicsserver/rigidbody.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/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"
+#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
+#include <oxygen/physicsserver/staticbody.h>
+#include <oxygen/physicsserver/dynamicbody.h>
+#include <oxygen/physicsserver/softbody.h>
+#include <oxygen/physicsserver/bodycontroller.h>
+#include <oxygen/physicsserver/dragcontroller.h>
+#include <oxygen/physicsserver/velocitycontroller.h>
+#include <oxygen/physicsserver/transformcollider.h>
+#include <oxygen/physicsserver/boxcollider.h>
+#include <oxygen/physicsserver/ccylindercollider.h>
+#include <oxygen/physicsserver/cylindercollider.h>
+#include <oxygen/physicsserver/collider.h>
+#include <oxygen/physicsserver/compoundcollider.h>
+#include <oxygen/physicsserver/concavecollider.h>
+#include <oxygen/physicsserver/conecollider.h>
+#include <oxygen/physicsserver/convexcollider.h>
+#include <oxygen/physicsserver/emptycollider.h>
+#include <oxygen/physicsserver/physicsserver.h>
+#include <oxygen/physicsserver/planecollider.h>
+#include <oxygen/physicsserver/raycollider.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/physicsserver/spherecollider.h>
+#include <oxygen/physicsserver/world.h>
+#include <oxygen/physicsserver/collisionhandler.h>
+#include <oxygen/physicsserver/contactjointhandler.h>
+#include <oxygen/physicsserver/recorderhandler.h>
+#include <oxygen/physicsserver/joint.h>
+#include <oxygen/physicsserver/generic6dofjoint.h>
+#include <oxygen/physicsserver/balljoint.h>
+#include <oxygen/physicsserver/conetwistjoint.h>
+#include <oxygen/physicsserver/hingejoint.h>
+#include <oxygen/physicsserver/fixedjoint.h>
+#include <oxygen/physicsserver/sliderjoint.h>
+#include <oxygen/physicsserver/universaljoint.h>
+#include <oxygen/physicsserver/hinge2joint.h>
-#include "sceneserver/basenode.h"
-#include "sceneserver/camera.h"
-#include "sceneserver/fpscontroller.h"
-#include "sceneserver/scene.h"
-#include "sceneserver/sceneserver.h"
-#include "sceneserver/transform.h"
-#include "sceneserver/sceneimporter.h"
+#include <oxygen/sceneserver/basenode.h>
+#include <oxygen/sceneserver/camera.h>
+#include <oxygen/sceneserver/fpscontroller.h>
+#include <oxygen/sceneserver/scene.h>
+#include <oxygen/sceneserver/sceneserver.h>
+#include <oxygen/sceneserver/transform.h>
+#include <oxygen/sceneserver/sceneimporter.h>
-#include "simulationserver/simulationserver.h"
-#include "simulationserver/simcontrolnode.h"
-#include "simulationserver/netcontrol.h"
-#include "simulationserver/netmessage.h"
-#include "simulationserver/agentcontrol.h"
-#include "simulationserver/monitorcontrol.h"
-#include "simulationserver/monitorlogger.h"
-#include "simulationserver/traincontrol.h"
+#include <oxygen/simulationserver/simulationserver.h>
+#include <oxygen/simulationserver/simcontrolnode.h>
+#include <oxygen/simulationserver/netcontrol.h>
+#include <oxygen/simulationserver/netmessage.h>
+#include <oxygen/simulationserver/agentcontrol.h>
+#include <oxygen/simulationserver/monitorcontrol.h>
+#include <oxygen/simulationserver/monitorlogger.h>
+#include <oxygen/simulationserver/traincontrol.h>
-#include "geometryserver/geometryserver.h"
-#include "geometryserver/meshexporter.h"
-#include "geometryserver/meshimporter.h"
-#include "geometryserver/stdmeshimporter.h"
+#include <oxygen/geometryserver/geometryserver.h>
+#include <oxygen/geometryserver/meshexporter.h>
+#include <oxygen/geometryserver/meshimporter.h>
+#include <oxygen/geometryserver/stdmeshimporter.h>
#ifdef HAVE_SPADES_HEADERS
-#include "spadesserver/spadesserver.h"
-#include "spadesserver/paramreader.h"
+#include <oxygen/spadesserver/spadesserver.h>
+#include <oxygen/spadesserver/paramreader.h>
#endif
-#include "monitorserver/monitorserver.h"
-#include "monitorserver/monitorsystem.h"
-#include "monitorserver/custommonitor.h"
-#include "monitorserver/monitoritem.h"
-#include "monitorserver/monitorcmdparser.h"
+#include <oxygen/monitorserver/monitorserver.h>
+#include <oxygen/monitorserver/monitorsystem.h>
+#include <oxygen/monitorserver/custommonitor.h>
+#include <oxygen/monitorserver/monitoritem.h>
+#include <oxygen/monitorserver/monitorcmdparser.h>
// control aspect
#include <zeitgeist/zeitgeist.h>
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "angularmotor.h"
+#include <oxygen/physicsserver/angularmotor.h>
#include <zeitgeist/logserver/logserver.h>
using namespace oxygen;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -25,7 +25,6 @@
namespace oxygen
{
-class RigidBody;
/** An angular motor allows the relative angular velocities of two
bodies to be controlled. The angular velocity can be controlled on
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "angularmotor.h"
+#include <oxygen/physicsserver/angularmotor.h>
using namespace boost;
using namespace oxygen;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -17,13 +17,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "balljoint.h"
+#include <oxygen/physicsserver/balljoint.h>
using namespace oxygen;
using namespace boost;
using namespace salt;
-BallJoint::BallJoint() : Joint()
+BallJoint::BallJoint() : Generic6DOFJoint()
{
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.h 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -21,13 +21,12 @@
#define OXYGEN_BALLJOINT_H
#include <oxygen/oxygen_defines.h>
-#include "joint.h"
+#include <oxygen/physicsserver/generic6dofjoint.h>
namespace oxygen
{
-class RigidBody;
-class OXYGEN_API BallJoint : public Joint
+class OXYGEN_API BallJoint : public Generic6DOFJoint
{
public:
BallJoint();
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/balljoint_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/balljoint_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/balljoint_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "balljoint.h"
+#include <oxygen/physicsserver/balljoint.h>
using namespace boost;
using namespace oxygen;
@@ -44,6 +44,6 @@
void CLASS(BallJoint)::DefineClass()
{
- DEFINE_BASECLASS(oxygen/Joint);
+ DEFINE_BASECLASS(oxygen/Generic6DOFJoint);
DEFINE_FUNCTION(setAnchor);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -26,6 +26,11 @@
namespace oxygen
{
+/** This is currently a placeholder class to comply with the
+ inheritance tree. Once a Body class other than RigidBody has
+ been implemented, common functionality should be moved to this
+ common base class to reduce the amount of redundant code.
+*/
class OXYGEN_API Body : public PhysicsObject
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/bodycontroller_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/bodycontroller_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/bodycontroller_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "bodycontroller.h"
+#include <oxygen/physicsserver/bodycontroller.h>
using namespace boost;
using namespace oxygen;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -20,12 +20,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "boxcollider.h"
+#include <oxygen/physicsserver/boxcollider.h>
using namespace oxygen;
using namespace salt;
-BoxCollider::BoxCollider() : Collider()
+BoxCollider::BoxCollider() : ConvexCollider()
{
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -23,14 +23,14 @@
#define OXYGEN_BOXCOLLIDER_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/collider.h>
+#include <oxygen/physicsserver/convexcollider.h>
namespace oxygen
{
/** BoxCollider encapsulates an ODE box geometry object.
*/
-class OXYGEN_API BoxCollider : public Collider
+class OXYGEN_API BoxCollider : public ConvexCollider
{
//
// Functions
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "boxcollider.h"
+#include <oxygen/physicsserver/boxcollider.h>
using namespace boost;
using namespace oxygen;
@@ -73,7 +73,7 @@
void CLASS(BoxCollider)::DefineClass()
{
- DEFINE_BASECLASS(oxygen/Collider);
+ DEFINE_BASECLASS(oxygen/ConvexCollider);
DEFINE_FUNCTION(setBoxLengths);
DEFINE_FUNCTION(getBoxLength);
DEFINE_FUNCTION(getPointDepth);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,12 +19,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "ccylindercollider.h"
+#include <oxygen/physicsserver/ccylindercollider.h>
using namespace oxygen;
using namespace salt;
-CCylinderCollider::CCylinderCollider() : Collider()
+CCylinderCollider::CCylinderCollider() : ConvexCollider()
{
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.h 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -23,7 +23,7 @@
#define OXYGEN_CCYLINDERCOLLIDER_H
#include <oxygen/oxygen_defines.h>
-#include "collider.h"
+#include <oxygen/physicsserver/convexcollider.h>
namespace oxygen
{
@@ -33,7 +33,7 @@
half-sphere caps at its ends. This feature makes the internal
collision detection code particularly fast and accurate.
*/
-class OXYGEN_API CCylinderCollider : public Collider
+class OXYGEN_API CCylinderCollider : public ConvexCollider
{
//
// Functions
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ccylindercollider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "ccylindercollider.h"
+#include <oxygen/physicsserver/ccylindercollider.h>
using namespace oxygen;
using namespace boost;
@@ -102,7 +102,7 @@
void CLASS(CCylinderCollider)::DefineClass()
{
- DEFINE_BASECLASS(oxygen/Collider);
+ DEFINE_BASECLASS(oxygen/ConvexCollider);
DEFINE_FUNCTION(setParams);
DEFINE_FUNCTION(setRadius);
DEFINE_FUNCTION(setLength);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -18,14 +18,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "collider.h"
-#include "space.h"
-#include "rigidbody.h"
+#include <oxygen/physicsserver/collider.h>
+#include <oxygen/physicsserver/collisionhandler.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/physicsserver/transformcollider.h>
+#include <oxygen/physicsserver/rigidbody.h>
+#include <oxygen/sceneserver/scene.h>
#include <zeitgeist/leaf.h>
-#include "collisionhandler.h"
-#include <oxygen/sceneserver/scene.h>
#include <zeitgeist/logserver/logserver.h>
-#include "transformcollider.h"
using namespace oxygen;
using namespace salt;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -23,14 +23,12 @@
#define OXYGEN_COLLIDER_H
#include <oxygen/physicsserver/physicsobject.h>
+#include <oxygen/oxygen_defines.h>
#include <string>
#include <set>
-#include <oxygen/oxygen_defines.h>
namespace oxygen
{
-class Space;
-class World;
/** \class Collider encapsulates an ODE geometry object- geom for
short. Geoms are the fundamental objects in the collision
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "collider.h"
+#include <oxygen/physicsserver/collider.h>
using namespace oxygen;
using namespace boost;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,12 +19,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "collisionhandler.h"
-#include "world.h"
-#include "space.h"
-#include "collider.h"
+#include <oxygen/physicsserver/collisionhandler.h>
+#include <oxygen/physicsserver/collider.h>
+#include <oxygen/physicsserver/world.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/sceneserver/scene.h>
#include <zeitgeist/logserver/logserver.h>
-#include <oxygen/sceneserver/scene.h>
using namespace oxygen;
using namespace boost;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "collisionhandler.h"
+#include <oxygen/physicsserver/collisionhandler.h>
using namespace oxygen;
Added: branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -0,0 +1,48 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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_COMPOUNDCOLLIDER_H
+#define OXYGEN_COMPOUNDCOLLIDER_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/collider.h>
+
+namespace oxygen
+{
+/**
+ CompoundCollider is not yet implemented.
+*/
+
+class OXYGEN_API CompoundCollider : public Collider
+{
+ //
+ // Functions
+ //
+public:
+ CompoundCollider() : Collider(){};
+ virtual ~CompoundCollider(){};
+};
+
+DECLARE_CLASS(CompoundCollider);
+
+} //namespace oxygen
+
+#endif //OXYGEN_COMPOUNDCOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/compoundcollider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -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/compoundcollider.h>
+
+using namespace oxygen;
+
+void CLASS(CompoundCollider)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/Collider);
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -0,0 +1,48 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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_CONCAVECOLLIDER_H
+#define OXYGEN_CONCAVECOLLIDER_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/collider.h>
+
+namespace oxygen
+{
+/**
+ ConcaveCollider is not yet implemented.
+*/
+
+class OXYGEN_API ConcaveCollider : public Collider
+{
+ //
+ // Functions
+ //
+public:
+ ConcaveCollider() : Collider(){};
+ virtual ~ConcaveCollider(){};
+};
+
+DECLARE_CLASS(ConcaveCollider);
+
+} //namespace oxygen
+
+#endif //OXYGEN_CONCAVECOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/concavecollider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -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/concavecollider.h>
+
+using namespace oxygen;
+
+void CLASS(ConcaveCollider)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/Collider);
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/conecollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/conecollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/conecollider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -0,0 +1,48 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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_CONECOLLIDER_H
+#define OXYGEN_CONECOLLIDER_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/convexcollider.h>
+
+namespace oxygen
+{
+/**
+ ConeCollider is not yet implemented.
+*/
+
+class OXYGEN_API ConeCollider : public ConvexCollider
+{
+ //
+ // Functions
+ //
+public:
+ ConeCollider() : ConvexCollider(){};
+ virtual ~ConeCollider(){};
+};
+
+DECLARE_CLASS(ConeCollider);
+
+} //namespace oxygen
+
+#endif //OXYGEN_CONECOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/conecollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/conecollider_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/conecollider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -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/conecollider.h>
+
+using namespace oxygen;
+
+void CLASS(ConeCollider)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/ConvexCollider);
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/conetwistjoint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/conetwistjoint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/conetwistjoint.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -0,0 +1,51 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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_CONETWISTJOINT_H
+#define OXYGEN_CONETWISTJOINT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/generic6dofjoint.h>
+
+namespace oxygen
+{
+/**
+ ConeTwistJoint is not yet implemented.
+*/
+
+class OXYGEN_API ConeTwistJoint : public Generic6DOFJoint
+{
+
+public:
+ ConeTwistJoint() : Generic6DOFJoint(){};
+ virtual ~ConeTwistJoint(){};
+
+ //overwrite pure virtual methods inherited from Joint
+ //to shut the compiler up
+ void SetParameter(int parameter, float value){};
+ float GetParameter(int parameter) const {};
+};
+
+DECLARE_CLASS(ConeTwistJoint);
+
+} //namespace oxygen
+
+#endif //OXYGEN_CONETWISTJOINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/conetwistjoint_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/conetwistjoint_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/conetwistjoint_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -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/conetwistjoint.h>
+
+using namespace oxygen;
+
+void CLASS(ConeTwistJoint)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/Generic6DOFJoint);
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,11 +19,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "contactjointhandler.h"
-#include "collider.h"
-#include "world.h"
-#include "space.h"
-
+#include <oxygen/physicsserver/contactjointhandler.h>
+#include <oxygen/physicsserver/collider.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/physicsserver/world.h>
#include <zeitgeist/logserver/logserver.h>
using namespace oxygen;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.h 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -23,7 +23,7 @@
#define OXYGEN_CONTACTJOINTHANDLER_H
#include <oxygen/oxygen_defines.h>
-#include "collisionhandler.h"
+#include <oxygen/physicsserver/collisionhandler.h>
namespace oxygen
{
@@ -153,5 +153,4 @@
} //namespace oxygen
-
#endif // OXYGEN_CONTACTJOINTHANDLER_H
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/contactjointhandler_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "contactjointhandler.h"
+#include <oxygen/physicsserver/contactjointhandler.h>
using namespace oxygen;
Added: branches/multiphys/spark/lib/oxygen/physicsserver/convexcollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/convexcollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/convexcollider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -0,0 +1,45 @@
+/* -*- 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: joint.h 107 2009-11-25 06:09:10Z a-held $
+
+ 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_CONVEXCOLLIDER_H
+#define OXYGEN_CONVEXCOLLIDER_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/collider.h>
+
+namespace oxygen
+{
+/** ConvexCollider is the common base class of all convex
+ geometry objects, such as spheres and boxes.
+*/
+
+class OXYGEN_API ConvexCollider : public Collider
+{
+public:
+ ConvexCollider() : Collider(){};
+ virtual ~ConvexCollider(){};
+};
+
+DECLARE_ABSTRACTCLASS(ConvexCollider);
+
+} //namespace oxygen
+
+#endif //OXYGEN_CONVEXCOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/convexcollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/convexcollider_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/convexcollider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -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/convexcollider.h>
+
+using namespace oxygen;
+
+void CLASS(ConvexCollider)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/Collider);
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/cylindercollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/cylindercollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/cylindercollider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -0,0 +1,48 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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_CYLINDERCOLLIDER_H
+#define OXYGEN_CYLINDERCOLLIDER_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/convexcollider.h>
+
+namespace oxygen
+{
+/**
+ CylinderCollider is not yet implemented.
+*/
+
+class OXYGEN_API CylinderCollider : public ConvexCollider
+{
+ //
+ // Functions
+ //
+public:
+ CylinderCollider() : ConvexCollider(){};
+ virtual ~CylinderCollider(){};
+};
+
+DECLARE_CLASS(CylinderCollider);
+
+} //namespace oxygen
+
+#endif //OXYGEN_CYLINDERCOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/cylindercollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/cylindercollider_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/cylindercollider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -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/cylindercollider.h>
+
+using namespace oxygen;
+
+void CLASS(CylinderCollider)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/ConvexCollider);
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/dragcontroller_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/dragcontroller_c.cpp 2009-11-25 06:09:10 UTC (rev 107)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/dragcontroller_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "dragcontroller.h"
+#include <oxygen/physicsserver/dragcontroller.h>
using namespace oxygen;
Added: branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -0,0 +1,48 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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_DYNAMICBODY_H
+#define OXYGEN_DYNAMICBODY_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/body.h>
+
+namespace oxygen
+{
+/**
+ DynamicBody is not yet implemented.
+*/
+
+class OXYGEN_API DynamicBody : public Body
+{
+ //
+ // Functions
+ //
+public:
+ DynamicBody() : Body(){};
+ virtual ~DynamicBody(){};
+};
+
+DECLARE_CLASS(DynamicBody);
+
+} //namespace oxygen
+
+#endif //OXYGEN_DYNAMICBODY_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/dynamicbody_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -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/dynamicbody.h>
+
+using namespace oxygen;
+
+void CLASS(DynamicBody)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/Body);
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider.h 2009-11-25 10:20:10 UTC (rev 108)
@@ -0,0 +1,48 @@
+/* -*- 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: body.h 106 2009-11-19 10:10:50Z a-held $
+
+ 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_EMPTYCOLLIDER_H
+#define OXYGEN_EMPTYCOLLIDER_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/collider.h>
+
+namespace oxygen
+{
+/**
+ EmptyCollider is not yet implemented.
+*/
+
+class OXYGEN_API EmptyCollider : public Collider
+{
+ //
+ // Functions
+ //
+public:
+ EmptyCollider() : Collider(){};
+ virtual ~EmptyCollider(){};
+};
+
+DECLARE_CLASS(EmptyCollider);
+
+} //namespace oxygen
+
+#endif //OXYGEN_EMPTYCOLLIDER_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/emptycollider_c.cpp 2009-11-25 10:20:10 UTC (rev 108)
@@ -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 t...
[truncated message content] |
|
From: <a-...@us...> - 2009-11-25 06:09:24
|
Revision: 107
http://simspark.svn.sourceforge.net/simspark/?rev=107&view=rev
Author: a-held
Date: 2009-11-25 06:09:10 +0000 (Wed, 25 Nov 2009)
Log Message:
-----------
Created abstract body class and moved functionality to new RigidBody class
changed everything in simspark to use the new class instead of the abstract one
Modified Paths:
--------------
branches/multiphys/rcssserver3d/data/rsg/agent/ball.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics_nocollider.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics_with_handler.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/nao/ccylinder_physics.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/nao/ccylinder_physics_nocollider.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/nao/sphere_physics.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/nao/sphere_physics_nocollider.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/box.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/box_with_handler.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/head.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/lowerarm_body.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/soccerbottorso.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbotleftlowerarmcomp.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbotrightlowerarmcomp.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbottorso.rsg
branches/multiphys/rcssserver3d/data/rsg/agent/soccerbottorsocomp.rsg
branches/multiphys/rcssserver3d/plugin/soccer/agentstate/agentstate.h
branches/multiphys/rcssserver3d/plugin/soccer/ball/ball.cpp
branches/multiphys/rcssserver3d/plugin/soccer/ball/ball.h
branches/multiphys/rcssserver3d/plugin/soccer/beameffector/beameffector.h
branches/multiphys/rcssserver3d/plugin/soccer/catcheffector/catcheffector.h
branches/multiphys/rcssserver3d/plugin/soccer/driveeffector/driveeffector.h
branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp
branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h
branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp
branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h
branches/multiphys/rcssserver3d/plugin/soccer/initeffector/initeffector.cpp
branches/multiphys/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.cpp
branches/multiphys/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.h
branches/multiphys/rcssserver3d/plugin/soccer/kickeffector/kickeffector.h
branches/multiphys/rcssserver3d/plugin/soccer/pantilteffector/pantilteffector.h
branches/multiphys/rcssserver3d/plugin/soccer/soccerbase/soccerbase.cpp
branches/multiphys/rcssserver3d/plugin/soccer/soccerbase/soccerbase.h
branches/multiphys/rcssserver3d/plugin/soccer/soccercontrolaspect/soccercontrolaspect.h
branches/multiphys/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp
branches/multiphys/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h
branches/multiphys/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp
branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinput.cpp
branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinput.h
branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.cpp
branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.h
branches/multiphys/rsgedit/src/property.cpp
branches/multiphys/rsgedit/src/sparkglrender.cpp
branches/multiphys/simspark-utilities/data/rsg/agent/ball.rsg
branches/multiphys/spark/data/rsg/boxspheres/box.rsg
branches/multiphys/spark/data/rsg/boxspheres/box_with_handler.rsg
branches/multiphys/spark/data/rsg/boxspheres/box_with_handler055.rsg
branches/multiphys/spark/data/rsg/boxspheres/box_with_handler056.rsg
branches/multiphys/spark/data/rsg/boxspheres/ccylinder.rsg
branches/multiphys/spark/data/rsg/boxspheres/sphere.rsg
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/angularmotor.h
branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/body.h
branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/bodycontroller.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/bodycontroller.h
branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/dragcontroller.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/hinge2joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/hingejoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/sliderjoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/space.h
branches/multiphys/spark/lib/oxygen/physicsserver/universaljoint.h
branches/multiphys/spark/lib/oxygen/physicsserver/velocitycontroller.cpp
branches/multiphys/spark/lib/oxygen/sceneserver/fpscontroller.cpp
branches/multiphys/spark/plugin/forceeffector/forceeffector.cpp
branches/multiphys/spark/plugin/forceeffector/forceeffector.h
branches/multiphys/spark/plugin/gyrorateperceptor/gyrorateperceptor.cpp
branches/multiphys/spark/plugin/gyrorateperceptor/gyrorateperceptor.h
branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp
branches/multiphys/spark/plugin/rosimporter/rosimporter.h
branches/multiphys/spark/plugin/sparkagent/hinge2effector.cpp
branches/multiphys/spark/plugin/sparkagent/hingeeffector.cpp
branches/multiphys/spark/plugin/sparkagent/universaljointeffector.cpp
branches/multiphys/spark/plugin/sparkmonitor/sparkmonitorclient.cpp
branches/multiphys/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp
branches/multiphys/spark/spark/spark.rb
branches/multiphys/spark/test/scenetest/script/scenetest.rb
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.h
branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody_c.cpp
Removed Paths:
-------------
branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/ball.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/ball.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/ball.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -15,7 +15,7 @@
(setScale $Radius $Radius $Radius)
)
- (nd Body
+ (nd RigidBody
(setName physics)
(setSphereTotal $Mass $Radius)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -4,7 +4,7 @@
(
(templ $lenX $lenY $lenZ $totalMass)
- (nd Body
+ (nd RigidBody
(setName boxBody)
(setBoxTotal $totalMass $lenX $lenY $lenZ)
@@ -16,4 +16,4 @@
(importScene rsg/agent/nao/contactjointhandler.rsg)
)
-)
\ No newline at end of file
+)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics_nocollider.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics_nocollider.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics_nocollider.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -4,7 +4,7 @@
(
(templ $lenX $lenY $lenZ $totalMass)
- (nd Body
+ (nd RigidBody
(setName boxBody)
(setBoxTotal $totalMass $lenX $lenY $lenZ)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics_with_handler.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics_with_handler.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/nao/box_physics_with_handler.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -4,7 +4,7 @@
(
(templ $lenX $lenY $lenZ $totalMass)
- (nd Body
+ (nd RigidBody
(setName boxBody)
(setBoxTotal $totalMass $lenX $lenY $lenZ)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/nao/ccylinder_physics.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/nao/ccylinder_physics.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/nao/ccylinder_physics.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -4,7 +4,7 @@
(
(templ $radius $length $totalMass)
- (nd Body
+ (nd RigidBody
(setName ccylinderBody)
(setCappedCylinderTotal $totalMass $radius $length)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/nao/ccylinder_physics_nocollider.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/nao/ccylinder_physics_nocollider.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/nao/ccylinder_physics_nocollider.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -4,7 +4,7 @@
(
(templ $radius $length $totalMass)
- (nd Body
+ (nd RigidBody
(setName ccylinderBody)
(setCappedCylinderTotal $totalMass $radius)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/nao/sphere_physics.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/nao/sphere_physics.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/nao/sphere_physics.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -4,7 +4,7 @@
(
(templ $radius $totalMass)
- (nd Body
+ (nd RigidBody
(setName sphereBody)
(setSphereTotal $totalMass $radius)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/nao/sphere_physics_nocollider.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/nao/sphere_physics_nocollider.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/nao/sphere_physics_nocollider.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -4,7 +4,7 @@
(
(templ $radius $totalMass)
- (nd Body
+ (nd RigidBody
(setName sphereBody)
(setSphereTotal $totalMass $radius)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/box.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/box.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/box.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -8,17 +8,17 @@
(setMaterial $material)
)
- (nd Body
+ (nd RigidBody
(setName boxBody)
(setBoxTotal $totalMass $lenX $lenY $lenZ)
- (nd DragController
- (setAngularDrag 0.01)
- (setLinearDrag 0.01)
- )
+ (nd DragController
+ (setAngularDrag 0.01)
+ (setLinearDrag 0.01)
+ )
)
(nd BoxCollider
(setBoxLengths $lenX $lenY $lenZ)
(importScene rsg/agent/nao/contactjointhandler.rsg)
)
- )
\ No newline at end of file
+ )
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/box_with_handler.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/box_with_handler.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/box_with_handler.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -8,7 +8,7 @@
(setMaterial $material)
)
- (nd Body
+ (nd RigidBody
(setName boxBody)
(setBoxTotal $totalMass $lenX $lenY $lenZ)
(nd DragController
@@ -21,4 +21,4 @@
(setBoxLengths $lenX $lenY $lenZ)
(importScene rsg/agent/nao/touchperceptorhandler.rsg)
)
- )
\ No newline at end of file
+ )
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/head.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/head.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/head.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -9,7 +9,7 @@
(setName head)
(setLocalPos $HeadPosX $HeadPosY $HeadPosZ)
- (nd Body
+ (nd RigidBody
(setName sphereBody)
(setSphereTotal $headMass $headRadius
$HeadPosX $HeadPosY $HeadPosZ
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/lowerarm_body.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/lowerarm_body.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/lowerarm_body.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -32,7 +32,7 @@
- (eval 0.04 * $scale)))
- (nd Body
+ (nd RigidBody
(setName boxBody)
;; Lower arm
(setBox $LowerarmMass $LowerarmLength $LowerarmWidth $LowerarmHeight)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/soccerbottorso.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/soccerbottorso.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbot058/soccerbottorso.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -16,7 +16,7 @@
; + (eval 0.1 * $scale))
; + (eval $headRadius / 2.0)))
- (nd Body
+ (nd RigidBody
(setName boxBody)
; Upper torso mass
(setBoxTotal $upperMass $upperLenX $upperLenY $upperLenZ)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbotleftlowerarmcomp.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbotleftlowerarmcomp.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbotleftlowerarmcomp.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -44,7 +44,7 @@
- (eval $HandBox3Height / 2.0) ) - 0.04 ) )
- (nd Body
+ (nd RigidBody
(setName boxBody)
; Lower arm mass
(setBox $LowerarmMass $LowerarmLength $LowerarmWidth $LowerarmHeight)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbotrightlowerarmcomp.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbotrightlowerarmcomp.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbotrightlowerarmcomp.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -44,7 +44,7 @@
- (eval $HandBox3Height / 2.0) ) - 0.04 ) )
- (nd Body
+ (nd RigidBody
(setName boxBody)
; Lower arm mass
(setBox $LowerarmMass $LowerarmLength $LowerarmWidth $LowerarmHeight)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbottorso.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbottorso.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbottorso.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -10,7 +10,7 @@
;(setScale 1.0 1.0 1.0)
)
- (nd Body
+ (nd RigidBody
(setName boxBody)
;(setBoxTotal $totalMass $lenX $lenY $lenZ)
(setBox $totalMass $lenX $lenY $lenZ)
@@ -36,4 +36,4 @@
)
)
-)
\ No newline at end of file
+)
Modified: branches/multiphys/rcssserver3d/data/rsg/agent/soccerbottorsocomp.rsg
===================================================================
--- branches/multiphys/rcssserver3d/data/rsg/agent/soccerbottorsocomp.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/data/rsg/agent/soccerbottorsocomp.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -14,7 +14,7 @@
(def $HeadPosY 0.05)
(def $HeadPosZ (eval (eval (eval 0.5 * $upperLenZ) + 0.1) + (eval $headRadius / 2.0)))
- (nd Body
+ (nd RigidBody
(setName boxBody)
; Upper torso mass
(setBox $upperMass $upperLenX $upperLenY $upperLenZ)
Modified: branches/multiphys/rcssserver3d/plugin/soccer/agentstate/agentstate.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -27,7 +27,7 @@
namespace oxygen
{
- class Body;
+ class RigidBody;
}
class AgentState : public ObjectState
Modified: branches/multiphys/rcssserver3d/plugin/soccer/ball/ball.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/ball/ball.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/ball/ball.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -46,7 +46,7 @@
if (mBody.get() == 0)
{
- mBody = shared_dynamic_cast<Body>(GetChildOfClass("Body"));
+ mBody = shared_dynamic_cast<RigidBody>(GetChildOfClass("RigidBody"));
}
}
Modified: branches/multiphys/rcssserver3d/plugin/soccer/ball/ball.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/ball/ball.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/ball/ball.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -23,7 +23,7 @@
#define BALL_H
#include <oxygen/sceneserver/transform.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <salt/vector.h>
class BallStateAspect;
@@ -65,7 +65,7 @@
salt::Vector3f mForce;
salt::Vector3f mTorque;
- boost::shared_ptr<oxygen::Body> mBody;
+ boost::shared_ptr<oxygen::RigidBody> mBody;
boost::shared_ptr<oxygen::AgentAspect> mKickedLast;
boost::shared_ptr<BallStateAspect> mBallStateAspect;
};
Modified: branches/multiphys/rcssserver3d/plugin/soccer/beameffector/beameffector.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/beameffector/beameffector.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/beameffector/beameffector.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -23,7 +23,7 @@
#define BEAMEFFECTOR_H
#include <oxygen/agentaspect/effector.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <gamestateaspect/gamestateaspect.h>
class BeamEffector : public oxygen::Effector
@@ -51,7 +51,7 @@
protected:
/** the reference to the parents body node */
- boost::shared_ptr<oxygen::Body> mBody;
+ boost::shared_ptr<oxygen::RigidBody> mBody;
/** the reference to the GameState */
boost::shared_ptr<GameStateAspect> mGameState;
Modified: branches/multiphys/rcssserver3d/plugin/soccer/catcheffector/catcheffector.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/catcheffector/catcheffector.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/catcheffector/catcheffector.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -22,7 +22,7 @@
#define CATCHEFFECTOR_H
#include <oxygen/agentaspect/effector.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <ball/ball.h>
#include <ballstateaspect/ballstateaspect.h>
@@ -33,7 +33,7 @@
namespace oxygen
{
- class Body;
+ class RigidBody;
class AgentAspect;
}
@@ -74,7 +74,7 @@
protected:
/** reference to the body node of the ball */
- boost::shared_ptr<oxygen::Body> mBallBody;
+ boost::shared_ptr<oxygen::RigidBody> mBallBody;
/** reference to the agent aspect */
boost::shared_ptr<oxygen::AgentAspect> mAgent;
/** reference to the agentstate */
Modified: branches/multiphys/rcssserver3d/plugin/soccer/driveeffector/driveeffector.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/driveeffector/driveeffector.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/driveeffector/driveeffector.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -24,7 +24,7 @@
#include <salt/random.h>
#include <oxygen/agentaspect/effector.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <agentstate/agentstate.h>
class DriveEffector : public oxygen::Effector
@@ -84,7 +84,7 @@
/** the reference to the parent transform node */
boost::shared_ptr<oxygen::Transform> mTransformParent;
/** the reference to the parents body node */
- boost::shared_ptr<oxygen::Body> mBody;
+ boost::shared_ptr<oxygen::RigidBody> mBody;
//! a reference to the agent state
boost::shared_ptr<AgentState> mAgentState;
Modified: branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -141,7 +141,7 @@
// parent should be a transform, or some other node, which has a
// Body-child
- mBody = shared_dynamic_cast<Body>(parent->GetChildOfClass("Body"));
+ mBody = shared_dynamic_cast<RigidBody>(parent->GetChildOfClass("RigidBody"));
if (mBody.get() == 0)
{
@@ -268,7 +268,7 @@
if (abs(err) > 0.00001)
{
- shared_ptr<Body> body = joint->GetBody(Joint::BI_FIRST);
+ shared_ptr<RigidBody> body = joint->GetBody(Joint::BI_FIRST);
if (body && !body->IsEnabled())
{
body->Enable();
Modified: branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpeffector.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -23,7 +23,7 @@
#define HMDPEFFECTOR_H
#include <oxygen/agentaspect/effector.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include "naospecific.h"
//! make it possible to have a pointer to the perceptor
@@ -112,7 +112,7 @@
protected:
/** the reference to the parents body node */
- boost::shared_ptr<oxygen::Body> mBody;
+ boost::shared_ptr<oxygen::RigidBody> mBody;
};
DECLARE_CLASS(HMDPEffector)
Modified: branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -23,7 +23,7 @@
#include "hmdpperceptor.h"
#include <zeitgeist/logserver/logserver.h>
#include <oxygen/sceneserver/transform.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <salt/vector.h>
using namespace oxygen;
@@ -51,7 +51,7 @@
shared_ptr<Transform> transformParent = shared_static_cast<Transform> (
FindParentSupportingClass<Transform> ().lock());
- mBody = shared_static_cast<Body> (transformParent->GetChildOfClass("Body"));
+ mBody = shared_static_cast<RigidBody> (transformParent->GetChildOfClass("RigidBody"));
}
void HMDPPerceptor::OnUnlink()
Modified: branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/hmdp_effector/hmdpperceptor.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -24,7 +24,7 @@
#define HMDPPERCEPTOR_H
#include <oxygen/agentaspect/perceptor.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
class HMDPPerceptor: public oxygen::Perceptor
{
@@ -45,7 +45,7 @@
private:
//! reference to the body of which the perceptor is measuring the angle change rate
- boost::shared_ptr<oxygen::Body> mBody;
+ boost::shared_ptr<oxygen::RigidBody> mBody;
};
DECLARE_CLASS(HMDPPerceptor)
Modified: branches/multiphys/rcssserver3d/plugin/soccer/initeffector/initeffector.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/initeffector/initeffector.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/initeffector/initeffector.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -24,7 +24,7 @@
#include <zeitgeist/logserver/logserver.h>
#include <oxygen/agentaspect/agentaspect.h>
#include <oxygen/gamecontrolserver/predicate.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/physicsserver/space.h>
#include <soccerbase/soccerbase.h>
#include <agentstate/agentstate.h>
Modified: branches/multiphys/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -22,7 +22,7 @@
#include <zeitgeist/logserver/logserver.h>
#include <gamestateaspect/gamestateaspect.h>
#include <soccerruleaspect/soccerruleaspect.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/sceneserver/fpscontroller.h>
#include <oxygen/gamecontrolserver/gamecontrolserver.h>
#include <oxygen/agentaspect/agentaspect.h>
@@ -93,7 +93,7 @@
}
// get camera body
- mCameraBody = shared_dynamic_cast<Body>
+ mCameraBody = shared_dynamic_cast<RigidBody>
(GetCore()->Get("/usr/scene/camera/physics"));
if (mCameraBody.get() == 0)
Modified: branches/multiphys/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/internalsoccermonitor/internalsoccerinput.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -28,7 +28,7 @@
namespace oxygen
{
class FPSController;
- class Body;
+ class RigidBody;
class GameControlServer;
}
@@ -88,7 +88,7 @@
boost::shared_ptr<SoccerRuleAspect> mSoccerRule;
/** cached reference to the camera body */
- boost::shared_ptr<oxygen::Body> mCameraBody;
+ boost::shared_ptr<oxygen::RigidBody> mCameraBody;
/** cached reference to the camera body */
boost::shared_ptr<oxygen::FPSController> mFPS;
Modified: branches/multiphys/rcssserver3d/plugin/soccer/kickeffector/kickeffector.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/kickeffector/kickeffector.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/kickeffector/kickeffector.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -25,7 +25,7 @@
#include <salt/random.h>
#include <oxygen/agentaspect/agentaspect.h>
#include <oxygen/agentaspect/effector.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <ball/ball.h>
#include <ballstateaspect/ballstateaspect.h>
@@ -104,7 +104,7 @@
typedef boost::shared_ptr<salt::NormalRNG<> > NormalRngPtr;
/** reference to the body node of the ball */
- boost::shared_ptr<oxygen::Body> mBallBody;
+ boost::shared_ptr<oxygen::RigidBody> mBallBody;
/** reference to the body node of the ball */
boost::shared_ptr<Ball> mBall;
/** reference to the agent aspect */
Modified: branches/multiphys/rcssserver3d/plugin/soccer/pantilteffector/pantilteffector.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/pantilteffector/pantilteffector.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/pantilteffector/pantilteffector.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -24,7 +24,7 @@
#include <salt/random.h>
#include <oxygen/agentaspect/effector.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <agentstate/agentstate.h>
class PanTiltEffector : public oxygen::Effector
@@ -77,7 +77,7 @@
/** the reference to the parent transform node */
boost::shared_ptr<oxygen::Transform> mTransformParent;
/** the reference to the parents body node */
- boost::shared_ptr<oxygen::Body> mBody;
+ boost::shared_ptr<oxygen::RigidBody> mBody;
//! a reference to the agent state
boost::shared_ptr<AgentState> mAgentState;
Modified: branches/multiphys/rcssserver3d/plugin/soccer/soccerbase/soccerbase.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/soccerbase/soccerbase.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/soccerbase/soccerbase.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "soccerbase.h"
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/physicsserver/spherecollider.h>
#include <oxygen/agentaspect/perceptor.h>
#include <oxygen/agentaspect/agentaspect.h>
@@ -94,10 +94,10 @@
bool
SoccerBase::GetAgentBody(const shared_ptr<Transform> transform,
- shared_ptr<Body>& agent_body)
+ shared_ptr<RigidBody>& agent_body)
{
- agent_body = transform->FindChildSupportingClass<Body>(true);
+ agent_body = transform->FindChildSupportingClass<RigidBody>(true);
if (agent_body.get() == 0)
{
@@ -112,7 +112,7 @@
bool
SoccerBase::GetAgentBody(const Leaf& base, TTeamIndex idx,
- int unum, shared_ptr<Body>& agent_body)
+ int unum, shared_ptr<RigidBody>& agent_body)
{
shared_ptr<AgentState> agentState;
shared_ptr<Transform> parent;
@@ -380,7 +380,7 @@
}
bool
-SoccerBase::GetBody(const Leaf& base, shared_ptr<Body>& body)
+SoccerBase::GetBody(const Leaf& base, shared_ptr<RigidBody>& body)
{
shared_ptr<Transform> parent;
if (! GetTransformParent(base,parent))
@@ -390,7 +390,7 @@
return false;
}
- body = shared_dynamic_cast<Body>(parent->FindChildSupportingClass<Body>());
+ body = shared_dynamic_cast<RigidBody>(parent->FindChildSupportingClass<RigidBody>());
if (body.get() == 0)
{
@@ -443,10 +443,10 @@
}
bool
-SoccerBase::GetBallBody(const Leaf& base, shared_ptr<Body>& body)
+SoccerBase::GetBallBody(const Leaf& base, shared_ptr<RigidBody>& body)
{
static shared_ptr<Scene> scene;
- static shared_ptr<Body> bodyRef;
+ static shared_ptr<RigidBody> bodyRef;
if (scene.get() == 0)
{
@@ -462,7 +462,7 @@
if (bodyRef.get() == 0)
{
- bodyRef = shared_dynamic_cast<Body>
+ bodyRef = shared_dynamic_cast<RigidBody>
(base.GetCore()->Get(scene->GetFullPath() + "Ball/physics"));
if (bodyRef.get() == 0)
@@ -647,7 +647,7 @@
Leaf::TLeafList leafList;
- parent->ListChildrenSupportingClass<Body>(leafList, true);
+ parent->ListChildrenSupportingClass<RigidBody>(leafList, true);
if (leafList.size() == 0)
{
@@ -663,8 +663,8 @@
// move all child bodies
for (; iter != leafList.end(); ++iter)
{
- shared_ptr<Body> childBody =
- shared_dynamic_cast<Body>(*iter);
+ shared_ptr<RigidBody> childBody =
+ shared_dynamic_cast<RigidBody>(*iter);
Vector3f childPos = childBody->GetPosition();
@@ -692,7 +692,7 @@
Leaf::TLeafList leafList;
- parent->ListChildrenSupportingClass<Body>(leafList, true);
+ parent->ListChildrenSupportingClass<RigidBody>(leafList, true);
if (leafList.size() == 0)
{
@@ -703,7 +703,7 @@
return false;
}
- shared_ptr<Body> body;
+ shared_ptr<RigidBody> body;
GetAgentBody(agent_aspect, body);
Matrix bodyR = body->GetRotation();
@@ -720,8 +720,8 @@
++iter
)
{
- shared_ptr<Body> childBody =
- shared_dynamic_cast<Body>(*iter);
+ shared_ptr<RigidBody> childBody =
+ shared_dynamic_cast<RigidBody>(*iter);
Vector3f childPos = childBody->GetPosition();
Matrix childR = childBody->GetRotation();
Modified: branches/multiphys/rcssserver3d/plugin/soccer/soccerbase/soccerbase.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/soccerbase/soccerbase.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/soccerbase/soccerbase.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -40,7 +40,7 @@
class Scene;
class Transform;
class Perceptor;
- class Body;
+ class RigidBody;
class SphereCollider;
class ControlAspect;
class AgentAspect;
@@ -84,19 +84,19 @@
/** returns a reference to the Body node below the closest
transform parent */
static bool
- GetBody(const zeitgeist::Leaf& base, boost::shared_ptr<oxygen::Body>& body);
+ GetBody(const zeitgeist::Leaf& base, boost::shared_ptr<oxygen::RigidBody>& body);
/** returns a reference to the Body node below the given Transform
node */
static bool
GetAgentBody(const boost::shared_ptr<oxygen::Transform> transform,
- boost::shared_ptr<oxygen::Body>& agent_body);
+ boost::shared_ptr<oxygen::RigidBody>& agent_body);
/** returns a reference to the Body node below the given Transform
node based on parameters team index and uniform number */
static bool
GetAgentBody(const zeitgeist::Leaf& base, TTeamIndex idx,
- int unum, boost::shared_ptr<oxygen::Body>& agent_body);
+ int unum, boost::shared_ptr<oxygen::RigidBody>& agent_body);
/** returns a reference to the AgentState node below the closest
Transform parent */
@@ -148,7 +148,7 @@
/** returns a reference to the Body node below the Ball */
static bool
GetBallBody(const zeitgeist::Leaf& base,
- boost::shared_ptr<oxygen::Body>& body);
+ boost::shared_ptr<oxygen::RigidBody>& body);
/** returns a reference to the Body SphereCollider node below the Ball */
static bool
Modified: branches/multiphys/rcssserver3d/plugin/soccer/soccercontrolaspect/soccercontrolaspect.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/soccercontrolaspect/soccercontrolaspect.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/soccercontrolaspect/soccercontrolaspect.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -32,7 +32,7 @@
namespace oxygen
{
class RecorderHandler;
- class Body;
+ class RigidBody;
}
/** \class SoccerControlAspect is the base class for all
Modified: branches/multiphys/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -23,7 +23,7 @@
#include <salt/random.h>
#include <zeitgeist/logserver/logserver.h>
#include <oxygen/agentaspect/agentaspect.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/sceneserver/scene.h>
#include <oxygen/gamecontrolserver/gamecontrolserver.h>
#include <soccerbase/soccerbase.h>
@@ -958,7 +958,7 @@
salt::BoundingSphere sphere(pos, mAudioCutDist);
shared_ptr<Transform> transform_parent;
- shared_ptr<Body> agent_body;
+ shared_ptr<RigidBody> agent_body;
for (
TAgentStateList::const_iterator it = agent_states.begin();
@@ -1104,7 +1104,7 @@
opp_defender_pos = 0.0;
shared_ptr<Transform> transform_parent;
- shared_ptr<Body> agent_body;
+ shared_ptr<RigidBody> agent_body;
list<shared_ptr<AgentState> >::const_iterator it;
for (it = opp_agent_states.begin(); it != opp_agent_states.end(); it++)
Modified: branches/multiphys/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -36,7 +36,7 @@
namespace oxygen
{
- class Body;
+ class RigidBody;
class AgentAspect;
class Transform;
}
@@ -193,7 +193,7 @@
protected:
/** reference to the body node of the Ball */
- boost::shared_ptr<oxygen::Body> mBallBody;
+ boost::shared_ptr<oxygen::RigidBody> mBallBody;
/** reference to the GameStateAspect */
CachedPath<GameStateAspect> mGameState;
Modified: branches/multiphys/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -23,7 +23,7 @@
*/
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/gamecontrolserver/gamecontrolserver.h>
#include <soccerbase/soccerbase.h>
#include <agentstate/agentstate.h>
@@ -365,7 +365,7 @@
return;
}
- shared_ptr<Body> body;
+ shared_ptr<RigidBody> body;
if (SoccerBase::GetBallBody(*this, body))
{
@@ -394,7 +394,7 @@
return;
}
- shared_ptr<Body> body;
+ shared_ptr<RigidBody> body;
if (SoccerBase::GetBallBody(*this, body))
{
Modified: branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinput.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -21,7 +21,7 @@
#include <zeitgeist/scriptserver/scriptserver.h>
#include <zeitgeist/logserver/logserver.h>
#include "soccermonitor.h"
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/sceneserver/fpscontroller.h>
using namespace boost;
@@ -68,7 +68,7 @@
}
// get camera body
- mCameraBody = shared_dynamic_cast<Body>
+ mCameraBody = shared_dynamic_cast<RigidBody>
(GetCore()->Get("/usr/scene/camera/physics"));
if (mCameraBody.get() == 0)
Modified: branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinput.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinput.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinput.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -27,7 +27,7 @@
namespace oxygen
{
class FPSController;
- class Body;
+ class RigidBody;
}
class SoccerInput : public kerosin::InputItem
@@ -79,7 +79,7 @@
boost::shared_ptr<oxygen::NetClient> mMonitorClient;
/** cached reference to the camera body */
- boost::shared_ptr<oxygen::Body> mCameraBody;
+ boost::shared_ptr<oxygen::RigidBody> mCameraBody;
boost::shared_ptr<oxygen::FPSController> mFPS;
};
Modified: branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.cpp
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -20,7 +20,7 @@
#include "soccerinputlogplayer.h"
#include <zeitgeist/scriptserver/scriptserver.h>
#include <zeitgeist/logserver/logserver.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
using namespace boost;
using namespace zeitgeist;
@@ -71,7 +71,7 @@
}
// get camera body
- mCameraBody = shared_dynamic_cast<Body>
+ mCameraBody = shared_dynamic_cast<RigidBody>
(GetCore()->Get("/usr/scene/camera/physics"));
if (mCameraBody.get() == 0)
Modified: branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.h
===================================================================
--- branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -72,7 +72,7 @@
boost::shared_ptr<zeitgeist::ScriptServer> mScriptServer;
/** cached reference to the camera body */
- boost::shared_ptr<oxygen::Body> mCameraBody;
+ boost::shared_ptr<oxygen::RigidBody> mCameraBody;
/** cached reference to the camera body */
boost::shared_ptr<oxygen::FPSController> mFPS;
Modified: branches/multiphys/rsgedit/src/property.cpp
===================================================================
--- branches/multiphys/rsgedit/src/property.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rsgedit/src/property.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -33,7 +33,7 @@
#include <oxygen/sceneserver/basenode.h>
#include <oxygen/sceneserver/transform.h>
#include <oxygen/sceneserver/scenedict.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/physicsserver/joint.h>
#include <oxygen/physicsserver/hingejoint.h>
#include <oxygen/physicsserver/universaljoint.h>
@@ -107,7 +107,7 @@
mClassMap[wxT("ClassClass")] = CL_CLASS;
mClassMap[wxT("/classes/oxygen/BaseNode")] = CL_BASENODE;
mClassMap[wxT("/classes/oxygen/Transform")] = CL_TRANSFORM;
- mClassMap[wxT("/classes/oxygen/Body")] = CL_BODY;
+ mClassMap[wxT("/classes/oxygen/RigidBody")] = CL_RIGIDBODY;
mClassMap[wxT("/classes/oxygen/Joint")] = CL_JOINT;
mClassMap[wxT("/classes/oxygen/HingeJoint")] = CL_HINGEJOINT;
mClassMap[wxT("/classes/oxygen/UniversalJoint")] = CL_UNIVERSALJOINT;
@@ -189,7 +189,7 @@
void Property::GenBodyEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const
{
- const Body& body = *shared_static_cast<Body>(leaf);
+ const RigidBody& body = *shared_static_cast<RigidBody>(leaf);
entries.push_back(Entry(wxT("GetMass"),FormatFloat(body.GetMass())));
entries.push_back(Entry(wxT("GetVelocity"),FormatVector3(body.GetVelocity())));
entries.push_back(Entry(wxT("GetAngularVelocity"),FormatVector3(body.GetAngularVelocity())));
@@ -398,7 +398,7 @@
GenTransformEntries(leaf, entries);
break;
- case CL_BODY:
+ case CL_RIGIDBODY:
GenBodyEntries(leaf, entries);
break;
Modified: branches/multiphys/rsgedit/src/sparkglrender.cpp
===================================================================
--- branches/multiphys/rsgedit/src/sparkglrender.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/rsgedit/src/sparkglrender.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -19,7 +19,7 @@
*/
#include "sparkglrender.h"
#include <zeitgeist/logserver/logserver.h>
-#include <oxygen/physicsserver/body.h>
+#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/physicsserver/joint.h>
#include <oxygen/sceneserver/camera.h>
#include <oxygen/sceneserver/sceneserver.h>
@@ -163,7 +163,7 @@
++i
)
{
- shared_ptr<Body> body =
+ shared_ptr<RigidBody> body =
jointNode->GetBody(static_cast<Joint::EBodyIndex>(i));
if (body.get() == 0)
Modified: branches/multiphys/simspark-utilities/data/rsg/agent/ball.rsg
===================================================================
--- branches/multiphys/simspark-utilities/data/rsg/agent/ball.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/simspark-utilities/data/rsg/agent/ball.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -15,7 +15,7 @@
(setScale $Radius $Radius $Radius)
)
- (nd Body
+ (nd RigidBody
(setName physics)
(setSphereTotal $Mass $Radius)
Modified: branches/multiphys/spark/data/rsg/boxspheres/box.rsg
===================================================================
--- branches/multiphys/spark/data/rsg/boxspheres/box.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/data/rsg/boxspheres/box.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -8,7 +8,7 @@
(setMaterial $material)
)
- (nd Body
+ (nd RigidBody
(setName boxBody)
;(setBoxTotal $totalMass $lenX $lenY $lenZ)
(setBox $totalMass $lenX $lenY $lenZ)
@@ -34,4 +34,4 @@
)
)
-)
\ No newline at end of file
+)
Modified: branches/multiphys/spark/data/rsg/boxspheres/box_with_handler.rsg
===================================================================
--- branches/multiphys/spark/data/rsg/boxspheres/box_with_handler.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/data/rsg/boxspheres/box_with_handler.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -8,7 +8,7 @@
(setMaterial $material)
)
- (nd Body
+ (nd RigidBody
(setName boxBody)
;(setBoxTotal $totalMass $lenX $lenY $lenZ)
(setBox $totalMass $lenX $lenY $lenZ)
@@ -36,4 +36,4 @@
;(nd PerceptorHandler)
)
-)
\ No newline at end of file
+)
Modified: branches/multiphys/spark/data/rsg/boxspheres/box_with_handler055.rsg
===================================================================
--- branches/multiphys/spark/data/rsg/boxspheres/box_with_handler055.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/data/rsg/boxspheres/box_with_handler055.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -8,7 +8,7 @@
(setMaterial $material)
)
- (nd Body
+ (nd RigidBody
(setName boxBody)
;(setBoxTotal $totalMass $lenX $lenY $lenZ)
(setBox $totalMass $lenX $lenY $lenZ)
Modified: branches/multiphys/spark/data/rsg/boxspheres/box_with_handler056.rsg
===================================================================
--- branches/multiphys/spark/data/rsg/boxspheres/box_with_handler056.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/data/rsg/boxspheres/box_with_handler056.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -8,7 +8,7 @@
(setMaterial $material)
)
- (nd Body
+ (nd RigidBody
(setName boxBody)
;(setBoxTotal $totalMass $lenX $lenY $lenZ)
(setBox $totalMass $lenX $lenY $lenZ)
@@ -36,4 +36,4 @@
;(nd PerceptorHandler)
)
-)
\ No newline at end of file
+)
Modified: branches/multiphys/spark/data/rsg/boxspheres/ccylinder.rsg
===================================================================
--- branches/multiphys/spark/data/rsg/boxspheres/ccylinder.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/data/rsg/boxspheres/ccylinder.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -9,7 +9,7 @@
(setMaterial $material)
)
- (nd Body
+ (nd RigidBody
(setName ccylinderBody)
;(setCappedCylinderTotal $totalMass $radius $length)
(setCappedCylinder $totalMass $radius $length)
Modified: branches/multiphys/spark/data/rsg/boxspheres/sphere.rsg
===================================================================
--- branches/multiphys/spark/data/rsg/boxspheres/sphere.rsg 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/data/rsg/boxspheres/sphere.rsg 2009-11-25 06:09:10 UTC (rev 107)
@@ -9,7 +9,7 @@
(setMaterial $material)
)
- (nd Body
+ (nd RigidBody
(setName sphereBody)
;(setSphereTotal $totalMass $radius)
(setSphere $totalMass $radius)
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-25 06:09:10 UTC (rev 107)
@@ -16,6 +16,7 @@
oxygen_defines.h
physicsserver/physicsobject.h
physicsserver/body.h
+ physicsserver/rigidbody.h
physicsserver/bodycontroller.h
physicsserver/boxcollider.h
physicsserver/ccylindercollider.h
@@ -109,8 +110,9 @@
oxygen.cpp
physicsserver/physicsobject.cpp
physicsserver/physicsobject_c.cpp
- physicsserver/body.cpp
physicsserver/body_c.cpp
+ physicsserver/rigidbody.cpp
+ physicsserver/rigidbody_c.cpp
physicsserver/bodycontroller.cpp
physicsserver/bodycontroller_c.cpp
physicsserver/transformcollider.cpp
Modified: branches/multiphys/spark/lib/oxygen/oxygen.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -55,6 +55,7 @@
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(RigidBody), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(BodyController), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(DragController), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(VelocityController), "oxygen/");
Modified: branches/multiphys/spark/lib/oxygen/oxygen.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -37,6 +37,7 @@
//abstract physics classes
#include <oxygen/physicsserver/physicsobject.h>
#include "physicsserver/body.h"
+#include "physicsserver/rigidbody.h"
#include "physicsserver/bodycontroller.h"
#include "physicsserver/dragcontroller.h"
#include "physicsserver/velocitycontroller.h"
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -25,7 +25,7 @@
namespace oxygen
{
-class Body;
+class RigidBody;
/** An angular motor allows the relative angular velocities of two
bodies to be controlled. The angular velocity can be controlled on
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.h 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/balljoint.h 2009-11-25 06:09:10 UTC (rev 107)
@@ -25,7 +25,7 @@
namespace oxygen
{
-class Body;
+class RigidBody;
class OXYGEN_API BallJoint : public Joint
{
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-11-19 10:10:50 UTC (rev 106)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-11-25 06:09:10 UTC (rev 107)
@@ -1,559 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
- this file is part of rcssserver3D
- Fri May 9 2003
- Copyright (C) 2003 Koblenz University
- $Id$
-
- 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 "body.h"
-#include "world.h"
-#include "../sceneserver/scene.h"
-#include "zeitgeist/logserver/logserver.h"
-#include "../sceneserver/transform.h"
-#include "transformcollider.h"
-
-using namespace boost;
-using namespace oxygen;
-using namespace salt;
-using namespace std;
-
-Body::Body() : PhysicsObject(), mODEBody(0), mMassTrans(0,0,0), mMassTransformed(false)
-{
-}
-
-Body::~Body()
-{
-}
-
-dBodyID Body::GetODEBody() const
-{
- return mODEBody;
-}
-
-void Body::Enable()
-{
- dBodyEnable(mODEBody);
-}
-
-void Body::Disable()
-{
- dBodyDisable(mODEBody);
-}
-
-bool Body::IsEnabled() const
-{
- return (dBodyIsEnabled(mODEBody) != 0);
-}
-
-void Body::UseGravity(bool f)
-{
- if (f == true)
- {
- // body is affected by gravity
- dBodySetGravityMode(mODEBody, 1);
- }
- else
- {
- // body is not affected by gravity
- dBodySetGravityMode(mODEBody, 0);
- }
-}
-
-bool Body::UsesGravity() const
-{
- return (dBodyGetGravityMode(mODEBody) != 0);
-}
-
-bool Body::CreateBody()
-{
- if (mODEBody != 0)
- {
- return true;
- }
-
- dWorldID world = GetWorldID();
- if (world == 0)
- {
- return false;
- }
-
- // create the managed body
- mODEBody = dBodyCreate(world);
- if (mODEBody == 0)
- {
- GetLog()->Error()
- << "(Body) ERROR: could not create new ODE body\n";
- return false;
- }
-
- return true;
-}
-
-void Body::DestroyODEObject()
-{
- if (mODEBody == 0)
- {
- return;
- }
-
- dBodyDestroy(mODEBody);
- mODEBody = 0;
-}
-
-void Body::OnLink()
-{
- PhysicsObject::OnLink();
-
- if (! CreateBody())
- {
- return;
- }
-
- // let the body, take on the world space position of the parent
- dBodySetData(mODEBody, this);
-
- shared_ptr<BaseNode> baseNode = shared_static_cast<BaseNode>
- (GetParent().lock());
-
- const Matrix& mat = baseNode->GetWorldTransform();
- SetRotation(mat);
- SetPosition(mat.Pos());
-}
-
-void
-Body::SetMass(float mass)
-{
- dMass ODEMass;
- dBodyGetMass(mODEBody, &ODEMass);
- dMassAdjust(&ODEMass, mass);
- dBodySetMass(mODEBody, &ODEMass);
-}
-
-float
-Body::GetMass() const
-{
- dMass m;
- dBodyGetMass(mODEBody, &m);
- return m.mass;
-}
-
-void Body::GetMassParameters(dMass& mass) const
-{
- dBodyGetMass(mODEBody, &mass);
-}
-
-void Body::SetMassParameters(const dMass& mass)
-{
- dBodySetMass(mODEBody, &mass);
-}
-
-void Body::PrepareSphere(dMass& mass, float density, float radius) const
-{
- dMassSetSphere(&mass, density, radius);
-}
-
-void Body::SetSphere(float density, float radius)
-{
- dMass ODEMass;
- PrepareSphere(ODEMass, density, radius);
- dBodySetMass(mODEBody, &ODEMass);
-}
-
-void Body::AddSphere(float density, float radius, const Matrix& matrix)
-{
- dMass ODEMass;
- PrepareSphere(ODEMass, density, radius);
- AddMass(ODEMass, matrix);
-}
-
-void Body::PrepareSphereTotal(dMass& mass, float total_mass, float radius) const
-{
- dMassSetSphereTotal(&mass, total_mass, radius);
-}
-
-void Body::SetSphereTotal(float total_mass, float radius)
-{
- dMass ODEMass;
- PrepareSphereTotal(ODEMass, total_mass, radius);
- dBodySetMass(mODEBody, &ODEMass);
-}
-
-void Body::AddSphereTotal(float total_mass, float radius, const Matrix& matrix)
-{
- dMass ODEMass;
- PrepareSphereTotal(ODEMass, total_mass, radius);
- AddMass(ODEMass, matrix);
-}
-
-void Body::PrepareBox(dMass& mass, float density, const Vector3f& size) const
-{
- dMassSetBox(&mass, density, size[0], size[1], size[2]);
-}
-
-void Body::SetBox(float density, const Vector3f& size)
-{
- dMass ODEMass;
- PrepareBox(ODEMass, density, size);
- dBodySetMass(mODEBody, &ODEMass);
-}
-
-void Body::AddBox(float density, const Vector3f& size, const Matrix& matrix)
-{
- dMass ODEMass;
- PrepareBox(ODEMass, density, size);
- AddMass(ODEMass, matrix);
-}
-
-void Body::PrepareBoxTotal(dMass& mass, float total_mass, const Vector3f& size) const
-{
- dMassSetBoxTotal(&mass, total_mass, size[0], size[1], size[2]);
-}
-
-void Body::SetBoxTotal(float total_mass, const Vector3f& size)
-{
- dMass ODEMass;
- PrepareBoxTotal(ODEMass, total_mass, size);
- dBodySetMass(mODEBody, &ODEMass);
-}
-
-void Body::AddBoxTotal(float total_mass, const Vector3f& size, const Matrix& matrix)
-{
- dMass ODEMass;
- PrepareBoxTotal(ODEMass, total_mass, size);
- AddMass(ODEMass, matrix);
-}
-/*
- dMass ODEMass;
- dBodyGetMass(mODEBody, &ODEMass);
- Vector3f trans(ODEMass.c[0], ODEMass.c[1], ODEMass.c[2]);
-
- if (trans.SquareLength() > 0)
- {
- mOrigin = mOrigin - trans;
- GetLog()->Warning() << "(Body::CenterMass) New origin: " << mOrigin << "\n";
-
- dMassTranslate(&ODEMass, -trans[0], -trans[1], -trans[2]);
- dBodySetMass(mODEBody, &ODEMass);
-
- Vector3f position = GetPosition();
- position = position + trans;
- SetPosition(position);
-
- mCOMShifted = true;
- }
-*/
-void Body::AddMass(const dMass& mass, const Matrix& matrix)
-{
- dMass transMass(mass);
-
- dMatrix3 rot;
- ConvertRotationMatrix(matrix, rot);
- dMassRotate(&transMass,rot);
-
- const Vector3f& trans(matrix.Pos());
- dMassTranslate(&transMass,trans[0],trans[1],trans[2]);
-
- dMassTranslate(&transMass,mMa...
[truncated message content] |
|
From: <a-...@us...> - 2009-11-19 10:10:58
|
Revision: 106
http://simspark.svn.sourceforge.net/simspark/?rev=106&view=rev
Author: a-held
Date: 2009-11-19 10:10:50 +0000 (Thu, 19 Nov 2009)
Log Message:
-----------
implemented bridge pattern for at least some methods in the Space class
replaced ODEObject with a neutrally named PhysicsObject class
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/angularmotor.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/collider.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/collider_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/joint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/space.h
branches/multiphys/spark/lib/oxygen/physicsserver/space_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.h
branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
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-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-19 10:10:50 UTC (rev 106)
@@ -14,6 +14,7 @@
gamecontrolserver/behavior.h
oxygen.h
oxygen_defines.h
+ physicsserver/physicsobject.h
physicsserver/body.h
physicsserver/bodycontroller.h
physicsserver/boxcollider.h
@@ -44,7 +45,6 @@
physicsserver/int/worldint.h
#ode-specific files
- physicsserver/ode/odeobject.h
physicsserver/ode/odeworld.h
physicsserver/ode/odewrapper.h
@@ -107,6 +107,8 @@
gamecontrolserver/behavior.cpp
gamecontrolserver/behavior_c.cpp
oxygen.cpp
+ physicsserver/physicsobject.cpp
+ physicsserver/physicsobject_c.cpp
physicsserver/body.cpp
physicsserver/body_c.cpp
physicsserver/bodycontroller.cpp
@@ -167,8 +169,6 @@
physicsserver/ode/odespace_c.cpp
physicsserver/ode/odeworld.cpp
physicsserver/ode/odeworld_c.cpp
- physicsserver/ode/odeobject.cpp
- physicsserver/ode/odeobject_c.cpp
sceneserver/basenode.cpp
sceneserver/basenode_c.cpp
Modified: branches/multiphys/spark/lib/oxygen/oxygen.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -53,6 +53,7 @@
// 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/");
@@ -85,10 +86,6 @@
zg.GetCore()->RegisterClassObject(new CLASS(AgentAspect), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Effector), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Perceptor), "oxygen/");
-
- //ODE-specific classes
- zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/");
-
#ifdef HAVE_SPADES_HEADERS
// spades
Modified: branches/multiphys/spark/lib/oxygen/oxygen.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -35,6 +35,7 @@
#include "gamecontrolserver/behavior.h"
//abstract physics classes
+#include <oxygen/physicsserver/physicsobject.h>
#include "physicsserver/body.h"
#include "physicsserver/bodycontroller.h"
#include "physicsserver/dragcontroller.h"
@@ -60,9 +61,6 @@
#include "physicsserver/universaljoint.h"
#include "physicsserver/hinge2joint.h"
-//ode-specific includes
-#include <oxygen/physicsserver/ode/odeobject.h>
-
#include "sceneserver/basenode.h"
#include "sceneserver/camera.h"
#include "sceneserver/fpscontroller.h"
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/angularmotor.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -21,7 +21,7 @@
#define OXYGEN_ANGULARMOTOR_H
#include <oxygen/oxygen_defines.h>
-#include "joint.h"
+#include <oxygen/physicsserver/joint.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -30,7 +30,7 @@
using namespace salt;
using namespace std;
-Body::Body() : ODEObject(), mODEBody(0), mMassTrans(0,0,0), mMassTransformed(false)
+Body::Body() : PhysicsObject(), mODEBody(0), mMassTrans(0,0,0), mMassTransformed(false)
{
}
@@ -115,7 +115,7 @@
void Body::OnLink()
{
- ODEObject::OnLink();
+ PhysicsObject::OnLink();
if (! CreateBody())
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -23,7 +23,7 @@
#define OXYGEN_BODY_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/physicsobject.h>
namespace oxygen
{
@@ -36,7 +36,7 @@
usually constant over time: Mass, Center of mass and Inertia
matrix (mass distribution matrix)
*/
-class OXYGEN_API Body : public ODEObject
+class OXYGEN_API Body : public PhysicsObject
{
//
// Functions
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -568,7 +568,7 @@
void CLASS(Body)::DefineClass()
{
- DEFINE_BASECLASS(oxygen/ODEObject);
+ DEFINE_BASECLASS(oxygen/PhysicsObject);
DEFINE_FUNCTION(enable);
DEFINE_FUNCTION(disable);
DEFINE_FUNCTION(isEnabled);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -32,7 +32,7 @@
using namespace boost;
using namespace std;
-Collider::Collider() : ODEObject(), mODEGeom(0)
+Collider::Collider() : PhysicsObject(), mODEGeom(0)
{
}
@@ -42,7 +42,7 @@
void Collider::OnLink()
{
- ODEObject::OnLink();
+ PhysicsObject::OnLink();
weak_ptr<Node> parent = GetParent();
@@ -95,7 +95,7 @@
void Collider::OnUnlink()
{
- ODEObject::OnUnlink();
+ PhysicsObject::OnUnlink();
// remove collision geometry from space
dSpaceID space = GetParentSpaceID();
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_COLLIDER_H
#define OXYGEN_COLLIDER_H
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/physicsobject.h>
#include <string>
#include <set>
#include <oxygen/oxygen_defines.h>
@@ -42,7 +42,7 @@
bodies. A body and a geom together represent all the properties of
the simulated object.
*/
-class OXYGEN_API Collider : public ODEObject
+class OXYGEN_API Collider : public PhysicsObject
{
//
// Functions
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider_c.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider_c.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -104,10 +104,10 @@
void CLASS(Collider)::DefineClass()
{
+ DEFINE_BASECLASS(oxygen/PhysicsObject);
DEFINE_FUNCTION(setPosition);
DEFINE_FUNCTION(setLocalPosition);
DEFINE_FUNCTION(setRotation);
DEFINE_FUNCTION(addCollisionHandler);
DEFINE_FUNCTION(addNotCollideWithColliderName);
- DEFINE_BASECLASS(oxygen/ODEObject);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/int/spaceint.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -23,7 +23,7 @@
#ifndef OXYGEN_SPACEINT_H
#define OXYGEN_SPACEINT_H
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/physicsobject.h>
#include <set>
#include <oxygen/oxygen_defines.h>
@@ -33,20 +33,20 @@
class Body;
class Collider;
-class OXYGEN_API SpaceInt : public ODEObject
+class OXYGEN_API SpaceInt : public PhysicsObject
{
public:
typedef std::set<dSpaceID> TSpaceIdSet;
- SpaceInt() : ODEObject(){};
+ SpaceInt() : PhysicsObject(){};
virtual ~SpaceInt(){};
//virtual void collisionNearCallback (void *data, dGeomID obj1, dGeomID obj2) = 0;
virtual dSpaceID GetODESpace() const = 0;
virtual dJointGroupID GetODEJointGroup() const = 0;
virtual void Collide() = 0;
- virtual void DestroyODEObject() = 0;
+ virtual void DestroyPhysicsObject() = 0;
virtual dSpaceID GetParentSpaceID() = 0;
virtual bool IsGlobalSpace() = 0;
virtual void DisableInnerCollision(bool disable) = 0;
@@ -59,6 +59,8 @@
virtual bool ConstructInternal() = 0;
virtual void PostPhysicsUpdateInternal() = 0;
virtual void DestroySpaceObjects() = 0;
+
+ boost::shared_ptr<Scene> scene;
};
DECLARE_ABSTRACTCLASS(SpaceInt);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -27,7 +27,7 @@
using namespace salt;
Joint::Joint() :
-ODEObject(), mODEJoint(0),
+PhysicsObject(), mODEJoint(0),
mJointMaxSpeed1(0), mJointMaxSpeed2(0),
mIsLimitJointMaxSpeed1(false), mIsLimitJointMaxSpeed2(false)
{
@@ -431,7 +431,7 @@
return GetParameter(dParamFMax + (idx * dParamGroup));
}
-void Joint::DestroyODEObject()
+void Joint::DestroyPhysicsObject()
{
if (! mODEJoint)
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -23,7 +23,7 @@
#define OXYGEN_JOINT_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/physicsobject.h>
namespace oxygen
{
@@ -47,7 +47,7 @@
rates) directly, instead you must set the corresponding body
positions and velocities.
*/
-class OXYGEN_API Joint : public ODEObject
+class OXYGEN_API Joint : public PhysicsObject
{
public:
enum EBodyIndex
@@ -67,7 +67,7 @@
virtual ~Joint();
/** destroy the managed ODE object */
- virtual void DestroyODEObject();
+ virtual void DestroyPhysicsObject();
/** attaches the joint to some new bodies. If the joint is already
attached, it will be detached from the old bodies first. To
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint_c.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint_c.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -547,7 +547,7 @@
void CLASS(Joint)::DefineClass()
{
- DEFINE_BASECLASS(oxygen/ODEObject);
+ DEFINE_BASECLASS(oxygen/PhysicsObject);
DEFINE_FUNCTION(attach);
DEFINE_FUNCTION(setHighStopDeg);
DEFINE_FUNCTION(getHighStopDeg);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -40,23 +40,23 @@
//
// Functions
//
- ODEObject();
- virtual ~ODEObject();
+ ODEObject(){};
+ virtual ~ODEObject(){};
/** 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();
+ virtual void OnUnlink(){};
/** returns the ODE world handle */
- dWorldID GetWorldID();
+ dWorldID GetWorldID(){};
/** returns the nearest parent space ODE handle */
- dSpaceID FindSpaceID();
+ dSpaceID FindSpaceID(){};
/** returns the ODE handle ID of the containing parent space */
- virtual dSpaceID GetParentSpaceID();
+ virtual dSpaceID GetParentSpaceID(){};
/** destroy the managed ODE object */
virtual void DestroyODEObject(){};
@@ -66,7 +66,7 @@
boost::shared_ptr<World> GetWorld();
/** finds the nearest parent space node */
- boost::shared_ptr<Space> GetSpace();
+ boost::shared_ptr<Space> GetSpace(){};
/** converts the rotation part of a salt::Matrix to an ODE
dMatrix3 */
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -184,12 +184,12 @@
void ODESpace::OnUnlink()
{
DisableInnerCollision(false);
- ODEObject::OnUnlink();
+ PhysicsObject::OnUnlink();
}
void ODESpace::OnLink()
{
- ODEObject::OnLink();
+ PhysicsObject::OnLink();
shared_ptr<Space> space = GetSpace();
dSpaceID spaceId = 0;
@@ -237,7 +237,6 @@
void ODESpace::DestroySpaceObjects()
{
- shared_ptr<Scene> scene = GetScene();
if (scene.get() == 0)
{
return;
@@ -245,7 +244,7 @@
TLeafList objects;
const bool recursive = true;
- scene->ListChildrenSupportingClass<ODEObject>(objects, recursive);
+ scene->ListChildrenSupportingClass<PhysicsObject>(objects, recursive);
bool globalSpace = IsGlobalSpace();
shared_ptr<Space> self = shared_static_cast<Space>(GetSelf().lock());
@@ -256,7 +255,7 @@
++iter
)
{
- shared_ptr<ODEObject> object = shared_static_cast<ODEObject>(*iter);
+ shared_ptr<PhysicsObject> object = shared_static_cast<PhysicsObject>(*iter);
if (object == self)
{
continue;
@@ -273,12 +272,12 @@
(parentSpace == mODESpace)
)
{
- object->DestroyODEObject();
+ object->DestroyPhysicsObject();
}
}
}
-void ODESpace::DestroyODEObject()
+void ODESpace::DestroyPhysicsObject()
{
if (! mODESpace)
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -41,7 +41,7 @@
dSpaceID GetODESpace() const;
dJointGroupID GetODEJointGroup() const;
void Collide();
- virtual void DestroyODEObject();
+ virtual void DestroyPhysicsObject();
virtual dSpaceID GetParentSpaceID();
bool IsGlobalSpace();
void DisableInnerCollision(bool disable);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -122,7 +122,7 @@
shared_ptr<Space> space = GetSpace();
if (space.get() != 0)
{
- space->DestroyODEObject();
+ space->DestroyPhysicsObject();
}
if (mODEWorld == 0)
Added: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -0,0 +1,167 @@
+/* -*- 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.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>
+#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;
+
+PhysicsObject::PhysicsObject() : BaseNode()
+{
+}
+
+PhysicsObject::~PhysicsObject()
+{
+}
+
+void PhysicsObject::OnUnlink()
+{
+ DestroyPhysicsObject();
+}
+
+/** returns the world node */
+shared_ptr<World> PhysicsObject::GetWorld()
+{
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<World>();
+ }
+
+ shared_ptr<World> worldNode = shared_dynamic_cast<World>
+ (scene->GetChildOfClass("World"));
+ if (worldNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
+ }
+
+ return worldNode;
+}
+
+shared_ptr<Space> PhysicsObject::GetSpace()
+{
+ // try to find the nearest parent space object
+ weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
+ if (! parentSpace.expired())
+ {
+ return parentSpace.lock();
+ }
+
+ // return the global space instance
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<Space>();
+ }
+
+ shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
+ (scene->GetChildOfClass("Space"));
+ if (spaceNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
+ }
+
+ return spaceNode;
+}
+
+dWorldID PhysicsObject::GetWorldID()
+{
+ shared_ptr<World> world = GetWorld();
+ if (world.get() == 0)
+ {
+ return 0;
+ }
+
+ dWorldID worldId = world->GetODEWorld();
+ if (worldId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: World returned empty ODE handle\n";
+ }
+
+ return worldId;
+}
+
+dSpaceID PhysicsObject::FindSpaceID()
+{
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() == 0)
+ {
+ return 0;
+ }
+
+ dSpaceID spaceId = space->GetODESpace();
+
+ if (spaceId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: Space returned empty ODE handle\n";
+ }
+
+ return spaceId;
+}
+
+dSpaceID PhysicsObject::GetParentSpaceID()
+{
+ return 0;
+}
+
+void PhysicsObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+{
+ matrix[0] = rot.m[0];
+ matrix[1] = rot.m[4];
+ matrix[2] = rot.m[8];
+ matrix[3] = 0;
+ matrix[4] = rot.m[1];
+ matrix[5] = rot.m[5];
+ matrix[6] = rot.m[9];
+ matrix[7] = 0;
+ matrix[8] = rot.m[2];
+ matrix[9] = rot.m[6];
+ matrix[10] = rot.m[10];
+ matrix[11] = 0;
+}
+
+void PhysicsObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+{
+ rot.m[0] = matrix[0] ;
+ rot.m[4] = matrix[1] ;
+ rot.m[8] = matrix[2];
+ rot.m[12] = matrix[3];
+ rot.m[1] = matrix[4];
+ rot.m[5] = matrix[5];
+ rot.m[9] = matrix[6];
+ rot.m[13] = matrix[7];
+ rot.m[2] = matrix[8];
+ rot.m[6] = matrix[9];
+ rot.m[10] = matrix[10] ;
+ rot.m[14] = matrix[11];
+ rot.m[3] = 0.0;
+ rot.m[7] = 0.0;
+ rot.m[11] = 0.0;
+ rot.m[15] = 1.0;
+}
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-19 10:10:50 UTC (rev 106)
@@ -0,0 +1,83 @@
+/* -*- 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/sceneserver/basenode.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
+
+namespace oxygen
+{
+class Space;
+class World;
+
+/** ODEObject is the base of all classes encapsulating ODE concepts
+ */
+class OXYGEN_API PhysicsObject : public BaseNode
+{
+public:
+ //
+ // Functions
+ //
+ PhysicsObject();
+ 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();
+
+ /** returns the ODE world handle */
+ dWorldID GetWorldID();
+
+ /** returns the nearest parent space ODE handle */
+ dSpaceID FindSpaceID();
+
+ /** returns the ODE handle ID of the containing parent space */
+ virtual dSpaceID GetParentSpaceID();
+
+ /** destroy the managed ODE object */
+ virtual void DestroyPhysicsObject(){};
+
+protected:
+ /** returns the world node */
+ boost::shared_ptr<World> GetWorld();
+
+ /** finds the nearest parent space node */
+ boost::shared_ptr<Space> GetSpace();
+
+ /** converts the rotation part of a salt::Matrix to an ODE
+ dMatrix3 */
+ void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
+
+ /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
+ void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+};
+
+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-19 10:10:50 UTC (rev 106)
@@ -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/lib/oxygen/physicsserver/space.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/space.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -19,9 +19,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "space.h"
-#include "world.h"
-#include "collider.h"
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/physicsserver/ode/odespace.h>
+#include <oxygen/physicsserver/collider.h>
+#include <oxygen/physicsserver/world.h>
#include <oxygen/sceneserver/scene.h>
#include <zeitgeist/logserver/logserver.h>
@@ -37,8 +38,9 @@
space->HandleCollide(obj1, obj2);
}
-Space::Space() : ODEObject(), mODESpace(0), mODEContactGroup(0)
+Space::Space() : PhysicsObject(), mODESpace(0)
{
+ mSpaceImp = shared_ptr<ODESpace>(new ODESpace());
}
Space::~Space()
@@ -47,12 +49,12 @@
dSpaceID Space::GetODESpace() const
{
- return mODESpace;
+ return mSpaceImp->GetODESpace();
}
dJointGroupID Space::GetODEJointGroup() const
{
- return mODEContactGroup;
+ return mSpaceImp->GetODEJointGroup();
}
void Space::Collide()
@@ -182,13 +184,13 @@
void Space::OnUnlink()
{
- DisableInnerCollision(false);
- ODEObject::OnUnlink();
+ mSpaceImp->DisableInnerCollision(false);
+ PhysicsObject::OnUnlink();
}
void Space::OnLink()
{
- ODEObject::OnLink();
+ PhysicsObject::OnLink();
shared_ptr<Space> space = GetSpace();
dSpaceID spaceId = 0;
@@ -199,136 +201,49 @@
}
mODESpace = dHashSpaceCreate(spaceId);
+
+ shared_ptr<ODESpace> odespace = shared_static_cast<ODESpace>(mSpaceImp);
+ odespace->mODESpace = mODESpace;
}
dSpaceID Space::GetParentSpaceID()
{
- if (mODESpace == 0)
- {
- return 0;
- }
-
- return dGeomGetSpace((dGeomID)mODESpace);
+ return mSpaceImp->GetParentSpaceID();
}
bool Space::IsGlobalSpace()
{
- return
- (
- (mODESpace != 0) &&
- (GetParentSpaceID() == 0)
- );
+ return mSpaceImp->IsGlobalSpace();
}
bool Space::ConstructInternal()
{
- // create a joint group for the contacts
- mODEContactGroup = dJointGroupCreate(0);
-
- return (mODEContactGroup != 0);
+ return mSpaceImp->ConstructInternal();
}
void Space::PostPhysicsUpdateInternal()
{
- // remove all contact joints
- dJointGroupEmpty (mODEContactGroup);
+ mSpaceImp->PostPhysicsUpdateInternal();
}
-void
-Space::DestroySpaceObjects()
+void Space::DestroySpaceObjects()
{
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- return;
- }
-
- TLeafList objects;
- const bool recursive = true;
- scene->ListChildrenSupportingClass<ODEObject>(objects, recursive);
-
- bool globalSpace = IsGlobalSpace();
- shared_ptr<Space> self = shared_static_cast<Space>(GetSelf().lock());
-
- for (
- TLeafList::iterator iter = objects.begin();
- iter != objects.end();
- ++iter
- )
- {
- shared_ptr<ODEObject> object = shared_static_cast<ODEObject>(*iter);
- if (object == self)
- {
- continue;
- }
-
- // destroy objects registered to this space; the top level
- // space object also destroy any other ODE object
- const dSpaceID parentSpace = object->GetParentSpaceID();
- if (
- (
- (globalSpace) &&
- (parentSpace == 0)
- ) ||
- (parentSpace == mODESpace)
- )
- {
- object->DestroyODEObject();
- }
- }
+ mSpaceImp->scene = GetScene();
+
+ mSpaceImp->DestroySpaceObjects();
}
-void
-Space::DestroyODEObject()
+void Space::DestroyPhysicsObject()
{
- if (! mODESpace)
- {
- return;
- }
-
- // make sure that all objects registered to this space are destroyed
- // before this space. Any other order provokes a segfault in ODE.
- DestroySpaceObjects();
-
- if (mODEContactGroup)
- {
- dJointGroupDestroy(mODEContactGroup);
- mODEContactGroup = 0;
- }
-
- // release the ODE space
- dSpaceDestroy(mODESpace);
- mODESpace = 0;
+ mSpaceImp->DestroyPhysicsObject();
}
void Space::DisableInnerCollision(bool disable)
{
- if (mODESpace == 0)
- {
- //assert(false);
- return;
- }
-
- if (disable)
- {
- gDisabledInnerCollisionSet.insert(mODESpace);
- return;
- }
-
- TSpaceIdSet::iterator iter = gDisabledInnerCollisionSet.find(mODESpace);
- if (iter == gDisabledInnerCollisionSet.end())
- {
- return;
- }
-
- gDisabledInnerCollisionSet.erase(iter);
+ mSpaceImp->DisableInnerCollision(disable);
}
bool Space::GetDisableInnerCollision() const
{
- TSpaceIdSet::const_iterator iter
- = gDisabledInnerCollisionSet.find(mODESpace);
-
- return (iter != gDisabledInnerCollisionSet.end());
+ return mSpaceImp->GetDisableInnerCollision();
}
-
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/space.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/space.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/space.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_SPACE_H
#define OXYGEN_SPACE_H
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/physicsobject.h>
#include <set>
#include <oxygen/oxygen_defines.h>
@@ -31,13 +31,14 @@
class Transform;
class Body;
class Collider;
+class SpaceInt;
/** Space encapsulates an ODE space object. A space is a non-placeable
geometry object ('geom') that can contain other geoms. It is
similar to the rigid body concept of the `world', except that it
applies to collision instead of dynamics.
*/
-class OXYGEN_API Space : public ODEObject
+class OXYGEN_API Space : public PhysicsObject
{
public:
typedef std::set<dSpaceID> TSpaceIdSet;
@@ -61,7 +62,7 @@
void Collide();
/** destroy the managed ODE object */
- virtual void DestroyODEObject();
+ virtual void DestroyPhysicsObject();
/** returns the ODE handle ID of the containing parent space */
virtual dSpaceID GetParentSpaceID();
@@ -115,12 +116,11 @@
// Members
//
private:
+ boost::shared_ptr<SpaceInt> mSpaceImp;
+
/** the managed ODE space */
dSpaceID mODESpace;
- /** the ODE group for all created contact joints */
- dJointGroupID mODEContactGroup;
-
private:
/** set of spaces with disabled inner collision */
static TSpaceIdSet gDisabledInnerCollisionSet;
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/space_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/space_c.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/space_c.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -38,6 +38,6 @@
void CLASS(Space)::DefineClass()
{
- DEFINE_BASECLASS(oxygen/ODEObject);
+ DEFINE_BASECLASS(oxygen/PhysicsObject);
DEFINE_FUNCTION(disableInnerCollision);
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -28,7 +28,7 @@
using namespace oxygen;
using namespace salt;
-World::World() : ODEObject()
+World::World() : PhysicsObject()
{
mWorldImp = shared_ptr<ODEWorld>(new ODEWorld());
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-11-19 10:10:50 UTC (rev 106)
@@ -23,7 +23,7 @@
#define OXYGEN_WORLD_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/physicsobject.h>
namespace oxygen
{
@@ -38,7 +38,7 @@
time, thus one reason to use separate worlds is to simulate
systems at different rates.
*/
-class OXYGEN_API World : public ODEObject
+class OXYGEN_API World : public PhysicsObject
{
//
// Functions
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-19 06:56:32 UTC (rev 105)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-19 10:10:50 UTC (rev 106)
@@ -127,7 +127,7 @@
void CLASS(World)::DefineClass()
{
- DEFINE_BASECLASS(oxygen/ODEObject);
+ DEFINE_BASECLASS(oxygen/PhysicsObject);
DEFINE_FUNCTION(setGravity);
DEFINE_FUNCTION(setERP);
DEFINE_FUNCTION(getERP);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-11-19 06:56:40
|
Revision: 105
http://simspark.svn.sourceforge.net/simspark/?rev=105&view=rev
Author: a-held
Date: 2009-11-19 06:56:32 +0000 (Thu, 19 Nov 2009)
Log Message:
-----------
renamed imp folder to int to ensure consistency with include paths
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/int/
Removed Paths:
-------------
branches/multiphys/spark/lib/oxygen/physicsserver/imp/
Property changes on: branches/multiphys/spark/lib/oxygen/physicsserver/int
___________________________________________________________________
Added: svn:mergeinfo
+ /trunk/spark/lib/oxygen/physicsserver/imp:95-101
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-11-19 06:49:34
|
Revision: 104
http://simspark.svn.sourceforge.net/simspark/?rev=104&view=rev
Author: a-held
Date: 2009-11-19 06:49:26 +0000 (Thu, 19 Nov 2009)
Log Message:
-----------
removed unnecessary Imp suffixes and redundant documentation
changed name of Imp folder to Int (since they are INTerfaces)
prepared bridge pattern for spaces
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/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.h
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/imp/
branches/multiphys/spark/lib/oxygen/physicsserver/imp/spaceint.h
branches/multiphys/spark/lib/oxygen/physicsserver/imp/spaceint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldint.h
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldint_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace_c.cpp
Removed Paths:
-------------
branches/multiphys/spark/lib/oxygen/physicsserver/imp/
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-18 07:42:23 UTC (rev 103)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-19 06:49:26 UTC (rev 104)
@@ -41,7 +41,7 @@
physicsserver/angularmotor.h
#interfaces
- physicsserver/imp/worldimp.h
+ physicsserver/int/worldint.h
#ode-specific files
physicsserver/ode/odeobject.h
@@ -159,9 +159,12 @@
physicsserver/angularmotor_c.cpp
#interfaces
- physicsserver/imp/worldimp_c.cpp
+ physicsserver/int/worldint_c.cpp
+ physicsserver/int/spaceint_c.cpp
#ODE-specific files
+ physicsserver/ode/odespace.cpp
+ physicsserver/ode/odespace_c.cpp
physicsserver/ode/odeworld.cpp
physicsserver/ode/odeworld_c.cpp
physicsserver/ode/odeobject.cpp
Modified: branches/multiphys/spark/lib/oxygen/oxygen.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-18 07:42:23 UTC (rev 103)
+++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-19 06:49:26 UTC (rev 104)
@@ -59,7 +59,6 @@
zg.GetCore()->RegisterClassObject(new CLASS(VelocityController), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Space), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(World), "oxygen/");
- zg.GetCore()->RegisterClassObject(new CLASS(WorldImp), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Joint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(BallJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(HingeJoint), "oxygen/");
@@ -89,7 +88,6 @@
//ODE-specific classes
zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/");
- zg.GetCore()->RegisterClassObject(new CLASS(ODEWorld), "oxygen/");
#ifdef HAVE_SPADES_HEADERS
Modified: branches/multiphys/spark/lib/oxygen/oxygen.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-18 07:42:23 UTC (rev 103)
+++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-19 06:49:26 UTC (rev 104)
@@ -60,12 +60,8 @@
#include "physicsserver/universaljoint.h"
#include "physicsserver/hinge2joint.h"
-//physics interfaces
-#include "physicsserver/imp/worldimp.h"
-
//ode-specific includes
#include <oxygen/physicsserver/ode/odeobject.h>
-#include <oxygen/physicsserver/ode/odeworld.h>
#include "sceneserver/basenode.h"
#include "sceneserver/camera.h"
Added: branches/multiphys/spark/lib/oxygen/physicsserver/imp/spaceint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/imp/spaceint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/spaceint.h 2009-11-19 06:49:26 UTC (rev 104)
@@ -0,0 +1,68 @@
+/* -*- 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: space.h 102 2009-11-18 07:24:29Z a-held $
+
+ 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_SPACEINT_H
+#define OXYGEN_SPACEINT_H
+
+#include <oxygen/physicsserver/ode/odeobject.h>
+#include <set>
+#include <oxygen/oxygen_defines.h>
+
+namespace oxygen
+{
+class Transform;
+class Body;
+class Collider;
+
+class OXYGEN_API SpaceInt : public ODEObject
+{
+
+public:
+ typedef std::set<dSpaceID> TSpaceIdSet;
+
+ SpaceInt() : ODEObject(){};
+ virtual ~SpaceInt(){};
+
+ //virtual void collisionNearCallback (void *data, dGeomID obj1, dGeomID obj2) = 0;
+ virtual dSpaceID GetODESpace() const = 0;
+ virtual dJointGroupID GetODEJointGroup() const = 0;
+ virtual void Collide() = 0;
+ virtual void DestroyODEObject() = 0;
+ virtual dSpaceID GetParentSpaceID() = 0;
+ virtual bool IsGlobalSpace() = 0;
+ virtual void DisableInnerCollision(bool disable) = 0;
+ virtual bool GetDisableInnerCollision() const = 0;
+ virtual void OnUnlink() = 0;
+ virtual void OnLink() = 0;
+ virtual void Collide(dSpaceID space) = 0;
+ virtual void HandleCollide(dGeomID obj1, dGeomID obj2) = 0;
+ virtual void HandleSpaceCollide(dGeomID obj1, dGeomID obj2) = 0;
+ virtual bool ConstructInternal() = 0;
+ virtual void PostPhysicsUpdateInternal() = 0;
+ virtual void DestroySpaceObjects() = 0;
+};
+
+DECLARE_ABSTRACTCLASS(SpaceInt);
+
+} //namespace oxygen
+
+#endif //OXYGEN_SPACEINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/imp/spaceint_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/imp/spaceint_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/spaceint_c.cpp 2009-11-19 06:49:26 UTC (rev 104)
@@ -0,0 +1,29 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+this file is part of rcssserver3D
+Fri May 9 2003
+Copyright (C) 2003 Koblenz University
+$Id: world_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/int/spaceint.h>
+
+using namespace oxygen;
+
+void CLASS(SpaceInt)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/ODEObject);
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldint.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldint.h 2009-11-19 06:49:26 UTC (rev 104)
@@ -0,0 +1,58 @@
+/* -*- 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: world.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_WORLDINT_H
+#define OXYGEN_WORLDINT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odeobject.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API WorldInt : public ODEObject
+{
+
+public:
+ WorldInt() : ODEObject(){};
+ virtual ~WorldInt(){};
+
+ virtual dWorldID GetODEWorld() const = 0;
+ virtual void SetGravity(const salt::Vector3f& gravity) = 0;
+ virtual salt::Vector3f GetGravity() const = 0;
+ virtual void SetERP(float erp) = 0;
+ virtual float GetERP() const = 0;
+ virtual void SetCFM(float cfm) = 0;
+ virtual float GetCFM() const = 0;
+ virtual void Step(float deltaTime) = 0;
+ virtual bool GetAutoDisableFlag() const = 0;
+ virtual void SetAutoDisableFlag(bool flag) = 0;
+ virtual void SetContactSurfaceLayer(float depth) = 0;
+ virtual float GetContactSurfaceLayer() const = 0;
+ virtual void DestroyODEObject() = 0;
+ virtual bool ConstructInternal() = 0;
+};
+
+DECLARE_ABSTRACTCLASS(WorldInt);
+
+}
+
+#endif //OXYGEN_WORLDINT_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldint_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldint_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldint_c.cpp 2009-11-19 06:49:26 UTC (rev 104)
@@ -0,0 +1,29 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+this file is part of rcssserver3D
+Fri May 9 2003
+Copyright (C) 2003 Koblenz University
+$Id: world_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/int/worldint.h>
+
+using namespace oxygen;
+
+void CLASS(WorldInt)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/ODEObject);
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.cpp 2009-11-19 06:49:26 UTC (rev 104)
@@ -0,0 +1,332 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id: space.cpp 80 2009-07-30 17:25:42Z 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/ode/odespace.h>
+#include <oxygen/physicsserver/world.h>
+#include <oxygen/physicsserver/collider.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/sceneserver/scene.h>
+#include <zeitgeist/logserver/logserver.h>
+
+using namespace boost;
+using namespace oxygen;
+
+/** set of spaces with disabled inner collision */
+ODESpace::TSpaceIdSet ODESpace::gDisabledInnerCollisionSet;
+
+//void ODESpace::collisionNearCallback (void *data, dGeomID obj1, dGeomID obj2)
+//{
+ // Space *space = (Space*)data;
+ // space->HandleCollide(obj1, obj2);
+//}
+
+ODESpace::ODESpace() : SpaceInt(), mODESpace(0), mODEContactGroup(0)
+{
+}
+
+ODESpace::~ODESpace()
+{
+}
+
+dSpaceID ODESpace::GetODESpace() const
+{
+ return mODESpace;
+}
+
+dJointGroupID ODESpace::GetODEJointGroup() const
+{
+ return mODEContactGroup;
+}
+
+void ODESpace::Collide()
+{
+ // bind collision callback function to this object
+ Collide(mODESpace);
+}
+
+void ODESpace::Collide(dSpaceID space)
+{
+ if (gDisabledInnerCollisionSet.find(space) == gDisabledInnerCollisionSet.end())
+ {
+ //dSpaceCollide(space, this, Space::collisionNearCallback);
+ }
+}
+
+void ODESpace::HandleSpaceCollide(dGeomID obj1, dGeomID obj2)
+{
+ // collide all geoms internal to the space(s)
+ //dSpaceCollide2 (obj1,obj2,this,&Space::collisionNearCallback);
+
+ if (dGeomIsSpace (obj1))
+ {
+ Collide((dSpaceID)obj1);
+ }
+
+ if (dGeomIsSpace (obj2))
+ {
+ Collide((dSpaceID)obj2);
+ }
+}
+
+void ODESpace::HandleCollide(dGeomID obj1, dGeomID obj2)
+{
+ if (
+ (dGeomIsSpace (obj1)) ||
+ (dGeomIsSpace (obj2))
+ )
+ {
+ // colliding a space with something
+ HandleSpaceCollide(obj1, obj2);
+ return;
+ }
+
+ // colliding two non-space geoms; reject collisions
+ // between bodies that are connected with joints
+ const dBodyID b1 = dGeomGetBody(obj1);
+ const dBodyID b2 = dGeomGetBody(obj2);
+
+ if (
+ (b1) && (b2) &&
+ (dAreConnectedExcluding(b1,b2,dJointTypeContact))
+ )
+ {
+ return;
+ }
+
+ // if obj1 and obj2 are in a space that disabled inner collision,
+ // reject the collision
+ const dSpaceID s1 = dGeomGetSpace(obj1);
+ const dSpaceID s2 = dGeomGetSpace(obj2);
+
+ // NOTICE: this should not happen since it is checked in Collide(dSpaceID)
+// if (
+// (s1 == s2) &&
+// (gDisabledInnerCollisionSet.find(s1) != gDisabledInnerCollisionSet.end())
+// )
+// {
+// return;
+// }
+
+
+ // if obj1 and obj2 are in the same space, and
+ // obj1 is in obj2's "mNotCollideWithSet" or ojb2 is in obj1's
+ // reject the collision
+
+ // get shared pointers to the two corresponding Collider nodes first
+ shared_ptr<Collider> collider = Collider::GetCollider(obj1);
+ shared_ptr<Collider> collidee = Collider::GetCollider(obj2);
+
+ if (
+ (collider.get() == 0) ||
+ (collidee.get() == 0)
+ )
+ {
+ return;
+ }
+
+ if (s1 == s2)
+ {
+ const oxygen::Collider::TColliderNameSet & collider_set = collider->GetNotCollideWithSet();
+ const oxygen::Collider::TColliderNameSet & collidee_set = collidee->GetNotCollideWithSet();
+ if (
+ (collider_set.find(collidee->GetName()) != collider_set.end()) ||
+ (collidee_set.find(collider->GetName()) != collidee_set.end())
+ )
+ {
+ return;
+ }
+ }
+
+ // dSpaceCollide(), is guaranteed to pass all potentially
+ // intersecting geom pairs to the callback function, but depending
+ // on the internal algorithms used by the space it may also make
+ // mistakes and pass non-intersecting pairs. Thus we can not
+ // expect that dCollide() will return contacts for every pair
+ // passed to the callback.
+ static const int nContacts = 4;
+ static dContact contacts[nContacts];
+
+ int n = dCollide (obj1, obj2, nContacts,
+ &contacts[0].geom, sizeof(dContact));
+
+ if (n == 0)
+ {
+ return;
+ }
+
+
+ for (int i=0;i<n;++i)
+ {
+ // notify the collider nodes
+ collider->OnCollision(collidee,contacts[i],Collider::CT_DIRECT);
+ collidee->OnCollision(collider,contacts[i],Collider::CT_SYMMETRIC);
+ }
+}
+
+void ODESpace::OnUnlink()
+{
+ DisableInnerCollision(false);
+ ODEObject::OnUnlink();
+}
+
+void ODESpace::OnLink()
+{
+ ODEObject::OnLink();
+
+ shared_ptr<Space> space = GetSpace();
+ dSpaceID spaceId = 0;
+
+ if (space.get() != 0)
+ {
+ spaceId = space->GetODESpace();
+ }
+
+ mODESpace = dHashSpaceCreate(spaceId);
+}
+
+dSpaceID ODESpace::GetParentSpaceID()
+{
+ if (mODESpace == 0)
+ {
+ return 0;
+ }
+
+ return dGeomGetSpace((dGeomID)mODESpace);
+}
+
+bool ODESpace::IsGlobalSpace()
+{
+ return
+ (
+ (mODESpace != 0) &&
+ (GetParentSpaceID() == 0)
+ );
+}
+
+bool ODESpace::ConstructInternal()
+{
+ // create a joint group for the contacts
+ mODEContactGroup = dJointGroupCreate(0);
+
+ return (mODEContactGroup != 0);
+}
+
+void ODESpace::PostPhysicsUpdateInternal()
+{
+ // remove all contact joints
+ dJointGroupEmpty (mODEContactGroup);
+}
+
+void ODESpace::DestroySpaceObjects()
+{
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ return;
+ }
+
+ TLeafList objects;
+ const bool recursive = true;
+ scene->ListChildrenSupportingClass<ODEObject>(objects, recursive);
+
+ bool globalSpace = IsGlobalSpace();
+ shared_ptr<Space> self = shared_static_cast<Space>(GetSelf().lock());
+
+ for (
+ TLeafList::iterator iter = objects.begin();
+ iter != objects.end();
+ ++iter
+ )
+ {
+ shared_ptr<ODEObject> object = shared_static_cast<ODEObject>(*iter);
+ if (object == self)
+ {
+ continue;
+ }
+
+ // destroy objects registered to this space; the top level
+ // space object also destroy any other ODE object
+ const dSpaceID parentSpace = object->GetParentSpaceID();
+ if (
+ (
+ (globalSpace) &&
+ (parentSpace == 0)
+ ) ||
+ (parentSpace == mODESpace)
+ )
+ {
+ object->DestroyODEObject();
+ }
+ }
+}
+
+void ODESpace::DestroyODEObject()
+{
+ if (! mODESpace)
+ {
+ return;
+ }
+
+ // make sure that all objects registered to this space are destroyed
+ // before this space. Any other order provokes a segfault in ODE.
+ DestroySpaceObjects();
+
+ if (mODEContactGroup)
+ {
+ dJointGroupDestroy(mODEContactGroup);
+ mODEContactGroup = 0;
+ }
+
+ // release the ODE space
+ dSpaceDestroy(mODESpace);
+ mODESpace = 0;
+}
+
+void ODESpace::DisableInnerCollision(bool disable)
+{
+ if (mODESpace == 0)
+ {
+ //assert(false);
+ return;
+ }
+
+ if (disable)
+ {
+ gDisabledInnerCollisionSet.insert(mODESpace);
+ return;
+ }
+
+ TSpaceIdSet::iterator iter = gDisabledInnerCollisionSet.find(mODESpace);
+ if (iter == gDisabledInnerCollisionSet.end())
+ {
+ return;
+ }
+
+ gDisabledInnerCollisionSet.erase(iter);
+}
+
+bool ODESpace::GetDisableInnerCollision() const
+{
+ TSpaceIdSet::const_iterator iter
+ = gDisabledInnerCollisionSet.find(mODESpace);
+
+ return (iter != gDisabledInnerCollisionSet.end());
+}
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace.h 2009-11-19 06:49:26 UTC (rev 104)
@@ -0,0 +1,74 @@
+/* -*- 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: world.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_ODESPACE_H
+#define OXYGEN_ODESPACE_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/int/spaceint.h>
+
+namespace oxygen
+{
+
+class OXYGEN_API ODESpace : public SpaceInt
+{
+
+public:
+ typedef std::set<dSpaceID> TSpaceIdSet;
+
+public:
+ ODESpace();
+ virtual ~ODESpace();
+
+ dSpaceID GetODESpace() const;
+ dJointGroupID GetODEJointGroup() const;
+ void Collide();
+ virtual void DestroyODEObject();
+ virtual dSpaceID GetParentSpaceID();
+ bool IsGlobalSpace();
+ void DisableInnerCollision(bool disable);
+ bool GetDisableInnerCollision() const;
+
+ dSpaceID mODESpace;
+
+protected:
+ //void collisionNearCallback (void *data, dGeomID obj1, dGeomID obj2);
+ virtual void OnUnlink();
+ virtual void OnLink();
+ void Collide(dSpaceID space);
+ void HandleCollide(dGeomID obj1, dGeomID obj2);
+ void HandleSpaceCollide(dGeomID obj1, dGeomID obj2);
+ virtual bool ConstructInternal();
+ virtual void PostPhysicsUpdateInternal();
+ void DestroySpaceObjects();
+
+private:
+ dJointGroupID mODEContactGroup;
+
+private:
+ static TSpaceIdSet gDisabledInnerCollisionSet;
+};
+
+DECLARE_CLASS(ODESpace);
+
+}
+
+#endif //OXYGEN_ODESPACE_H
Added: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odespace_c.cpp 2009-11-19 06:49:26 UTC (rev 104)
@@ -0,0 +1,29 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+this file is part of rcssserver3D
+Fri May 9 2003
+Copyright (C) 2003 Koblenz University
+$Id: world_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/ode/odespace.h>
+
+using namespace oxygen;
+
+void CLASS(ODESpace)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/SpaceInt);
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-18 07:42:23 UTC (rev 103)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-19 06:49:26 UTC (rev 104)
@@ -27,7 +27,7 @@
using namespace oxygen;
using namespace salt;
-ODEWorld::ODEWorld() : WorldImp(), mODEWorld(0)
+ODEWorld::ODEWorld() : WorldInt(), mODEWorld(0)
{
}
@@ -35,12 +35,12 @@
{
}
-dWorldID ODEWorld::GetODEWorldImp() const
+dWorldID ODEWorld::GetODEWorld() const
{
return mODEWorld;
}
-void ODEWorld::SetGravityImp(const Vector3f& gravity)
+void ODEWorld::SetGravity(const Vector3f& gravity)
{
dWorldSetGravity(mODEWorld,
gravity.x(),
@@ -49,59 +49,59 @@
);
}
-salt::Vector3f ODEWorld::GetGravityImp() const
+salt::Vector3f ODEWorld::GetGravity() const
{
dVector3 dGravity;
dWorldGetGravity(mODEWorld,dGravity);
return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
}
-void ODEWorld::SetERPImp(float erp)
+void ODEWorld::SetERP(float erp)
{
dWorldSetERP(mODEWorld, erp);
}
-float ODEWorld::GetERPImp() const
+float ODEWorld::GetERP() const
{
return dWorldGetERP(mODEWorld);
}
-void ODEWorld::SetCFMImp(float cfm)
+void ODEWorld::SetCFM(float cfm)
{
dWorldSetCFM(mODEWorld, cfm);
}
-float ODEWorld::GetCFMImp() const
+float ODEWorld::GetCFM() const
{
return dWorldGetCFM(mODEWorld);
}
-void ODEWorld::StepImp(float deltaTime)
+void ODEWorld::Step(float deltaTime)
{
dWorldStep(mODEWorld, deltaTime);
}
-bool ODEWorld::GetAutoDisableFlagImp() const
+bool ODEWorld::GetAutoDisableFlag() const
{
return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
}
-void ODEWorld::SetAutoDisableFlagImp(bool flag)
+void ODEWorld::SetAutoDisableFlag(bool flag)
{
dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
}
-void ODEWorld::SetContactSurfaceLayerImp(float depth)
+void ODEWorld::SetContactSurfaceLayer(float depth)
{
dWorldSetContactSurfaceLayer(mODEWorld, depth);
}
-float ODEWorld::GetContactSurfaceLayerImp() const
+float ODEWorld::GetContactSurfaceLayer() const
{
return dWorldGetContactSurfaceLayer(mODEWorld);
}
-bool ODEWorld::ConstructInternalImp()
+bool ODEWorld::ConstructInternal()
{
// create an ode world
mODEWorld = dWorldCreate();
@@ -109,7 +109,7 @@
return (mODEWorld != 0);
}
-void ODEWorld::DestroyODEObjectImp()
+void ODEWorld::DestroyODEObject()
{
static bool recurseLock = false;
if (recurseLock)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-18 07:42:23 UTC (rev 103)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-19 06:49:26 UTC (rev 104)
@@ -23,102 +23,41 @@
#define OXYGEN_ODEWORLD_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/imp/worldimp.h>
+#include <oxygen/physicsserver/int/worldint.h>
namespace oxygen
{
-/** World encapsulates an ODE world object. It is a container for
- rigid bodies and joints. Objects in different worlds can not
- interact, for example rigid bodies from two different worlds can
- not collide. All the objects in a world exist at the same point in
- time, thus one reason to use separate worlds is to simulate
- systems at different rates.
-*/
-class OXYGEN_API ODEWorld : public WorldImp
+class OXYGEN_API ODEWorld : public WorldInt
{
- //
- // Functions
- //
+
public:
ODEWorld();
virtual ~ODEWorld();
- /** returns the ID of the managed ODE world */
- dWorldID GetODEWorldImp() const;
+ dWorldID GetODEWorld() const;
+ void SetGravity(const salt::Vector3f& gravity);
+ salt::Vector3f GetGravity() const;
+ void SetERP(float erp);
+ float GetERP() const;
+ void SetCFM(float cfm);
+ float GetCFM() const;
+ void Step(float deltaTime);
+ bool GetAutoDisableFlag() const;
+ void SetAutoDisableFlag(bool flag);
+ void SetContactSurfaceLayer(float depth);
+ float GetContactSurfaceLayer() const;
+ virtual void DestroyODEObject();
- /** sets the gravity vector of this vorld */
- void SetGravityImp(const salt::Vector3f& gravity);
-
- /** gets the gravity vector of this world */
- salt::Vector3f GetGravityImp() const;
-
- /** sets the Error Reduction Parameter of this world. The ERP
- specifies what proportion of a joint error will be fixed
- during the next simulation step. if ERP=0 then no correcting
- force is applied and the bodies will eventually drift apart as
- the simulation proceeds. If ERP=1 then the simulation will
- attempt to fix all joint error during the next time
- step. However, setting ERP=1 is not recommended, as the joint
- error will not be completely fixed due to various internal
- approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
- is the default).
- */
- void SetERPImp(float erp);
-
- /** returns the Error Reduction Parameter of this World.
- */
- float GetERPImp() const;
-
- /** sets the Constraint Force mixing (CFM) value. If CFM is set to
- zero, the constraint will be hard. If CFM is set to a positive
- value, it will be possible to violate the constraint by
- `pushing on it' (for example, for contact constraints by
- forcing the two contacting objects together). In other words
- the constraint will be soft, and the softness will increase as
- CFM increases. Note that setting CFM to a negative value can
- have undesirable bad effects, such as instability.
- */
- void SetCFMImp(float cfm);
-
- /** returns the Constraint Force mixing (CFM) value. */
- float GetCFMImp() const;
-
- /** steps the world deltatime forward, i.e. performs physics
- simulation for a deltaTime seconds interval.
- */
- void StepImp(float deltaTime);
-
- bool GetAutoDisableFlagImp() const;
- void SetAutoDisableFlagImp(bool flag);
-
- /** Set and get the depth of the surface layer around all geometry
- objects. Contacts are allowed to sink into the surface layer up to
- the given depth before coming to rest. The default value is
- zero. Increasing this to some small value (e.g. 0.001) can help
- prevent jittering problems due to contacts being repeatedly made
- and broken.
- */
- void SetContactSurfaceLayerImp(float depth);
- float GetContactSurfaceLayerImp() const;
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObjectImp();
-
protected:
- /** creates them managed ODE world */
- virtual bool ConstructInternalImp();
+ virtual bool ConstructInternal();
- //
- // Members
- //
private:
- /** the dynamics world represented by this object */
dWorldID mODEWorld;
};
DECLARE_CLASS(ODEWorld);
-};
+}
-#endif //OXYGEN_WORLD_H
+#endif //OXYGEN_ODEWORLD_H
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-11-18 07:42:23 UTC (rev 103)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-11-19 06:49:26 UTC (rev 104)
@@ -30,8 +30,7 @@
World::World() : ODEObject()
{
- shared_ptr<ODEWorld> odeworld(new ODEWorld());
- mWorldImp = (shared_dynamic_cast<WorldImp>(odeworld));
+ mWorldImp = shared_ptr<ODEWorld>(new ODEWorld());
}
World::~World()
@@ -40,70 +39,70 @@
dWorldID World::GetODEWorld() const
{
- return mWorldImp->GetODEWorldImp();
+ return mWorldImp->GetODEWorld();
}
void World::SetGravity(const Vector3f& gravity)
{
- mWorldImp->SetGravityImp(gravity);
+ mWorldImp->SetGravity(gravity);
}
salt::Vector3f World::GetGravity() const
{
- return mWorldImp->GetGravityImp();
+ return mWorldImp->GetGravity();
}
void World::SetERP(float erp)
{
- mWorldImp->SetERPImp(erp);
+ mWorldImp->SetERP(erp);
}
float World::GetERP() const
{
- return mWorldImp->GetERPImp();
+ return mWorldImp->GetERP();
}
void World::SetCFM(float cfm)
{
- mWorldImp->SetCFMImp(cfm);
+ mWorldImp->SetCFM(cfm);
}
float World::GetCFM() const
{
- return mWorldImp->GetCFMImp();
+ return mWorldImp->GetCFM();
}
void World::Step(float deltaTime)
{
- mWorldImp->StepImp(deltaTime);
+ mWorldImp->Step(deltaTime);
}
bool World::GetAutoDisableFlag() const
{
- return mWorldImp->GetAutoDisableFlagImp();
+ return mWorldImp->GetAutoDisableFlag();
}
void World::SetAutoDisableFlag(bool flag)
{
- mWorldImp->SetAutoDisableFlagImp(flag);
+ mWorldImp->SetAutoDisableFlag(flag);
}
void World::SetContactSurfaceLayer(float depth)
{
- mWorldImp->SetContactSurfaceLayerImp(depth);
+ mWorldImp->SetContactSurfaceLayer(depth);
}
float World::GetContactSurfaceLayer() const
{
- return mWorldImp->GetContactSurfaceLayerImp();
+ return mWorldImp->GetContactSurfaceLayer();
}
bool World::ConstructInternal()
{
- return mWorldImp->ConstructInternalImp();
+ return mWorldImp->ConstructInternal();
}
void World::DestroyODEObject()
{
- mWorldImp->DestroyODEObjectImp();
+ mWorldImp->DestroyODEObject();
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-11-18 07:42:23 UTC (rev 103)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-11-19 06:49:26 UTC (rev 104)
@@ -28,7 +28,7 @@
namespace oxygen
{
-class WorldImp;
+class WorldInt;
class ODEWorld;
/** World encapsulates an ODE world object. It is a container for
@@ -116,7 +116,7 @@
// Members
//
private:
- boost::shared_ptr<WorldImp> mWorldImp;
+ boost::shared_ptr<WorldInt> mWorldImp;
};
DECLARE_CLASS(World);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-11-18 07:42:32
|
Revision: 103
http://simspark.svn.sourceforge.net/simspark/?rev=103&view=rev
Author: a-held
Date: 2009-11-18 07:42:23 +0000 (Wed, 18 Nov 2009)
Log Message:
-----------
undid changes to trunk that were accidentally commited yesterday
Modified Paths:
--------------
trunk/spark/lib/oxygen/CMakeLists.txt
trunk/spark/lib/oxygen/oxygen.cpp
trunk/spark/lib/oxygen/oxygen.h
trunk/spark/lib/oxygen/physicsserver/body.cpp
trunk/spark/lib/oxygen/physicsserver/body.h
trunk/spark/lib/oxygen/physicsserver/boxcollider.h
trunk/spark/lib/oxygen/physicsserver/collider.h
trunk/spark/lib/oxygen/physicsserver/collisionhandler.h
trunk/spark/lib/oxygen/physicsserver/joint.h
trunk/spark/lib/oxygen/physicsserver/physicsserver.h
trunk/spark/lib/oxygen/physicsserver/space.h
trunk/spark/lib/oxygen/physicsserver/world.cpp
trunk/spark/lib/oxygen/physicsserver/world.h
trunk/spark/lib/oxygen/physicsserver/world_c.cpp
trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp
trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h
Added Paths:
-----------
trunk/spark/lib/oxygen/physicsserver/odeobject.cpp
trunk/spark/lib/oxygen/physicsserver/odeobject.h
trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp
trunk/spark/lib/oxygen/physicsserver/odewrapper.h
Removed Paths:
-------------
trunk/spark/lib/oxygen/physicsserver/imp/
trunk/spark/lib/oxygen/physicsserver/ode/
Modified: trunk/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- trunk/spark/lib/oxygen/CMakeLists.txt 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/CMakeLists.txt 2009-11-18 07:42:23 UTC (rev 103)
@@ -21,6 +21,8 @@
physicsserver/collider.h
physicsserver/collisionhandler.h
physicsserver/contactjointhandler.h
+ physicsserver/odeobject.h
+ physicsserver/odewrapper.h
physicsserver/physicsserver.h
physicsserver/planecollider.h
physicsserver/raycollider.h
@@ -39,15 +41,6 @@
physicsserver/universaljoint.h
physicsserver/hinge2joint.h
physicsserver/angularmotor.h
-
- #interfaces
- physicsserver/imp/worldimp.h
-
- #ode-specific files
- physicsserver/ode/odeobject.h
- physicsserver/ode/odeworld.h
- physicsserver/ode/odewrapper.h
-
sceneserver/sceneimporter.h
sceneserver/basenode.h
sceneserver/fpscontroller.h
@@ -123,6 +116,8 @@
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
@@ -157,16 +152,6 @@
physicsserver/hinge2joint_c.cpp
physicsserver/angularmotor.cpp
physicsserver/angularmotor_c.cpp
-
- #interfaces
- physicsserver/imp/worldimp_c.cpp
-
- #ODE-specific files
- physicsserver/ode/odeworld.cpp
- physicsserver/ode/odeworld_c.cpp
- physicsserver/ode/odeobject.cpp
- physicsserver/ode/odeobject_c.cpp
-
sceneserver/basenode.cpp
sceneserver/basenode_c.cpp
sceneserver/fpscontroller.cpp
Modified: trunk/spark/lib/oxygen/oxygen.cpp
===================================================================
--- trunk/spark/lib/oxygen/oxygen.cpp 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/oxygen.cpp 2009-11-18 07:42:23 UTC (rev 103)
@@ -57,9 +57,9 @@
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(WorldImp), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Joint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(BallJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(HingeJoint), "oxygen/");
@@ -86,11 +86,6 @@
zg.GetCore()->RegisterClassObject(new CLASS(AgentAspect), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Effector), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Perceptor), "oxygen/");
-
- //ODE-specific classes
- zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/");
- zg.GetCore()->RegisterClassObject(new CLASS(ODEWorld), "oxygen/");
-
#ifdef HAVE_SPADES_HEADERS
// spades
Modified: trunk/spark/lib/oxygen/oxygen.h
===================================================================
--- trunk/spark/lib/oxygen/oxygen.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/oxygen.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -34,7 +34,6 @@
#include "gamecontrolserver/actionobject.h"
#include "gamecontrolserver/behavior.h"
-//abstract physics classes
#include "physicsserver/body.h"
#include "physicsserver/bodycontroller.h"
#include "physicsserver/dragcontroller.h"
@@ -43,6 +42,7 @@
#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"
@@ -60,13 +60,6 @@
#include "physicsserver/universaljoint.h"
#include "physicsserver/hinge2joint.h"
-//physics interfaces
-#include "physicsserver/imp/worldimp.h"
-
-//ode-specific includes
-#include <oxygen/physicsserver/ode/odeobject.h>
-#include <oxygen/physicsserver/ode/odeworld.h>
-
#include "sceneserver/basenode.h"
#include "sceneserver/camera.h"
#include "sceneserver/fpscontroller.h"
Modified: trunk/spark/lib/oxygen/physicsserver/body.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/body.cpp 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/body.cpp 2009-11-18 07:42:23 UTC (rev 103)
@@ -339,7 +339,7 @@
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMassSetCapsule (&mass, density, direction, radius, length);
+ dMassSetCappedCylinder (&mass, density, direction, radius, length);
}
void Body::SetCappedCylinder (float density, float radius, float length)
@@ -361,7 +361,7 @@
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMassSetCapsuleTotal(&mass, total_mass, direction, radius, length);
+ dMassSetCappedCylinderTotal(&mass, total_mass, direction, radius, length);
}
void Body::SetCappedCylinderTotal(float total_mass, float radius, float length)
Modified: trunk/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/body.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/body.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -23,7 +23,7 @@
#define OXYGEN_BODY_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
namespace oxygen
{
Modified: trunk/spark/lib/oxygen/physicsserver/boxcollider.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -23,7 +23,7 @@
#define OXYGEN_BOXCOLLIDER_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/collider.h>
+#include "collider.h"
namespace oxygen
{
Modified: trunk/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_COLLIDER_H
#define OXYGEN_COLLIDER_H
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
#include <string>
#include <set>
#include <oxygen/oxygen_defines.h>
Modified: trunk/spark/lib/oxygen/physicsserver/collisionhandler.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -24,7 +24,7 @@
#include <oxygen/sceneserver/basenode.h>
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
+#include "odewrapper.h"
namespace oxygen
{
Modified: trunk/spark/lib/oxygen/physicsserver/joint.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -23,7 +23,7 @@
#define OXYGEN_JOINT_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
namespace oxygen
{
Copied: trunk/spark/lib/oxygen/physicsserver/odeobject.cpp (from rev 97, trunk/spark/lib/oxygen/physicsserver/odeobject.cpp)
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/odeobject.cpp (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/odeobject.cpp 2009-11-18 07:42:23 UTC (rev 103)
@@ -0,0 +1,167 @@
+/* -*- 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$
+
+ 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 "odeobject.h"
+#include "space.h"
+#include "world.h"
+#include <oxygen/sceneserver/scene.h>
+#include <zeitgeist/logserver/logserver.h>
+
+using namespace oxygen;
+using namespace boost;
+
+ODEObject::ODEObject() : BaseNode()
+{
+}
+
+ODEObject::~ODEObject()
+{
+}
+
+void ODEObject::OnUnlink()
+{
+ DestroyODEObject();
+}
+
+/** returns the world node */
+shared_ptr<World> ODEObject::GetWorld()
+{
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<World>();
+ }
+
+ shared_ptr<World> worldNode = shared_dynamic_cast<World>
+ (scene->GetChildOfClass("World"));
+ if (worldNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
+ }
+
+ return worldNode;
+}
+
+shared_ptr<Space> ODEObject::GetSpace()
+{
+ // try to find the nearest parent space object
+ weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
+ if (! parentSpace.expired())
+ {
+ return parentSpace.lock();
+ }
+
+ // return the global space instance
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<Space>();
+ }
+
+ shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
+ (scene->GetChildOfClass("Space"));
+ if (spaceNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
+ }
+
+ return spaceNode;
+}
+
+dWorldID ODEObject::GetWorldID()
+{
+ shared_ptr<World> world = GetWorld();
+ if (world.get() == 0)
+ {
+ return 0;
+ }
+
+ dWorldID worldId = world->GetODEWorld();
+ if (worldId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: World returned empty ODE handle\n";
+ }
+
+ return worldId;
+}
+
+dSpaceID ODEObject::FindSpaceID()
+{
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() == 0)
+ {
+ return 0;
+ }
+
+ dSpaceID spaceId = space->GetODESpace();
+
+ if (spaceId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: Space returned empty ODE handle\n";
+ }
+
+ return spaceId;
+}
+
+dSpaceID ODEObject::GetParentSpaceID()
+{
+ return 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+{
+ matrix[0] = rot.m[0];
+ matrix[1] = rot.m[4];
+ matrix[2] = rot.m[8];
+ matrix[3] = 0;
+ matrix[4] = rot.m[1];
+ matrix[5] = rot.m[5];
+ matrix[6] = rot.m[9];
+ matrix[7] = 0;
+ matrix[8] = rot.m[2];
+ matrix[9] = rot.m[6];
+ matrix[10] = rot.m[10];
+ matrix[11] = 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+{
+ rot.m[0] = matrix[0] ;
+ rot.m[4] = matrix[1] ;
+ rot.m[8] = matrix[2];
+ rot.m[12] = matrix[3];
+ rot.m[1] = matrix[4];
+ rot.m[5] = matrix[5];
+ rot.m[9] = matrix[6];
+ rot.m[13] = matrix[7];
+ rot.m[2] = matrix[8];
+ rot.m[6] = matrix[9];
+ rot.m[10] = matrix[10] ;
+ rot.m[14] = matrix[11];
+ rot.m[3] = 0.0;
+ rot.m[7] = 0.0;
+ rot.m[11] = 0.0;
+ rot.m[15] = 1.0;
+}
Copied: trunk/spark/lib/oxygen/physicsserver/odeobject.h (from rev 97, trunk/spark/lib/oxygen/physicsserver/odeobject.h)
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/odeobject.h (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/odeobject.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -0,0 +1,83 @@
+/* -*- 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$
+ $Id$
+
+ 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_ODEOBJECT_H
+#define OXYGEN_ODEOBJECT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/sceneserver/basenode.h>
+#include "odewrapper.h"
+
+namespace oxygen
+{
+class Space;
+class World;
+
+/** ODEObject is the base of all classes encapsulating ODE concepts
+ */
+class OXYGEN_API ODEObject : public BaseNode
+{
+public:
+ //
+ // Functions
+ //
+ ODEObject();
+ virtual ~ODEObject();
+
+ /** 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();
+
+ /** returns the ODE world handle */
+ dWorldID GetWorldID();
+
+ /** returns the nearest parent space ODE handle */
+ dSpaceID FindSpaceID();
+
+ /** returns the ODE handle ID of the containing parent space */
+ virtual dSpaceID GetParentSpaceID();
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObject() = 0;
+
+protected:
+ /** returns the world node */
+ boost::shared_ptr<World> GetWorld();
+
+ /** finds the nearest parent space node */
+ boost::shared_ptr<Space> GetSpace();
+
+ /** converts the rotation part of a salt::Matrix to an ODE
+ dMatrix3 */
+ void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
+
+ /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
+ void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+};
+
+DECLARE_ABSTRACTCLASS(ODEObject);
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEOBJECT_H
Copied: trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp (from rev 97, trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp)
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2009-11-18 07:42:23 UTC (rev 103)
@@ -0,0 +1,29 @@
+/* -*- mode: c++ -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id$
+
+ 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 "odeobject.h"
+
+using namespace oxygen;
+
+void CLASS(ODEObject)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/BaseNode);
+}
Copied: trunk/spark/lib/oxygen/physicsserver/odewrapper.h (from rev 97, trunk/spark/lib/oxygen/physicsserver/odewrapper.h)
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/odewrapper.h (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/odewrapper.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -0,0 +1,80 @@
+/* -*- 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$
+
+ 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_ODEWRAPPER_H
+#define OXYGEN_ODEWRAPPER_H
+
+#undef EXTERN
+#undef HAVE_VPRINTF
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+#undef PREFIX
+#undef VERSION
+
+#ifdef WIN32
+
+#ifdef copysignf
+#undef copysignf
+#endif
+
+#ifdef copysign
+#undef copysign
+#endif
+
+#endif // WIN32
+
+#ifdef __APPLE__
+
+// there is a conflicting type in a system header (Leopard)
+// so we define a dummy here
+#define uint32 dummy
+
+#endif
+
+#include <ode/ode.h>
+
+#ifdef __APPLE__
+
+// undefine the dummy
+#undef uint32
+
+#endif
+
+#undef EXTERN
+#undef HAVE_VPRINTF
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+#undef PREFIX
+#undef VERSION
+
+#ifdef HAVE_CONFIG_H
+#include <sparkconfig.h>
+#endif
+
+#endif // OXYGEN_ODEWRAPPER
Modified: trunk/spark/lib/oxygen/physicsserver/physicsserver.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -25,7 +25,7 @@
#include <zeitgeist/class.h>
#include <zeitgeist/leaf.h>
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
+#include "odewrapper.h"
namespace oxygen
{
Modified: trunk/spark/lib/oxygen/physicsserver/space.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/space.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/space.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_SPACE_H
#define OXYGEN_SPACE_H
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
#include <set>
#include <oxygen/oxygen_defines.h>
Modified: trunk/spark/lib/oxygen/physicsserver/world.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/world.cpp 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/world.cpp 2009-11-18 07:42:23 UTC (rev 103)
@@ -19,19 +19,16 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <oxygen/physicsserver/ode/odeworld.h>
-#include <oxygen/physicsserver/world.h>
-#include <oxygen/physicsserver/space.h>
+#include "world.h"
+#include "space.h"
#include <oxygen/sceneserver/scene.h>
using namespace boost;
using namespace oxygen;
using namespace salt;
-World::World() : ODEObject()
+World::World() : ODEObject(), mODEWorld(0)
{
- shared_ptr<ODEWorld> odeworld(new ODEWorld());
- mWorldImp = (shared_dynamic_cast<WorldImp>(odeworld));
}
World::~World()
@@ -40,70 +37,102 @@
dWorldID World::GetODEWorld() const
{
- return mWorldImp->GetODEWorldImp();
+ return mODEWorld;
}
void World::SetGravity(const Vector3f& gravity)
{
- mWorldImp->SetGravityImp(gravity);
+ dWorldSetGravity(mODEWorld,
+ gravity.x(),
+ gravity.y(),
+ gravity.z()
+ );
}
salt::Vector3f World::GetGravity() const
{
- return mWorldImp->GetGravityImp();
+ dVector3 dGravity;
+ dWorldGetGravity(mODEWorld,dGravity);
+ return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
}
void World::SetERP(float erp)
{
- mWorldImp->SetERPImp(erp);
+ dWorldSetERP(mODEWorld, erp);
}
float World::GetERP() const
{
- return mWorldImp->GetERPImp();
+ return dWorldGetERP(mODEWorld);
}
void World::SetCFM(float cfm)
{
- mWorldImp->SetCFMImp(cfm);
+ dWorldSetCFM(mODEWorld, cfm);
}
float World::GetCFM() const
{
- return mWorldImp->GetCFMImp();
+ return dWorldGetCFM(mODEWorld);
}
void World::Step(float deltaTime)
{
- mWorldImp->StepImp(deltaTime);
+ dWorldStep(mODEWorld, deltaTime);
}
bool World::GetAutoDisableFlag() const
{
- return mWorldImp->GetAutoDisableFlagImp();
+ return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
}
void World::SetAutoDisableFlag(bool flag)
{
- mWorldImp->SetAutoDisableFlagImp(flag);
+ dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
}
void World::SetContactSurfaceLayer(float depth)
{
- mWorldImp->SetContactSurfaceLayerImp(depth);
+ dWorldSetContactSurfaceLayer(mODEWorld, depth);
}
float World::GetContactSurfaceLayer() const
{
- return mWorldImp->GetContactSurfaceLayerImp();
+ return dWorldGetContactSurfaceLayer(mODEWorld);
}
bool World::ConstructInternal()
{
- return mWorldImp->ConstructInternalImp();
+ // create an ode world
+ mODEWorld = dWorldCreate();
+
+ return (mODEWorld != 0);
}
void World::DestroyODEObject()
{
- mWorldImp->DestroyODEObjectImp();
+ static bool recurseLock = false;
+ if (recurseLock)
+ {
+ return;
+ }
+
+ recurseLock = true;
+
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() != 0)
+ {
+ space->DestroyODEObject();
+ }
+
+ if (mODEWorld == 0)
+ {
+ return;
+ }
+
+ // release the ODE world
+ dWorldDestroy(mODEWorld);
+ mODEWorld = 0;
+
+ recurseLock = false;
}
Modified: trunk/spark/lib/oxygen/physicsserver/world.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/world.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/world.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -23,14 +23,11 @@
#define OXYGEN_WORLD_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
namespace oxygen
{
-class WorldImp;
-class ODEWorld;
-
/** World encapsulates an ODE world object. It is a container for
rigid bodies and joints. Objects in different worlds can not
interact, for example rigid bodies from two different worlds can
@@ -116,11 +113,12 @@
// Members
//
private:
- boost::shared_ptr<WorldImp> mWorldImp;
+ /** the dynamics world represented by this object */
+ dWorldID mODEWorld;
};
DECLARE_CLASS(World);
-}
+};
#endif //OXYGEN_WORLD_H
Modified: trunk/spark/lib/oxygen/physicsserver/world_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-18 07:42:23 UTC (rev 103)
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <oxygen/physicsserver/world.h>
+#include "world.h"
using namespace boost;
using namespace oxygen;
Modified: trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp
===================================================================
--- trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp 2009-11-18 07:42:23 UTC (rev 103)
@@ -21,7 +21,7 @@
*/
#include "forceresistanceperceptor.h"
-#include <oxygen/physicsserver/ode/odewrapper.h>
+#include <oxygen/physicsserver/odewrapper.h>
#include <oxygen/sceneserver/transform.h>
using namespace std;
Modified: trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h
===================================================================
--- trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h 2009-11-18 07:24:29 UTC (rev 102)
+++ trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h 2009-11-18 07:42:23 UTC (rev 103)
@@ -24,7 +24,7 @@
#define FORCERESISTANCEPERCEPTOR_H_
#include <oxygen/agentaspect/perceptor.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
+#include <oxygen/physicsserver/odewrapper.h>
#include <oxygen/sceneserver/transform.h>
#include <salt/vector.h>
#include <list>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-11-18 07:24:37
|
Revision: 102
http://simspark.svn.sourceforge.net/simspark/?rev=102&view=rev
Author: a-held
Date: 2009-11-18 07:24:29 +0000 (Wed, 18 Nov 2009)
Log Message:
-----------
bringing branch up to date
Modified Paths:
--------------
branches/multiphys/rcssserver3d/ChangeLog
branches/multiphys/rcssserver3d/RELEASE
branches/multiphys/spark/ChangeLog
branches/multiphys/spark/RELEASE
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/boxcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h
branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
branches/multiphys/spark/lib/oxygen/physicsserver/space.h
branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.h
branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.h
branches/multiphys/spark/lib/oxygen/simulationserver/netcontrol.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.h
branches/multiphys/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp
branches/multiphys/spark/plugin/collisionperceptor/forceresistanceperceptor.h
branches/multiphys/spark/utility/rcssnet/socket.cpp
branches/multiphys/spark/utility/rcssnet/socket.hpp
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/imp/
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odewrapper.h
Removed Paths:
-------------
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odewrapper.h
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/lib/oxygen/physicsserver/odewrapper.h
Property Changed:
----------------
branches/multiphys/
Property changes on: branches/multiphys
___________________________________________________________________
Added: svn:mergeinfo
+ /trunk:95-101
Modified: branches/multiphys/rcssserver3d/ChangeLog
===================================================================
--- branches/multiphys/rcssserver3d/ChangeLog 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/rcssserver3d/ChangeLog 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,3 +1,8 @@
+2009-10-31 Hedayat Vatankhah <he...@gr...>
+
+ * RELEASE:
+ - write about changes sine 0.6.2, initial draft.
+
2009-08-24 Marian Buchta <mar...@gm...>
* CMakeLists.txt:
Modified: branches/multiphys/rcssserver3d/RELEASE
===================================================================
--- branches/multiphys/rcssserver3d/RELEASE 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/rcssserver3d/RELEASE 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,15 +1,10 @@
-RELEASE News of rcssserver3d-0.6.2
+RELEASE News of rcssserver3d-0.6.3 (In progress)
-This release is mainly a bug-fix release, and is the last release before
-RoboCup 2009 competitions.
-
-* Some improvements:
- - improved Windows and MacOSX support
- - improved external monitor
- - fixed a bug in rcssserver3d's goal counting
- - added right kick-off key to the monitor (Simon Raffeiner)
- - simspark can take command line argument specifying the rb script to run
- (using --script-path command line option)
-
+* Most notable changes:
+ - No internal monitor by default. Run rcssmonitor3d separately to see the game.
+ - Added HMDP effector/perceptor
+ - Some compilation fixes
+ - Improved Windows support
+
You can get the package on the Simspark page on SourceForge
at http://sourceforge.net/projects/simspark/
Modified: branches/multiphys/spark/ChangeLog
===================================================================
--- branches/multiphys/spark/ChangeLog 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/ChangeLog 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,3 +1,24 @@
+2009-10-31 Hedayat Vatankhah <he...@gr...>
+
+ * lib/oxygen/simulationserver/simulationserver.h:
+ * lib/oxygen/simulationserver/simulationserver.cpp:
+ - prevent a deadlock case (on exit) in multi-threaded mode
+
+ * lib/oxygen/simulationserver/agentcontrol.h:
+ * lib/oxygen/simulationserver/agentcontrol.cpp:
+ - send senses in SenseAgent method, so that they'll be sent after receiving
+ commands from the agents. this will ensure that any commands sent after
+ sending senses will be executed in the next cycle, which results in a
+ more deterministic behaviour
+
+2009-10-30 Hedayat Vatankhah <he...@gr...>
+
+ * lib/oxygen/simulationserver/netcontrol.cpp (NetControl::InitSimulation):
+ - try to set REUSEADDR flag to reuse local addresses.
+
+ * utility/rcssnet/socket.cpp (Socket::setReuseAddr):
+ - added the new function
+
2009-08-25 Marian Buchta <mar...@gm...>
* plugin/openglsyswx/CMakeLists.txt:
Modified: branches/multiphys/spark/RELEASE
===================================================================
--- branches/multiphys/spark/RELEASE 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/RELEASE 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,15 +1,17 @@
-RELEASE News of simspark-0.1.2
+RELEASE News of simspark-0.1.3 (in progress)
-This release brings some bugfixes, better performance and also better Windows
-support. A Windows installer will be available too. This is the first version
-which runs in multi-threaded mode by default. The multi-threaded mode is still
-in early stages, and it can be improved cosiderably in future.
+SOME INTERESTING COMMENTS!
Main changes of this release are:
- - improved Windows support, including Windows Installer.
- - Multi-threaded mode now works, and is the default mode when running simspark
- - Performance improvements
- - Fixed a bug in networking code, which were introduced in 0.1.1
+ - Compilation fixes
+ - Improved Windows support
+ - Simspark should always accept connections. No more "Connection refused"
+ messages and the need to wait for simspark's network port to be freed!
+ - Simspark will now collect received commands right before sending
+ sense data of the last cycle. So, any commands which is sent by agents
+ after receiving new sense data will be executed in the next cycle, not the
+ current one. This results in a more deterministic behavior, and agents'
+ efficiency should not change between remote and local runs considerably.
You can get the package on the Simspark page on SourceForge
at http://sourceforge.net/projects/simspark/
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-18 07:24:29 UTC (rev 102)
@@ -21,8 +21,6 @@
physicsserver/collider.h
physicsserver/collisionhandler.h
physicsserver/contactjointhandler.h
- physicsserver/odeobject.h
- physicsserver/odewrapper.h
physicsserver/physicsserver.h
physicsserver/planecollider.h
physicsserver/raycollider.h
@@ -41,6 +39,15 @@
physicsserver/universaljoint.h
physicsserver/hinge2joint.h
physicsserver/angularmotor.h
+
+ #interfaces
+ physicsserver/imp/worldimp.h
+
+ #ode-specific files
+ physicsserver/ode/odeobject.h
+ physicsserver/ode/odeworld.h
+ physicsserver/ode/odewrapper.h
+
sceneserver/sceneimporter.h
sceneserver/basenode.h
sceneserver/fpscontroller.h
@@ -116,8 +123,6 @@
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
@@ -152,6 +157,16 @@
physicsserver/hinge2joint_c.cpp
physicsserver/angularmotor.cpp
physicsserver/angularmotor_c.cpp
+
+ #interfaces
+ physicsserver/imp/worldimp_c.cpp
+
+ #ODE-specific files
+ physicsserver/ode/odeworld.cpp
+ physicsserver/ode/odeworld_c.cpp
+ physicsserver/ode/odeobject.cpp
+ physicsserver/ode/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-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -57,9 +57,9 @@
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(WorldImp), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Joint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(BallJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(HingeJoint), "oxygen/");
@@ -86,6 +86,11 @@
zg.GetCore()->RegisterClassObject(new CLASS(AgentAspect), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Effector), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Perceptor), "oxygen/");
+
+ //ODE-specific classes
+ zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(ODEWorld), "oxygen/");
+
#ifdef HAVE_SPADES_HEADERS
// spades
Modified: branches/multiphys/spark/lib/oxygen/oxygen.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -34,6 +34,7 @@
#include "gamecontrolserver/actionobject.h"
#include "gamecontrolserver/behavior.h"
+//abstract physics classes
#include "physicsserver/body.h"
#include "physicsserver/bodycontroller.h"
#include "physicsserver/dragcontroller.h"
@@ -42,7 +43,6 @@
#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"
@@ -60,6 +60,13 @@
#include "physicsserver/universaljoint.h"
#include "physicsserver/hinge2joint.h"
+//physics interfaces
+#include "physicsserver/imp/worldimp.h"
+
+//ode-specific includes
+#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/ode/odeworld.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-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -339,7 +339,7 @@
// 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)
@@ -361,7 +361,7 @@
// 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)
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -23,7 +23,7 @@
#define OXYGEN_BODY_H
#include <oxygen/oxygen_defines.h>
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -23,7 +23,7 @@
#define OXYGEN_BOXCOLLIDER_H
#include <oxygen/oxygen_defines.h>
-#include "collider.h"
+#include <oxygen/physicsserver/collider.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_COLLIDER_H
#define OXYGEN_COLLIDER_H
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
#include <string>
#include <set>
#include <oxygen/oxygen_defines.h>
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -24,7 +24,7 @@
#include <oxygen/sceneserver/basenode.h>
#include <oxygen/oxygen_defines.h>
-#include "odewrapper.h"
+#include <oxygen/physicsserver/ode/odewrapper.h>
namespace oxygen
{
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/imp/worldimp.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,116 +0,0 @@
-/* -*- 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: world.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_WORLDIMP_H
-#define OXYGEN_WORLDIMP_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
-
-namespace oxygen
-{
-
-/** World encapsulates an ODE world object. It is a container for
- rigid bodies and joints. Objects in different worlds can not
- interact, for example rigid bodies from two different worlds can
- not collide. All the objects in a world exist at the same point in
- time, thus one reason to use separate worlds is to simulate
- systems at different rates.
-*/
-class OXYGEN_API WorldImp : public ODEObject
-{
- //
- // Functions
- //
-public:
- WorldImp() : ODEObject(){};
- virtual ~WorldImp(){};
-
- /** returns the ID of the managed ODE world */
- virtual dWorldID GetODEWorldImp() const = 0;
-
- /** sets the gravity vector of this vorld */
- virtual void SetGravityImp(const salt::Vector3f& gravity) = 0;
-
- /** gets the gravity vector of this world */
- virtual salt::Vector3f GetGravityImp() const = 0;
-
- /** sets the Error Reduction Parameter of this world. The ERP
- specifies what proportion of a joint error will be fixed
- during the next simulation step. if ERP=0 then no correcting
- force is applied and the bodies will eventually drift apart as
- the simulation proceeds. If ERP=1 then the simulation will
- attempt to fix all joint error during the next time
- step. However, setting ERP=1 is not recommended, as the joint
- error will not be completely fixed due to various internal
- approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
- is the default).
- */
- virtual void SetERPImp(float erp) = 0;
-
- /** returns the Error Reduction Parameter of this World.
- */
- virtual float GetERPImp() const = 0;
-
- /** sets the Constraint Force mixing (CFM) value. If CFM is set to
- zero, the constraint will be hard. If CFM is set to a positive
- value, it will be possible to violate the constraint by
- `pushing on it' (for example, for contact constraints by
- forcing the two contacting objects together). In other words
- the constraint will be soft, and the softness will increase as
- CFM increases. Note that setting CFM to a negative value can
- have undesirable bad effects, such as instability.
- */
- virtual void SetCFMImp(float cfm) = 0;
-
- /** returns the Constraint Force mixing (CFM) value. */
- virtual float GetCFMImp() const = 0;
-
- /** steps the world deltatime forward, i.e. performs physics
- simulation for a deltaTime seconds interval.
- */
- virtual void StepImp(float deltaTime) = 0;
-
- virtual bool GetAutoDisableFlagImp() const = 0;
- virtual void SetAutoDisableFlagImp(bool flag) = 0;
-
- /** Set and get the depth of the surface layer around all geometry
- objects. Contacts are allowed to sink into the surface layer up to
- the given depth before coming to rest. The default value is
- zero. Increasing this to some small value (e.g. 0.001) can help
- prevent jittering problems due to contacts being repeatedly made
- and broken.
- */
- virtual void SetContactSurfaceLayerImp(float depth) = 0;
- virtual float GetContactSurfaceLayerImp() const = 0;
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObjectImp() = 0;
-
- /** creates them managed ODE world */
- virtual bool ConstructInternalImp() = 0;
-};
-
-DECLARE_ABSTRACTCLASS(WorldImp);
-
-}
-
-#endif //OXYGEN_WORLDIMP_H
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h (from rev 101, trunk/spark/lib/oxygen/physicsserver/imp/worldimp.h)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -0,0 +1,116 @@
+/* -*- 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: world.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_WORLDIMP_H
+#define OXYGEN_WORLDIMP_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odeobject.h>
+
+namespace oxygen
+{
+
+/** World encapsulates an ODE world object. It is a container for
+ rigid bodies and joints. Objects in different worlds can not
+ interact, for example rigid bodies from two different worlds can
+ not collide. All the objects in a world exist at the same point in
+ time, thus one reason to use separate worlds is to simulate
+ systems at different rates.
+*/
+class OXYGEN_API WorldImp : public ODEObject
+{
+ //
+ // Functions
+ //
+public:
+ WorldImp() : ODEObject(){};
+ virtual ~WorldImp(){};
+
+ /** returns the ID of the managed ODE world */
+ virtual dWorldID GetODEWorldImp() const = 0;
+
+ /** sets the gravity vector of this vorld */
+ virtual void SetGravityImp(const salt::Vector3f& gravity) = 0;
+
+ /** gets the gravity vector of this world */
+ virtual salt::Vector3f GetGravityImp() const = 0;
+
+ /** sets the Error Reduction Parameter of this world. The ERP
+ specifies what proportion of a joint error will be fixed
+ during the next simulation step. if ERP=0 then no correcting
+ force is applied and the bodies will eventually drift apart as
+ the simulation proceeds. If ERP=1 then the simulation will
+ attempt to fix all joint error during the next time
+ step. However, setting ERP=1 is not recommended, as the joint
+ error will not be completely fixed due to various internal
+ approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
+ is the default).
+ */
+ virtual void SetERPImp(float erp) = 0;
+
+ /** returns the Error Reduction Parameter of this World.
+ */
+ virtual float GetERPImp() const = 0;
+
+ /** sets the Constraint Force mixing (CFM) value. If CFM is set to
+ zero, the constraint will be hard. If CFM is set to a positive
+ value, it will be possible to violate the constraint by
+ `pushing on it' (for example, for contact constraints by
+ forcing the two contacting objects together). In other words
+ the constraint will be soft, and the softness will increase as
+ CFM increases. Note that setting CFM to a negative value can
+ have undesirable bad effects, such as instability.
+ */
+ virtual void SetCFMImp(float cfm) = 0;
+
+ /** returns the Constraint Force mixing (CFM) value. */
+ virtual float GetCFMImp() const = 0;
+
+ /** steps the world deltatime forward, i.e. performs physics
+ simulation for a deltaTime seconds interval.
+ */
+ virtual void StepImp(float deltaTime) = 0;
+
+ virtual bool GetAutoDisableFlagImp() const = 0;
+ virtual void SetAutoDisableFlagImp(bool flag) = 0;
+
+ /** Set and get the depth of the surface layer around all geometry
+ objects. Contacts are allowed to sink into the surface layer up to
+ the given depth before coming to rest. The default value is
+ zero. Increasing this to some small value (e.g. 0.001) can help
+ prevent jittering problems due to contacts being repeatedly made
+ and broken.
+ */
+ virtual void SetContactSurfaceLayerImp(float depth) = 0;
+ virtual float GetContactSurfaceLayerImp() const = 0;
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObjectImp() = 0;
+
+ /** creates them managed ODE world */
+ virtual bool ConstructInternalImp() = 0;
+};
+
+DECLARE_ABSTRACTCLASS(WorldImp);
+
+}
+
+#endif //OXYGEN_WORLDIMP_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,29 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
-
-this file is part of rcssserver3D
-Fri May 9 2003
-Copyright (C) 2003 Koblenz University
-$Id: world_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/imp/worldimp.h>
-
-using namespace oxygen;
-
-void CLASS(WorldImp)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/ODEObject);
-}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp (from rev 101, trunk/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -0,0 +1,29 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+this file is part of rcssserver3D
+Fri May 9 2003
+Copyright (C) 2003 Koblenz University
+$Id: world_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/imp/worldimp.h>
+
+using namespace oxygen;
+
+void CLASS(WorldImp)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/ODEObject);
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -23,7 +23,7 @@
#define OXYGEN_JOINT_H
#include <oxygen/oxygen_defines.h>
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
namespace oxygen
{
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,167 +0,0 @@
-/* -*- 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.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/ode/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()
-{
-}
-
-void ODEObject::OnUnlink()
-{
- DestroyODEObject();
-}
-
-/** returns the world node */
-shared_ptr<World> ODEObject::GetWorld()
-{
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
- return shared_ptr<World>();
- }
-
- shared_ptr<World> worldNode = shared_dynamic_cast<World>
- (scene->GetChildOfClass("World"));
- if (worldNode.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
- }
-
- return worldNode;
-}
-
-shared_ptr<Space> ODEObject::GetSpace()
-{
- // try to find the nearest parent space object
- weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
- if (! parentSpace.expired())
- {
- return parentSpace.lock();
- }
-
- // return the global space instance
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
- return shared_ptr<Space>();
- }
-
- shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
- (scene->GetChildOfClass("Space"));
- if (spaceNode.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
- }
-
- return spaceNode;
-}
-
-dWorldID ODEObject::GetWorldID()
-{
- shared_ptr<World> world = GetWorld();
- if (world.get() == 0)
- {
- return 0;
- }
-
- dWorldID worldId = world->GetODEWorld();
- if (worldId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: World returned empty ODE handle\n";
- }
-
- return worldId;
-}
-
-dSpaceID ODEObject::FindSpaceID()
-{
- shared_ptr<Space> space = GetSpace();
- if (space.get() == 0)
- {
- return 0;
- }
-
- dSpaceID spaceId = space->GetODESpace();
-
- if (spaceId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: Space returned empty ODE handle\n";
- }
-
- return spaceId;
-}
-
-dSpaceID ODEObject::GetParentSpaceID()
-{
- return 0;
-}
-
-void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
-{
- matrix[0] = rot.m[0];
- matrix[1] = rot.m[4];
- matrix[2] = rot.m[8];
- matrix[3] = 0;
- matrix[4] = rot.m[1];
- matrix[5] = rot.m[5];
- matrix[6] = rot.m[9];
- matrix[7] = 0;
- matrix[8] = rot.m[2];
- matrix[9] = rot.m[6];
- matrix[10] = rot.m[10];
- matrix[11] = 0;
-}
-
-void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
-{
- rot.m[0] = matrix[0] ;
- rot.m[4] = matrix[1] ;
- rot.m[8] = matrix[2];
- rot.m[12] = matrix[3];
- rot.m[1] = matrix[4];
- rot.m[5] = matrix[5];
- rot.m[9] = matrix[6];
- rot.m[13] = matrix[7];
- rot.m[2] = matrix[8];
- rot.m[6] = matrix[9];
- rot.m[10] = matrix[10] ;
- rot.m[14] = matrix[11];
- rot.m[3] = 0.0;
- rot.m[7] = 0.0;
- rot.m[11] = 0.0;
- rot.m[15] = 1.0;
-}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp (from rev 101, trunk/spark/lib/oxygen/physicsserver/ode/odeobject.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -0,0 +1,167 @@
+/* -*- 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.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/ode/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()
+{
+}
+
+void ODEObject::OnUnlink()
+{
+ DestroyODEObject();
+}
+
+/** returns the world node */
+shared_ptr<World> ODEObject::GetWorld()
+{
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<World>();
+ }
+
+ shared_ptr<World> worldNode = shared_dynamic_cast<World>
+ (scene->GetChildOfClass("World"));
+ if (worldNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
+ }
+
+ return worldNode;
+}
+
+shared_ptr<Space> ODEObject::GetSpace()
+{
+ // try to find the nearest parent space object
+ weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
+ if (! parentSpace.expired())
+ {
+ return parentSpace.lock();
+ }
+
+ // return the global space instance
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<Space>();
+ }
+
+ shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
+ (scene->GetChildOfClass("Space"));
+ if (spaceNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
+ }
+
+ return spaceNode;
+}
+
+dWorldID ODEObject::GetWorldID()
+{
+ shared_ptr<World> world = GetWorld();
+ if (world.get() == 0)
+ {
+ return 0;
+ }
+
+ dWorldID worldId = world->GetODEWorld();
+ if (worldId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: World returned empty ODE handle\n";
+ }
+
+ return worldId;
+}
+
+dSpaceID ODEObject::FindSpaceID()
+{
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() == 0)
+ {
+ return 0;
+ }
+
+ dSpaceID spaceId = space->GetODESpace();
+
+ if (spaceId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: Space returned empty ODE handle\n";
+ }
+
+ return spaceId;
+}
+
+dSpaceID ODEObject::GetParentSpaceID()
+{
+ return 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+{
+ matrix[0] = rot.m[0];
+ matrix[1] = rot.m[4];
+ matrix[2] = rot.m[8];
+ matrix[3] = 0;
+ matrix[4] = rot.m[1];
+ matrix[5] = rot.m[5];
+ matrix[6] = rot.m[9];
+ matrix[7] = 0;
+ matrix[8] = rot.m[2];
+ matrix[9] = rot.m[6];
+ matrix[10] = rot.m[10];
+ matrix[11] = 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+{
+ rot.m[0] = matrix[0] ;
+ rot.m[4] = matrix[1] ;
+ rot.m[8] = matrix[2];
+ rot.m[12] = matrix[3];
+ rot.m[1] = matrix[4];
+ rot.m[5] = matrix[5];
+ rot.m[9] = matrix[6];
+ rot.m[13] = matrix[7];
+ rot.m[2] = matrix[8];
+ rot.m[6] = matrix[9];
+ rot.m[10] = matrix[10] ;
+ rot.m[14] = matrix[11];
+ rot.m[3] = 0.0;
+ rot.m[7] = 0.0;
+ rot.m[11] = 0.0;
+ rot.m[15] = 1.0;
+}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,83 +0,0 @@
-/* -*- 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_ODEOBJECT_H
-#define OXYGEN_ODEOBJECT_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/sceneserver/basenode.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
-
-namespace oxygen
-{
-class Space;
-class World;
-
-/** ODEObject is the base of all classes encapsulating ODE concepts
- */
-class OXYGEN_API ODEObject : public BaseNode
-{
-public:
- //
- // Functions
- //
- ODEObject();
- virtual ~ODEObject();
-
- /** 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();
-
- /** returns the ODE world handle */
- dWorldID GetWorldID();
-
- /** returns the nearest parent space ODE handle */
- dSpaceID FindSpaceID();
-
- /** returns the ODE handle ID of the containing parent space */
- virtual dSpaceID GetParentSpaceID();
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObject(){};
-
-protected:
- /** returns the world node */
- boost::shared_ptr<World> GetWorld();
-
- /** finds the nearest parent space node */
- boost::shared_ptr<Space> GetSpace();
-
- /** converts the rotation part of a salt::Matrix to an ODE
- dMatrix3 */
- void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
-
- /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
- void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
-};
-
-DECLARE_ABSTRACTCLASS(ODEObject);
-
-} //namespace oxygen
-
-#endif //OXYGEN_ODEOBJECT_H
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h (from rev 101, trunk/spark/lib/oxygen/physicsserver/ode/odeobject.h)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -0,0 +1,83 @@
+/* -*- 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_ODEOBJECT_H
+#define OXYGEN_ODEOBJECT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/sceneserver/basenode.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
+
+namespace oxygen
+{
+class Space;
+class World;
+
+/** ODEObject is the base of all classes encapsulating ODE concepts
+ */
+class OXYGEN_API ODEObject : public BaseNode
+{
+public:
+ //
+ // Functions
+ //
+ ODEObject();
+ virtual ~ODEObject();
+
+ /** 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();
+
+ /** returns the ODE world handle */
+ dWorldID GetWorldID();
+
+ /** returns the nearest parent space ODE handle */
+ dSpaceID FindSpaceID();
+
+ /** returns the ODE handle ID of the containing parent space */
+ virtual dSpaceID GetParentSpaceID();
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObject(){};
+
+protected:
+ /** returns the world node */
+ boost::shared_ptr<World> GetWorld();
+
+ /** finds the nearest parent space node */
+ boost::shared_ptr<Space> GetSpace();
+
+ /** converts the rotation part of a salt::Matrix to an ODE
+ dMatrix3 */
+ void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
+
+ /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
+ void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+};
+
+DECLARE_ABSTRACTCLASS(ODEObject);
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEOBJECT_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,29 +0,0 @@
-/* -*- 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/ode/odeobject.h>
-
-using namespace oxygen;
-
-void CLASS(ODEObject)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/BaseNode);
-}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp (from rev 101, trunk/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -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/ode/odeobject.h>
+
+using namespace oxygen;
+
+void CLASS(ODEObject)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/BaseNode);
+}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,138 +0,0 @@
-/* -*- mode: c++ -*-
-
- this file is part of rcssserver3D
- Fri May 9 2003
- Copyright (C) 2003 Koblenz University
- $Id: world.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/ode/odeworld.h>
-#include <oxygen/physicsserver/space.h>
-#include <oxygen/sceneserver/scene.h>
-
-using namespace boost;
-using namespace oxygen;
-using namespace salt;
-
-ODEWorld::ODEWorld() : WorldImp(), mODEWorld(0)
-{
-}
-
-ODEWorld::~ODEWorld()
-{
-}
-
-dWorldID ODEWorld::GetODEWorldImp() const
-{
- return mODEWorld;
-}
-
-void ODEWorld::SetGravityImp(const Vector3f& gravity)
-{
- dWorldSetGravity(mODEWorld,
- gravity.x(),
- gravity.y(),
- gravity.z()
- );
-}
-
-salt::Vector3f ODEWorld::GetGravityImp() const
-{
- dVector3 dGravity;
- dWorldGetGravity(mODEWorld,dGravity);
- return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
-}
-
-void ODEWorld::SetERPImp(float erp)
-{
- dWorldSetERP(mODEWorld, erp);
-}
-
-float ODEWorld::GetERPImp() const
-{
- return dWorldGetERP(mODEWorld);
-}
-
-void ODEWorld::SetCFMImp(float cfm)
-{
- dWorldSetCFM(mODEWorld, cfm);
-}
-
-float ODEWorld::GetCFMImp() const
-{
- return dWorldGetCFM(mODEWorld);
-}
-
-void ODEWorld::StepImp(float deltaTime)
-{
- dWorldStep(mODEWorld, deltaTime);
-}
-
-bool ODEWorld::GetAutoDisableFlagImp() const
-{
- return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
-}
-
-void ODEWorld::SetAutoDisableFlagImp(bool flag)
-{
- dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
-}
-
-void ODEWorld::SetContactSurfaceLayerImp(float depth)
-{
- dWorldSetContactSurfaceLayer(mODEWorld, depth);
-}
-
-float ODEWorld::GetContactSurfaceLayerImp() const
-{
- return dWorldGetContactSurfaceLayer(mODEWorld);
-}
-
-bool ODEWorld::ConstructInternalImp()
-{
- // create an ode world
- mODEWorld = dWorldCreate();
-
- return (mODEWorld != 0);
-}
-
-void ODEWorld::DestroyODEObjectImp()
-{
- static bool recurseLock = false;
- if (recurseLock)
- {
- return;
- }
-
- recurseLock = true;
-
- shared_ptr<Space> space = GetSpace();
- if (space.get() != 0)
- {
- space->DestroyODEObject();
- }
-
- if (mODEWorld == 0)
- {
- return;
- }
-
- // release the ODE world
- dWorldDestroy(mODEWorld);
- mODEWorld = 0;
-
- recurseLock = false;
-}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp (from rev 101, trunk/spark/lib/oxygen/physicsserver/ode/odeworld.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-18 07:24:29 UTC (rev 102)
@@ -0,0 +1,138 @@
+/* -*- mode: c++ -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id: world.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/ode/odeworld.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/sceneserver/scene.h>
+
+using namespace boost;
+using namespace oxygen;
+using namespace salt;
+
+ODEWorld::ODEWorld() : WorldImp(), mODEWorld(0)
+{
+}
+
+ODEWorld::~ODEWorld()
+{
+}
+
+dWorldID ODEWorld::GetODEWorldImp() const
+{
+ return mODEWorld;
+}
+
+void ODEWorld::SetGravityImp(const Vector3f& gravity)
+{
+ dWorldSetGravity(mODEWorld,
+ gravity.x(),
+ gravity.y(),
+ gravity.z()
+ );
+}
+
+salt::Vector3f ODEWorld::GetGravityImp() const
+{
+ dVector3 dGravity;
+ dWorldGetGravity(mODEWorld,dGravity);
+ return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
+}
+
+void ODEWorld::SetERPImp(float erp)
+{
+ dWorldSetERP(mODEWorld, erp);
+}
+
+float ODEWorld::GetERPImp() const
+{
+ return dWorldGetERP(mODEWorld);
+}
+
+void ODEWorld::SetCFMImp(float cfm)
+{
+ dWorldSetCFM(mODEWorld, cfm);
+}
+
+float ODEWorld::GetCFMImp() const
+{
+ return dWorldGetCFM(mODEWorld);
+}
+
+void ODEWorld::StepImp(float deltaTime)
+{
+ dWorldStep(mODEWorld, deltaTime);
+}
+
+bool ODEWorld::GetAutoDisableFlagImp() const
+{
+ return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
+}
+
+void ODEWorld::SetAutoDisableFlagImp(bool flag)
+{
+ dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
+}
+
+void ODEWorld::SetContactSurfaceLayerImp(float depth)
+{
+ dWorldSetContactSurfaceLayer(mODEWorld, depth);
+}
+
+float ODEWorld::GetContactSurfaceLayerImp() const
+{
+ return dWorldGetContactSurfaceLayer(mODEWorld);
+}
+
+bool ODEWorld::ConstructInternalImp()
+{
+ // create an ode world
+ mODEWorld = dWorldCreate();
+
+ return (mODEWorld != 0);
+}
+
+void ODEWorld::DestroyODEObjectImp()
+{
+ static bool recurseLock = false;
+ if (recurseLock)
+ {
+ return;
+ }
+
+ recurseLock = true;
+
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() != 0)
+ {
+ space->DestroyODEObject();
+ }
+
+ if (mODEWorld == 0)
+ {
+ return;
+ }
+
+ // release the ODE world
+ dWorldDestroy(mODEWorld);
+ mODEWorld = 0;
+
+ recurseLock = false;
+}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-18 07:11:28 UTC (rev 101)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -1,124 +0,0 @@
-/* -*- 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: world.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_ODEWORLD_H
-#define OXYGEN_ODEWORLD_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/imp/worldimp.h>
-
-namespace oxygen
-{
-
-/** World encapsulates an ODE world object. It is a container for
- rigid bodies and joints. Objects in different worlds can not
- interact, for example rigid bodies from two different worlds can
- not collide. All the objects in a world exist at the same point in
- time, thus one reason to use separate worlds is to simulate
- systems at different rates.
-*/
-class OXYGEN_API ODEWorld : public WorldImp
-{
- //
- // Functions
- //
-public:
- ODEWorld();
- virtual ~ODEWorld();
-
- /** returns the ID of the managed ODE world */
- dWorldID GetODEWorldImp() const;
-
- /** sets the gravity vector of this vorld */
- void SetGravityImp(const salt::Vector3f& gravity);
-
- /** gets the gravity vector of this world */
- salt::Vector3f GetGravityImp() const;
-
- /** sets the Error Reduction Parameter of this world. The ERP
- specifies what proportion of a joint error will be fixed
- during the next simulation step. if ERP=0 then no correcting
- force is applied and the bodies will eventually drift apart as
- the simulation proceeds. If ERP=1 then the simulation will
- attempt to fix all joint error during the next time
- step. However, setting ERP=1 is not recommended, as the joint
- error will not be completely fixed due to various internal
- approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
- is the default).
- */
- void SetERPImp(float erp);
-
- /** returns the Error Reduction Parameter of this World.
- */
- float GetERPImp() const;
-
- /** sets the Constraint Force mixing (CFM) value. If CFM is set to
- zero, the constraint will be hard. If CFM is set to a positive
- value, it will be possible to violate the constraint by
- `pushing on it' (for example, for contact constraints by
- forcing the two contacting objects together). In other words
- the constraint will be soft, and the softness will increase as
- CFM increases. Note that setting CFM to a negative value can
- have undesirable bad effects, such as instability.
- */
- void SetCFMImp(float cfm);
-
- /** returns the Constraint Force mixing (CFM) value. */
- float GetCFMImp() const;
-
- /** steps the world deltatime forward, i.e. performs physics
- simulation for a deltaTime seconds interval.
- */
- void StepImp(float deltaTime);
-
- bool GetAutoDisableFlagImp() const;
- void SetAutoDisableFlagImp(bool flag);
-
- /** Set and get the depth of the surface layer around all geometry
- objects. Contacts are allowed to sink into the surface layer up to
- the given depth before coming to rest. The default value is
- zero. Increasing this to some small value (e.g. 0.001) can help
- prevent jittering problems due to contacts being repeatedly made
- and broken.
- */
- void SetContactSurfaceLayerImp(float depth);
- float GetContactSurfaceLayerImp() const;
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObjectImp();
-
-protected:
- /** creates them managed ODE world */
- virtual bool ConstructInternalImp();
-
- //
- // Members
- //
-private:
- /** the dynamics world represented by this object */
- dWorldID mODEWorld;
-};
-
-DECLARE_CLASS(ODEWorld);
-
-};
-
-#endif //OXYGEN_WORLD_H
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h (from rev 101, trunk/spark/lib/oxygen/physicsserver/ode/odeworld.h)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-18 07:24:29 UTC (rev 102)
@@ -0,0 +1,124 @@
+/* -*- 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: world.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 Li...
[truncated message content] |
|
From: <a-...@us...> - 2009-11-18 07:11:35
|
Revision: 101
http://simspark.svn.sourceforge.net/simspark/?rev=101&view=rev
Author: a-held
Date: 2009-11-18 07:11:28 +0000 (Wed, 18 Nov 2009)
Log Message:
-----------
Rolled back branch to revision 97
Revision Links:
--------------
http://simspark.svn.sourceforge.net/simspark/?rev=97&view=rev
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/boxcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h
branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
branches/multiphys/spark/lib/oxygen/physicsserver/space.h
branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.h
branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.h
branches/multiphys/spark/lib/oxygen/simulationserver/netcontrol.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.h
branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp
Added Paths:
-----------
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/lib/oxygen/physicsserver/odewrapper.h
Removed Paths:
-------------
branches/multiphys/spark/lib/oxygen/physicsserver/imp/
branches/multiphys/spark/lib/oxygen/physicsserver/ode/
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject_c.cpp
Property Changed:
----------------
branches/multiphys/spark/lib/oxygen/
Property changes on: branches/multiphys/spark/lib/oxygen
___________________________________________________________________
Deleted: svn:mergeinfo
- /trunk/spark/lib/oxygen:95-99
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-18 07:11:28 UTC (rev 101)
@@ -14,51 +14,33 @@
gamecontrolserver/behavior.h
oxygen.h
oxygen_defines.h
-
- #abstract physics
- physicsserver/physicsserver.h
- physicsserver/physicsobject.h
physicsserver/body.h
- physicsserver/collider.h
+ physicsserver/bodycontroller.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/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
-
-
- #interfaces
- physicsserver/imp/worldimp.h
-
- #ode-specific files
- physicsserver/ode/odeobject.h
- physicsserver/ode/odeworld.h
- physicsserver/ode/odewrapper.h
-
+ physicsserver/hinge2joint.h
+ physicsserver/angularmotor.h
sceneserver/sceneimporter.h
sceneserver/basenode.h
sceneserver/fpscontroller.h
@@ -118,15 +100,12 @@
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/collider.cpp
- physicsserver/collider_c.cpp
+ physicsserver/bodycontroller.cpp
+ physicsserver/bodycontroller_c.cpp
+ physicsserver/transformcollider.cpp
+ physicsserver/transformcollider_c.cpp
physicsserver/boxcollider.cpp
physicsserver/boxcollider_c.cpp
physicsserver/ccylindercollider.cpp
@@ -137,61 +116,42 @@
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/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
-
-
- #interfaces
- physicsserver/imp/worldimp_c.cpp
-
- #ODE-specific files
- physicsserver/ode/odeworld.cpp
- physicsserver/ode/odeworld_c.cpp
- physicsserver/ode/odeobject.cpp
- physicsserver/ode/odeobject_c.cpp
-
+ physicsserver/hinge2joint.cpp
+ physicsserver/hinge2joint_c.cpp
+ physicsserver/angularmotor.cpp
+ physicsserver/angularmotor_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-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -53,44 +53,39 @@
// 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(WorldImp), "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(Space), "oxygen/");
- zg.GetCore()->RegisterClassObject(new CLASS(World), "oxygen/");
- zg.GetCore()->RegisterClassObject(new CLASS(BodyController), "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(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/");
zg.GetCore()->RegisterClassObject(new CLASS(Perceptor), "oxygen/");
-
- //ODE-specific classes
- zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/");
- zg.GetCore()->RegisterClassObject(new CLASS(ODEWorld), "oxygen/");
-
#ifdef HAVE_SPADES_HEADERS
// spades
Modified: branches/multiphys/spark/lib/oxygen/oxygen.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -34,7 +34,6 @@
#include "gamecontrolserver/actionobject.h"
#include "gamecontrolserver/behavior.h"
-//abstract physics classes
#include "physicsserver/body.h"
#include "physicsserver/bodycontroller.h"
#include "physicsserver/dragcontroller.h"
@@ -43,6 +42,7 @@
#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"
@@ -60,13 +60,6 @@
#include "physicsserver/universaljoint.h"
#include "physicsserver/hinge2joint.h"
-//physics interfaces
-#include "physicsserver/imp/worldimp.h"
-
-//ode-specific includes
-#include <oxygen/physicsserver/ode/odeobject.h>
-#include <oxygen/physicsserver/ode/odeworld.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-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -334,47 +334,47 @@
AddMass(ODEMass, matrix);
}
-void Body::PrepareCapsule (dMass& mass, float density, float radius, float length) const
+void Body::PrepareCappedCylinder (dMass& mass, float density, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMassSetCapsule (&mass, density, direction, radius, length);
+ dMassSetCappedCylinder (&mass, density, direction, radius, length);
}
-void Body::SetCapsule (float density, float radius, float length)
+void Body::SetCappedCylinder (float density, float radius, float length)
{
dMass ODEMass;
- PrepareCapsule(ODEMass, density, radius, length);
+ PrepareCappedCylinder(ODEMass, density, radius, length);
dBodySetMass(mODEBody, &ODEMass);
}
-void Body::AddCapsule (float density, float radius, float length, const Matrix& matrix)
+void Body::AddCappedCylinder (float density, float radius, float length, const Matrix& matrix)
{
dMass ODEMass;
- PrepareCapsule(ODEMass, density, radius, length);
+ PrepareCappedCylinder(ODEMass, density, radius, length);
AddMass(ODEMass, matrix);
}
-void Body::PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const
+void Body::PrepareCappedCylinderTotal(dMass& mass, float total_mass, float radius, float length) const
{
// direction: (1=x, 2=y, 3=z)
int direction = 3;
- dMassSetCapsuleTotal(&mass, total_mass, direction, radius, length);
+ dMassSetCappedCylinderTotal(&mass, total_mass, direction, radius, length);
}
-void Body::SetCapsuleTotal(float total_mass, float radius, float length)
+void Body::SetCappedCylinderTotal(float total_mass, float radius, float length)
{
dMass ODEMass;
- PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
+ PrepareCappedCylinderTotal(ODEMass, total_mass, radius, length);
dBodySetMass(mODEBody, &ODEMass);
}
-void Body::AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix)
+void Body::AddCappedCylinderTotal(float total_mass, float radius, float length, const salt::Matrix& matrix)
{
dMass ODEMass;
- PrepareCapsuleTotal(ODEMass, total_mass, radius, length);
+ PrepareCappedCylinderTotal(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-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -23,7 +23,7 @@
#define OXYGEN_BODY_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
namespace oxygen
{
@@ -167,13 +167,13 @@
counting the spherical cap) is length. The cylinder's long axis
is oriented along the body's z axis.
*/
- void SetCapsule (float density, float radius, float length);
+ void SetCappedCylinder (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 AddCapsule (float density, float radius, float length, const salt::Matrix& matrix);
+ void AddCappedCylinder (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 SetCapsuleTotal(float total_mass, float radius, float length);
+ void SetCappedCylinderTotal(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 AddCapsuleTotal(float total_mass, float radius, float length, const salt::Matrix& matrix);
+ void AddCappedCylinderTotal(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 PrepareCapsule (dMass& mass, float density, float radius, float length) const;
+ void PrepareCappedCylinder (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 PrepareCapsuleTotal(dMass& mass, float total_mass, float radius, float length) const;
+ void PrepareCappedCylinderTotal(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-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body_c.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -379,7 +379,7 @@
return true;
}
-FUNCTION(Body,setCapsule)
+FUNCTION(Body,setCappedCylinder)
{
float inDensity;
float inRadius;
@@ -395,11 +395,11 @@
return false;
}
- obj->SetCapsule(inDensity,inRadius,inLength);
+ obj->SetCappedCylinder(inDensity,inRadius,inLength);
return true;
}
-FUNCTION(Body,addCapsule)
+FUNCTION(Body,addCappedCylinder)
{
float inDensity;
float inRadius;
@@ -421,11 +421,11 @@
// Matrix is allowed to be missing, defaults to identity
in.GetValue(in[3],inMat);
- obj->AddCapsule(inDensity,inRadius,inLength,inMat);
+ obj->AddCappedCylinder(inDensity,inRadius,inLength,inMat);
return true;
}
-FUNCTION(Body,setCapsuleTotal)
+FUNCTION(Body,setCappedCylinderTotal)
{
float inMassTotal;
float inRadius;
@@ -441,11 +441,11 @@
return false;
}
- obj->SetCapsuleTotal(inMassTotal,inRadius,inLength);
+ obj->SetCappedCylinderTotal(inMassTotal,inRadius,inLength);
return true;
}
-FUNCTION(Body,addCapsuleTotal)
+FUNCTION(Body,addCappedCylinderTotal)
{
float inMassTotal;
float inRadius;
@@ -466,7 +466,7 @@
// Matrix is allowed to be missing, defaults to identity
in.GetValue(in[3],inMat);
- obj->AddCapsuleTotal(inMassTotal,inRadius,inLength,inMat);
+ obj->AddCappedCylinderTotal(inMassTotal,inRadius,inLength,inMat);
return true;
}
@@ -585,10 +585,10 @@
DEFINE_FUNCTION(addCylinder);
DEFINE_FUNCTION(setCylinderTotal);
DEFINE_FUNCTION(addCylinderTotal);
- DEFINE_FUNCTION(setCapsule);
- DEFINE_FUNCTION(addCapsule);
- DEFINE_FUNCTION(setCapsuleTotal);
- DEFINE_FUNCTION(addCapsuleTotal);
+ DEFINE_FUNCTION(setCappedCylinder);
+ DEFINE_FUNCTION(addCappedCylinder);
+ DEFINE_FUNCTION(setCappedCylinderTotal);
+ DEFINE_FUNCTION(addCappedCylinderTotal);
DEFINE_FUNCTION(setMass);
DEFINE_FUNCTION(getMass);
DEFINE_FUNCTION(setVelocity);
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -23,7 +23,7 @@
#define OXYGEN_BOXCOLLIDER_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/collider.h>
+#include "collider.h"
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_COLLIDER_H
#define OXYGEN_COLLIDER_H
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
#include <string>
#include <set>
#include <oxygen/oxygen_defines.h>
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -24,7 +24,7 @@
#include <oxygen/sceneserver/basenode.h>
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
+#include "odewrapper.h"
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -23,7 +23,7 @@
#define OXYGEN_JOINT_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
namespace oxygen
{
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.cpp (from rev 97, branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -0,0 +1,167 @@
+/* -*- 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$
+
+ 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 "odeobject.h"
+#include "space.h"
+#include "world.h"
+#include <oxygen/sceneserver/scene.h>
+#include <zeitgeist/logserver/logserver.h>
+
+using namespace oxygen;
+using namespace boost;
+
+ODEObject::ODEObject() : BaseNode()
+{
+}
+
+ODEObject::~ODEObject()
+{
+}
+
+void ODEObject::OnUnlink()
+{
+ DestroyODEObject();
+}
+
+/** returns the world node */
+shared_ptr<World> ODEObject::GetWorld()
+{
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<World>();
+ }
+
+ shared_ptr<World> worldNode = shared_dynamic_cast<World>
+ (scene->GetChildOfClass("World"));
+ if (worldNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
+ }
+
+ return worldNode;
+}
+
+shared_ptr<Space> ODEObject::GetSpace()
+{
+ // try to find the nearest parent space object
+ weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
+ if (! parentSpace.expired())
+ {
+ return parentSpace.lock();
+ }
+
+ // return the global space instance
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<Space>();
+ }
+
+ shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
+ (scene->GetChildOfClass("Space"));
+ if (spaceNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
+ }
+
+ return spaceNode;
+}
+
+dWorldID ODEObject::GetWorldID()
+{
+ shared_ptr<World> world = GetWorld();
+ if (world.get() == 0)
+ {
+ return 0;
+ }
+
+ dWorldID worldId = world->GetODEWorld();
+ if (worldId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: World returned empty ODE handle\n";
+ }
+
+ return worldId;
+}
+
+dSpaceID ODEObject::FindSpaceID()
+{
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() == 0)
+ {
+ return 0;
+ }
+
+ dSpaceID spaceId = space->GetODESpace();
+
+ if (spaceId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: Space returned empty ODE handle\n";
+ }
+
+ return spaceId;
+}
+
+dSpaceID ODEObject::GetParentSpaceID()
+{
+ return 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+{
+ matrix[0] = rot.m[0];
+ matrix[1] = rot.m[4];
+ matrix[2] = rot.m[8];
+ matrix[3] = 0;
+ matrix[4] = rot.m[1];
+ matrix[5] = rot.m[5];
+ matrix[6] = rot.m[9];
+ matrix[7] = 0;
+ matrix[8] = rot.m[2];
+ matrix[9] = rot.m[6];
+ matrix[10] = rot.m[10];
+ matrix[11] = 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+{
+ rot.m[0] = matrix[0] ;
+ rot.m[4] = matrix[1] ;
+ rot.m[8] = matrix[2];
+ rot.m[12] = matrix[3];
+ rot.m[1] = matrix[4];
+ rot.m[5] = matrix[5];
+ rot.m[9] = matrix[6];
+ rot.m[13] = matrix[7];
+ rot.m[2] = matrix[8];
+ rot.m[6] = matrix[9];
+ rot.m[10] = matrix[10] ;
+ rot.m[14] = matrix[11];
+ rot.m[3] = 0.0;
+ rot.m[7] = 0.0;
+ rot.m[11] = 0.0;
+ rot.m[15] = 1.0;
+}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.h (from rev 97, branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.h)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/odeobject.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -0,0 +1,83 @@
+/* -*- 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$
+ $Id$
+
+ 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_ODEOBJECT_H
+#define OXYGEN_ODEOBJECT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/sceneserver/basenode.h>
+#include "odewrapper.h"
+
+namespace oxygen
+{
+class Space;
+class World;
+
+/** ODEObject is the base of all classes encapsulating ODE concepts
+ */
+class OXYGEN_API ODEObject : public BaseNode
+{
+public:
+ //
+ // Functions
+ //
+ ODEObject();
+ virtual ~ODEObject();
+
+ /** 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();
+
+ /** returns the ODE world handle */
+ dWorldID GetWorldID();
+
+ /** returns the nearest parent space ODE handle */
+ dSpaceID FindSpaceID();
+
+ /** returns the ODE handle ID of the containing parent space */
+ virtual dSpaceID GetParentSpaceID();
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObject() = 0;
+
+protected:
+ /** returns the world node */
+ boost::shared_ptr<World> GetWorld();
+
+ /** finds the nearest parent space node */
+ boost::shared_ptr<Space> GetSpace();
+
+ /** converts the rotation part of a salt::Matrix to an ODE
+ dMatrix3 */
+ void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
+
+ /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
+ void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+};
+
+DECLARE_ABSTRACTCLASS(ODEObject);
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEOBJECT_H
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/odeobject_c.cpp (from rev 97, branches/multiphys/spark/lib/oxygen/physicsserver/odeobject_c.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/odeobject_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -0,0 +1,29 @@
+/* -*- mode: c++ -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id$
+
+ 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 "odeobject.h"
+
+using namespace oxygen;
+
+void CLASS(ODEObject)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/BaseNode);
+}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/odewrapper.h (from rev 97, branches/multiphys/spark/lib/oxygen/physicsserver/odewrapper.h)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/odewrapper.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/odewrapper.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -0,0 +1,80 @@
+/* -*- 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$
+
+ 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_ODEWRAPPER_H
+#define OXYGEN_ODEWRAPPER_H
+
+#undef EXTERN
+#undef HAVE_VPRINTF
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+#undef PREFIX
+#undef VERSION
+
+#ifdef WIN32
+
+#ifdef copysignf
+#undef copysignf
+#endif
+
+#ifdef copysign
+#undef copysign
+#endif
+
+#endif // WIN32
+
+#ifdef __APPLE__
+
+// there is a conflicting type in a system header (Leopard)
+// so we define a dummy here
+#define uint32 dummy
+
+#endif
+
+#include <ode/ode.h>
+
+#ifdef __APPLE__
+
+// undefine the dummy
+#undef uint32
+
+#endif
+
+#undef EXTERN
+#undef HAVE_VPRINTF
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+#undef PREFIX
+#undef VERSION
+
+#ifdef HAVE_CONFIG_H
+#include <sparkconfig.h>
+#endif
+
+#endif // OXYGEN_ODEWRAPPER
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -1,81 +0,0 @@
-/* -*- 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
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject_c.cpp 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsobject_c.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -1,29 +0,0 @@
-/* -*- 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/lib/oxygen/physicsserver/physicsserver.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -25,7 +25,7 @@
#include <zeitgeist/class.h>
#include <zeitgeist/leaf.h>
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
+#include "odewrapper.h"
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/space.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/space.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/space.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_SPACE_H
#define OXYGEN_SPACE_H
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
#include <set>
#include <oxygen/oxygen_defines.h>
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -19,19 +19,16 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <oxygen/physicsserver/ode/odeworld.h>
-#include <oxygen/physicsserver/world.h>
-#include <oxygen/physicsserver/space.h>
+#include "world.h"
+#include "space.h"
#include <oxygen/sceneserver/scene.h>
using namespace boost;
using namespace oxygen;
using namespace salt;
-World::World() : ODEObject()
+World::World() : ODEObject(), mODEWorld(0)
{
- shared_ptr<ODEWorld> odeworld(new ODEWorld());
- mWorldImp = (shared_dynamic_cast<WorldImp>(odeworld));
}
World::~World()
@@ -40,70 +37,102 @@
dWorldID World::GetODEWorld() const
{
- return mWorldImp->GetODEWorldImp();
+ return mODEWorld;
}
void World::SetGravity(const Vector3f& gravity)
{
- mWorldImp->SetGravityImp(gravity);
+ dWorldSetGravity(mODEWorld,
+ gravity.x(),
+ gravity.y(),
+ gravity.z()
+ );
}
salt::Vector3f World::GetGravity() const
{
- return mWorldImp->GetGravityImp();
+ dVector3 dGravity;
+ dWorldGetGravity(mODEWorld,dGravity);
+ return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
}
void World::SetERP(float erp)
{
- mWorldImp->SetERPImp(erp);
+ dWorldSetERP(mODEWorld, erp);
}
float World::GetERP() const
{
- return mWorldImp->GetERPImp();
+ return dWorldGetERP(mODEWorld);
}
void World::SetCFM(float cfm)
{
- mWorldImp->SetCFMImp(cfm);
+ dWorldSetCFM(mODEWorld, cfm);
}
float World::GetCFM() const
{
- return mWorldImp->GetCFMImp();
+ return dWorldGetCFM(mODEWorld);
}
void World::Step(float deltaTime)
{
- mWorldImp->StepImp(deltaTime);
+ dWorldStep(mODEWorld, deltaTime);
}
bool World::GetAutoDisableFlag() const
{
- return mWorldImp->GetAutoDisableFlagImp();
+ return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
}
void World::SetAutoDisableFlag(bool flag)
{
- mWorldImp->SetAutoDisableFlagImp(flag);
+ dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
}
void World::SetContactSurfaceLayer(float depth)
{
- mWorldImp->SetContactSurfaceLayerImp(depth);
+ dWorldSetContactSurfaceLayer(mODEWorld, depth);
}
float World::GetContactSurfaceLayer() const
{
- return mWorldImp->GetContactSurfaceLayerImp();
+ return dWorldGetContactSurfaceLayer(mODEWorld);
}
bool World::ConstructInternal()
{
- return mWorldImp->ConstructInternalImp();
+ // create an ode world
+ mODEWorld = dWorldCreate();
+
+ return (mODEWorld != 0);
}
void World::DestroyODEObject()
{
- mWorldImp->DestroyODEObjectImp();
+ static bool recurseLock = false;
+ if (recurseLock)
+ {
+ return;
+ }
+
+ recurseLock = true;
+
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() != 0)
+ {
+ space->DestroyODEObject();
+ }
+
+ if (mODEWorld == 0)
+ {
+ return;
+ }
+
+ // release the ODE world
+ dWorldDestroy(mODEWorld);
+ mODEWorld = 0;
+
+ recurseLock = false;
}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -23,14 +23,11 @@
#define OXYGEN_WORLD_H
#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
+#include "odeobject.h"
namespace oxygen
{
-class WorldImp;
-class ODEWorld;
-
/** World encapsulates an ODE world object. It is a container for
rigid bodies and joints. Objects in different worlds can not
interact, for example rigid bodies from two different worlds can
@@ -116,11 +113,12 @@
// Members
//
private:
- boost::shared_ptr<WorldImp> mWorldImp;
+ /** the dynamics world represented by this object */
+ dWorldID mODEWorld;
};
DECLARE_CLASS(World);
-}
+};
#endif //OXYGEN_WORLD_H
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <oxygen/physicsserver/world.h>
+#include "world.h"
using namespace boost;
using namespace oxygen;
Modified: branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.cpp 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -51,10 +51,6 @@
void AgentControl::ClientConnect(shared_ptr<Client> client)
{
- // Make sure that there is enough space in sense message cache vector
- if (client->id >= mClientSenses.size())
- mClientSenses.resize(client->id+1);
-
if (mGameControlServer.get() == 0)
{
return;
@@ -65,8 +61,6 @@
void AgentControl::ClientDisconnect(shared_ptr<Client> client)
{
- mClientSenses[client->id].clear();
-
if (mGameControlServer.get() == 0)
{
return;
@@ -130,23 +124,6 @@
}
}
-void AgentControl::SenseAgent()
-{
- int clientID;
- for (
- TAddrMap::iterator iter = mClients.begin();
- iter != mClients.end();
- ++iter
- )
- {
- clientID = iter->second->id;
- if (!mClientSenses[clientID].empty())
- {
- SendClientMessage(iter->second, mClientSenses[clientID]);
- }
- }
-}
-
void AgentControl::EndCycle()
{
NetControl::EndCycle();
@@ -169,14 +146,17 @@
return;
}
- // generate senses for all agents
+ // generate senses for all agents and send them to the
+ // corresponding net clients
+ int idx = 0;
+ vector<string> sensesArray(mClients.size());
for (
TAddrMap::iterator iter = mClients.begin();
iter != mClients.end();
- ++iter
+ ++iter, idx++
)
{
- const shared_ptr<Client> &client = (*iter).second;
+ shared_ptr<Client>& client = (*iter).second;
shared_ptr<AgentAspect> agent =
mGameControlServer->GetAgentAspect(client->id);
@@ -186,12 +166,27 @@
}
shared_ptr<PredicateList> senseList = agent->QueryPerceptors();
- mClientSenses[client->id] = parser->Generate(senseList);
- if (mClientSenses[client->id].empty())
+ sensesArray[idx] = parser->Generate(senseList);
+ if (sensesArray[idx].empty())
{
continue;
}
- mNetMessage->PrepareToSend(mClientSenses[client->id]);
+ mNetMessage->PrepareToSend(sensesArray[idx]);
}
+
+ // sending the senses
+ idx = 0;
+ for (
+ TAddrMap::iterator iter = mClients.begin();
+ iter != mClients.end();
+ ++iter, idx++
+ )
+ {
+ if (!sensesArray[idx].empty())
+ {
+ SendClientMessage(iter->second, sensesArray[idx]);
+ }
+
+ }
}
Modified: branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -47,10 +47,7 @@
GameControlServer */
virtual void StartCycle();
- /** sends sense updates to all connected agents */
- virtual void SenseAgent();
-
- /** generates sense updates for all connected agents */
+ /** generates and sends sense updates to all connected agents */
virtual void EndCycle();
protected:
@@ -59,8 +56,6 @@
protected:
/** cached reference to the GameControlServer */
CachedPath<GameControlServer> mGameControlServer;
-
- std::vector<std::string> mClientSenses;
};
DECLARE_CLASS(AgentControl);
Modified: branches/multiphys/spark/lib/oxygen/simulationserver/netcontrol.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/simulationserver/netcontrol.cpp 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/simulationserver/netcontrol.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -159,15 +159,6 @@
return;
}
- ret = mSocket->setReuseAddr(true);
-
- if (ret < 0)
- {
- GetLog()->Warning()
- << "(NetControl) failed to enable reuse of server socket "
- << "with '" << strerror(errno) << "'\n";
- }
-
try
{
mSocket->bind(mLocalAddr);
Modified: branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.cpp
===================================================================
--- branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.cpp 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -45,8 +45,7 @@
}
SimulationServer::SimulationServer() :
- Node(), mAdjustSpeed(false), mExitThreads(false), mMaxStepsPerCycle(3),
- mThreadBarrier(0)
+ Node(), mAdjustSpeed(false), mMaxStepsPerCycle(3), mThreadBarrier(0)
{
mSimTime = 0.0f;
mSimStep = 0.2f;
@@ -423,15 +422,14 @@
shared_ptr<SimControlNode> renderControl = GetControlNode("RenderControl");
float initDelta, finalDelta;
- while (!mExitThreads)
+ while (true)
{
++mCycle;
mThreadBarrier->wait();
- if (mExit)
- mExitThreads = true;
- // Wait for SimControlNodes' acts at the begining of a cycle
mThreadBarrier->wait();
+ if (mExit) // this check should be here so that all threads will quit
+ break;
finalDelta = initDelta = mSumDeltaTime;
mSceneServer->PrePhysicsUpdate(mSimStep);
@@ -454,7 +452,6 @@
if (renderControl
&& renderControl->GetTime() - mSimTime < 0.005f )
renderControl->EndCycle();
-
mThreadBarrier->wait();
mSumDeltaTime -= initDelta - finalDelta;
}
@@ -476,7 +473,7 @@
bool isRenderControl = (controlNode->GetName() == "RenderControl");
bool newCycle = false;
- while (!mExitThreads)
+ while ( true )
{
mThreadBarrier->wait();
newCycle = false;
@@ -489,6 +486,8 @@
controlNode->SetSimTime(mSimTime);
}
mThreadBarrier->wait();
+ if (mExit)
+ break;
if (isInputControl)
{
Modified: branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.h 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.h 2009-11-18 07:11:28 UTC (rev 101)
@@ -220,11 +220,6 @@
/** skips physical simulation for some time to catch up real time */
bool mAdjustSpeed;
- /** in multi-threaded mode, this indicates that all threads should be
- * terminated.
- */
- bool mExitThreads;
-
/** determines the number of allowed steps per cycle when mAdjustSpeed is true */
int mMaxStepsPerCycle;
Modified: branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp
===================================================================
--- branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp 2009-11-18 00:29:17 UTC (rev 100)
+++ branches/multiphys/spark/plugin/rosimporter/rosimporter.cpp 2009-11-18 07:11:28 UTC (rev 101)
@@ -1036,7 +1036,7 @@
if (body.get() != 0)
{
body->SetName(S_BODY+name);
- body->SetCapsuleTotal(physical.mass, radius, height);
+ body->SetCappedCylinderTotal(physical.mass, radius, height);
GetContext().AddMass(physical.mass, Trans());
}
@@ -1055,7 +1055,7 @@
collider->AddChildReference(handler);
}
- GetLog()->Debug() << "(RosImporter) created capsule " << name << "\n";
+ GetLog()->Debug() << "(RosImporter) created capped cylinder " << name << "\n";
return ReadChildElements(transform, element);
}
@@ -2014,7 +2014,7 @@
shared_ptr<Body> body = GetContextBody(contextTransform);
if (body.get() != 0)
{
- body->AddCapsuleTotal(physical.mass, radius, height, trans.matrix);
+ body->AddCappedCylinderTotal(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.
|
|
From: <he...@us...> - 2009-11-18 00:29:32
|
Revision: 100
http://simspark.svn.sourceforge.net/simspark/?rev=100&view=rev
Author: hedayat
Date: 2009-11-18 00:29:17 +0000 (Wed, 18 Nov 2009)
Log Message:
-----------
Merge changes from trunk to this branch
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.h
branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h
branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h
branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
branches/multiphys/spark/lib/oxygen/physicsserver/physicsserver.h
branches/multiphys/spark/lib/oxygen/physicsserver/space.h
branches/multiphys/spark/lib/oxygen/physicsserver/world.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/world.h
branches/multiphys/spark/lib/oxygen/physicsserver/world_c.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/agentcontrol.h
branches/multiphys/spark/lib/oxygen/simulationserver/netcontrol.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.cpp
branches/multiphys/spark/lib/oxygen/simulationserver/simulationserver.h
Added Paths:
-----------
branches/multiphys/spark/lib/oxygen/physicsserver/imp/
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odewrapper.h
Removed Paths:
-------------
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h
branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp
branches/multiphys/spark/lib/oxygen/physicsserver/ode/odewrapper.h
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/lib/oxygen/physicsserver/odewrapper.h
Property Changed:
----------------
branches/multiphys/spark/lib/oxygen/
Property changes on: branches/multiphys/spark/lib/oxygen
___________________________________________________________________
Added: svn:mergeinfo
+ /trunk/spark/lib/oxygen:95-99
Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2009-11-18 00:29:17 UTC (rev 100)
@@ -22,6 +22,10 @@
physicsserver/collider.h
physicsserver/boxcollider.h
physicsserver/ccylindercollider.h
+ physicsserver/collider.h
+ physicsserver/collisionhandler.h
+ physicsserver/contactjointhandler.h
+ physicsserver/physicsserver.h
physicsserver/planecollider.h
physicsserver/spherecollider.h
physicsserver/joint.h
@@ -46,6 +50,15 @@
physicsserver/odewrapper.h
physicsserver/odeobject.h
+
+ #interfaces
+ physicsserver/imp/worldimp.h
+
+ #ode-specific files
+ physicsserver/ode/odeobject.h
+ physicsserver/ode/odeworld.h
+ physicsserver/ode/odewrapper.h
+
sceneserver/sceneimporter.h
sceneserver/basenode.h
sceneserver/fpscontroller.h
@@ -118,6 +131,14 @@
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/physicsserver.cpp
+ physicsserver/physicsserver_c.cpp
physicsserver/planecollider.cpp
physicsserver/planecollider_c.cpp
physicsserver/spherecollider.cpp
@@ -161,6 +182,16 @@
physicsserver/odeobject.cpp
physicsserver/odeobject_c.cpp
+
+ #interfaces
+ physicsserver/imp/worldimp_c.cpp
+
+ #ODE-specific files
+ physicsserver/ode/odeworld.cpp
+ physicsserver/ode/odeworld_c.cpp
+ physicsserver/ode/odeobject.cpp
+ physicsserver/ode/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-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/oxygen.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -55,11 +55,12 @@
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(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(BodyController), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(DragController), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(VelocityController), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(Space), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(World), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(WorldImp), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Joint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(BallJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(HingeJoint), "oxygen/");
@@ -85,6 +86,11 @@
zg.GetCore()->RegisterClassObject(new CLASS(AgentAspect), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Effector), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Perceptor), "oxygen/");
+
+ //ODE-specific classes
+ zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(ODEWorld), "oxygen/");
+
#ifdef HAVE_SPADES_HEADERS
// spades
Modified: branches/multiphys/spark/lib/oxygen/oxygen.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/oxygen.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -34,36 +34,39 @@
#include "gamecontrolserver/actionobject.h"
#include "gamecontrolserver/behavior.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>
+//abstract physics classes
+#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/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"
-//ODE-specific includes
-#include <oxygen/physicsserver/odeobject.h>
+//physics interfaces
+#include "physicsserver/imp/worldimp.h"
+//ode-specific includes
+#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/ode/odeworld.h>
+
#include "sceneserver/basenode.h"
#include "sceneserver/camera.h"
#include "sceneserver/fpscontroller.h"
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/body.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -23,7 +23,7 @@
#define OXYGEN_BODY_H
#include <oxygen/oxygen_defines.h>
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -23,7 +23,7 @@
#define OXYGEN_BOXCOLLIDER_H
#include <oxygen/oxygen_defines.h>
-#include "collider.h"
+#include <oxygen/physicsserver/collider.h>
namespace oxygen
{
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_COLLIDER_H
#define OXYGEN_COLLIDER_H
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
#include <string>
#include <set>
#include <oxygen/oxygen_defines.h>
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -24,7 +24,7 @@
#include <oxygen/sceneserver/basenode.h>
#include <oxygen/oxygen_defines.h>
-#include "odewrapper.h"
+#include <oxygen/physicsserver/ode/odewrapper.h>
namespace oxygen
{
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/imp/worldimp.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -1,116 +0,0 @@
-/* -*- 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: world.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_WORLDIMP_H
-#define OXYGEN_WORLDIMP_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/ode/odeobject.h>
-
-namespace oxygen
-{
-
-/** World encapsulates an ODE world object. It is a container for
- rigid bodies and joints. Objects in different worlds can not
- interact, for example rigid bodies from two different worlds can
- not collide. All the objects in a world exist at the same point in
- time, thus one reason to use separate worlds is to simulate
- systems at different rates.
-*/
-class OXYGEN_API WorldImp : public ODEObject
-{
- //
- // Functions
- //
-public:
- WorldImp() : ODEObject(){};
- virtual ~WorldImp(){};
-
- /** returns the ID of the managed ODE world */
- virtual dWorldID GetODEWorldImp() const = 0;
-
- /** sets the gravity vector of this vorld */
- virtual void SetGravityImp(const salt::Vector3f& gravity) = 0;
-
- /** gets the gravity vector of this world */
- virtual salt::Vector3f GetGravityImp() const = 0;
-
- /** sets the Error Reduction Parameter of this world. The ERP
- specifies what proportion of a joint error will be fixed
- during the next simulation step. if ERP=0 then no correcting
- force is applied and the bodies will eventually drift apart as
- the simulation proceeds. If ERP=1 then the simulation will
- attempt to fix all joint error during the next time
- step. However, setting ERP=1 is not recommended, as the joint
- error will not be completely fixed due to various internal
- approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
- is the default).
- */
- virtual void SetERPImp(float erp) = 0;
-
- /** returns the Error Reduction Parameter of this World.
- */
- virtual float GetERPImp() const = 0;
-
- /** sets the Constraint Force mixing (CFM) value. If CFM is set to
- zero, the constraint will be hard. If CFM is set to a positive
- value, it will be possible to violate the constraint by
- `pushing on it' (for example, for contact constraints by
- forcing the two contacting objects together). In other words
- the constraint will be soft, and the softness will increase as
- CFM increases. Note that setting CFM to a negative value can
- have undesirable bad effects, such as instability.
- */
- virtual void SetCFMImp(float cfm) = 0;
-
- /** returns the Constraint Force mixing (CFM) value. */
- virtual float GetCFMImp() const = 0;
-
- /** steps the world deltatime forward, i.e. performs physics
- simulation for a deltaTime seconds interval.
- */
- virtual void StepImp(float deltaTime) = 0;
-
- virtual bool GetAutoDisableFlagImp() const = 0;
- virtual void SetAutoDisableFlagImp(bool flag) = 0;
-
- /** Set and get the depth of the surface layer around all geometry
- objects. Contacts are allowed to sink into the surface layer up to
- the given depth before coming to rest. The default value is
- zero. Increasing this to some small value (e.g. 0.001) can help
- prevent jittering problems due to contacts being repeatedly made
- and broken.
- */
- virtual void SetContactSurfaceLayerImp(float depth) = 0;
- virtual float GetContactSurfaceLayerImp() const = 0;
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObjectImp() = 0;
-
- /** creates them managed ODE world */
- virtual bool ConstructInternalImp() = 0;
-};
-
-DECLARE_ABSTRACTCLASS(WorldImp);
-
-}
-
-#endif //OXYGEN_WORLDIMP_H
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h (from rev 99, trunk/spark/lib/oxygen/physicsserver/imp/worldimp.h)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -0,0 +1,116 @@
+/* -*- 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: world.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_WORLDIMP_H
+#define OXYGEN_WORLDIMP_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odeobject.h>
+
+namespace oxygen
+{
+
+/** World encapsulates an ODE world object. It is a container for
+ rigid bodies and joints. Objects in different worlds can not
+ interact, for example rigid bodies from two different worlds can
+ not collide. All the objects in a world exist at the same point in
+ time, thus one reason to use separate worlds is to simulate
+ systems at different rates.
+*/
+class OXYGEN_API WorldImp : public ODEObject
+{
+ //
+ // Functions
+ //
+public:
+ WorldImp() : ODEObject(){};
+ virtual ~WorldImp(){};
+
+ /** returns the ID of the managed ODE world */
+ virtual dWorldID GetODEWorldImp() const = 0;
+
+ /** sets the gravity vector of this vorld */
+ virtual void SetGravityImp(const salt::Vector3f& gravity) = 0;
+
+ /** gets the gravity vector of this world */
+ virtual salt::Vector3f GetGravityImp() const = 0;
+
+ /** sets the Error Reduction Parameter of this world. The ERP
+ specifies what proportion of a joint error will be fixed
+ during the next simulation step. if ERP=0 then no correcting
+ force is applied and the bodies will eventually drift apart as
+ the simulation proceeds. If ERP=1 then the simulation will
+ attempt to fix all joint error during the next time
+ step. However, setting ERP=1 is not recommended, as the joint
+ error will not be completely fixed due to various internal
+ approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
+ is the default).
+ */
+ virtual void SetERPImp(float erp) = 0;
+
+ /** returns the Error Reduction Parameter of this World.
+ */
+ virtual float GetERPImp() const = 0;
+
+ /** sets the Constraint Force mixing (CFM) value. If CFM is set to
+ zero, the constraint will be hard. If CFM is set to a positive
+ value, it will be possible to violate the constraint by
+ `pushing on it' (for example, for contact constraints by
+ forcing the two contacting objects together). In other words
+ the constraint will be soft, and the softness will increase as
+ CFM increases. Note that setting CFM to a negative value can
+ have undesirable bad effects, such as instability.
+ */
+ virtual void SetCFMImp(float cfm) = 0;
+
+ /** returns the Constraint Force mixing (CFM) value. */
+ virtual float GetCFMImp() const = 0;
+
+ /** steps the world deltatime forward, i.e. performs physics
+ simulation for a deltaTime seconds interval.
+ */
+ virtual void StepImp(float deltaTime) = 0;
+
+ virtual bool GetAutoDisableFlagImp() const = 0;
+ virtual void SetAutoDisableFlagImp(bool flag) = 0;
+
+ /** Set and get the depth of the surface layer around all geometry
+ objects. Contacts are allowed to sink into the surface layer up to
+ the given depth before coming to rest. The default value is
+ zero. Increasing this to some small value (e.g. 0.001) can help
+ prevent jittering problems due to contacts being repeatedly made
+ and broken.
+ */
+ virtual void SetContactSurfaceLayerImp(float depth) = 0;
+ virtual float GetContactSurfaceLayerImp() const = 0;
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObjectImp() = 0;
+
+ /** creates them managed ODE world */
+ virtual bool ConstructInternalImp() = 0;
+};
+
+DECLARE_ABSTRACTCLASS(WorldImp);
+
+}
+
+#endif //OXYGEN_WORLDIMP_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -1,29 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
-
-this file is part of rcssserver3D
-Fri May 9 2003
-Copyright (C) 2003 Koblenz University
-$Id: world_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/imp/worldimp.h>
-
-using namespace oxygen;
-
-void CLASS(WorldImp)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/ODEObject);
-}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp (from rev 99, trunk/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -0,0 +1,29 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+this file is part of rcssserver3D
+Fri May 9 2003
+Copyright (C) 2003 Koblenz University
+$Id: world_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/imp/worldimp.h>
+
+using namespace oxygen;
+
+void CLASS(WorldImp)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/ODEObject);
+}
Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.h
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -23,7 +23,7 @@
#define OXYGEN_JOINT_H
#include <oxygen/oxygen_defines.h>
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
namespace oxygen
{
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -1,167 +0,0 @@
-/* -*- 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.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/ode/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()
-{
-}
-
-void ODEObject::OnUnlink()
-{
- DestroyODEObject();
-}
-
-/** returns the world node */
-shared_ptr<World> ODEObject::GetWorld()
-{
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
- return shared_ptr<World>();
- }
-
- shared_ptr<World> worldNode = shared_dynamic_cast<World>
- (scene->GetChildOfClass("World"));
- if (worldNode.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
- }
-
- return worldNode;
-}
-
-shared_ptr<Space> ODEObject::GetSpace()
-{
- // try to find the nearest parent space object
- weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
- if (! parentSpace.expired())
- {
- return parentSpace.lock();
- }
-
- // return the global space instance
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
- return shared_ptr<Space>();
- }
-
- shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
- (scene->GetChildOfClass("Space"));
- if (spaceNode.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
- }
-
- return spaceNode;
-}
-
-dWorldID ODEObject::GetWorldID()
-{
- shared_ptr<World> world = GetWorld();
- if (world.get() == 0)
- {
- return 0;
- }
-
- dWorldID worldId = world->GetODEWorld();
- if (worldId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: World returned empty ODE handle\n";
- }
-
- return worldId;
-}
-
-dSpaceID ODEObject::FindSpaceID()
-{
- shared_ptr<Space> space = GetSpace();
- if (space.get() == 0)
- {
- return 0;
- }
-
- dSpaceID spaceId = space->GetODESpace();
-
- if (spaceId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: Space returned empty ODE handle\n";
- }
-
- return spaceId;
-}
-
-dSpaceID ODEObject::GetParentSpaceID()
-{
- return 0;
-}
-
-void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
-{
- matrix[0] = rot.m[0];
- matrix[1] = rot.m[4];
- matrix[2] = rot.m[8];
- matrix[3] = 0;
- matrix[4] = rot.m[1];
- matrix[5] = rot.m[5];
- matrix[6] = rot.m[9];
- matrix[7] = 0;
- matrix[8] = rot.m[2];
- matrix[9] = rot.m[6];
- matrix[10] = rot.m[10];
- matrix[11] = 0;
-}
-
-void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
-{
- rot.m[0] = matrix[0] ;
- rot.m[4] = matrix[1] ;
- rot.m[8] = matrix[2];
- rot.m[12] = matrix[3];
- rot.m[1] = matrix[4];
- rot.m[5] = matrix[5];
- rot.m[9] = matrix[6];
- rot.m[13] = matrix[7];
- rot.m[2] = matrix[8];
- rot.m[6] = matrix[9];
- rot.m[10] = matrix[10] ;
- rot.m[14] = matrix[11];
- rot.m[3] = 0.0;
- rot.m[7] = 0.0;
- rot.m[11] = 0.0;
- rot.m[15] = 1.0;
-}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp (from rev 99, trunk/spark/lib/oxygen/physicsserver/ode/odeobject.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -0,0 +1,167 @@
+/* -*- 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.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/ode/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()
+{
+}
+
+void ODEObject::OnUnlink()
+{
+ DestroyODEObject();
+}
+
+/** returns the world node */
+shared_ptr<World> ODEObject::GetWorld()
+{
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<World>();
+ }
+
+ shared_ptr<World> worldNode = shared_dynamic_cast<World>
+ (scene->GetChildOfClass("World"));
+ if (worldNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
+ }
+
+ return worldNode;
+}
+
+shared_ptr<Space> ODEObject::GetSpace()
+{
+ // try to find the nearest parent space object
+ weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
+ if (! parentSpace.expired())
+ {
+ return parentSpace.lock();
+ }
+
+ // return the global space instance
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<Space>();
+ }
+
+ shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
+ (scene->GetChildOfClass("Space"));
+ if (spaceNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
+ }
+
+ return spaceNode;
+}
+
+dWorldID ODEObject::GetWorldID()
+{
+ shared_ptr<World> world = GetWorld();
+ if (world.get() == 0)
+ {
+ return 0;
+ }
+
+ dWorldID worldId = world->GetODEWorld();
+ if (worldId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: World returned empty ODE handle\n";
+ }
+
+ return worldId;
+}
+
+dSpaceID ODEObject::FindSpaceID()
+{
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() == 0)
+ {
+ return 0;
+ }
+
+ dSpaceID spaceId = space->GetODESpace();
+
+ if (spaceId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: Space returned empty ODE handle\n";
+ }
+
+ return spaceId;
+}
+
+dSpaceID ODEObject::GetParentSpaceID()
+{
+ return 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+{
+ matrix[0] = rot.m[0];
+ matrix[1] = rot.m[4];
+ matrix[2] = rot.m[8];
+ matrix[3] = 0;
+ matrix[4] = rot.m[1];
+ matrix[5] = rot.m[5];
+ matrix[6] = rot.m[9];
+ matrix[7] = 0;
+ matrix[8] = rot.m[2];
+ matrix[9] = rot.m[6];
+ matrix[10] = rot.m[10];
+ matrix[11] = 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+{
+ rot.m[0] = matrix[0] ;
+ rot.m[4] = matrix[1] ;
+ rot.m[8] = matrix[2];
+ rot.m[12] = matrix[3];
+ rot.m[1] = matrix[4];
+ rot.m[5] = matrix[5];
+ rot.m[9] = matrix[6];
+ rot.m[13] = matrix[7];
+ rot.m[2] = matrix[8];
+ rot.m[6] = matrix[9];
+ rot.m[10] = matrix[10] ;
+ rot.m[14] = matrix[11];
+ rot.m[3] = 0.0;
+ rot.m[7] = 0.0;
+ rot.m[11] = 0.0;
+ rot.m[15] = 1.0;
+}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -1,83 +0,0 @@
-/* -*- 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_ODEOBJECT_H
-#define OXYGEN_ODEOBJECT_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/sceneserver/basenode.h>
-#include <oxygen/physicsserver/ode/odewrapper.h>
-
-namespace oxygen
-{
-class Space;
-class World;
-
-/** ODEObject is the base of all classes encapsulating ODE concepts
- */
-class OXYGEN_API ODEObject : public BaseNode
-{
-public:
- //
- // Functions
- //
- ODEObject();
- virtual ~ODEObject();
-
- /** 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();
-
- /** returns the ODE world handle */
- dWorldID GetWorldID();
-
- /** returns the nearest parent space ODE handle */
- dSpaceID FindSpaceID();
-
- /** returns the ODE handle ID of the containing parent space */
- virtual dSpaceID GetParentSpaceID();
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObject(){};
-
-protected:
- /** returns the world node */
- boost::shared_ptr<World> GetWorld();
-
- /** finds the nearest parent space node */
- boost::shared_ptr<Space> GetSpace();
-
- /** converts the rotation part of a salt::Matrix to an ODE
- dMatrix3 */
- void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
-
- /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
- void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
-};
-
-DECLARE_ABSTRACTCLASS(ODEObject);
-
-} //namespace oxygen
-
-#endif //OXYGEN_ODEOBJECT_H
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h (from rev 99, trunk/spark/lib/oxygen/physicsserver/ode/odeobject.h)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -0,0 +1,83 @@
+/* -*- 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_ODEOBJECT_H
+#define OXYGEN_ODEOBJECT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/sceneserver/basenode.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
+
+namespace oxygen
+{
+class Space;
+class World;
+
+/** ODEObject is the base of all classes encapsulating ODE concepts
+ */
+class OXYGEN_API ODEObject : public BaseNode
+{
+public:
+ //
+ // Functions
+ //
+ ODEObject();
+ virtual ~ODEObject();
+
+ /** 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();
+
+ /** returns the ODE world handle */
+ dWorldID GetWorldID();
+
+ /** returns the nearest parent space ODE handle */
+ dSpaceID FindSpaceID();
+
+ /** returns the ODE handle ID of the containing parent space */
+ virtual dSpaceID GetParentSpaceID();
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObject(){};
+
+protected:
+ /** returns the world node */
+ boost::shared_ptr<World> GetWorld();
+
+ /** finds the nearest parent space node */
+ boost::shared_ptr<Space> GetSpace();
+
+ /** converts the rotation part of a salt::Matrix to an ODE
+ dMatrix3 */
+ void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
+
+ /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
+ void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+};
+
+DECLARE_ABSTRACTCLASS(ODEObject);
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEOBJECT_H
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -1,29 +0,0 @@
-/* -*- 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/ode/odeobject.h>
-
-using namespace oxygen;
-
-void CLASS(ODEObject)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/BaseNode);
-}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp (from rev 99, trunk/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -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/ode/odeobject.h>
+
+using namespace oxygen;
+
+void CLASS(ODEObject)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/BaseNode);
+}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -1,138 +0,0 @@
-/* -*- mode: c++ -*-
-
- this file is part of rcssserver3D
- Fri May 9 2003
- Copyright (C) 2003 Koblenz University
- $Id: world.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/ode/odeworld.h>
-#include <oxygen/physicsserver/space.h>
-#include <oxygen/sceneserver/scene.h>
-
-using namespace boost;
-using namespace oxygen;
-using namespace salt;
-
-ODEWorld::ODEWorld() : WorldImp(), mODEWorld(0)
-{
-}
-
-ODEWorld::~ODEWorld()
-{
-}
-
-dWorldID ODEWorld::GetODEWorldImp() const
-{
- return mODEWorld;
-}
-
-void ODEWorld::SetGravityImp(const Vector3f& gravity)
-{
- dWorldSetGravity(mODEWorld,
- gravity.x(),
- gravity.y(),
- gravity.z()
- );
-}
-
-salt::Vector3f ODEWorld::GetGravityImp() const
-{
- dVector3 dGravity;
- dWorldGetGravity(mODEWorld,dGravity);
- return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
-}
-
-void ODEWorld::SetERPImp(float erp)
-{
- dWorldSetERP(mODEWorld, erp);
-}
-
-float ODEWorld::GetERPImp() const
-{
- return dWorldGetERP(mODEWorld);
-}
-
-void ODEWorld::SetCFMImp(float cfm)
-{
- dWorldSetCFM(mODEWorld, cfm);
-}
-
-float ODEWorld::GetCFMImp() const
-{
- return dWorldGetCFM(mODEWorld);
-}
-
-void ODEWorld::StepImp(float deltaTime)
-{
- dWorldStep(mODEWorld, deltaTime);
-}
-
-bool ODEWorld::GetAutoDisableFlagImp() const
-{
- return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
-}
-
-void ODEWorld::SetAutoDisableFlagImp(bool flag)
-{
- dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
-}
-
-void ODEWorld::SetContactSurfaceLayerImp(float depth)
-{
- dWorldSetContactSurfaceLayer(mODEWorld, depth);
-}
-
-float ODEWorld::GetContactSurfaceLayerImp() const
-{
- return dWorldGetContactSurfaceLayer(mODEWorld);
-}
-
-bool ODEWorld::ConstructInternalImp()
-{
- // create an ode world
- mODEWorld = dWorldCreate();
-
- return (mODEWorld != 0);
-}
-
-void ODEWorld::DestroyODEObjectImp()
-{
- static bool recurseLock = false;
- if (recurseLock)
- {
- return;
- }
-
- recurseLock = true;
-
- shared_ptr<Space> space = GetSpace();
- if (space.get() != 0)
- {
- space->DestroyODEObject();
- }
-
- if (mODEWorld == 0)
- {
- return;
- }
-
- // release the ODE world
- dWorldDestroy(mODEWorld);
- mODEWorld = 0;
-
- recurseLock = false;
-}
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp (from rev 99, trunk/spark/lib/oxygen/physicsserver/ode/odeworld.cpp)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-18 00:29:17 UTC (rev 100)
@@ -0,0 +1,138 @@
+/* -*- mode: c++ -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id: world.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/ode/odeworld.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/sceneserver/scene.h>
+
+using namespace boost;
+using namespace oxygen;
+using namespace salt;
+
+ODEWorld::ODEWorld() : WorldImp(), mODEWorld(0)
+{
+}
+
+ODEWorld::~ODEWorld()
+{
+}
+
+dWorldID ODEWorld::GetODEWorldImp() const
+{
+ return mODEWorld;
+}
+
+void ODEWorld::SetGravityImp(const Vector3f& gravity)
+{
+ dWorldSetGravity(mODEWorld,
+ gravity.x(),
+ gravity.y(),
+ gravity.z()
+ );
+}
+
+salt::Vector3f ODEWorld::GetGravityImp() const
+{
+ dVector3 dGravity;
+ dWorldGetGravity(mODEWorld,dGravity);
+ return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
+}
+
+void ODEWorld::SetERPImp(float erp)
+{
+ dWorldSetERP(mODEWorld, erp);
+}
+
+float ODEWorld::GetERPImp() const
+{
+ return dWorldGetERP(mODEWorld);
+}
+
+void ODEWorld::SetCFMImp(float cfm)
+{
+ dWorldSetCFM(mODEWorld, cfm);
+}
+
+float ODEWorld::GetCFMImp() const
+{
+ return dWorldGetCFM(mODEWorld);
+}
+
+void ODEWorld::StepImp(float deltaTime)
+{
+ dWorldStep(mODEWorld, deltaTime);
+}
+
+bool ODEWorld::GetAutoDisableFlagImp() const
+{
+ return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
+}
+
+void ODEWorld::SetAutoDisableFlagImp(bool flag)
+{
+ dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
+}
+
+void ODEWorld::SetContactSurfaceLayerImp(float depth)
+{
+ dWorldSetContactSurfaceLayer(mODEWorld, depth);
+}
+
+float ODEWorld::GetContactSurfaceLayerImp() const
+{
+ return dWorldGetContactSurfaceLayer(mODEWorld);
+}
+
+bool ODEWorld::ConstructInternalImp()
+{
+ // create an ode world
+ mODEWorld = dWorldCreate();
+
+ return (mODEWorld != 0);
+}
+
+void ODEWorld::DestroyODEObjectImp()
+{
+ static bool recurseLock = false;
+ if (recurseLock)
+ {
+ return;
+ }
+
+ recurseLock = true;
+
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() != 0)
+ {
+ space->DestroyODEObject();
+ }
+
+ if (mODEWorld == 0)
+ {
+ return;
+ }
+
+ // release the ODE world
+ dWorldDestroy(mODEWorld);
+ mODEWorld = 0;
+
+ recurseLock = false;
+}
Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-17 11:29:29 UTC (rev 99)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -1,124 +0,0 @@
-/* -*- 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: world.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_ODEWORLD_H
-#define OXYGEN_ODEWORLD_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/physicsserver/imp/worldimp.h>
-
-namespace oxygen
-{
-
-/** World encapsulates an ODE world object. It is a container for
- rigid bodies and joints. Objects in different worlds can not
- interact, for example rigid bodies from two different worlds can
- not collide. All the objects in a world exist at the same point in
- time, thus one reason to use separate worlds is to simulate
- systems at different rates.
-*/
-class OXYGEN_API ODEWorld : public WorldImp
-{
- //
- // Functions
- //
-public:
- ODEWorld();
- virtual ~ODEWorld();
-
- /** returns the ID of the managed ODE world */
- dWorldID GetODEWorldImp() const;
-
- /** sets the gravity vector of this vorld */
- void SetGravityImp(const salt::Vector3f& gravity);
-
- /** gets the gravity vector of this world */
- salt::Vector3f GetGravityImp() const;
-
- /** sets the Error Reduction Parameter of this world. The ERP
- specifies what proportion of a joint error will be fixed
- during the next simulation step. if ERP=0 then no correcting
- force is applied and the bodies will eventually drift apart as
- the simulation proceeds. If ERP=1 then the simulation will
- attempt to fix all joint error during the next time
- step. However, setting ERP=1 is not recommended, as the joint
- error will not be completely fixed due to various internal
- approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
- is the default).
- */
- void SetERPImp(float erp);
-
- /** returns the Error Reduction Parameter of this World.
- */
- float GetERPImp() const;
-
- /** sets the Constraint Force mixing (CFM) value. If CFM is set to
- zero, the constraint will be hard. If CFM is set to a positive
- value, it will be possible to violate the constraint by
- `pushing on it' (for example, for contact constraints by
- forcing the two contacting objects together). In other words
- the constraint will be soft, and the softness will increase as
- CFM increases. Note that setting CFM to a negative value can
- have undesirable bad effects, such as instability.
- */
- void SetCFMImp(float cfm);
-
- /** returns the Constraint Force mixing (CFM) value. */
- float GetCFMImp() const;
-
- /** steps the world deltatime forward, i.e. performs physics
- simulation for a deltaTime seconds interval.
- */
- void StepImp(float deltaTime);
-
- bool GetAutoDisableFlagImp() const;
- void SetAutoDisableFlagImp(bool flag);
-
- /** Set and get the depth of the surface layer around all geometry
- objects. Contacts are allowed to sink into the surface layer up to
- the given depth before coming to rest. The default value is
- zero. Increasing this to some small value (e.g. 0.001) can help
- prevent jittering problems due to contacts being repeatedly made
- and broken.
- */
- void SetContactSurfaceLayerImp(float depth);
- float GetContactSurfaceLayerImp() const;
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObjectImp();
-
-protected:
- /** creates them managed ODE world */
- virtual bool ConstructInternalImp();
-
- //
- // Members
- //
-private:
- /** the dynamics world represented by this object */
- dWorldID mODEWorld;
-};
-
-DECLARE_CLASS(ODEWorld);
-
-};
-
-#endif //OXYGEN_WORLD_H
Copied: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h (from rev 99, trunk/spark/lib/oxygen/physicsserver/ode/odeworld.h)
===================================================================
--- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h (rev 0)
+++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-18 00:29:17 UTC (rev 100)
@@ -0,0 +1,124 @@
+/* -*- 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: world.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_ODEWORLD_H
+#define OXYGEN_ODEWORLD_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/imp/worldimp.h>
+
+namespace oxygen
+{
+
+/** World encapsulates an ODE world object. It is a container for
+ rigid bodies and joints. Objects in different worlds can not
+ interact, for example rigid bodies from two different worlds can
+ not collide. All the objects in a world exist at the same point in
+ time, thus one reason to use separate worlds is to simulate
+ systems at different rates.
+*/
+class OXYGEN_API ODEWorld : public WorldImp
+{
+ //
+ // Functions
+ //
+public:
+ ODEWorld();
+ virtual ~ODEWorld();
+
+ /** returns the ID of the managed ODE world */
+ dWorldID GetODEWorldImp() const;
+
+ /** sets the gravity vector of this vorld */
+ void SetGravityImp(const salt::Vector3f& gravity);
+
+ /** gets the gravity vector of this world */
+ salt::Vector3f GetGravityImp() const;
+
+ /** sets the Error Reduction Parameter of this world. The ERP
+ specifies what proportion of a joint error will be fixed
+ during the next simulation step. if ERP=0 then no correcting
+ force is applied and the bodies will eventually drift apart as
+ the simulation proceeds. If ERP=1 then the simulation will
+ attempt to fix all joint error during the next time
+ step. However, setting ERP=1 is not recommended, as the joint
+ error will not be completely fixed due to various internal
+ approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
+ is the default).
+ */
+ void SetERPImp(float erp);
+
+ /** returns the Error Reduction Parameter of this World.
+ */
+ float GetERPImp() const;
+
+ /** sets the Constraint Force mixing (CFM) value. If CFM is set to
+ zero, the constraint will be hard. If CFM is set to a positive
+ value, it will be possible to violate the constraint by
+ `pushing on it' (for example, for contact constraints by
+ forcing the two contacting objects together). In other words
+ the constraint will be soft, and the softness will increase as
+ CFM increases. Note that setting CFM to a negative value can
+ have undesirable bad effects, such as instability.
+ */
+ void SetCFMImp(float cfm);
+
+ /** returns the Constraint Force mixing (CFM) value. */
+ float GetCFMImp() const;
+
+ /** steps the world deltatime forward, i.e. performs physics
+ simulation for a deltaTime seconds interval.
+ */
+ void StepImp(float deltaTime);
+
+ bool GetAutoDisableFlagImp() const;
+ void SetAutoDisableFlagImp(bool flag);
+
+ /** Set and get the depth of the surface layer around all geometry
+ objects. Contacts are allowed to sink into the surface layer up to
+ the given depth before coming to rest. The default value is
+ zero. Increasing this to some small value (e.g. 0.001) can help
+ prevent jittering problems due to contacts being repeatedly made
+ and broken.
+ */
+ void SetContactSurfaceLayerImp(float depth);
+ float GetContactSurfaceLayerImp() const;
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObjec...
[truncated message content] |
|
From: <a-...@us...> - 2009-11-17 11:29:38
|
Revision: 99
http://simspark.svn.sourceforge.net/simspark/?rev=99&view=rev
Author: a-held
Date: 2009-11-17 11:29:29 +0000 (Tue, 17 Nov 2009)
Log Message:
-----------
Reverted changes in last revision
added abstract layer on World via bridge pattern
refactored CappedCylinder to Capsule
moved ODE-specific classes to a new ODE folder
moved implementation classes to a new imp folder
Modified Paths:
--------------
trunk/spark/lib/oxygen/CMakeLists.txt
trunk/spark/lib/oxygen/oxygen.cpp
trunk/spark/lib/oxygen/oxygen.h
trunk/spark/lib/oxygen/physicsserver/body.cpp
trunk/spark/lib/oxygen/physicsserver/body.h
trunk/spark/lib/oxygen/physicsserver/boxcollider.h
trunk/spark/lib/oxygen/physicsserver/collider.h
trunk/spark/lib/oxygen/physicsserver/collisionhandler.h
trunk/spark/lib/oxygen/physicsserver/joint.h
trunk/spark/lib/oxygen/physicsserver/physicsserver.h
trunk/spark/lib/oxygen/physicsserver/space.h
trunk/spark/lib/oxygen/physicsserver/world.cpp
trunk/spark/lib/oxygen/physicsserver/world.h
trunk/spark/lib/oxygen/physicsserver/world_c.cpp
trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp
trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h
Added Paths:
-----------
trunk/spark/lib/oxygen/physicsserver/imp/
trunk/spark/lib/oxygen/physicsserver/imp/worldimp.h
trunk/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp
trunk/spark/lib/oxygen/physicsserver/ode/
trunk/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
trunk/spark/lib/oxygen/physicsserver/ode/odeobject.h
trunk/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
trunk/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
trunk/spark/lib/oxygen/physicsserver/ode/odeworld.h
trunk/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp
trunk/spark/lib/oxygen/physicsserver/ode/odewrapper.h
Removed Paths:
-------------
trunk/spark/lib/oxygen/physicsserver/odeobject.cpp
trunk/spark/lib/oxygen/physicsserver/odeobject.h
trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp
trunk/spark/lib/oxygen/physicsserver/odewrapper.h
Modified: trunk/spark/lib/oxygen/CMakeLists.txt
===================================================================
--- trunk/spark/lib/oxygen/CMakeLists.txt 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/CMakeLists.txt 2009-11-17 11:29:29 UTC (rev 99)
@@ -21,8 +21,6 @@
physicsserver/collider.h
physicsserver/collisionhandler.h
physicsserver/contactjointhandler.h
- physicsserver/odeobject.h
- physicsserver/odewrapper.h
physicsserver/physicsserver.h
physicsserver/planecollider.h
physicsserver/raycollider.h
@@ -41,6 +39,15 @@
physicsserver/universaljoint.h
physicsserver/hinge2joint.h
physicsserver/angularmotor.h
+
+ #interfaces
+ physicsserver/imp/worldimp.h
+
+ #ode-specific files
+ physicsserver/ode/odeobject.h
+ physicsserver/ode/odeworld.h
+ physicsserver/ode/odewrapper.h
+
sceneserver/sceneimporter.h
sceneserver/basenode.h
sceneserver/fpscontroller.h
@@ -116,8 +123,6 @@
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
@@ -152,6 +157,16 @@
physicsserver/hinge2joint_c.cpp
physicsserver/angularmotor.cpp
physicsserver/angularmotor_c.cpp
+
+ #interfaces
+ physicsserver/imp/worldimp_c.cpp
+
+ #ODE-specific files
+ physicsserver/ode/odeworld.cpp
+ physicsserver/ode/odeworld_c.cpp
+ physicsserver/ode/odeobject.cpp
+ physicsserver/ode/odeobject_c.cpp
+
sceneserver/basenode.cpp
sceneserver/basenode_c.cpp
sceneserver/fpscontroller.cpp
Modified: trunk/spark/lib/oxygen/oxygen.cpp
===================================================================
--- trunk/spark/lib/oxygen/oxygen.cpp 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/oxygen.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -57,9 +57,9 @@
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(WorldImp), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Joint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(BallJoint), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(HingeJoint), "oxygen/");
@@ -86,6 +86,11 @@
zg.GetCore()->RegisterClassObject(new CLASS(AgentAspect), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Effector), "oxygen/");
zg.GetCore()->RegisterClassObject(new CLASS(Perceptor), "oxygen/");
+
+ //ODE-specific classes
+ zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/");
+ zg.GetCore()->RegisterClassObject(new CLASS(ODEWorld), "oxygen/");
+
#ifdef HAVE_SPADES_HEADERS
// spades
Modified: trunk/spark/lib/oxygen/oxygen.h
===================================================================
--- trunk/spark/lib/oxygen/oxygen.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/oxygen.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -34,6 +34,7 @@
#include "gamecontrolserver/actionobject.h"
#include "gamecontrolserver/behavior.h"
+//abstract physics classes
#include "physicsserver/body.h"
#include "physicsserver/bodycontroller.h"
#include "physicsserver/dragcontroller.h"
@@ -42,7 +43,6 @@
#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"
@@ -60,6 +60,13 @@
#include "physicsserver/universaljoint.h"
#include "physicsserver/hinge2joint.h"
+//physics interfaces
+#include "physicsserver/imp/worldimp.h"
+
+//ode-specific includes
+#include <oxygen/physicsserver/ode/odeobject.h>
+#include <oxygen/physicsserver/ode/odeworld.h>
+
#include "sceneserver/basenode.h"
#include "sceneserver/camera.h"
#include "sceneserver/fpscontroller.h"
Modified: trunk/spark/lib/oxygen/physicsserver/body.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/body.cpp 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/body.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -339,7 +339,7 @@
// 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)
@@ -361,7 +361,7 @@
// 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)
Modified: trunk/spark/lib/oxygen/physicsserver/body.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/body.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/body.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -23,7 +23,7 @@
#define OXYGEN_BODY_H
#include <oxygen/oxygen_defines.h>
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
namespace oxygen
{
Modified: trunk/spark/lib/oxygen/physicsserver/boxcollider.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -23,7 +23,7 @@
#define OXYGEN_BOXCOLLIDER_H
#include <oxygen/oxygen_defines.h>
-#include "collider.h"
+#include <oxygen/physicsserver/collider.h>
namespace oxygen
{
Modified: trunk/spark/lib/oxygen/physicsserver/collider.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/collider.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/collider.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_COLLIDER_H
#define OXYGEN_COLLIDER_H
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
#include <string>
#include <set>
#include <oxygen/oxygen_defines.h>
Modified: trunk/spark/lib/oxygen/physicsserver/collisionhandler.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -24,7 +24,7 @@
#include <oxygen/sceneserver/basenode.h>
#include <oxygen/oxygen_defines.h>
-#include "odewrapper.h"
+#include <oxygen/physicsserver/ode/odewrapper.h>
namespace oxygen
{
Added: trunk/spark/lib/oxygen/physicsserver/imp/worldimp.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/imp/worldimp.h (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/imp/worldimp.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -0,0 +1,116 @@
+/* -*- 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: world.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_WORLDIMP_H
+#define OXYGEN_WORLDIMP_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/ode/odeobject.h>
+
+namespace oxygen
+{
+
+/** World encapsulates an ODE world object. It is a container for
+ rigid bodies and joints. Objects in different worlds can not
+ interact, for example rigid bodies from two different worlds can
+ not collide. All the objects in a world exist at the same point in
+ time, thus one reason to use separate worlds is to simulate
+ systems at different rates.
+*/
+class OXYGEN_API WorldImp : public ODEObject
+{
+ //
+ // Functions
+ //
+public:
+ WorldImp() : ODEObject(){};
+ virtual ~WorldImp(){};
+
+ /** returns the ID of the managed ODE world */
+ virtual dWorldID GetODEWorldImp() const = 0;
+
+ /** sets the gravity vector of this vorld */
+ virtual void SetGravityImp(const salt::Vector3f& gravity) = 0;
+
+ /** gets the gravity vector of this world */
+ virtual salt::Vector3f GetGravityImp() const = 0;
+
+ /** sets the Error Reduction Parameter of this world. The ERP
+ specifies what proportion of a joint error will be fixed
+ during the next simulation step. if ERP=0 then no correcting
+ force is applied and the bodies will eventually drift apart as
+ the simulation proceeds. If ERP=1 then the simulation will
+ attempt to fix all joint error during the next time
+ step. However, setting ERP=1 is not recommended, as the joint
+ error will not be completely fixed due to various internal
+ approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
+ is the default).
+ */
+ virtual void SetERPImp(float erp) = 0;
+
+ /** returns the Error Reduction Parameter of this World.
+ */
+ virtual float GetERPImp() const = 0;
+
+ /** sets the Constraint Force mixing (CFM) value. If CFM is set to
+ zero, the constraint will be hard. If CFM is set to a positive
+ value, it will be possible to violate the constraint by
+ `pushing on it' (for example, for contact constraints by
+ forcing the two contacting objects together). In other words
+ the constraint will be soft, and the softness will increase as
+ CFM increases. Note that setting CFM to a negative value can
+ have undesirable bad effects, such as instability.
+ */
+ virtual void SetCFMImp(float cfm) = 0;
+
+ /** returns the Constraint Force mixing (CFM) value. */
+ virtual float GetCFMImp() const = 0;
+
+ /** steps the world deltatime forward, i.e. performs physics
+ simulation for a deltaTime seconds interval.
+ */
+ virtual void StepImp(float deltaTime) = 0;
+
+ virtual bool GetAutoDisableFlagImp() const = 0;
+ virtual void SetAutoDisableFlagImp(bool flag) = 0;
+
+ /** Set and get the depth of the surface layer around all geometry
+ objects. Contacts are allowed to sink into the surface layer up to
+ the given depth before coming to rest. The default value is
+ zero. Increasing this to some small value (e.g. 0.001) can help
+ prevent jittering problems due to contacts being repeatedly made
+ and broken.
+ */
+ virtual void SetContactSurfaceLayerImp(float depth) = 0;
+ virtual float GetContactSurfaceLayerImp() const = 0;
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObjectImp() = 0;
+
+ /** creates them managed ODE world */
+ virtual bool ConstructInternalImp() = 0;
+};
+
+DECLARE_ABSTRACTCLASS(WorldImp);
+
+}
+
+#endif //OXYGEN_WORLDIMP_H
Added: trunk/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/imp/worldimp_c.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -0,0 +1,29 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+this file is part of rcssserver3D
+Fri May 9 2003
+Copyright (C) 2003 Koblenz University
+$Id: world_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/imp/worldimp.h>
+
+using namespace oxygen;
+
+void CLASS(WorldImp)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/ODEObject);
+}
Modified: trunk/spark/lib/oxygen/physicsserver/joint.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/joint.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/joint.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -23,7 +23,7 @@
#define OXYGEN_JOINT_H
#include <oxygen/oxygen_defines.h>
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
namespace oxygen
{
Added: trunk/spark/lib/oxygen/physicsserver/ode/odeobject.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject.cpp (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/ode/odeobject.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -0,0 +1,167 @@
+/* -*- 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.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/ode/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()
+{
+}
+
+void ODEObject::OnUnlink()
+{
+ DestroyODEObject();
+}
+
+/** returns the world node */
+shared_ptr<World> ODEObject::GetWorld()
+{
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<World>();
+ }
+
+ shared_ptr<World> worldNode = shared_dynamic_cast<World>
+ (scene->GetChildOfClass("World"));
+ if (worldNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
+ }
+
+ return worldNode;
+}
+
+shared_ptr<Space> ODEObject::GetSpace()
+{
+ // try to find the nearest parent space object
+ weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
+ if (! parentSpace.expired())
+ {
+ return parentSpace.lock();
+ }
+
+ // return the global space instance
+ shared_ptr<Scene> scene = GetScene();
+ if (scene.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
+ return shared_ptr<Space>();
+ }
+
+ shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
+ (scene->GetChildOfClass("Space"));
+ if (spaceNode.get() == 0)
+ {
+ GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
+ }
+
+ return spaceNode;
+}
+
+dWorldID ODEObject::GetWorldID()
+{
+ shared_ptr<World> world = GetWorld();
+ if (world.get() == 0)
+ {
+ return 0;
+ }
+
+ dWorldID worldId = world->GetODEWorld();
+ if (worldId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: World returned empty ODE handle\n";
+ }
+
+ return worldId;
+}
+
+dSpaceID ODEObject::FindSpaceID()
+{
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() == 0)
+ {
+ return 0;
+ }
+
+ dSpaceID spaceId = space->GetODESpace();
+
+ if (spaceId == 0)
+ {
+ GetLog()->Error()
+ << "(ODEObject) ERROR: Space returned empty ODE handle\n";
+ }
+
+ return spaceId;
+}
+
+dSpaceID ODEObject::GetParentSpaceID()
+{
+ return 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
+{
+ matrix[0] = rot.m[0];
+ matrix[1] = rot.m[4];
+ matrix[2] = rot.m[8];
+ matrix[3] = 0;
+ matrix[4] = rot.m[1];
+ matrix[5] = rot.m[5];
+ matrix[6] = rot.m[9];
+ matrix[7] = 0;
+ matrix[8] = rot.m[2];
+ matrix[9] = rot.m[6];
+ matrix[10] = rot.m[10];
+ matrix[11] = 0;
+}
+
+void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
+{
+ rot.m[0] = matrix[0] ;
+ rot.m[4] = matrix[1] ;
+ rot.m[8] = matrix[2];
+ rot.m[12] = matrix[3];
+ rot.m[1] = matrix[4];
+ rot.m[5] = matrix[5];
+ rot.m[9] = matrix[6];
+ rot.m[13] = matrix[7];
+ rot.m[2] = matrix[8];
+ rot.m[6] = matrix[9];
+ rot.m[10] = matrix[10] ;
+ rot.m[14] = matrix[11];
+ rot.m[3] = 0.0;
+ rot.m[7] = 0.0;
+ rot.m[11] = 0.0;
+ rot.m[15] = 1.0;
+}
Added: trunk/spark/lib/oxygen/physicsserver/ode/odeobject.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject.h (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/ode/odeobject.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -0,0 +1,83 @@
+/* -*- 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_ODEOBJECT_H
+#define OXYGEN_ODEOBJECT_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/sceneserver/basenode.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
+
+namespace oxygen
+{
+class Space;
+class World;
+
+/** ODEObject is the base of all classes encapsulating ODE concepts
+ */
+class OXYGEN_API ODEObject : public BaseNode
+{
+public:
+ //
+ // Functions
+ //
+ ODEObject();
+ virtual ~ODEObject();
+
+ /** 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();
+
+ /** returns the ODE world handle */
+ dWorldID GetWorldID();
+
+ /** returns the nearest parent space ODE handle */
+ dSpaceID FindSpaceID();
+
+ /** returns the ODE handle ID of the containing parent space */
+ virtual dSpaceID GetParentSpaceID();
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObject(){};
+
+protected:
+ /** returns the world node */
+ boost::shared_ptr<World> GetWorld();
+
+ /** finds the nearest parent space node */
+ boost::shared_ptr<Space> GetSpace();
+
+ /** converts the rotation part of a salt::Matrix to an ODE
+ dMatrix3 */
+ void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
+
+ /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
+ void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
+};
+
+DECLARE_ABSTRACTCLASS(ODEObject);
+
+} //namespace oxygen
+
+#endif //OXYGEN_ODEOBJECT_H
Added: trunk/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/ode/odeobject_c.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -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/ode/odeobject.h>
+
+using namespace oxygen;
+
+void CLASS(ODEObject)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/BaseNode);
+}
Added: trunk/spark/lib/oxygen/physicsserver/ode/odeworld.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeworld.cpp (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/ode/odeworld.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -0,0 +1,138 @@
+/* -*- mode: c++ -*-
+
+ this file is part of rcssserver3D
+ Fri May 9 2003
+ Copyright (C) 2003 Koblenz University
+ $Id: world.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/ode/odeworld.h>
+#include <oxygen/physicsserver/space.h>
+#include <oxygen/sceneserver/scene.h>
+
+using namespace boost;
+using namespace oxygen;
+using namespace salt;
+
+ODEWorld::ODEWorld() : WorldImp(), mODEWorld(0)
+{
+}
+
+ODEWorld::~ODEWorld()
+{
+}
+
+dWorldID ODEWorld::GetODEWorldImp() const
+{
+ return mODEWorld;
+}
+
+void ODEWorld::SetGravityImp(const Vector3f& gravity)
+{
+ dWorldSetGravity(mODEWorld,
+ gravity.x(),
+ gravity.y(),
+ gravity.z()
+ );
+}
+
+salt::Vector3f ODEWorld::GetGravityImp() const
+{
+ dVector3 dGravity;
+ dWorldGetGravity(mODEWorld,dGravity);
+ return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
+}
+
+void ODEWorld::SetERPImp(float erp)
+{
+ dWorldSetERP(mODEWorld, erp);
+}
+
+float ODEWorld::GetERPImp() const
+{
+ return dWorldGetERP(mODEWorld);
+}
+
+void ODEWorld::SetCFMImp(float cfm)
+{
+ dWorldSetCFM(mODEWorld, cfm);
+}
+
+float ODEWorld::GetCFMImp() const
+{
+ return dWorldGetCFM(mODEWorld);
+}
+
+void ODEWorld::StepImp(float deltaTime)
+{
+ dWorldStep(mODEWorld, deltaTime);
+}
+
+bool ODEWorld::GetAutoDisableFlagImp() const
+{
+ return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
+}
+
+void ODEWorld::SetAutoDisableFlagImp(bool flag)
+{
+ dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
+}
+
+void ODEWorld::SetContactSurfaceLayerImp(float depth)
+{
+ dWorldSetContactSurfaceLayer(mODEWorld, depth);
+}
+
+float ODEWorld::GetContactSurfaceLayerImp() const
+{
+ return dWorldGetContactSurfaceLayer(mODEWorld);
+}
+
+bool ODEWorld::ConstructInternalImp()
+{
+ // create an ode world
+ mODEWorld = dWorldCreate();
+
+ return (mODEWorld != 0);
+}
+
+void ODEWorld::DestroyODEObjectImp()
+{
+ static bool recurseLock = false;
+ if (recurseLock)
+ {
+ return;
+ }
+
+ recurseLock = true;
+
+ shared_ptr<Space> space = GetSpace();
+ if (space.get() != 0)
+ {
+ space->DestroyODEObject();
+ }
+
+ if (mODEWorld == 0)
+ {
+ return;
+ }
+
+ // release the ODE world
+ dWorldDestroy(mODEWorld);
+ mODEWorld = 0;
+
+ recurseLock = false;
+}
Added: trunk/spark/lib/oxygen/physicsserver/ode/odeworld.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeworld.h (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/ode/odeworld.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -0,0 +1,124 @@
+/* -*- 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: world.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_ODEWORLD_H
+#define OXYGEN_ODEWORLD_H
+
+#include <oxygen/oxygen_defines.h>
+#include <oxygen/physicsserver/imp/worldimp.h>
+
+namespace oxygen
+{
+
+/** World encapsulates an ODE world object. It is a container for
+ rigid bodies and joints. Objects in different worlds can not
+ interact, for example rigid bodies from two different worlds can
+ not collide. All the objects in a world exist at the same point in
+ time, thus one reason to use separate worlds is to simulate
+ systems at different rates.
+*/
+class OXYGEN_API ODEWorld : public WorldImp
+{
+ //
+ // Functions
+ //
+public:
+ ODEWorld();
+ virtual ~ODEWorld();
+
+ /** returns the ID of the managed ODE world */
+ dWorldID GetODEWorldImp() const;
+
+ /** sets the gravity vector of this vorld */
+ void SetGravityImp(const salt::Vector3f& gravity);
+
+ /** gets the gravity vector of this world */
+ salt::Vector3f GetGravityImp() const;
+
+ /** sets the Error Reduction Parameter of this world. The ERP
+ specifies what proportion of a joint error will be fixed
+ during the next simulation step. if ERP=0 then no correcting
+ force is applied and the bodies will eventually drift apart as
+ the simulation proceeds. If ERP=1 then the simulation will
+ attempt to fix all joint error during the next time
+ step. However, setting ERP=1 is not recommended, as the joint
+ error will not be completely fixed due to various internal
+ approximations. A value of ERP=0.1 to 0.8 is recommended (0.2
+ is the default).
+ */
+ void SetERPImp(float erp);
+
+ /** returns the Error Reduction Parameter of this World.
+ */
+ float GetERPImp() const;
+
+ /** sets the Constraint Force mixing (CFM) value. If CFM is set to
+ zero, the constraint will be hard. If CFM is set to a positive
+ value, it will be possible to violate the constraint by
+ `pushing on it' (for example, for contact constraints by
+ forcing the two contacting objects together). In other words
+ the constraint will be soft, and the softness will increase as
+ CFM increases. Note that setting CFM to a negative value can
+ have undesirable bad effects, such as instability.
+ */
+ void SetCFMImp(float cfm);
+
+ /** returns the Constraint Force mixing (CFM) value. */
+ float GetCFMImp() const;
+
+ /** steps the world deltatime forward, i.e. performs physics
+ simulation for a deltaTime seconds interval.
+ */
+ void StepImp(float deltaTime);
+
+ bool GetAutoDisableFlagImp() const;
+ void SetAutoDisableFlagImp(bool flag);
+
+ /** Set and get the depth of the surface layer around all geometry
+ objects. Contacts are allowed to sink into the surface layer up to
+ the given depth before coming to rest. The default value is
+ zero. Increasing this to some small value (e.g. 0.001) can help
+ prevent jittering problems due to contacts being repeatedly made
+ and broken.
+ */
+ void SetContactSurfaceLayerImp(float depth);
+ float GetContactSurfaceLayerImp() const;
+
+ /** destroy the managed ODE object */
+ virtual void DestroyODEObjectImp();
+
+protected:
+ /** creates them managed ODE world */
+ virtual bool ConstructInternalImp();
+
+ //
+ // Members
+ //
+private:
+ /** the dynamics world represented by this object */
+ dWorldID mODEWorld;
+};
+
+DECLARE_CLASS(ODEWorld);
+
+};
+
+#endif //OXYGEN_WORLD_H
Added: trunk/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/ode/odeworld_c.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -0,0 +1,29 @@
+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
+
+this file is part of rcssserver3D
+Fri May 9 2003
+Copyright (C) 2003 Koblenz University
+$Id: world_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/ode/odeworld.h>
+
+using namespace oxygen;
+
+void CLASS(ODEWorld)::DefineClass()
+{
+ DEFINE_BASECLASS(oxygen/WorldImp);
+}
Added: trunk/spark/lib/oxygen/physicsserver/ode/odewrapper.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/ode/odewrapper.h (rev 0)
+++ trunk/spark/lib/oxygen/physicsserver/ode/odewrapper.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -0,0 +1,80 @@
+/* -*- 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: odewrapper.h 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.
+*/
+#ifndef OXYGEN_ODEWRAPPER_H
+#define OXYGEN_ODEWRAPPER_H
+
+#undef EXTERN
+#undef HAVE_VPRINTF
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+#undef PREFIX
+#undef VERSION
+
+#ifdef WIN32
+
+#ifdef copysignf
+#undef copysignf
+#endif
+
+#ifdef copysign
+#undef copysign
+#endif
+
+#endif // WIN32
+
+#ifdef __APPLE__
+
+// there is a conflicting type in a system header (Leopard)
+// so we define a dummy here
+#define uint32 dummy
+
+#endif
+
+#include <ode/ode.h>
+
+#ifdef __APPLE__
+
+// undefine the dummy
+#undef uint32
+
+#endif
+
+#undef EXTERN
+#undef HAVE_VPRINTF
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+#undef PREFIX
+#undef VERSION
+
+#ifdef HAVE_CONFIG_H
+#include <sparkconfig.h>
+#endif
+
+#endif // OXYGEN_ODEWRAPPER
Deleted: trunk/spark/lib/oxygen/physicsserver/odeobject.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/odeobject.cpp 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/odeobject.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -1,167 +0,0 @@
-/* -*- 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$
-
- 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 "odeobject.h"
-#include "space.h"
-#include "world.h"
-#include <oxygen/sceneserver/scene.h>
-#include <zeitgeist/logserver/logserver.h>
-
-using namespace oxygen;
-using namespace boost;
-
-ODEObject::ODEObject() : BaseNode()
-{
-}
-
-ODEObject::~ODEObject()
-{
-}
-
-void ODEObject::OnUnlink()
-{
- DestroyODEObject();
-}
-
-/** returns the world node */
-shared_ptr<World> ODEObject::GetWorld()
-{
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
- return shared_ptr<World>();
- }
-
- shared_ptr<World> worldNode = shared_dynamic_cast<World>
- (scene->GetChildOfClass("World"));
- if (worldNode.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no World node\n";
- }
-
- return worldNode;
-}
-
-shared_ptr<Space> ODEObject::GetSpace()
-{
- // try to find the nearest parent space object
- weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>();
- if (! parentSpace.expired())
- {
- return parentSpace.lock();
- }
-
- // return the global space instance
- shared_ptr<Scene> scene = GetScene();
- if (scene.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n";
- return shared_ptr<Space>();
- }
-
- shared_ptr<Space> spaceNode = shared_dynamic_cast<Space>
- (scene->GetChildOfClass("Space"));
- if (spaceNode.get() == 0)
- {
- GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n";
- }
-
- return spaceNode;
-}
-
-dWorldID ODEObject::GetWorldID()
-{
- shared_ptr<World> world = GetWorld();
- if (world.get() == 0)
- {
- return 0;
- }
-
- dWorldID worldId = world->GetODEWorld();
- if (worldId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: World returned empty ODE handle\n";
- }
-
- return worldId;
-}
-
-dSpaceID ODEObject::FindSpaceID()
-{
- shared_ptr<Space> space = GetSpace();
- if (space.get() == 0)
- {
- return 0;
- }
-
- dSpaceID spaceId = space->GetODESpace();
-
- if (spaceId == 0)
- {
- GetLog()->Error()
- << "(ODEObject) ERROR: Space returned empty ODE handle\n";
- }
-
- return spaceId;
-}
-
-dSpaceID ODEObject::GetParentSpaceID()
-{
- return 0;
-}
-
-void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix)
-{
- matrix[0] = rot.m[0];
- matrix[1] = rot.m[4];
- matrix[2] = rot.m[8];
- matrix[3] = 0;
- matrix[4] = rot.m[1];
- matrix[5] = rot.m[5];
- matrix[6] = rot.m[9];
- matrix[7] = 0;
- matrix[8] = rot.m[2];
- matrix[9] = rot.m[6];
- matrix[10] = rot.m[10];
- matrix[11] = 0;
-}
-
-void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const
-{
- rot.m[0] = matrix[0] ;
- rot.m[4] = matrix[1] ;
- rot.m[8] = matrix[2];
- rot.m[12] = matrix[3];
- rot.m[1] = matrix[4];
- rot.m[5] = matrix[5];
- rot.m[9] = matrix[6];
- rot.m[13] = matrix[7];
- rot.m[2] = matrix[8];
- rot.m[6] = matrix[9];
- rot.m[10] = matrix[10] ;
- rot.m[14] = matrix[11];
- rot.m[3] = 0.0;
- rot.m[7] = 0.0;
- rot.m[11] = 0.0;
- rot.m[15] = 1.0;
-}
Deleted: trunk/spark/lib/oxygen/physicsserver/odeobject.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/odeobject.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/odeobject.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -1,83 +0,0 @@
-/* -*- 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$
- $Id$
-
- 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_ODEOBJECT_H
-#define OXYGEN_ODEOBJECT_H
-
-#include <oxygen/oxygen_defines.h>
-#include <oxygen/sceneserver/basenode.h>
-#include "odewrapper.h"
-
-namespace oxygen
-{
-class Space;
-class World;
-
-/** ODEObject is the base of all classes encapsulating ODE concepts
- */
-class OXYGEN_API ODEObject : public BaseNode
-{
-public:
- //
- // Functions
- //
- ODEObject();
- virtual ~ODEObject();
-
- /** 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();
-
- /** returns the ODE world handle */
- dWorldID GetWorldID();
-
- /** returns the nearest parent space ODE handle */
- dSpaceID FindSpaceID();
-
- /** returns the ODE handle ID of the containing parent space */
- virtual dSpaceID GetParentSpaceID();
-
- /** destroy the managed ODE object */
- virtual void DestroyODEObject() = 0;
-
-protected:
- /** returns the world node */
- boost::shared_ptr<World> GetWorld();
-
- /** finds the nearest parent space node */
- boost::shared_ptr<Space> GetSpace();
-
- /** converts the rotation part of a salt::Matrix to an ODE
- dMatrix3 */
- void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix);
-
- /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */
- void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const;
-};
-
-DECLARE_ABSTRACTCLASS(ODEObject);
-
-} //namespace oxygen
-
-#endif //OXYGEN_ODEOBJECT_H
Deleted: trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -1,29 +0,0 @@
-/* -*- mode: c++ -*-
-
- this file is part of rcssserver3D
- Fri May 9 2003
- Copyright (C) 2003 Koblenz University
- $Id$
-
- 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 "odeobject.h"
-
-using namespace oxygen;
-
-void CLASS(ODEObject)::DefineClass()
-{
- DEFINE_BASECLASS(oxygen/BaseNode);
-}
Deleted: trunk/spark/lib/oxygen/physicsserver/odewrapper.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/odewrapper.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/odewrapper.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -1,80 +0,0 @@
-/* -*- 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$
-
- 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_ODEWRAPPER_H
-#define OXYGEN_ODEWRAPPER_H
-
-#undef EXTERN
-#undef HAVE_VPRINTF
-#undef PACKAGE
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-#undef PREFIX
-#undef VERSION
-
-#ifdef WIN32
-
-#ifdef copysignf
-#undef copysignf
-#endif
-
-#ifdef copysign
-#undef copysign
-#endif
-
-#endif // WIN32
-
-#ifdef __APPLE__
-
-// there is a conflicting type in a system header (Leopard)
-// so we define a dummy here
-#define uint32 dummy
-
-#endif
-
-#include <ode/ode.h>
-
-#ifdef __APPLE__
-
-// undefine the dummy
-#undef uint32
-
-#endif
-
-#undef EXTERN
-#undef HAVE_VPRINTF
-#undef PACKAGE
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-#undef PREFIX
-#undef VERSION
-
-#ifdef HAVE_CONFIG_H
-#include <sparkconfig.h>
-#endif
-
-#endif // OXYGEN_ODEWRAPPER
Modified: trunk/spark/lib/oxygen/physicsserver/physicsserver.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -25,7 +25,7 @@
#include <zeitgeist/class.h>
#include <zeitgeist/leaf.h>
#include <oxygen/oxygen_defines.h>
-#include "odewrapper.h"
+#include <oxygen/physicsserver/ode/odewrapper.h>
namespace oxygen
{
Modified: trunk/spark/lib/oxygen/physicsserver/space.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/space.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/space.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -22,7 +22,7 @@
#ifndef OXYGEN_SPACE_H
#define OXYGEN_SPACE_H
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
#include <set>
#include <oxygen/oxygen_defines.h>
Modified: trunk/spark/lib/oxygen/physicsserver/world.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/world.cpp 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/world.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -19,16 +19,19 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "world.h"
-#include "space.h"
+#include <oxygen/physicsserver/ode/odeworld.h>
+#include <oxygen/physicsserver/world.h>
+#include <oxygen/physicsserver/space.h>
#include <oxygen/sceneserver/scene.h>
using namespace boost;
using namespace oxygen;
using namespace salt;
-World::World() : ODEObject(), mODEWorld(0)
+World::World() : ODEObject()
{
+ shared_ptr<ODEWorld> odeworld(new ODEWorld());
+ mWorldImp = (shared_dynamic_cast<WorldImp>(odeworld));
}
World::~World()
@@ -37,102 +40,70 @@
dWorldID World::GetODEWorld() const
{
- return mODEWorld;
+ return mWorldImp->GetODEWorldImp();
}
void World::SetGravity(const Vector3f& gravity)
{
- dWorldSetGravity(mODEWorld,
- gravity.x(),
- gravity.y(),
- gravity.z()
- );
+ mWorldImp->SetGravityImp(gravity);
}
salt::Vector3f World::GetGravity() const
{
- dVector3 dGravity;
- dWorldGetGravity(mODEWorld,dGravity);
- return Vector3f(dGravity[0],dGravity[1],dGravity[2]);
+ return mWorldImp->GetGravityImp();
}
void World::SetERP(float erp)
{
- dWorldSetERP(mODEWorld, erp);
+ mWorldImp->SetERPImp(erp);
}
float World::GetERP() const
{
- return dWorldGetERP(mODEWorld);
+ return mWorldImp->GetERPImp();
}
void World::SetCFM(float cfm)
{
- dWorldSetCFM(mODEWorld, cfm);
+ mWorldImp->SetCFMImp(cfm);
}
float World::GetCFM() const
{
- return dWorldGetCFM(mODEWorld);
+ return mWorldImp->GetCFMImp();
}
void World::Step(float deltaTime)
{
- dWorldStep(mODEWorld, deltaTime);
+ mWorldImp->StepImp(deltaTime);
}
bool World::GetAutoDisableFlag() const
{
- return (dWorldGetAutoDisableFlag(mODEWorld) == 1);
+ return mWorldImp->GetAutoDisableFlagImp();
}
void World::SetAutoDisableFlag(bool flag)
{
- dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag));
+ mWorldImp->SetAutoDisableFlagImp(flag);
}
void World::SetContactSurfaceLayer(float depth)
{
- dWorldSetContactSurfaceLayer(mODEWorld, depth);
+ mWorldImp->SetContactSurfaceLayerImp(depth);
}
float World::GetContactSurfaceLayer() const
{
- return dWorldGetContactSurfaceLayer(mODEWorld);
+ return mWorldImp->GetContactSurfaceLayerImp();
}
bool World::ConstructInternal()
{
- // create an ode world
- mODEWorld = dWorldCreate();
-
- return (mODEWorld != 0);
+ return mWorldImp->ConstructInternalImp();
}
void World::DestroyODEObject()
{
- static bool recurseLock = false;
- if (recurseLock)
- {
- return;
- }
-
- recurseLock = true;
-
- shared_ptr<Space> space = GetSpace();
- if (space.get() != 0)
- {
- space->DestroyODEObject();
- }
-
- if (mODEWorld == 0)
- {
- return;
- }
-
- // release the ODE world
- dWorldDestroy(mODEWorld);
- mODEWorld = 0;
-
- recurseLock = false;
+ mWorldImp->DestroyODEObjectImp();
}
Modified: trunk/spark/lib/oxygen/physicsserver/world.h
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/world.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/world.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -23,11 +23,14 @@
#define OXYGEN_WORLD_H
#include <oxygen/oxygen_defines.h>
-#include "odeobject.h"
+#include <oxygen/physicsserver/ode/odeobject.h>
namespace oxygen
{
+class WorldImp;
+class ODEWorld;
+
/** World encapsulates an ODE world object. It is a container for
rigid bodies and joints. Objects in different worlds can not
interact, for example rigid bodies from two different worlds can
@@ -113,12 +116,11 @@
// Members
//
private:
- /** the dynamics world represented by this object */
- dWorldID mODEWorld;
+ boost::shared_ptr<WorldImp> mWorldImp;
};
DECLARE_CLASS(World);
-};
+}
#endif //OXYGEN_WORLD_H
Modified: trunk/spark/lib/oxygen/physicsserver/world_c.cpp
===================================================================
--- trunk/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "world.h"
+#include <oxygen/physicsserver/world.h>
using namespace boost;
using namespace oxygen;
Modified: trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp
===================================================================
--- trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp 2009-11-17 11:29:29 UTC (rev 99)
@@ -21,7 +21,7 @@
*/
#include "forceresistanceperceptor.h"
-#include <oxygen/physicsserver/odewrapper.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
#include <oxygen/sceneserver/transform.h>
using namespace std;
Modified: trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h
===================================================================
--- trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h 2009-11-16 10:24:11 UTC (rev 98)
+++ trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h 2009-11-17 11:29:29 UTC (rev 99)
@@ -24,7 +24,7 @@
#define FORCERESISTANCEPERCEPTOR_H_
#include <oxygen/agentaspect/perceptor.h>
-#include <oxygen/physicsserver/odewrapper.h>
+#include <oxygen/physicsserver/ode/odewrapper.h>
#include <oxygen/sceneserver/transform.h>
#include <salt/vector.h>
#include <list>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <he...@us...> - 2009-10-31 09:41:47
|
Revision: 97
http://simspark.svn.sourceforge.net/simspark/?rev=97&view=rev
Author: hedayat
Date: 2009-10-31 09:41:13 +0000 (Sat, 31 Oct 2009)
Log Message:
-----------
Initial draft to document changes till now
Modified Paths:
--------------
trunk/rcssserver3d/ChangeLog
trunk/rcssserver3d/RELEASE
Modified: trunk/rcssserver3d/ChangeLog
===================================================================
--- trunk/rcssserver3d/ChangeLog 2009-10-31 09:39:27 UTC (rev 96)
+++ trunk/rcssserver3d/ChangeLog 2009-10-31 09:41:13 UTC (rev 97)
@@ -1,3 +1,8 @@
+2009-10-31 Hedayat Vatankhah <he...@gr...>
+
+ * RELEASE:
+ - write about changes sine 0.6.2, initial draft.
+
2009-08-24 Marian Buchta <mar...@gm...>
* CMakeLists.txt:
Modified: trunk/rcssserver3d/RELEASE
===================================================================
--- trunk/rcssserver3d/RELEASE 2009-10-31 09:39:27 UTC (rev 96)
+++ trunk/rcssserver3d/RELEASE 2009-10-31 09:41:13 UTC (rev 97)
@@ -1,15 +1,10 @@
-RELEASE News of rcssserver3d-0.6.2
+RELEASE News of rcssserver3d-0.6.3 (In progress)
-This release is mainly a bug-fix release, and is the last release before
-RoboCup 2009 competitions.
-
-* Some improvements:
- - improved Windows and MacOSX support
- - improved external monitor
- - fixed a bug in rcssserver3d's goal counting
- - added right kick-off key to the monitor (Simon Raffeiner)
- - simspark can take command line argument specifying the rb script to run
- (using --script-path command line option)
-
+* Most notable changes:
+ - No internal monitor by default. Run rcssmonitor3d separately to see the game.
+ - Added HMDP effector/perceptor
+ - Some compilation fixes
+ - Improved Windows support
+
You can get the package on the Simspark page on SourceForge
at http://sourceforge.net/projects/simspark/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <he...@us...> - 2009-10-31 09:39:50
|
Revision: 96
http://simspark.svn.sourceforge.net/simspark/?rev=96&view=rev
Author: hedayat
Date: 2009-10-31 09:39:27 +0000 (Sat, 31 Oct 2009)
Log Message:
-----------
Add SO_REUSEADDR option to the Socket class and use it in simspark
Send senses after receiving action commands from the agents
Modified Paths:
--------------
trunk/spark/ChangeLog
trunk/spark/RELEASE
trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp
trunk/spark/lib/oxygen/simulationserver/agentcontrol.h
trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp
trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp
trunk/spark/lib/oxygen/simulationserver/simulationserver.h
trunk/spark/utility/rcssnet/socket.cpp
trunk/spark/utility/rcssnet/socket.hpp
Modified: trunk/spark/ChangeLog
===================================================================
--- trunk/spark/ChangeLog 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/ChangeLog 2009-10-31 09:39:27 UTC (rev 96)
@@ -1,3 +1,24 @@
+2009-10-31 Hedayat Vatankhah <he...@gr...>
+
+ * lib/oxygen/simulationserver/simulationserver.h:
+ * lib/oxygen/simulationserver/simulationserver.cpp:
+ - prevent a deadlock case (on exit) in multi-threaded mode
+
+ * lib/oxygen/simulationserver/agentcontrol.h:
+ * lib/oxygen/simulationserver/agentcontrol.cpp:
+ - send senses in SenseAgent method, so that they'll be sent after receiving
+ commands from the agents. this will ensure that any commands sent after
+ sending senses will be executed in the next cycle, which results in a
+ more deterministic behaviour
+
+2009-10-30 Hedayat Vatankhah <he...@gr...>
+
+ * lib/oxygen/simulationserver/netcontrol.cpp (NetControl::InitSimulation):
+ - try to set REUSEADDR flag to reuse local addresses.
+
+ * utility/rcssnet/socket.cpp (Socket::setReuseAddr):
+ - added the new function
+
2009-08-25 Marian Buchta <mar...@gm...>
* plugin/openglsyswx/CMakeLists.txt:
Modified: trunk/spark/RELEASE
===================================================================
--- trunk/spark/RELEASE 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/RELEASE 2009-10-31 09:39:27 UTC (rev 96)
@@ -1,15 +1,17 @@
-RELEASE News of simspark-0.1.2
+RELEASE News of simspark-0.1.3 (in progress)
-This release brings some bugfixes, better performance and also better Windows
-support. A Windows installer will be available too. This is the first version
-which runs in multi-threaded mode by default. The multi-threaded mode is still
-in early stages, and it can be improved cosiderably in future.
+SOME INTERESTING COMMENTS!
Main changes of this release are:
- - improved Windows support, including Windows Installer.
- - Multi-threaded mode now works, and is the default mode when running simspark
- - Performance improvements
- - Fixed a bug in networking code, which were introduced in 0.1.1
+ - Compilation fixes
+ - Improved Windows support
+ - Simspark should always accept connections. No more "Connection refused"
+ messages and the need to wait for simspark's network port to be freed!
+ - Simspark will now collect received commands right before sending
+ sense data of the last cycle. So, any commands which is sent by agents
+ after receiving new sense data will be executed in the next cycle, not the
+ current one. This results in a more deterministic behavior, and agents'
+ efficiency should not change between remote and local runs considerably.
You can get the package on the Simspark page on SourceForge
at http://sourceforge.net/projects/simspark/
Modified: trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp
===================================================================
--- trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp 2009-10-31 09:39:27 UTC (rev 96)
@@ -51,6 +51,10 @@
void AgentControl::ClientConnect(shared_ptr<Client> client)
{
+ // Make sure that there is enough space in sense message cache vector
+ if (client->id >= mClientSenses.size())
+ mClientSenses.resize(client->id+1);
+
if (mGameControlServer.get() == 0)
{
return;
@@ -61,6 +65,8 @@
void AgentControl::ClientDisconnect(shared_ptr<Client> client)
{
+ mClientSenses[client->id].clear();
+
if (mGameControlServer.get() == 0)
{
return;
@@ -124,6 +130,23 @@
}
}
+void AgentControl::SenseAgent()
+{
+ int clientID;
+ for (
+ TAddrMap::iterator iter = mClients.begin();
+ iter != mClients.end();
+ ++iter
+ )
+ {
+ clientID = iter->second->id;
+ if (!mClientSenses[clientID].empty())
+ {
+ SendClientMessage(iter->second, mClientSenses[clientID]);
+ }
+ }
+}
+
void AgentControl::EndCycle()
{
NetControl::EndCycle();
@@ -146,17 +169,14 @@
return;
}
- // generate senses for all agents and send them to the
- // corresponding net clients
- int idx = 0;
- vector<string> sensesArray(mClients.size());
+ // generate senses for all agents
for (
TAddrMap::iterator iter = mClients.begin();
iter != mClients.end();
- ++iter, idx++
+ ++iter
)
{
- shared_ptr<Client>& client = (*iter).second;
+ const shared_ptr<Client> &client = (*iter).second;
shared_ptr<AgentAspect> agent =
mGameControlServer->GetAgentAspect(client->id);
@@ -166,27 +186,12 @@
}
shared_ptr<PredicateList> senseList = agent->QueryPerceptors();
- sensesArray[idx] = parser->Generate(senseList);
- if (sensesArray[idx].empty())
+ mClientSenses[client->id] = parser->Generate(senseList);
+ if (mClientSenses[client->id].empty())
{
continue;
}
- mNetMessage->PrepareToSend(sensesArray[idx]);
+ mNetMessage->PrepareToSend(mClientSenses[client->id]);
}
-
- // sending the senses
- idx = 0;
- for (
- TAddrMap::iterator iter = mClients.begin();
- iter != mClients.end();
- ++iter, idx++
- )
- {
- if (!sensesArray[idx].empty())
- {
- SendClientMessage(iter->second, sensesArray[idx]);
- }
-
- }
}
Modified: trunk/spark/lib/oxygen/simulationserver/agentcontrol.h
===================================================================
--- trunk/spark/lib/oxygen/simulationserver/agentcontrol.h 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/lib/oxygen/simulationserver/agentcontrol.h 2009-10-31 09:39:27 UTC (rev 96)
@@ -47,7 +47,10 @@
GameControlServer */
virtual void StartCycle();
- /** generates and sends sense updates to all connected agents */
+ /** sends sense updates to all connected agents */
+ virtual void SenseAgent();
+
+ /** generates sense updates for all connected agents */
virtual void EndCycle();
protected:
@@ -56,6 +59,8 @@
protected:
/** cached reference to the GameControlServer */
CachedPath<GameControlServer> mGameControlServer;
+
+ std::vector<std::string> mClientSenses;
};
DECLARE_CLASS(AgentControl);
Modified: trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp
===================================================================
--- trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp 2009-10-31 09:39:27 UTC (rev 96)
@@ -159,6 +159,15 @@
return;
}
+ ret = mSocket->setReuseAddr(true);
+
+ if (ret < 0)
+ {
+ GetLog()->Warning()
+ << "(NetControl) failed to enable reuse of server socket "
+ << "with '" << strerror(errno) << "'\n";
+ }
+
try
{
mSocket->bind(mLocalAddr);
Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp
===================================================================
--- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2009-10-31 09:39:27 UTC (rev 96)
@@ -45,7 +45,8 @@
}
SimulationServer::SimulationServer() :
- Node(), mAdjustSpeed(false), mMaxStepsPerCycle(3), mThreadBarrier(0)
+ Node(), mAdjustSpeed(false), mExitThreads(false), mMaxStepsPerCycle(3),
+ mThreadBarrier(0)
{
mSimTime = 0.0f;
mSimStep = 0.2f;
@@ -422,14 +423,15 @@
shared_ptr<SimControlNode> renderControl = GetControlNode("RenderControl");
float initDelta, finalDelta;
- while (true)
+ while (!mExitThreads)
{
++mCycle;
mThreadBarrier->wait();
+ if (mExit)
+ mExitThreads = true;
+ // Wait for SimControlNodes' acts at the begining of a cycle
mThreadBarrier->wait();
- if (mExit) // this check should be here so that all threads will quit
- break;
finalDelta = initDelta = mSumDeltaTime;
mSceneServer->PrePhysicsUpdate(mSimStep);
@@ -452,6 +454,7 @@
if (renderControl
&& renderControl->GetTime() - mSimTime < 0.005f )
renderControl->EndCycle();
+
mThreadBarrier->wait();
mSumDeltaTime -= initDelta - finalDelta;
}
@@ -473,7 +476,7 @@
bool isRenderControl = (controlNode->GetName() == "RenderControl");
bool newCycle = false;
- while ( true )
+ while (!mExitThreads)
{
mThreadBarrier->wait();
newCycle = false;
@@ -486,8 +489,6 @@
controlNode->SetSimTime(mSimTime);
}
mThreadBarrier->wait();
- if (mExit)
- break;
if (isInputControl)
{
Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h
===================================================================
--- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2009-10-31 09:39:27 UTC (rev 96)
@@ -220,6 +220,11 @@
/** skips physical simulation for some time to catch up real time */
bool mAdjustSpeed;
+ /** in multi-threaded mode, this indicates that all threads should be
+ * terminated.
+ */
+ bool mExitThreads;
+
/** determines the number of allowed steps per cycle when mAdjustSpeed is true */
int mMaxStepsPerCycle;
Modified: trunk/spark/utility/rcssnet/socket.cpp
===================================================================
--- trunk/spark/utility/rcssnet/socket.cpp 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/utility/rcssnet/socket.cpp 2009-10-31 09:39:27 UTC (rev 96)
@@ -304,7 +304,22 @@
return -1;
}
- Socket::SocketDesc
+ int
+ Socket::setReuseAddr( bool on )
+ {
+ if( isOpen() )
+ {
+ int doreuse = on;
+ return setsockopt( getFD(), SOL_SOCKET,
+ SO_REUSEADDR,
+ (const char*)&doreuse,
+ sizeof( int ) );
+ }
+ errno = EPERM;
+ return -1;
+ }
+
+ Socket::SocketDesc
Socket::getFD() const
{ return ( isOpen() ? *(m_handle.get()) : Socket::INVALIDSOCKET ); }
Modified: trunk/spark/utility/rcssnet/socket.hpp
===================================================================
--- trunk/spark/utility/rcssnet/socket.hpp 2009-10-26 07:24:44 UTC (rev 95)
+++ trunk/spark/utility/rcssnet/socket.hpp 2009-10-31 09:39:27 UTC (rev 96)
@@ -95,6 +95,9 @@
int
setBroadcast( bool on = true );
+ int
+ setReuseAddr( bool on = true );
+
SocketDesc
getFD() const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-10-26 07:24:58
|
Revision: 95
http://simspark.svn.sourceforge.net/simspark/?rev=95&view=rev
Author: a-held
Date: 2009-10-26 07:24:44 +0000 (Mon, 26 Oct 2009)
Log Message:
-----------
created branch for working on abstract physics layer
Added Paths:
-----------
branches/multiphys/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <a-...@us...> - 2009-10-26 07:23:42
|
Revision: 94
http://simspark.svn.sourceforge.net/simspark/?rev=94&view=rev
Author: a-held
Date: 2009-10-26 07:23:35 +0000 (Mon, 26 Oct 2009)
Log Message:
-----------
created branches directory
Added Paths:
-----------
branches/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2009-08-25 14:48:42
|
Revision: 93
http://simspark.svn.sourceforge.net/simspark/?rev=93&view=rev
Author: marianbuchta
Date: 2009-08-25 14:48:35 +0000 (Tue, 25 Aug 2009)
Log Message:
-----------
simspark-utilities:
-add extra install/uninstall commands for NSIS installer
Modified Paths:
--------------
trunk/simspark-utilities/CMakeLists.txt
trunk/simspark-utilities/ChangeLog
Added Paths:
-----------
trunk/simspark-utilities/windows/
trunk/simspark-utilities/windows/install_extra.nsi
trunk/simspark-utilities/windows/uninstall_extra.nsi
Modified: trunk/simspark-utilities/CMakeLists.txt
===================================================================
--- trunk/simspark-utilities/CMakeLists.txt 2009-08-25 12:31:23 UTC (rev 92)
+++ trunk/simspark-utilities/CMakeLists.txt 2009-08-25 14:48:35 UTC (rev 93)
@@ -103,4 +103,11 @@
set(CPACK_SOURCE_PACKAGE_FILE_NAME
${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION})
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
+set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
+set(CPACK_NSIS_HELP_LINK "TODO:simspark wiki link")
+set(CPACK_NSIS_URL_INFO_ABOUT "http://simspark.sourceforge.net")
+set(CPACK_NSIS_CONTACT "sim...@li...")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " !include ${CMAKE_SOURCE_DIR}\\\\windows\\\\install_extra.nsi")
+set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " !include ${CMAKE_SOURCE_DIR}\\\\windows\\\\uninstall_extra.nsi")
include(CPack)
Modified: trunk/simspark-utilities/ChangeLog
===================================================================
--- trunk/simspark-utilities/ChangeLog 2009-08-25 12:31:23 UTC (rev 92)
+++ trunk/simspark-utilities/ChangeLog 2009-08-25 14:48:35 UTC (rev 93)
@@ -1,3 +1,10 @@
+2009-08-25 Marian Buchta <mar...@gm...>
+
+ * windows/install_extra.nsi:
+ * windows/uninstall_extra.nsi:
+ * CMakeLists.txt
+ - add extra install/uninstall commands for NSIS installer
+
2009-08-21 Marian Buchta <mar...@gm...>
* cmake/FindSpark.cmake:
Added: trunk/simspark-utilities/windows/install_extra.nsi
===================================================================
--- trunk/simspark-utilities/windows/install_extra.nsi (rev 0)
+++ trunk/simspark-utilities/windows/install_extra.nsi 2009-08-25 14:48:35 UTC (rev 93)
@@ -0,0 +1,25 @@
+CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Monitorspark.lnk" "$INSTDIR\bin\monitorspark.cmd"
+CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\SampleAgent.lnk" "$INSTDIR\bin\sampleagent.cmd"
+CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\SampleSim.lnk" "$INSTDIR\bin\samplesim.cmd"
+!insertmacro MUI_STARTMENU_WRITE_END
+!define MUI_STARTMENUPAGE_CURRENT_ID "SOMETHING_NOT_AVAILABLE"
+
+WriteRegExpandStr HKLM 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' 'SIMSPARK-UTILITIES_DIR' '$INSTDIR'
+ClearErrors
+FileOpen $0 $INSTDIR\bin\monitorspark.cmd w
+FileWrite $0 'PATH=%PATH%;%SPARK_DIR%\lib\simspark$\n'
+FileWrite $0 'cd "%SIMSPARK-UTILITIES_DIR%\bin\"$\n'
+FileWrite $0 'monitorspark.exe %1 %2 %3 %4'
+FileClose $0
+ClearErrors
+FileOpen $0 $INSTDIR\bin\sampleagent.cmd w
+FileWrite $0 'PATH=%PATH%;%SPARK_DIR%\lib\simspark$\n'
+FileWrite $0 'cd "%SIMSPARK-UTILITIES_DIR%\bin\"$\n'
+FileWrite $0 'sampleagent.exe %1 %2 %3 %4'
+FileClose $0
+ClearErrors
+FileOpen $0 $INSTDIR\bin\samplesim.cmd w
+FileWrite $0 'PATH=%PATH%;%SPARK_DIR%\lib\simspark$\n'
+FileWrite $0 'cd "%SIMSPARK-UTILITIES_DIR%\bin\"$\n'
+FileWrite $0 'samplesim.exe %1 %2 %3 %4'
+FileClose $0
Added: trunk/simspark-utilities/windows/uninstall_extra.nsi
===================================================================
--- trunk/simspark-utilities/windows/uninstall_extra.nsi (rev 0)
+++ trunk/simspark-utilities/windows/uninstall_extra.nsi 2009-08-25 14:48:35 UTC (rev 93)
@@ -0,0 +1,11 @@
+Delete '$INSTDIR\bin\monitorspark.cmd'
+Delete '$INSTDIR\bin\sampleagent.cmd'
+Delete '$INSTDIR\bin\samplesim.cmd'
+DeleteRegValue HKLM 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' 'SIMSPARK-UTILITIES_DIR'
+
+Var /GLOBAL STARTMENU_DIR_FORLINKS
+!insertmacro MUI_STARTMENU_GETFOLDER Application $STARTMENU_DIR_FORLINKS
+
+Delete "$SMPROGRAMS\$STARTMENU_DIR_FORLINKS\Monitorspark.lnk"
+Delete "$SMPROGRAMS\$STARTMENU_DIR_FORLINKS\SampleAgent.lnk"
+Delete "$SMPROGRAMS\$STARTMENU_DIR_FORLINKS\SampleSim.lnk"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2009-08-25 12:31:30
|
Revision: 92
http://simspark.svn.sourceforge.net/simspark/?rev=92&view=rev
Author: marianbuchta
Date: 2009-08-25 12:31:23 +0000 (Tue, 25 Aug 2009)
Log Message:
-----------
rsgedit:
-remove forget line from previous revision
spark:
-fixed CMake configuration error on Windows when wxWidgets is available
Modified Paths:
--------------
trunk/rsgedit/CMakeLists.txt
trunk/rsgedit/ChangeLog
trunk/spark/ChangeLog
trunk/spark/plugin/inputwx/CMakeLists.txt
trunk/spark/plugin/openglsyswx/CMakeLists.txt
Modified: trunk/rsgedit/CMakeLists.txt
===================================================================
--- trunk/rsgedit/CMakeLists.txt 2009-08-24 00:59:01 UTC (rev 91)
+++ trunk/rsgedit/CMakeLists.txt 2009-08-25 12:31:23 UTC (rev 92)
@@ -79,14 +79,6 @@
install(DIRECTORY "${Boost_LIBRARY_DIRS}/" DESTINATION ${BINDIR}
FILES_MATCHING PATTERN "*.dll")
-
- string(REGEX REPLACE "(.*)\\.lib" "\\1.dll" DevIL_DLL "${DevIL_LIBRARY_IL}")
- if (EXISTS ${DevIL_DLL})
- install(PROGRAMS ${DevIL_DLL} DESTINATION ${BINDIR})
- endif (EXISTS ${DevIL_DLL})
-
- install(DIRECTORY "${FREETYPE_INCLUDE_DIR_ft2build}/../bin/" DESTINATION ${BINDIR}
- FILES_MATCHING PATTERN "*.dll")
endif (WIN32)
########### uninstall support ############
Modified: trunk/rsgedit/ChangeLog
===================================================================
--- trunk/rsgedit/ChangeLog 2009-08-24 00:59:01 UTC (rev 91)
+++ trunk/rsgedit/ChangeLog 2009-08-25 12:31:23 UTC (rev 92)
@@ -1,3 +1,8 @@
+2009-08-25 Marian Buchta <mar...@gm...>
+
+ * CMakeLists.txt:
+ - forgot remove lines (from previous revision) to find Ruby,Freetype and DevIL libraries and add dlls into package via NSIS installer (Windows).
+
2009-08-24 Marian Buchta <mar...@gm...>
* src/CMakeLists.txt:
Modified: trunk/spark/ChangeLog
===================================================================
--- trunk/spark/ChangeLog 2009-08-24 00:59:01 UTC (rev 91)
+++ trunk/spark/ChangeLog 2009-08-25 12:31:23 UTC (rev 92)
@@ -1,3 +1,9 @@
+2009-08-25 Marian Buchta <mar...@gm...>
+
+ * plugin/openglsyswx/CMakeLists.txt:
+ * plugin/inputwx/CMakeLists.txt:
+ - fixed CMake configuration error on Windows when wxWidgets is available
+
2009-08-24 Marian Buchta <mar...@gm...>
* cmake/FindRuby.cmake:
Modified: trunk/spark/plugin/inputwx/CMakeLists.txt
===================================================================
--- trunk/spark/plugin/inputwx/CMakeLists.txt 2009-08-24 00:59:01 UTC (rev 91)
+++ trunk/spark/plugin/inputwx/CMakeLists.txt 2009-08-25 12:31:23 UTC (rev 92)
@@ -17,7 +17,7 @@
target_link_libraries(inputwx ${wxWidgets_LIBRARIES} ${spark_libs})
- set_target_properties(inputwx PROPERTIES COMPILE_FLAGS ${wxWidgets_CXX_FLAGS})
+ set_target_properties(inputwx PROPERTIES COMPILE_FLAGS "${wxWidgets_CXX_FLAGS}")
if (NOT APPLE)
set_target_properties(inputwx PROPERTIES VERSION 0.0.0 SOVERSION 0)
endif (NOT APPLE)
Modified: trunk/spark/plugin/openglsyswx/CMakeLists.txt
===================================================================
--- trunk/spark/plugin/openglsyswx/CMakeLists.txt 2009-08-24 00:59:01 UTC (rev 91)
+++ trunk/spark/plugin/openglsyswx/CMakeLists.txt 2009-08-25 12:31:23 UTC (rev 92)
@@ -19,7 +19,7 @@
set_target_properties(openglsyswx PROPERTIES VERSION 0.0.0 SOVERSION 0)
endif (NOT APPLE)
- set_target_properties(inputwx PROPERTIES COMPILE_FLAGS ${wxWidgets_CXX_FLAGS})
+ set_target_properties(inputwx PROPERTIES COMPILE_FLAGS "${wxWidgets_CXX_FLAGS}")
install(TARGETS openglsyswx DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME})
endif (wxWidgets_FOUND)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|