aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-10 19:13:52 +0000
committerTeravus Ovares2007-11-10 19:13:52 +0000
commitcb07ba0d68eeb57bae1cb60f387483ff720cc29d (patch)
treea46f7b6b50e70a9f5f56a89396ba8a3f1078c19e /OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
parent* ODE Fixed annoying bug where resizing causes there to be a 'ghost' prim lef... (diff)
downloadopensim-SC_OLD-cb07ba0d68eeb57bae1cb60f387483ff720cc29d.zip
opensim-SC_OLD-cb07ba0d68eeb57bae1cb60f387483ff720cc29d.tar.gz
opensim-SC_OLD-cb07ba0d68eeb57bae1cb60f387483ff720cc29d.tar.bz2
opensim-SC_OLD-cb07ba0d68eeb57bae1cb60f387483ff720cc29d.tar.xz
* Moves the Meshmerizer to a separate plugin
* Experimental. Linux Prebuild needs testing. * One more update after this to remove the ODEMeshing directory....
Diffstat (limited to 'OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs67
1 files changed, 54 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 09ebf29..47c8ae0 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33using Nini.Config;
33 34
34namespace OpenSim.Region.Physics.Manager 35namespace OpenSim.Region.Physics.Manager
35{ 36{
@@ -38,28 +39,50 @@ namespace OpenSim.Region.Physics.Manager
38 /// </summary> 39 /// </summary>
39 public class PhysicsPluginManager 40 public class PhysicsPluginManager
40 { 41 {
41 private Dictionary<string, IPhysicsPlugin> _plugins = new Dictionary<string, IPhysicsPlugin>(); 42 private Dictionary<string, IPhysicsPlugin> _PhysPlugins = new Dictionary<string, IPhysicsPlugin>();
43 private Dictionary<string, IMeshingPlugin> _MeshPlugins = new Dictionary<string, IMeshingPlugin>();
42 44
43 public PhysicsPluginManager() 45 public PhysicsPluginManager()
44 { 46 {
45 } 47 }
46 48
47 public PhysicsScene GetPhysicsScene(string engineName) 49 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName)
48 { 50 {
49 if (String.IsNullOrEmpty(engineName)) 51
52 if (String.IsNullOrEmpty(physEngineName))
53 {
54 return PhysicsScene.Null;
55 }
56
57 if (String.IsNullOrEmpty(meshEngineName))
50 { 58 {
51 return PhysicsScene.Null; 59 return PhysicsScene.Null;
52 } 60 }
53 61
54 if (_plugins.ContainsKey(engineName)) 62
63 IMesher meshEngine = null;
64 if (_MeshPlugins.ContainsKey(meshEngineName))
55 { 65 {
56 MainLog.Instance.Verbose("PHYSICS", "creating " + engineName); 66 MainLog.Instance.Verbose("PHYSICS", "creating meshing engine " + meshEngineName);
57 return _plugins[engineName].GetScene(); 67 meshEngine = _MeshPlugins[meshEngineName].GetMesher();
58 } 68 }
59 else 69 else
60 { 70 {
61 MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", engineName); 71 MainLog.Instance.Warn("PHYSICS", "couldn't find meshingEngine: {0}", meshEngineName);
62 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", engineName)); 72 throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName));
73 }
74
75 if (_PhysPlugins.ContainsKey(physEngineName))
76 {
77 MainLog.Instance.Verbose("PHYSICS", "creating " + physEngineName);
78 PhysicsScene result = _PhysPlugins[physEngineName].GetScene();
79 result.Initialise(meshEngine);
80 return result;
81 }
82 else
83 {
84 MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", physEngineName);
85 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName));
63 } 86 }
64 } 87 }
65 88
@@ -85,18 +108,29 @@ namespace OpenSim.Region.Physics.Manager
85 { 108 {
86 if (!pluginType.IsAbstract) 109 if (!pluginType.IsAbstract)
87 { 110 {
88 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); 111 Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
89 112
90 if (typeInterface != null) 113 if (physTypeInterface != null)
91 { 114 {
92 IPhysicsPlugin plug = 115 IPhysicsPlugin plug =
93 (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 116 (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
94 plug.Init(); 117 plug.Init();
95 _plugins.Add(plug.GetName(), plug); 118 _PhysPlugins.Add(plug.GetName(), plug);
96 MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName()); 119 MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName());
97 } 120 }
98 121
99 typeInterface = null; 122 Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true);
123
124 if (meshTypeInterface != null)
125 {
126 IMeshingPlugin plug =
127 (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
128 _MeshPlugins.Add(plug.GetName(), plug);
129 MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plug.GetName());
130 }
131
132 physTypeInterface = null;
133 meshTypeInterface = null;
100 } 134 }
101 } 135 }
102 } 136 }
@@ -127,4 +161,11 @@ namespace OpenSim.Region.Physics.Manager
127 string GetName(); 161 string GetName();
128 void Dispose(); 162 void Dispose();
129 } 163 }
130} \ No newline at end of file 164
165 public interface IMeshingPlugin
166 {
167 string GetName();
168 IMesher GetMesher();
169 }
170
171}