aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs
diff options
context:
space:
mode:
authorUbitUmarov2015-09-09 17:15:04 +0100
committerUbitUmarov2015-09-09 17:15:04 +0100
commit8571736ff31ad46e46e2a6ebf342aecbe686ea36 (patch)
treea51eef352d031c5aa1dd804286aab828a2960e3c /OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs
parent demote ConvexDecompositionDotNet to a simple dll, i had made it a region module (diff)
downloadopensim-SC-8571736ff31ad46e46e2a6ebf342aecbe686ea36.zip
opensim-SC-8571736ff31ad46e46e2a6ebf342aecbe686ea36.tar.gz
opensim-SC-8571736ff31ad46e46e2a6ebf342aecbe686ea36.tar.bz2
opensim-SC-8571736ff31ad46e46e2a6ebf342aecbe686ea36.tar.xz
split Module from its scene, so if not enabled there is no scene memory allocation. All physics modules need this ( if not others)
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs88
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 @@
1using System;
2using System.Reflection;
3using log4net;
4using Nini.Config;
5using Mono.Addins;
6using OdeAPI;
7using OpenSim.Framework;
8using OpenSim.Region.Framework.Scenes;
9using OpenSim.Region.Framework.Interfaces;
10
11namespace 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}