From: <a-...@us...> - 2010-02-02 08:17:22
|
Revision: 156 http://simspark.svn.sourceforge.net/simspark/?rev=156&view=rev Author: a-held Date: 2010-02-02 08:17:15 +0000 (Tue, 02 Feb 2010) Log Message: ----------- got rid of staticphysicsmethods class Modified Paths: -------------- branches/multiphys/spark/lib/oxygen/CMakeLists.txt branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp branches/multiphys/spark/lib/oxygen/physicsserver/int/colliderint.h branches/multiphys/spark/lib/oxygen/physicsserver/int/jointint.h branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 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/odejoint.cpp branches/multiphys/spark/lib/oxygen/physicsserver/ode/odejoint.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 Removed Paths: ------------- branches/multiphys/spark/lib/oxygen/physicsserver/ode/staticphysicsmethods_ode.cpp branches/multiphys/spark/lib/oxygen/physicsserver/staticphysicsmethods.h Modified: branches/multiphys/spark/lib/oxygen/CMakeLists.txt =================================================================== --- branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/CMakeLists.txt 2010-02-02 08:17:15 UTC (rev 156) @@ -40,7 +40,6 @@ physicsserver/recorderhandler.h physicsserver/space.h physicsserver/spherecollider.h - physicsserver/staticphysicsmethods.h physicsserver/transformcollider.h physicsserver/world.h physicsserver/dragcontroller.h @@ -93,7 +92,6 @@ physicsserver/int/worldint.h #ode-specific files - physicsserver/ode/staticphysicsmethods_ode.cpp physicsserver/ode/odeangularmotor.h physicsserver/ode/odeballjoint.h physicsserver/ode/odebody.h Modified: branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/collider.cpp 2010-02-02 08:17:15 UTC (rev 156) @@ -167,7 +167,7 @@ } Collider* collPtr = - StaticPhysicsMethods::GetColliderPointer(geomID); + mColliderImp->GetColliderPointer(geomID); if (collPtr == 0) { Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/colliderint.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/int/colliderint.h 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/int/colliderint.h 2010-02-02 08:17:15 UTC (rev 156) @@ -37,6 +37,10 @@ { public: + /** Gets the pointer to the Collider object that manages the geom + specified by geomID. + */ + virtual Collider* GetColliderPointer(long geomID) = 0; virtual void SetPosition(const salt::Vector3f& globalPos, long geomID) = 0; virtual void SetLocalPosition(const salt::Vector3f& pos, long geomID) = 0; Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/jointint.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/int/jointint.h 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/int/jointint.h 2010-02-02 08:17:15 UTC (rev 156) @@ -38,7 +38,22 @@ class OXYGEN_API JointInt { public: + + /** Gets the pointer to the Joint object that manages the joint + specified by jointID. + */ + virtual Joint* GetJoint(long jointID) = 0; + /** Checks if two bodies, specified by bodyID1 and bodyID2, are + connected by a joint. + */ + virtual bool AreConnected(long bodyID1, long bodyID2) = 0; + + /** Checks if two bodies, specified by bodyID1 and bodyID2, are + connected by a joint that is not of the type specified by joint_type. + */ + virtual bool AreConnectedExcluding(long bodyID1, long bodyID2, int joint_type) = 0; + virtual void DestroyJoint(long jointID, boost::shared_ptr<GenericJointFeedback> feedback) = 0; virtual void Attach(long bodyID1, long bodiID2, long jointID) = 0; Modified: branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2010-02-02 08:17:15 UTC (rev 156) @@ -34,6 +34,8 @@ { public: + virtual RigidBody* GetBodyPointer(long bodyID) = 0; + virtual void Enable(long bodyID) = 0; virtual void Disable(long bodyID) = 0; virtual bool IsEnabled(long bodyID) const = 0; Modified: branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/joint.cpp 2010-02-02 08:17:15 UTC (rev 156) @@ -60,7 +60,7 @@ return shared_ptr<Joint>(); } - Joint* jointPtr = StaticPhysicsMethods::GetJoint(jointID); + Joint* jointPtr = mJointImp->GetJoint(jointID); if (jointPtr == 0) { @@ -184,7 +184,7 @@ return false; } - const bool connected = StaticPhysicsMethods::AreConnected(body1->GetBodyID(), body2->GetBodyID()); + const bool connected = mJointImp->AreConnected(body1->GetBodyID(), body2->GetBodyID()); return connected; } @@ -201,10 +201,9 @@ return false; } - const bool connected = - StaticPhysicsMethods::AreConnectedExcluding(body1->GetBodyID(), - body2->GetBodyID(), - joint_type); + const bool connected = mJointImp->AreConnectedExcluding(body1->GetBodyID(), + body2->GetBodyID(), + joint_type); return connected; } Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.cpp 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.cpp 2010-02-02 08:17:15 UTC (rev 156) @@ -44,6 +44,11 @@ { } +Collider* ODECollider::GetColliderPointer(long geomID){ + dGeomID ODEGeom = (dGeomID) geomID; + return static_cast<Collider*>(dGeomGetData(ODEGeom)); +} + void ODECollider::SetRotation(const Matrix& rot, long geomID) { dGeomID ODEGeom = (dGeomID) geomID; Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.h 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odecollider.h 2010-02-02 08:17:15 UTC (rev 156) @@ -37,6 +37,11 @@ ODECollider(); virtual ~ODECollider(); + /** Gets the pointer to the Collider object that manages the geom + specified by geomID. + */ + Collider* GetColliderPointer(long geomID); + void SetPosition(const salt::Vector3f& globalPos, long geomID); void SetLocalPosition(const salt::Vector3f& pos, long GeomID); salt::Vector3f GetPosition(long geomID) const; Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odejoint.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odejoint.cpp 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odejoint.cpp 2010-02-02 08:17:15 UTC (rev 156) @@ -31,6 +31,23 @@ { } +Joint* ODEJoint::GetJoint(long jointID){ + dJointID ODEJoint = (dJointID) jointID; + return static_cast<Joint*>(dJointGetData(ODEJoint)); +} + +bool ODEJoint::AreConnected(long bodyID1, long bodyID2){ + dBodyID ODEBody1 = (dBodyID) bodyID1; + dBodyID ODEBody2 = (dBodyID) bodyID2; + return dAreConnected(ODEBody1, ODEBody2) == 1; +} + +bool ODEJoint::AreConnectedExcluding(long bodyID1, long bodyID2, int joint_type){ + dBodyID ODEBody1 = (dBodyID) bodyID1; + dBodyID ODEBody2 = (dBodyID) bodyID2; + return dAreConnectedExcluding(ODEBody1, ODEBody2, joint_type) == 1; +} + void ODEJoint::OnLink(long jointID, Joint* joint) { dJointID ODEJoint = (dJointID) jointID; Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/odejoint.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/ode/odejoint.h 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/odejoint.h 2010-02-02 08:17:15 UTC (rev 156) @@ -33,6 +33,10 @@ { public: ODEJoint(); + + Joint* GetJoint(long jointID); + bool AreConnected(long bodyID1, long bodyID2); + bool AreConnectedExcluding(long bodyID1, long bodyID2, int joint_type); virtual void DestroyJoint(long jointID, boost::shared_ptr<GenericJointFeedback> feedback); Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.cpp 2010-02-02 08:17:15 UTC (rev 156) @@ -36,6 +36,11 @@ ODERigidBody::ODERigidBody() : Body(){ } +RigidBody* ODERigidBody::GetBodyPointer(long bodyID){ + dBodyID ODEBody = (dBodyID) bodyID; + return static_cast<RigidBody*>(dBodyGetData(ODEBody)); +} + void ODERigidBody::Enable(long bodyID) { dBodyID ODEBody = (dBodyID) bodyID; Modified: branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/oderigidbody.h 2010-02-02 08:17:15 UTC (rev 156) @@ -35,6 +35,8 @@ public: ODERigidBody(); + RigidBody* GetBodyPointer(long bodyID); + void Enable(long bodyID); void Disable(long bodyID); bool IsEnabled(long bodyID) const; Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/ode/staticphysicsmethods_ode.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/ode/staticphysicsmethods_ode.cpp 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/ode/staticphysicsmethods_ode.cpp 2010-02-02 08:17:15 UTC (rev 156) @@ -1,56 +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: body.cpp 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/staticphysicsmethods.h> -#include <oxygen/physicsserver/collider.h> -#include <oxygen/physicsserver/joint.h> -#include <oxygen/physicsserver/rigidbody.h> -#include <oxygen/physicsserver/space.h> -#include <oxygen/physicsserver/ode/odewrapper.h> - -using namespace oxygen; -using namespace boost; - -Collider* StaticPhysicsMethods::GetColliderPointer(long geomID){ - dGeomID ODEGeom = (dGeomID) geomID; - return static_cast<Collider*>(dGeomGetData(ODEGeom)); -} - -Joint* StaticPhysicsMethods::GetJoint(long jointID){ - dJointID ODEJoint = (dJointID) jointID; - return static_cast<Joint*>(dJointGetData(ODEJoint)); -} - -RigidBody* StaticPhysicsMethods::GetBodyPointer(long bodyID){ - dBodyID ODEBody = (dBodyID) bodyID; - return static_cast<RigidBody*>(dBodyGetData(ODEBody)); -} - -bool StaticPhysicsMethods::AreConnected(long bodyID1, long bodyID2){ - dBodyID ODEBody1 = (dBodyID) bodyID1; - dBodyID ODEBody2 = (dBodyID) bodyID2; - return dAreConnected(ODEBody1, ODEBody2) == 1; -} - -bool StaticPhysicsMethods::AreConnectedExcluding(long bodyID1, long bodyID2, int joint_type){ - dBodyID ODEBody1 = (dBodyID) bodyID1; - dBodyID ODEBody2 = (dBodyID) bodyID2; - return dAreConnectedExcluding(ODEBody1, ODEBody2, joint_type) == 1; -} Modified: branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/rigidbody.cpp 2010-02-02 08:17:15 UTC (rev 156) @@ -327,7 +327,7 @@ return shared_ptr<RigidBody>(); } - RigidBody* bodyPtr = StaticPhysicsMethods::GetBodyPointer(bodyID); + RigidBody* bodyPtr = mRigidBodyImp->GetBodyPointer(bodyID); if (bodyPtr == 0) { Deleted: branches/multiphys/spark/lib/oxygen/physicsserver/staticphysicsmethods.h =================================================================== --- branches/multiphys/spark/lib/oxygen/physicsserver/staticphysicsmethods.h 2010-02-01 05:08:06 UTC (rev 155) +++ branches/multiphys/spark/lib/oxygen/physicsserver/staticphysicsmethods.h 2010-02-02 08:17:15 UTC (rev 156) @@ -1,71 +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: 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_STATICPHYSICSMETHODS_H -#define OXYGEN_STATICPHYSICSMETHODS_H - -#include <oxygen/oxygen_defines.h> - -namespace oxygen -{ -class Collider; -class Joint; -class RigidBody; -/** StaticPhysicsMethods is a workaround class. It defines static - engine-specific methods which are called from within other - static methods in engine-unspecific classes. - - The StaticPhysicsMethods class should be implemented once for each - supported engine. The preprocessor must decide which file to use. -*/ - -class OXYGEN_API StaticPhysicsMethods{ - -public: - /** Gets the pointer to the Collider object that manages the geom - specified by geomID. - */ - static Collider* GetColliderPointer(long geomID); - - /** Gets the pointer to the Joint object that manages the joint - specified by jointID. - */ - static Joint* GetJoint(long jointID); - - /** Gets the pointer to the RigidBody object that manages the rigid body - specified by bodyID. - */ - static RigidBody* GetBodyPointer(long bodyID); - - /** Checks if two bodies, specified by bodyID1 and bodyID2, are - connected by a joint. - */ - static bool AreConnected(long bodyID1, long bodyID2); - - /** Checks if two bodies, specified by bodyID1 and bodyID2, are - connected by a joint that is not of the type specified by joint_type. - */ - static bool AreConnectedExcluding(long bodyID1, long bodyID2, int joint_type); -}; - -} //namespace oxygen - -#endif //OXYGEN_GENERICPHYSICSOBJECTS_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |