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. |