diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3dba20f262..832043d441 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -518,16 +518,16 @@ namespace OpenSim # region Setup methods - protected override PhysicsScene GetPhysicsScene() + protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) { - return GetPhysicsScene(m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source); + return GetPhysicsScene( + m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source, osSceneIdentifier); } /// /// Handler to supply the current status of this sim - /// - /// Currently this is always OK if the simulator is still listening for connections on its HTTP service /// + /// Currently this is always OK if the simulator is still listening for connections on its HTTP service protected class SimStatusHandler : IStreamedRequestHandler { public byte[] Handle(string path, Stream request, diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index ce978dfe2c..cc3edff594 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -71,7 +71,17 @@ namespace OpenSim.Region.ClientStack protected SceneManager m_sceneManager = new SceneManager(); protected abstract void Initialize(); - protected abstract PhysicsScene GetPhysicsScene(); + + /// + /// Get a new physics scene. + /// + /// + /// + /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. + /// + /// + protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); + protected abstract StorageManager CreateStorageManager(); protected abstract ClientStackManager CreateClientStackManager(); protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, @@ -99,13 +109,24 @@ namespace OpenSim.Region.ClientStack m_httpServer.Start(); } - protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config) + /// + /// Get a new physics scene. + /// + /// The name of the physics engine to use + /// The name of the mesh engine to use + /// The configuration data to pass to the physics and mesh engines + /// + /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. + /// + /// + protected PhysicsScene GetPhysicsScene( + string engine, string meshEngine, IConfigSource config, string osSceneIdentifier) { PhysicsPluginManager physicsPluginManager; physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssemblies("Physics"); - return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config); + return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); } /// @@ -153,7 +174,7 @@ namespace OpenSim.Region.ClientStack scene.LoadWorldMap(); - scene.PhysicsScene = GetPhysicsScene(); + scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight); diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index 8a06eaadb7..5212f94d15 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); - testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource); + testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); return testScene; } diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 013c9cfd4d..3673302b2d 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 4f1afdd9ec..8f5ffd8c96 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 428a586f7d..4ab8d448d9 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 606134afeb..c913639072 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 b066d0c471..d1a3ce7ac1 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 c8cbcf5f9a..04e3e75a0c 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 9a4e92f7ef..43af72dbe3 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 6502827a64..a7ee26d1f7 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();