aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2015-09-09 17:55:46 +0100
committerUbitUmarov2015-09-09 17:55:46 +0100
commite1a8125b4fadc76baba73712843aee57edd2936f (patch)
tree571c7c77d387a889706c3a1a08ac3bcea0a31b12 /OpenSim
parent split Module from its scene, so if not enabled there is no scene memory allo... (diff)
downloadopensim-SC_OLD-e1a8125b4fadc76baba73712843aee57edd2936f.zip
opensim-SC_OLD-e1a8125b4fadc76baba73712843aee57edd2936f.tar.gz
opensim-SC_OLD-e1a8125b4fadc76baba73712843aee57edd2936f.tar.bz2
opensim-SC_OLD-e1a8125b4fadc76baba73712843aee57edd2936f.tar.xz
found core hack to fix modules interdependencies RegionLoaded is not that obvius
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs9
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs52
2 files changed, 37 insertions, 24 deletions
diff --git a/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs b/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs
index 7c3c688..8be7c7c 100644
--- a/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs
@@ -78,10 +78,19 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
78 78
79 public void RemoveRegion(Scene scene) 79 public void RemoveRegion(Scene scene)
80 { 80 {
81 if (!m_Enabled || m_scene == null)
82 return;
83
84 m_scene.Dispose();
85 m_scene = null;
81 } 86 }
82 87
83 public void RegionLoaded(Scene scene) 88 public void RegionLoaded(Scene scene)
84 { 89 {
90 if (!m_Enabled || m_scene == null)
91 return;
92
93 m_scene.RegionLoaded();
85 } 94 }
86 #endregion 95 #endregion
87 } 96 }
diff --git a/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs b/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs
index 58eb4b5..bd0e372 100644
--- a/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs
@@ -312,19 +312,21 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
312 private ODERayCastRequestManager m_rayCastManager; 312 private ODERayCastRequestManager m_rayCastManager;
313 public ODEMeshWorker m_meshWorker; 313 public ODEMeshWorker m_meshWorker;
314 314
315/* maybe needed if ode uses tls 315 /* maybe needed if ode uses tls
316 private void checkThread() 316 private void checkThread()
317 { 317 {
318
319 int th = Thread.CurrentThread.ManagedThreadId;
320 if(th != threadid)
321 {
322 threadid = th;
323 d.AllocateODEDataForThread(~0U);
324 }
325 }
326 */
327
328 IConfig physicsconfig = null;
318 329
319 int th = Thread.CurrentThread.ManagedThreadId;
320 if(th != threadid)
321 {
322 threadid = th;
323 d.AllocateODEDataForThread(~0U);
324 }
325 }
326 */
327
328 public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool podeUbitLib) 330 public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool podeUbitLib)
329 { 331 {
330 OdeLock = new Object(); 332 OdeLock = new Object();
@@ -336,25 +338,29 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
336 m_odeUbitLib = podeUbitLib; 338 m_odeUbitLib = podeUbitLib;
337 m_frameWorkScene = pscene; 339 m_frameWorkScene = pscene;
338 340
339 mesher = m_frameWorkScene.RequestModuleInterface<IMesher>();
340 if (mesher == null)
341 {
342 m_log.WarnFormat("[UbitODE] No mesher. module disabled");
343 return;
344 }
345
346 m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this); 341 m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this);
347 342
348 Initialization(); 343 Initialization();
349 344
350 base.Initialise(m_frameWorkScene.PhysicsRequestAsset, 345 base.Initialise(m_frameWorkScene.PhysicsRequestAsset,
351 (m_frameWorkScene.Heightmap != null ? m_frameWorkScene.Heightmap.GetFloatsSerialised() : new float[m_frameWorkScene.RegionInfo.RegionSizeX * m_frameWorkScene.RegionInfo.RegionSizeY]), 346 (m_frameWorkScene.Heightmap != null ? m_frameWorkScene.Heightmap.GetFloatsSerialised() : new float[m_frameWorkScene.RegionInfo.RegionSizeX * m_frameWorkScene.RegionInfo.RegionSizeY]),
352 (float)m_frameWorkScene.RegionInfo.RegionSettings.WaterHeight); 347 (float)m_frameWorkScene.RegionInfo.RegionSettings.WaterHeight);
348 }
353 349
350 // core hack this just means all modules where loaded
351 // so now we can look for dependencies
352 public void RegionLoaded()
353 {
354 mesher = m_frameWorkScene.RequestModuleInterface<IMesher>();
355 if (mesher == null)
356 {
357 m_log.WarnFormat("[UbitODE] No mesher. module disabled");
358 return;
359 }
354 360
361 m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig);
355 m_frameWorkScene.PhysicsEnabled = true; 362 m_frameWorkScene.PhysicsEnabled = true;
356 } 363 }
357
358 /// <summary> 364 /// <summary>
359 /// Initiailizes the scene 365 /// Initiailizes the scene
360 /// Sets many properties that ODE requires to be stable 366 /// Sets many properties that ODE requires to be stable
@@ -454,7 +460,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
454 460
455 int contactsPerCollision = 80; 461 int contactsPerCollision = 80;
456 462
457 IConfig physicsconfig = null; 463 physicsconfig = null;
458 464
459 if (m_config != null) 465 if (m_config != null)
460 { 466 {
@@ -505,8 +511,6 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
505 d.WorldSetContactSurfaceLayer(world, contactsurfacelayer); 511 d.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
506 d.WorldSetContactMaxCorrectingVel(world, 60.0f); 512 d.WorldSetContactMaxCorrectingVel(world, 60.0f);
507 513
508 m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig);
509
510 HalfOdeStep = ODE_STEPSIZE * 0.5f; 514 HalfOdeStep = ODE_STEPSIZE * 0.5f;
511 odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f); 515 odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f);
512 516