diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/PhysicsModules/Ode/ODEModule.cs | |
parent | Add a build script. (diff) | |
download | opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEModule.cs | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs b/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs new file mode 100644 index 0000000..22fc84d --- /dev/null +++ b/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs | |||
@@ -0,0 +1,89 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using log4net; | ||
4 | using Nini.Config; | ||
5 | using Mono.Addins; | ||
6 | using OpenSim.Framework; | ||
7 | using OpenSim.Region.Framework.Scenes; | ||
8 | using OpenSim.Region.Framework.Interfaces; | ||
9 | |||
10 | namespace OpenSim.Region.PhysicsModule.ODE | ||
11 | { | ||
12 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] | ||
13 | public class OdeModule : INonSharedRegionModule | ||
14 | { | ||
15 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
16 | |||
17 | private bool m_Enabled = false; | ||
18 | private IConfigSource m_config; | ||
19 | private OdeScene m_scene; | ||
20 | |||
21 | #region INonSharedRegionModule | ||
22 | |||
23 | public string Name | ||
24 | { | ||
25 | get { return "OpenDynamicsEngine"; } | ||
26 | } | ||
27 | |||
28 | public string Version | ||
29 | { | ||
30 | get { return "1.0"; } | ||
31 | } | ||
32 | |||
33 | public Type ReplaceableInterface | ||
34 | { | ||
35 | get { return null; } | ||
36 | } | ||
37 | |||
38 | public void Initialise(IConfigSource source) | ||
39 | { | ||
40 | IConfig config = source.Configs["Startup"]; | ||
41 | if (config != null) | ||
42 | { | ||
43 | string physics = config.GetString("physics", string.Empty); | ||
44 | if (physics == Name) | ||
45 | { | ||
46 | m_config = source; | ||
47 | m_Enabled = true; | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | public void Close() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public void AddRegion(Scene scene) | ||
57 | { | ||
58 | if (!m_Enabled) | ||
59 | return; | ||
60 | |||
61 | if (Util.IsWindows()) | ||
62 | Util.LoadArchSpecificWindowsDll("ode.dll"); | ||
63 | |||
64 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to | ||
65 | // http://opensimulator.org/mantis/view.php?id=2750). | ||
66 | d.InitODE(); | ||
67 | |||
68 | m_scene = new OdeScene(scene, m_config, Name, Version); | ||
69 | } | ||
70 | |||
71 | public void RemoveRegion(Scene scene) | ||
72 | { | ||
73 | if (!m_Enabled || m_scene == null) | ||
74 | return; | ||
75 | |||
76 | m_scene.Dispose(); | ||
77 | m_scene = null; | ||
78 | } | ||
79 | |||
80 | public void RegionLoaded(Scene scene) | ||
81 | { | ||
82 | if (!m_Enabled || m_scene == null) | ||
83 | return; | ||
84 | |||
85 | m_scene.RegionLoaded(); | ||
86 | } | ||
87 | #endregion | ||
88 | } | ||
89 | } | ||