From: <a-...@us...> - 2010-02-26 09:19:52
|
Revision: 178 http://simspark.svn.sourceforge.net/simspark/?rev=178&view=rev Author: a-held Date: 2010-02-26 09:19:45 +0000 (Fri, 26 Feb 2010) Log Message: ----------- Remove a tiny bit of ODE-specific code that I overlooked Modified Paths: -------------- trunk/spark/lib/oxygen/CMakeLists.txt trunk/spark/lib/oxygen/physicsserver/int/rigidbodyint.h trunk/spark/lib/oxygen/physicsserver/rigidbody.cpp trunk/spark/lib/oxygen/physicsserver/rigidbody.h trunk/spark/lib/oxygen/physicsserver/rigidbody_c.cpp trunk/spark/plugin/odeimps/oderigidbody.cpp trunk/spark/plugin/odeimps/oderigidbody.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 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/CMakeLists.txt 2010-02-26 09:19:45 UTC (rev 178) @@ -89,8 +89,8 @@ physicsserver/int/universaljointint.h physicsserver/int/worldint.h - proxyserver/agentproxy.h - proxyserver/proxyserver.h + #proxyserver/agentproxy.h + #proxyserver/proxyserver.h sceneserver/sceneimporter.h sceneserver/basenode.h sceneserver/fpscontroller.h @@ -279,10 +279,10 @@ monitorserver/custommonitor_c.cpp monitorserver/monitorcmdparser.cpp monitorserver/monitorcmdparser_c.cpp - proxyserver/agentproxy.cpp - proxyserver/agentproxy_c.cpp - proxyserver/proxyserver.cpp - proxyserver/proxyserver_c.cpp + #proxyserver/agentproxy.cpp + #proxyserver/agentproxy_c.cpp + #proxyserver/proxyserver.cpp + #proxyserver/proxyserver_c.cpp ) if(SPADES_FOUND) set(oxygen_LIB_SRCS Modified: trunk/spark/lib/oxygen/physicsserver/int/rigidbodyint.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2010-02-26 09:19:45 UTC (rev 178) @@ -247,6 +247,17 @@ by \param worldID */ virtual long CreateBody(long worldID) = 0; + + /** Creates a new mass object with the information passed on to this + method via \param mass and \param cVector + */ + virtual GenericMass& CreateMass(float mass, salt::Vector3f cVector) = 0; + + /** Sets the value of the inertia tensor of this body. \param i is the + index of the \param value 's position in the inertia tensor. + (It's a 3x3 matrix) + */ + virtual void SetInertiaTensorAt(int i, float value, GenericMass& mass) = 0; }; } //namespace oxygen Deleted: trunk/spark/lib/oxygen/physicsserver/odeobject.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odeobject.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/odeobject.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -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() const -{ - 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 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/odeobject.h 2010-02-26 09:19:45 UTC (rev 178) @@ -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; - - /** returns the world node */ - boost::shared_ptr<World> GetWorld() const; - -protected: - /** 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 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -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 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/odewrapper.h 2010-02-26 09:19:45 UTC (rev 178) @@ -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/rigidbody.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/rigidbody.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/rigidbody.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -389,3 +389,13 @@ { mRigidBodyImp->TranslateMass(v, mBodyID); } + +GenericMass& RigidBody::CreateMass(float mass, salt::Vector3f cVector) +{ + mRigidBodyImp->CreateMass(mass, cVector); +} + +void RigidBody::SetInertiaTensorAt(int i, float value, GenericMass& mass) +{ + mRigidBodyImp->SetInertiaTensorAt(i, value, mass); +} Modified: trunk/spark/lib/oxygen/physicsserver/rigidbody.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/rigidbody.h 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/rigidbody.h 2010-02-26 09:19:45 UTC (rev 178) @@ -239,6 +239,17 @@ orientation */ void SynchronizeParent() const; + + /** Creates a new mass object with the information passed on to this + method via \param mass and \param cVector + */ + GenericMass& CreateMass(float mass, salt::Vector3f cVector); + + /** Sets the value of the inertia tensor of this body. \param i is the + index of the \param value 's position in the inertia tensor. + (It's a 3x3 matrix) + */ + void SetInertiaTensorAt(int i, float value, GenericMass& mass); protected: /** creates the managed body and moves it to the position of Modified: trunk/spark/lib/oxygen/physicsserver/rigidbody_c.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/rigidbody_c.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/rigidbody_c.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -20,8 +20,6 @@ */ #include <oxygen/physicsserver/rigidbody.h> -//TODO: Do not include odewrapper in this file! -#include <../plugin/odeimps/odewrapper.h> using namespace boost; using namespace oxygen; @@ -88,22 +86,33 @@ return false; } - dMass mass; - mass.mass = inMass; - mass.c[0] = inCenter[0]; - mass.c[1] = inCenter[1]; - mass.c[2] = inCenter[2]; - + GenericMass& mass = obj->CreateMass(inMass, inCenter); + //mass.mass = inMass; + //mass.c[0] = inCenter[0]; + //mass.c[1] = inCenter[1]; + //mass.c[2] = inCenter[2]; + + float currentValue; + + //try to emulate the loop commented out below without understanding it for (int i=0;i<9;++i) { - if (! in.AdvanceValue(iter,mass.I[i])) + if (in.AdvanceValue(iter,currentValue)) { - return false; + obj->SetInertiaTensorAt(i, currentValue, mass); } - } + else return false; + } + + //for (int i=0;i<9;++i) + // { + // if (! in.AdvanceValue(iter,mass.I[i])) + // { + // return false; + // } + // } - GenericMass& massRef = (GenericMass&) mass; - obj->SetMassParameters(massRef); + obj->SetMassParameters(mass); return true; } Modified: trunk/spark/plugin/odeimps/oderigidbody.cpp =================================================================== --- trunk/spark/plugin/odeimps/oderigidbody.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/plugin/odeimps/oderigidbody.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -455,3 +455,21 @@ dBodyGetMass(ODEBody, &m); dMassTranslate(&m,v[0],v[1],v[2]); } + +GenericMass& RigidBodyImp::CreateMass(float mass, salt::Vector3f cVector) +{ + dMass ODEMass; + ODEMass.mass = mass; + ODEMass.c[0] = cVector[0]; + ODEMass.c[1] = cVector[1]; + ODEMass.c[2] = cVector[2]; + + GenericMass& massRef = (GenericMass&) ODEMass; + return massRef; +} + +void RigidBodyImp::SetInertiaTensorAt(int i, float value, GenericMass& mass) +{ + dMass& ODEMass = (dMass&) mass; + ODEMass.I[i] = value; +} Modified: trunk/spark/plugin/odeimps/oderigidbody.h =================================================================== --- trunk/spark/plugin/odeimps/oderigidbody.h 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/plugin/odeimps/oderigidbody.h 2010-02-26 09:19:45 UTC (rev 178) @@ -90,6 +90,8 @@ void BodySetData(oxygen::RigidBody* rb, long bodyID); oxygen::RigidBody* BodyGetData(long bodyID); long CreateBody(long worldID); + oxygen::GenericMass& CreateMass(float mass, salt::Vector3f cVector); + void SetInertiaTensorAt(int i, float value, oxygen::GenericMass& mass); protected: //These methods are only called internally and are not declared in the interface. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |