aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Manager
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
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')
-rw-r--r--OpenSim/Region/Physics/Manager/IMesher.cs26
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs67
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs11
3 files changed, 90 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
new file mode 100644
index 0000000..037616c
--- /dev/null
+++ b/OpenSim/Region/Physics/Manager/IMesher.cs
@@ -0,0 +1,26 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using OpenSim.Framework;
6
7namespace OpenSim.Region.Physics.Manager
8{
9 public interface IMesher
10 {
11 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size);
12 }
13
14 public interface IVertex {
15 }
16
17 public interface IMesh
18 {
19 List<PhysicsVector> getVertexList();
20 int[] getIndexListAsInt();
21 int[] getIndexListAsIntLocked();
22 float[] getVertexListAsFloatLocked();
23
24
25 }
26}
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}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 13591ea..6f19e72 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -28,6 +28,7 @@
28using Axiom.Math; 28using Axiom.Math;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
31using OpenSim.Region.Physics.Manager;
31 32
32namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
33{ 34{
@@ -38,6 +39,8 @@ namespace OpenSim.Region.Physics.Manager
38 get { return new NullPhysicsScene(); } 39 get { return new NullPhysicsScene(); }
39 } 40 }
40 41
42 public abstract void Initialise(IMesher meshmerizer);
43
41 public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position); 44 public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position);
42 45
43 public abstract void RemoveAvatar(PhysicsActor actor); 46 public abstract void RemoveAvatar(PhysicsActor actor);
@@ -63,6 +66,12 @@ namespace OpenSim.Region.Physics.Manager
63 { 66 {
64 private static int m_workIndicator; 67 private static int m_workIndicator;
65 68
69
70 public override void Initialise(IMesher meshmerizer)
71 {
72 // Does nothing right now
73 }
74
66 public override PhysicsActor AddAvatar(string avName, PhysicsVector position) 75 public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
67 { 76 {
68 MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position); 77 MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position);
@@ -123,4 +132,4 @@ namespace OpenSim.Region.Physics.Manager
123 } 132 }
124 } 133 }
125 } 134 }
126} \ No newline at end of file 135}