From 3b0db66b92a9e497d965d2a26c9d6de643612b63 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 15 Dec 2008 18:39:54 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2775 with small tweaks * This pushes an identifier for the OpenSim scene to the physics scene. This allows log messages from the physics scene to identify which OpenSim scene they relate to. * Thanks Gerhard --- .../Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 9 ++++++--- OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 10 ++++++++-- OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs | 6 +++--- OpenSim/Region/Physics/OdePlugin/ODETestClass.cs | 2 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 13 ++++++++----- OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 4 ++-- OpenSim/Region/Physics/POSPlugin/POSScene.cs | 5 ++++- OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 9 ++++++--- 8 files changed, 38 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 013c9cf..3673302 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -47,9 +47,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin return true; } - public PhysicsScene GetScene() + public PhysicsScene GetScene(string sceneIdentifier) { - return new BasicScene(); + return new BasicScene(sceneIdentifier); } public string GetName() @@ -67,8 +67,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin private List _actors = new List(); private float[] _heightMap; - public BasicScene() + string sceneIdentifier; + + public BasicScene(string _sceneIdentifier) { + sceneIdentifier = _sceneIdentifier; } public override void Initialise(IMesher meshmerizer, IConfigSource config) diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 4f1afdd..8f5ffd8 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -212,11 +212,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin return true; } - public PhysicsScene GetScene() + public PhysicsScene GetScene(string sceneIdentifier) { if (_mScene == null) { - _mScene = new BulletXScene(); + _mScene = new BulletXScene(sceneIdentifier); } return (_mScene); } @@ -493,6 +493,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin public IMesher mesher; // private IConfigSource m_config; + String identifier; + + public BulletXScene(String sceneIdentifier) + { + identifier = sceneIdentifier; + } public static float Gravity { diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 428a586..4ab8d44 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Physics.Manager /// /// /// - public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config) + public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName) { if (String.IsNullOrEmpty(physEngineName)) { @@ -92,7 +92,7 @@ namespace OpenSim.Region.Physics.Manager if (_PhysPlugins.ContainsKey(physEngineName)) { m_log.Info("[PHYSICS]: creating " + physEngineName); - PhysicsScene result = _PhysPlugins[physEngineName].GetScene(); + PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); result.Initialise(meshEngine, config); return result; } @@ -226,7 +226,7 @@ namespace OpenSim.Region.Physics.Manager public interface IPhysicsPlugin { bool Init(); - PhysicsScene GetScene(); + PhysicsScene GetScene(String sceneIdentifier); string GetName(); void Dispose(); } diff --git a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs index 606134a..c913639 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Physics.OdePlugin // Loading Zero Mesher imp = new ZeroMesherPlugin(); // Getting Physics Scene - ps = cbt.GetScene(); + ps = cbt.GetScene("test"); // Initializing Physics Scene. ps.Initialise(imp.GetMesher(),null); float[] _heightmap = new float[256 * 256]; diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index b066d0c..d1a3ce7 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.Physics.OdePlugin return true; } - public PhysicsScene GetScene() + public PhysicsScene GetScene(String sceneIdentifier) { if (_mScene == null) { @@ -74,7 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin // http://opensimulator.org/mantis/view.php?id=2750). d.InitODE(); - _mScene = new OdeScene(ode); + _mScene = new OdeScene(ode, sceneIdentifier); } return (_mScene); } @@ -123,7 +123,7 @@ namespace OpenSim.Region.Physics.OdePlugin public class OdeScene : PhysicsScene { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private ILog m_log; // private Dictionary m_storedCollisions = new Dictionary(); CollisionLocker ode; @@ -270,8 +270,11 @@ namespace OpenSim.Region.Physics.OdePlugin /// Sets many properties that ODE requires to be stable /// These settings need to be tweaked 'exactly' right or weird stuff happens. /// - public OdeScene(CollisionLocker dode) - { + public OdeScene(CollisionLocker dode, string sceneIdentifier) + { + m_log + = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier); + OdeLock = new Object(); ode = dode; nearCallback = near; diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index c8cbcf5..04e3e75 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs @@ -47,9 +47,9 @@ namespace OpenSim.Region.Physics.POSPlugin return true; } - public PhysicsScene GetScene() + public PhysicsScene GetScene(string sceneIdentifier) { - return new POSScene(); + return new POSScene(sceneIdentifier); } public string GetName() diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs index 9a4e92f..43af72d 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs @@ -41,8 +41,11 @@ namespace OpenSim.Region.Physics.POSPlugin private float[] _heightMap; private const float gravity = -9.8f; - public POSScene() + string sceneIdentifier; + + public POSScene(String _sceneIdentifier) { + sceneIdentifier = _sceneIdentifier; } public override void Initialise(IMesher meshmerizer, IConfigSource config) diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 6502827..a7ee26d 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -51,11 +51,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin return true; } - public PhysicsScene GetScene() + public PhysicsScene GetScene(string sceneIdentifier) { if (_mScene == null) { - _mScene = new PhysXScene(); + _mScene = new PhysXScene(sceneIdentifier); } return (_mScene); } @@ -78,8 +78,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin private NxPhysicsSDK mySdk; private NxScene scene; - public PhysXScene() + string sceneIdentifier; + public PhysXScene(string _sceneIdentifier) { + sceneIdentifier = _sceneIdentifier; + mySdk = NxPhysicsSDK.CreateSDK(); Console.WriteLine("Sdk created - now creating scene"); scene = mySdk.CreateScene(); -- cgit v1.1