diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs b/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs new file mode 100644 index 0000000..7c3c688 --- /dev/null +++ b/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs | |||
@@ -0,0 +1,88 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using log4net; | ||
4 | using Nini.Config; | ||
5 | using Mono.Addins; | ||
6 | using OdeAPI; | ||
7 | using OpenSim.Framework; | ||
8 | using OpenSim.Region.Framework.Scenes; | ||
9 | using OpenSim.Region.Framework.Interfaces; | ||
10 | |||
11 | namespace OpenSim.Region.PhysicsModule.UbitOde | ||
12 | { | ||
13 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UBITODEPhysicsScene")] | ||
14 | class UbitOdeModule : INonSharedRegionModule | ||
15 | { | ||
16 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
17 | |||
18 | private bool m_Enabled = false; | ||
19 | private IConfigSource m_config; | ||
20 | private ODEScene m_scene; | ||
21 | private bool OdeUbitLib; | ||
22 | |||
23 | #region INonSharedRegionModule | ||
24 | |||
25 | public string Name | ||
26 | { | ||
27 | get { return "UbitODE"; } | ||
28 | } | ||
29 | |||
30 | public Type ReplaceableInterface | ||
31 | { | ||
32 | get { return null; } | ||
33 | } | ||
34 | |||
35 | public void Initialise(IConfigSource source) | ||
36 | { | ||
37 | IConfig config = source.Configs["Startup"]; | ||
38 | if (config != null) | ||
39 | { | ||
40 | string physics = config.GetString("physics", string.Empty); | ||
41 | if (physics == Name) | ||
42 | { | ||
43 | m_config = source; | ||
44 | m_Enabled = true; | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | public void Close() | ||
50 | { | ||
51 | } | ||
52 | |||
53 | public void AddRegion(Scene scene) | ||
54 | { | ||
55 | if (!m_Enabled) | ||
56 | return; | ||
57 | |||
58 | if (Util.IsWindows()) | ||
59 | Util.LoadArchSpecificWindowsDll("ode.dll"); | ||
60 | |||
61 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to | ||
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("[UbitODE] ode library configuration: {0}", ode_config); | ||
69 | |||
70 | if (ode_config.Contains("ODE_Ubit")) | ||
71 | { | ||
72 | OdeUbitLib = true; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | m_scene = new ODEScene(scene, m_config, Name, OdeUbitLib); | ||
77 | } | ||
78 | |||
79 | public void RemoveRegion(Scene scene) | ||
80 | { | ||
81 | } | ||
82 | |||
83 | public void RegionLoaded(Scene scene) | ||
84 | { | ||
85 | } | ||
86 | #endregion | ||
87 | } | ||
88 | } | ||