blob: d61ee61c19800d6395e0ad2d55382b6471cea64a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
using System;
using System.Reflection;
using log4net;
using Nini.Config;
using Mono.Addins;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.PhysicsModule.ODE
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")]
public class OdeModule : INonSharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false;
private IConfigSource m_config;
private OdeScene m_scene;
#region INonSharedRegionModule
public string Name
{
get { return "OpenDynamicsEngine"; }
}
public string Version
{
get { return "1.0"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
public void Initialise(IConfigSource source)
{
IConfig config = source.Configs["Startup"];
if (config != null)
{
string physics = config.GetString("physics", string.Empty);
if (physics == Name)
{
m_config = source;
m_Enabled = true;
}
}
}
public void Close()
{
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("ode.dll");
// Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
// http://opensimulator.org/mantis/view.php?id=2750).
d.InitODE();
m_scene = new OdeScene(scene, m_config, Name, Version);
}
public void RemoveRegion(Scene scene)
{
if (!m_Enabled || m_scene == null)
return;
m_scene.Dispose();
m_scene = null;
}
public void RegionLoaded(Scene scene)
{
if (!m_Enabled || m_scene == null)
return;
m_scene.RegionLoaded();
}
#endregion
}
}
|