aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-06-29 14:14:16 +0100
committerUbitUmarov2016-06-29 14:14:16 +0100
commitea140d7cac29f0649f29ee140e96cb17400c4b78 (patch)
tree254102dd2c56f8f69bf27f8d77b2ccac9bbc51ec /OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs
parentRevert " don't try to send initial AgentGroupDataUpdate to NPCs" this was (diff)
downloadopensim-SC_OLD-ea140d7cac29f0649f29ee140e96cb17400c4b78.zip
opensim-SC_OLD-ea140d7cac29f0649f29ee140e96cb17400c4b78.tar.gz
opensim-SC_OLD-ea140d7cac29f0649f29ee140e96cb17400c4b78.tar.bz2
opensim-SC_OLD-ea140d7cac29f0649f29ee140e96cb17400c4b78.tar.xz
change ubOde module, hopefully for better handling of multiple scenes on same instance. ( may be broken now )
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs60
1 files changed, 35 insertions, 25 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs
index bd66b4d..dd1c0ab 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs
@@ -1,4 +1,5 @@
1using System; 1using System;
2using System.Collections.Generic;
2using System.Reflection; 3using System.Reflection;
3using log4net; 4using log4net;
4using Nini.Config; 5using Nini.Config;
@@ -15,10 +16,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
15 { 16 {
16 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 17 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
17 18
19 private static Dictionary<Scene, ODEScene> m_scenes = new Dictionary<Scene, ODEScene>();
18 private bool m_Enabled = false; 20 private bool m_Enabled = false;
19 private IConfigSource m_config; 21 private IConfigSource m_config;
20 private ODEScene m_scene;
21 private bool OSOdeLib; 22 private bool OSOdeLib;
23
22 24
23 #region INonSharedRegionModule 25 #region INonSharedRegionModule
24 26
@@ -42,6 +44,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde
42 { 44 {
43 m_config = source; 45 m_config = source;
44 m_Enabled = true; 46 m_Enabled = true;
47
48 if (Util.IsWindows())
49 Util.LoadArchSpecificWindowsDll("ode.dll");
50
51 d.InitODE();
52
53 string ode_config = d.GetConfiguration();
54 if (ode_config != null && ode_config != "")
55 {
56 m_log.InfoFormat("[ubODE] ode library configuration: {0}", ode_config);
57
58 if (ode_config.Contains("ODE_OPENSIM"))
59 {
60 OSOdeLib = true;
61 }
62 }
45 } 63 }
46 } 64 }
47 } 65 }
@@ -55,42 +73,34 @@ namespace OpenSim.Region.PhysicsModule.ubOde
55 if (!m_Enabled) 73 if (!m_Enabled)
56 return; 74 return;
57 75
58 if (Util.IsWindows()) 76 if(m_scenes.ContainsKey(scene)) // ???
59 Util.LoadArchSpecificWindowsDll("ode.dll"); 77 return;
60 78 ODEScene newodescene = new ODEScene(scene, m_config, Name, OSOdeLib);
61 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to 79 m_scenes[scene] = newodescene;
62 // http://opensimulator.org/mantis/view.php?id=2750).
63 d.InitODE();
64
65 string ode_config = d.GetConfiguration();
66 if (ode_config != null && ode_config != "")
67 {
68 m_log.InfoFormat("[ubODE] ode library configuration: {0}", ode_config);
69 // ubODE still not avaiable
70 if (ode_config.Contains("ODE_OPENSIM"))
71 {
72 OSOdeLib = true;
73 }
74 }
75
76 m_scene = new ODEScene(scene, m_config, Name, OSOdeLib);
77 } 80 }
78 81
79 public void RemoveRegion(Scene scene) 82 public void RemoveRegion(Scene scene)
80 { 83 {
81 if (!m_Enabled || m_scene == null) 84 if (!m_Enabled)
82 return; 85 return;
83 86
84 m_scene.Dispose(); 87 // a odescene.dispose is called later directly by scene.cs
85 m_scene = null; 88 // since it is seen as a module interface
89
90 if(m_scenes.ContainsKey(scene))
91 m_scenes.Remove(scene);
86 } 92 }
87 93
88 public void RegionLoaded(Scene scene) 94 public void RegionLoaded(Scene scene)
89 { 95 {
90 if (!m_Enabled || m_scene == null) 96 if (!m_Enabled)
91 return; 97 return;
98
99 if(m_scenes.ContainsKey(scene))
100 {
101 m_scenes[scene].RegionLoaded();
102 }
92 103
93 m_scene.RegionLoaded();
94 } 104 }
95 #endregion 105 #endregion
96 } 106 }