diff options
author | Justin Clarke Casey | 2008-12-15 18:39:54 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-12-15 18:39:54 +0000 |
commit | 3b0db66b92a9e497d965d2a26c9d6de643612b63 (patch) | |
tree | 3452afd22484b8baad138a3ecc5469ea57c8427f /OpenSim | |
parent | * minor: Stop presence child status suffering an NRE if the agent uuid given ... (diff) | |
download | opensim-SC-3b0db66b92a9e497d965d2a26c9d6de643612b63.zip opensim-SC-3b0db66b92a9e497d965d2a26c9d6de643612b63.tar.gz opensim-SC-3b0db66b92a9e497d965d2a26c9d6de643612b63.tar.bz2 opensim-SC-3b0db66b92a9e497d965d2a26c9d6de643612b63.tar.xz |
* 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
Diffstat (limited to 'OpenSim')
11 files changed, 68 insertions, 29 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3dba20f..832043d 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -518,16 +518,16 @@ namespace OpenSim | |||
518 | 518 | ||
519 | # region Setup methods | 519 | # region Setup methods |
520 | 520 | ||
521 | protected override PhysicsScene GetPhysicsScene() | 521 | protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) |
522 | { | 522 | { |
523 | return GetPhysicsScene(m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source); | 523 | return GetPhysicsScene( |
524 | m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source, osSceneIdentifier); | ||
524 | } | 525 | } |
525 | 526 | ||
526 | /// <summary> | 527 | /// <summary> |
527 | /// Handler to supply the current status of this sim | 528 | /// Handler to supply the current status of this sim |
528 | /// | ||
529 | /// Currently this is always OK if the simulator is still listening for connections on its HTTP service | ||
530 | /// </summary> | 529 | /// </summary> |
530 | /// Currently this is always OK if the simulator is still listening for connections on its HTTP service | ||
531 | protected class SimStatusHandler : IStreamedRequestHandler | 531 | protected class SimStatusHandler : IStreamedRequestHandler |
532 | { | 532 | { |
533 | public byte[] Handle(string path, Stream request, | 533 | public byte[] Handle(string path, Stream request, |
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index ce978df..cc3edff 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -71,7 +71,17 @@ namespace OpenSim.Region.ClientStack | |||
71 | protected SceneManager m_sceneManager = new SceneManager(); | 71 | protected SceneManager m_sceneManager = new SceneManager(); |
72 | 72 | ||
73 | protected abstract void Initialize(); | 73 | protected abstract void Initialize(); |
74 | protected abstract PhysicsScene GetPhysicsScene(); | 74 | |
75 | /// <summary> | ||
76 | /// Get a new physics scene. | ||
77 | /// </summary> | ||
78 | /// | ||
79 | /// <param name="osSceneIdentifier"> | ||
80 | /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. | ||
81 | /// </param> | ||
82 | /// <returns></returns> | ||
83 | protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); | ||
84 | |||
75 | protected abstract StorageManager CreateStorageManager(); | 85 | protected abstract StorageManager CreateStorageManager(); |
76 | protected abstract ClientStackManager CreateClientStackManager(); | 86 | protected abstract ClientStackManager CreateClientStackManager(); |
77 | protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, | 87 | protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, |
@@ -99,13 +109,24 @@ namespace OpenSim.Region.ClientStack | |||
99 | m_httpServer.Start(); | 109 | m_httpServer.Start(); |
100 | } | 110 | } |
101 | 111 | ||
102 | protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config) | 112 | /// <summary> |
113 | /// Get a new physics scene. | ||
114 | /// </summary> | ||
115 | /// <param name="engine">The name of the physics engine to use</param> | ||
116 | /// <param name="meshEngine">The name of the mesh engine to use</param> | ||
117 | /// <param name="config">The configuration data to pass to the physics and mesh engines</param> | ||
118 | /// <param name="osSceneIdentifier"> | ||
119 | /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. | ||
120 | /// </param> | ||
121 | /// <returns></returns> | ||
122 | protected PhysicsScene GetPhysicsScene( | ||
123 | string engine, string meshEngine, IConfigSource config, string osSceneIdentifier) | ||
103 | { | 124 | { |
104 | PhysicsPluginManager physicsPluginManager; | 125 | PhysicsPluginManager physicsPluginManager; |
105 | physicsPluginManager = new PhysicsPluginManager(); | 126 | physicsPluginManager = new PhysicsPluginManager(); |
106 | physicsPluginManager.LoadPluginsFromAssemblies("Physics"); | 127 | physicsPluginManager.LoadPluginsFromAssemblies("Physics"); |
107 | 128 | ||
108 | return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config); | 129 | return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); |
109 | } | 130 | } |
110 | 131 | ||
111 | /// <summary> | 132 | /// <summary> |
@@ -153,7 +174,7 @@ namespace OpenSim.Region.ClientStack | |||
153 | 174 | ||
154 | scene.LoadWorldMap(); | 175 | scene.LoadWorldMap(); |
155 | 176 | ||
156 | scene.PhysicsScene = GetPhysicsScene(); | 177 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); |
157 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 178 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
158 | scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight); | 179 | scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight); |
159 | 180 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index 8a06eaa..5212f94 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 | |||
71 | 71 | ||
72 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | 72 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); |
73 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | 73 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); |
74 | testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource); | 74 | testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); |
75 | 75 | ||
76 | return testScene; | 76 | return testScene; |
77 | } | 77 | } |
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 | |||
47 | return true; | 47 | return true; |
48 | } | 48 | } |
49 | 49 | ||
50 | public PhysicsScene GetScene() | 50 | public PhysicsScene GetScene(string sceneIdentifier) |
51 | { | 51 | { |
52 | return new BasicScene(); | 52 | return new BasicScene(sceneIdentifier); |
53 | } | 53 | } |
54 | 54 | ||
55 | public string GetName() | 55 | public string GetName() |
@@ -67,8 +67,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
67 | private List<BasicActor> _actors = new List<BasicActor>(); | 67 | private List<BasicActor> _actors = new List<BasicActor>(); |
68 | private float[] _heightMap; | 68 | private float[] _heightMap; |
69 | 69 | ||
70 | public BasicScene() | 70 | string sceneIdentifier; |
71 | |||
72 | public BasicScene(string _sceneIdentifier) | ||
71 | { | 73 | { |
74 | sceneIdentifier = _sceneIdentifier; | ||
72 | } | 75 | } |
73 | 76 | ||
74 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | 77 | 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 | |||
212 | return true; | 212 | return true; |
213 | } | 213 | } |
214 | 214 | ||
215 | public PhysicsScene GetScene() | 215 | public PhysicsScene GetScene(string sceneIdentifier) |
216 | { | 216 | { |
217 | if (_mScene == null) | 217 | if (_mScene == null) |
218 | { | 218 | { |
219 | _mScene = new BulletXScene(); | 219 | _mScene = new BulletXScene(sceneIdentifier); |
220 | } | 220 | } |
221 | return (_mScene); | 221 | return (_mScene); |
222 | } | 222 | } |
@@ -493,6 +493,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
493 | public IMesher mesher; | 493 | public IMesher mesher; |
494 | // private IConfigSource m_config; | 494 | // private IConfigSource m_config; |
495 | 495 | ||
496 | String identifier; | ||
497 | |||
498 | public BulletXScene(String sceneIdentifier) | ||
499 | { | ||
500 | identifier = sceneIdentifier; | ||
501 | } | ||
496 | 502 | ||
497 | public static float Gravity | 503 | public static float Gravity |
498 | { | 504 | { |
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 | |||
65 | /// <param name="meshEngineName"></param> | 65 | /// <param name="meshEngineName"></param> |
66 | /// <param name="config"></param> | 66 | /// <param name="config"></param> |
67 | /// <returns></returns> | 67 | /// <returns></returns> |
68 | public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config) | 68 | public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName) |
69 | { | 69 | { |
70 | if (String.IsNullOrEmpty(physEngineName)) | 70 | if (String.IsNullOrEmpty(physEngineName)) |
71 | { | 71 | { |
@@ -92,7 +92,7 @@ namespace OpenSim.Region.Physics.Manager | |||
92 | if (_PhysPlugins.ContainsKey(physEngineName)) | 92 | if (_PhysPlugins.ContainsKey(physEngineName)) |
93 | { | 93 | { |
94 | m_log.Info("[PHYSICS]: creating " + physEngineName); | 94 | m_log.Info("[PHYSICS]: creating " + physEngineName); |
95 | PhysicsScene result = _PhysPlugins[physEngineName].GetScene(); | 95 | PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); |
96 | result.Initialise(meshEngine, config); | 96 | result.Initialise(meshEngine, config); |
97 | return result; | 97 | return result; |
98 | } | 98 | } |
@@ -226,7 +226,7 @@ namespace OpenSim.Region.Physics.Manager | |||
226 | public interface IPhysicsPlugin | 226 | public interface IPhysicsPlugin |
227 | { | 227 | { |
228 | bool Init(); | 228 | bool Init(); |
229 | PhysicsScene GetScene(); | 229 | PhysicsScene GetScene(String sceneIdentifier); |
230 | string GetName(); | 230 | string GetName(); |
231 | void Dispose(); | 231 | void Dispose(); |
232 | } | 232 | } |
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 | |||
49 | // Loading Zero Mesher | 49 | // Loading Zero Mesher |
50 | imp = new ZeroMesherPlugin(); | 50 | imp = new ZeroMesherPlugin(); |
51 | // Getting Physics Scene | 51 | // Getting Physics Scene |
52 | ps = cbt.GetScene(); | 52 | ps = cbt.GetScene("test"); |
53 | // Initializing Physics Scene. | 53 | // Initializing Physics Scene. |
54 | ps.Initialise(imp.GetMesher(),null); | 54 | ps.Initialise(imp.GetMesher(),null); |
55 | float[] _heightmap = new float[256 * 256]; | 55 | 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 | |||
66 | return true; | 66 | return true; |
67 | } | 67 | } |
68 | 68 | ||
69 | public PhysicsScene GetScene() | 69 | public PhysicsScene GetScene(String sceneIdentifier) |
70 | { | 70 | { |
71 | if (_mScene == null) | 71 | if (_mScene == null) |
72 | { | 72 | { |
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
74 | // http://opensimulator.org/mantis/view.php?id=2750). | 74 | // http://opensimulator.org/mantis/view.php?id=2750). |
75 | d.InitODE(); | 75 | d.InitODE(); |
76 | 76 | ||
77 | _mScene = new OdeScene(ode); | 77 | _mScene = new OdeScene(ode, sceneIdentifier); |
78 | } | 78 | } |
79 | return (_mScene); | 79 | return (_mScene); |
80 | } | 80 | } |
@@ -123,7 +123,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
123 | 123 | ||
124 | public class OdeScene : PhysicsScene | 124 | public class OdeScene : PhysicsScene |
125 | { | 125 | { |
126 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 126 | private ILog m_log; |
127 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); | 127 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); |
128 | 128 | ||
129 | CollisionLocker ode; | 129 | CollisionLocker ode; |
@@ -270,8 +270,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
270 | /// Sets many properties that ODE requires to be stable | 270 | /// Sets many properties that ODE requires to be stable |
271 | /// These settings need to be tweaked 'exactly' right or weird stuff happens. | 271 | /// These settings need to be tweaked 'exactly' right or weird stuff happens. |
272 | /// </summary> | 272 | /// </summary> |
273 | public OdeScene(CollisionLocker dode) | 273 | public OdeScene(CollisionLocker dode, string sceneIdentifier) |
274 | { | 274 | { |
275 | m_log | ||
276 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier); | ||
277 | |||
275 | OdeLock = new Object(); | 278 | OdeLock = new Object(); |
276 | ode = dode; | 279 | ode = dode; |
277 | nearCallback = near; | 280 | 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 | |||
47 | return true; | 47 | return true; |
48 | } | 48 | } |
49 | 49 | ||
50 | public PhysicsScene GetScene() | 50 | public PhysicsScene GetScene(string sceneIdentifier) |
51 | { | 51 | { |
52 | return new POSScene(); | 52 | return new POSScene(sceneIdentifier); |
53 | } | 53 | } |
54 | 54 | ||
55 | public string GetName() | 55 | 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 | |||
41 | private float[] _heightMap; | 41 | private float[] _heightMap; |
42 | private const float gravity = -9.8f; | 42 | private const float gravity = -9.8f; |
43 | 43 | ||
44 | public POSScene() | 44 | string sceneIdentifier; |
45 | |||
46 | public POSScene(String _sceneIdentifier) | ||
45 | { | 47 | { |
48 | sceneIdentifier = _sceneIdentifier; | ||
46 | } | 49 | } |
47 | 50 | ||
48 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | 51 | 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 | |||
51 | return true; | 51 | return true; |
52 | } | 52 | } |
53 | 53 | ||
54 | public PhysicsScene GetScene() | 54 | public PhysicsScene GetScene(string sceneIdentifier) |
55 | { | 55 | { |
56 | if (_mScene == null) | 56 | if (_mScene == null) |
57 | { | 57 | { |
58 | _mScene = new PhysXScene(); | 58 | _mScene = new PhysXScene(sceneIdentifier); |
59 | } | 59 | } |
60 | return (_mScene); | 60 | return (_mScene); |
61 | } | 61 | } |
@@ -78,8 +78,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
78 | private NxPhysicsSDK mySdk; | 78 | private NxPhysicsSDK mySdk; |
79 | private NxScene scene; | 79 | private NxScene scene; |
80 | 80 | ||
81 | public PhysXScene() | 81 | string sceneIdentifier; |
82 | public PhysXScene(string _sceneIdentifier) | ||
82 | { | 83 | { |
84 | sceneIdentifier = _sceneIdentifier; | ||
85 | |||
83 | mySdk = NxPhysicsSDK.CreateSDK(); | 86 | mySdk = NxPhysicsSDK.CreateSDK(); |
84 | Console.WriteLine("Sdk created - now creating scene"); | 87 | Console.WriteLine("Sdk created - now creating scene"); |
85 | scene = mySdk.CreateScene(); | 88 | scene = mySdk.CreateScene(); |