aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Manager
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/Physics/Manager
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs240
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs (renamed from OpenSim/Region/Physics/Manager/ZeroMesher.cs)69
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/Manager/AssemblyInfo.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs (renamed from OpenSim/Region/Physics/Manager/CollisionLocker.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs (renamed from OpenSim/Region/Physics/Manager/IMesher.cs)3
-rwxr-xr-xOpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs (renamed from OpenSim/Region/Physics/Manager/IPhysicsParameters.cs)8
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs (renamed from OpenSim/Region/Physics/Manager/NullPhysicsScene.cs)10
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsActor.cs)29
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsJoint.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsScene.cs)95
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsSensor.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsVector.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs (renamed from OpenSim/Region/Physics/Manager/VehicleConstants.cs)2
13 files changed, 182 insertions, 284 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
deleted file mode 100644
index 8ccfda5..0000000
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ /dev/null
@@ -1,240 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using Nini.Config;
33using log4net;
34using OpenSim.Framework;
35
36namespace OpenSim.Region.Physics.Manager
37{
38 /// <summary>
39 /// Description of MyClass.
40 /// </summary>
41 public class PhysicsPluginManager
42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
45 private Dictionary<string, IPhysicsPlugin> _PhysPlugins = new Dictionary<string, IPhysicsPlugin>();
46 private Dictionary<string, IMeshingPlugin> _MeshPlugins = new Dictionary<string, IMeshingPlugin>();
47
48 /// <summary>
49 /// Constructor.
50 /// </summary>
51 public PhysicsPluginManager()
52 {
53 // Load "plugins", that are hard coded and not existing in form of an external lib, and hence always
54 // available
55 IMeshingPlugin plugHard;
56 plugHard = new ZeroMesherPlugin();
57 _MeshPlugins.Add(plugHard.GetName(), plugHard);
58
59 m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName());
60 }
61
62 /// <summary>
63 /// Get a physics scene for the given physics engine and mesher.
64 /// </summary>
65 /// <param name="physEngineName"></param>
66 /// <param name="meshEngineName"></param>
67 /// <param name="config"></param>
68 /// <returns></returns>
69 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName)
70 {
71 if (String.IsNullOrEmpty(physEngineName))
72 {
73 return PhysicsScene.Null;
74 }
75
76 if (String.IsNullOrEmpty(meshEngineName))
77 {
78 return PhysicsScene.Null;
79 }
80
81 IMesher meshEngine = null;
82 if (_MeshPlugins.ContainsKey(meshEngineName))
83 {
84 m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName);
85 meshEngine = _MeshPlugins[meshEngineName].GetMesher(config);
86 }
87 else
88 {
89 m_log.WarnFormat("[PHYSICS]: couldn't find meshingEngine: {0}", meshEngineName);
90 throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName));
91 }
92
93 if (_PhysPlugins.ContainsKey(physEngineName))
94 {
95 m_log.Info("[PHYSICS]: creating " + physEngineName);
96 PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName);
97 result.Initialise(meshEngine, config);
98 return result;
99 }
100 else
101 {
102 m_log.WarnFormat("[PHYSICS]: couldn't find physicsEngine: {0}", physEngineName);
103 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName));
104 }
105 }
106
107 /// <summary>
108 /// Load all plugins in assemblies at the given path
109 /// </summary>
110 /// <param name="pluginsPath"></param>
111 public void LoadPluginsFromAssemblies(string assembliesPath)
112 {
113 // Walk all assemblies (DLLs effectively) and see if they are home
114 // of a plugin that is of interest for us
115 string[] pluginFiles = Directory.GetFiles(assembliesPath, "*.dll");
116
117 for (int i = 0; i < pluginFiles.Length; i++)
118 {
119 LoadPluginsFromAssembly(pluginFiles[i]);
120 }
121 }
122
123 /// <summary>
124 /// Load plugins from an assembly at the given path
125 /// </summary>
126 /// <param name="assemblyPath"></param>
127 public void LoadPluginsFromAssembly(string assemblyPath)
128 {
129 // TODO / NOTE
130 // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from
131 // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll'
132 // using the LoadFrom context. The use of this context can result in unexpected behavior
133 // for serialization, casting and dependency resolution. In almost all cases, it is recommended
134 // that the LoadFrom context be avoided. This can be done by installing assemblies in the
135 // Global Assembly Cache or in the ApplicationBase directory and using Assembly.
136 // Load when explicitly loading assemblies.
137 Assembly pluginAssembly = null;
138 Type[] types = null;
139
140 try
141 {
142 pluginAssembly = Assembly.LoadFrom(assemblyPath);
143 }
144 catch (Exception ex)
145 {
146 m_log.Error("[PHYSICS]: Failed to load plugin from " + assemblyPath, ex);
147 }
148
149 if (pluginAssembly != null)
150 {
151 try
152 {
153 types = pluginAssembly.GetTypes();
154 }
155 catch (ReflectionTypeLoadException ex)
156 {
157 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath + ": " +
158 ex.LoaderExceptions[0].Message, ex);
159 }
160 catch (Exception ex)
161 {
162 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath, ex);
163 }
164
165 if (types != null)
166 {
167 foreach (Type pluginType in types)
168 {
169 if (pluginType.IsPublic)
170 {
171 if (!pluginType.IsAbstract)
172 {
173 Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
174
175 if (physTypeInterface != null)
176 {
177 IPhysicsPlugin plug =
178 (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
179 plug.Init();
180 if (!_PhysPlugins.ContainsKey(plug.GetName()))
181 {
182 _PhysPlugins.Add(plug.GetName(), plug);
183 m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName());
184 }
185 }
186
187 Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true);
188
189 if (meshTypeInterface != null)
190 {
191 IMeshingPlugin plug =
192 (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
193 if (!_MeshPlugins.ContainsKey(plug.GetName()))
194 {
195 _MeshPlugins.Add(plug.GetName(), plug);
196 m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName());
197 }
198 }
199
200 physTypeInterface = null;
201 meshTypeInterface = null;
202 }
203 }
204 }
205 }
206 }
207
208 pluginAssembly = null;
209 }
210
211 //---
212 public static void PhysicsPluginMessage(string message, bool isWarning)
213 {
214 if (isWarning)
215 {
216 m_log.Warn("[PHYSICS]: " + message);
217 }
218 else
219 {
220 m_log.Info("[PHYSICS]: " + message);
221 }
222 }
223
224 //---
225 }
226
227 public interface IPhysicsPlugin
228 {
229 bool Init();
230 PhysicsScene GetScene(String sceneIdentifier);
231 string GetName();
232 void Dispose();
233 }
234
235 public interface IMeshingPlugin
236 {
237 string GetName();
238 IMesher GetMesher(IConfigSource config);
239 }
240}
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs
index 270d2ec..0a3b3a4 100644
--- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs
@@ -26,9 +26,15 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.PhysicsModules.SharedBase;
30using OpenMetaverse; 34using OpenMetaverse;
31using Nini.Config; 35using Nini.Config;
36using Mono.Addins;
37using log4net;
32 38
33/* 39/*
34 * This is the zero mesher. 40 * This is the zero mesher.
@@ -41,27 +47,67 @@ using Nini.Config;
41 * it's always availabe and thus the default in case of configuration errors 47 * it's always availabe and thus the default in case of configuration errors
42*/ 48*/
43 49
44namespace OpenSim.Region.Physics.Manager 50namespace OpenSim.Region.PhysicsModules.Meshing
45{ 51{
46 public class ZeroMesherPlugin : IMeshingPlugin 52
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ZeroMesher")]
54 public class ZeroMesher : IMesher, INonSharedRegionModule
47 { 55 {
48 public ZeroMesherPlugin() 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 private bool m_Enabled = false;
58
59 #region INonSharedRegionModule
60 public string Name
49 { 61 {
62 get { return "ZeroMesher"; }
50 } 63 }
51 64
52 public string GetName() 65 public Type ReplaceableInterface
53 { 66 {
54 return "ZeroMesher"; 67 get { return null; }
55 } 68 }
56 69
57 public IMesher GetMesher(IConfigSource config) 70 public void Initialise(IConfigSource source)
58 { 71 {
59 return new ZeroMesher(); 72 // TODO: Move this out of Startup
73 IConfig config = source.Configs["Startup"];
74 if (config != null)
75 {
76 // This is the default Mesher
77 string mesher = config.GetString("meshing", Name);
78 if (mesher == Name)
79 m_Enabled = true;
80 }
60 } 81 }
61 }
62 82
63 public class ZeroMesher : IMesher 83 public void Close()
64 { 84 {
85 }
86
87 public void AddRegion(Scene scene)
88 {
89 if (!m_Enabled)
90 return;
91
92 scene.RegisterModuleInterface<IMesher>(this);
93 }
94
95 public void RemoveRegion(Scene scene)
96 {
97 if (!m_Enabled)
98 return;
99
100 scene.UnregisterModuleInterface<IMesher>(this);
101 }
102
103 public void RegionLoaded(Scene scene)
104 {
105 if (!m_Enabled)
106 return;
107 }
108 #endregion
109
110 #region IMesher
65 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) 111 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
66 { 112 {
67 return CreateMesh(primName, primShape, size, lod, false, false); 113 return CreateMesh(primName, primShape, size, lod, false, false);
@@ -79,5 +125,8 @@ namespace OpenSim.Region.Physics.Manager
79 125
80 return null; 126 return null;
81 } 127 }
128 #endregion
129
130
82 } 131 }
83} 132}
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs
index 36b4235..33f60e4 100644
--- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.7.5.*")] 58[assembly : AssemblyVersion("0.8.2.*")]
diff --git a/OpenSim/Region/Physics/Manager/CollisionLocker.cs b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs
index cace4e4..6e658b5 100644
--- a/OpenSim/Region/Physics/Manager/CollisionLocker.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31namespace OpenSim.Region.Physics.Manager 31namespace OpenSim.Region.PhysicsModules.SharedBase
32{ 32{
33 public class CollisionLocker 33 public class CollisionLocker
34 { 34 {
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs
index 10c4bd3..5c75307 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.PhysicsModules.SharedBase
34{ 34{
35 public interface IMesher 35 public interface IMesher
36 { 36 {
@@ -59,6 +59,7 @@ namespace OpenSim.Region.Physics.Manager
59 List<Vector3> getVertexList(); 59 List<Vector3> getVertexList();
60 int[] getIndexListAsInt(); 60 int[] getIndexListAsInt();
61 int[] getIndexListAsIntLocked(); 61 int[] getIndexListAsIntLocked();
62 float[] getVertexListAsFloat();
62 float[] getVertexListAsFloatLocked(); 63 float[] getVertexListAsFloatLocked();
63 void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount); 64 void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount);
64 void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount); 65 void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount);
diff --git a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs
index b8676ba..fb0c9e2 100755
--- a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.PhysicsModules.SharedBase
34{ 34{
35 public struct PhysParameterEntry 35 public struct PhysParameterEntry
36 { 36 {
@@ -60,14 +60,14 @@ namespace OpenSim.Region.Physics.Manager
60 60
61 // Set parameter on a specific or all instances. 61 // Set parameter on a specific or all instances.
62 // Return 'false' if not able to set the parameter. 62 // Return 'false' if not able to set the parameter.
63 bool SetPhysicsParameter(string parm, float value, uint localID); 63 bool SetPhysicsParameter(string parm, string value, uint localID);
64 64
65 // Get parameter. 65 // Get parameter.
66 // Return 'false' if not able to get the parameter. 66 // Return 'false' if not able to get the parameter.
67 bool GetPhysicsParameter(string parm, out float value); 67 bool GetPhysicsParameter(string parm, out string value);
68 68
69 // Get parameter from a particular object 69 // Get parameter from a particular object
70 // TODO: 70 // TODO:
71 // bool GetPhysicsParameter(string parm, out float value, uint localID); 71 // bool GetPhysicsParameter(string parm, out string value, uint localID);
72 } 72 }
73} 73}
diff --git a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs
index 1ccf46d..432708c 100644
--- a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs
@@ -32,7 +32,7 @@ using Nini.Config;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34 34
35namespace OpenSim.Region.Physics.Manager 35namespace OpenSim.Region.PhysicsModules.SharedBase
36{ 36{
37 class NullPhysicsScene : PhysicsScene 37 class NullPhysicsScene : PhysicsScene
38 { 38 {
@@ -40,12 +40,8 @@ namespace OpenSim.Region.Physics.Manager
40 40
41 private static int m_workIndicator; 41 private static int m_workIndicator;
42 42
43 public override void Initialise(IMesher meshmerizer, IConfigSource config) 43 public override PhysicsActor AddAvatar(
44 { 44 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
45 // Does nothing right now
46 }
47
48 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
49 { 45 {
50 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); 46 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position);
51 return PhysicsActor.Null; 47 return PhysicsActor.Null;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
index d119791..c04ff58 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
@@ -32,7 +32,7 @@ using System.Reflection;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34 34
35namespace OpenSim.Region.Physics.Manager 35namespace OpenSim.Region.PhysicsModules.SharedBase
36{ 36{
37 public delegate void PositionUpdate(Vector3 position); 37 public delegate void PositionUpdate(Vector3 position);
38 public delegate void VelocityUpdate(Vector3 velocity); 38 public delegate void VelocityUpdate(Vector3 velocity);
@@ -147,6 +147,8 @@ namespace OpenSim.Region.Physics.Manager
147 147
148 public abstract Vector3 Size { get; set; } 148 public abstract Vector3 Size { get; set; }
149 149
150 public virtual byte PhysicsShapeType { get; set; }
151
150 public abstract PrimitiveBaseShape Shape { set; } 152 public abstract PrimitiveBaseShape Shape { set; }
151 153
152 uint m_baseLocalID; 154 uint m_baseLocalID;
@@ -218,9 +220,11 @@ namespace OpenSim.Region.Physics.Manager
218 handler(e); 220 handler(e);
219 } 221 }
220 222
221 public virtual void SetMaterial (int material) 223 public virtual void SetMaterial (int material) { }
222 { 224 public virtual float Density { get; set; }
223 } 225 public virtual float GravModifier { get; set; }
226 public virtual float Friction { get; set; }
227 public virtual float Restitution { get; set; }
224 228
225 /// <summary> 229 /// <summary>
226 /// Position of this actor. 230 /// Position of this actor.
@@ -287,7 +291,7 @@ namespace OpenSim.Region.Physics.Manager
287 291
288 // Used for MoveTo 292 // Used for MoveTo
289 public abstract Vector3 PIDTarget { set; } 293 public abstract Vector3 PIDTarget { set; }
290 public abstract bool PIDActive { set;} 294 public abstract bool PIDActive { get; set; }
291 public abstract float PIDTau { set; } 295 public abstract float PIDTau { set; }
292 296
293 // Used for llSetHoverHeight and maybe vehicle height 297 // Used for llSetHoverHeight and maybe vehicle height
@@ -309,6 +313,13 @@ namespace OpenSim.Region.Physics.Manager
309 public abstract void SubscribeEvents(int ms); 313 public abstract void SubscribeEvents(int ms);
310 public abstract void UnSubscribeEvents(); 314 public abstract void UnSubscribeEvents();
311 public abstract bool SubscribedEvents(); 315 public abstract bool SubscribedEvents();
316
317 // Extendable interface for new, physics engine specific operations
318 public virtual object Extension(string pFunct, params object[] pParams)
319 {
320 // A NOP of the physics engine does not implement this feature
321 return null;
322 }
312 } 323 }
313 324
314 public class NullPhysicsActor : PhysicsActor 325 public class NullPhysicsActor : PhysicsActor
@@ -534,7 +545,13 @@ namespace OpenSim.Region.Physics.Manager
534 } 545 }
535 546
536 public override Vector3 PIDTarget { set { return; } } 547 public override Vector3 PIDTarget { set { return; } }
537 public override bool PIDActive { set { return; } } 548
549 public override bool PIDActive
550 {
551 get { return false; }
552 set { return; }
553 }
554
538 public override float PIDTau { set { return; } } 555 public override float PIDTau { set { return; } }
539 556
540 public override float PIDHoverHeight { set { return; } } 557 public override float PIDHoverHeight { set { return; } }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs
index b685d04..ce2bf05 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.PhysicsModules.SharedBase
34{ 34{
35 public enum PhysicsJointType : int 35 public enum PhysicsJointType : int
36 { 36 {
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs
index 488900e..32691fc 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs
@@ -25,14 +25,17 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
31
30using log4net; 32using log4net;
31using Nini.Config; 33using Nini.Config;
34
32using OpenSim.Framework; 35using OpenSim.Framework;
33using OpenMetaverse; 36using OpenMetaverse;
34 37
35namespace OpenSim.Region.Physics.Manager 38namespace OpenSim.Region.PhysicsModules.SharedBase
36{ 39{
37 public delegate void physicsCrash(); 40 public delegate void physicsCrash();
38 41
@@ -43,6 +46,35 @@ namespace OpenSim.Region.Physics.Manager
43 public delegate void JointDeactivated(PhysicsJoint joint); 46 public delegate void JointDeactivated(PhysicsJoint joint);
44 public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" 47 public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation"
45 48
49 public enum RayFilterFlags : ushort
50 {
51 // the flags
52 water = 0x01,
53 land = 0x02,
54 agent = 0x04,
55 nonphysical = 0x08,
56 physical = 0x10,
57 phantom = 0x20,
58 volumedtc = 0x40,
59
60 // ray cast colision control (may only work for meshs)
61 ContactsUnImportant = 0x2000,
62 BackFaceCull = 0x4000,
63 ClosestHit = 0x8000,
64
65 // some combinations
66 LSLPhantom = phantom | volumedtc,
67 PrimsNonPhantom = nonphysical | physical,
68 PrimsNonPhantomAgents = nonphysical | physical | agent,
69
70 AllPrims = nonphysical | phantom | volumedtc | physical,
71 AllButLand = agent | nonphysical | physical | phantom | volumedtc,
72
73 ClosestAndBackCull = ClosestHit | BackFaceCull,
74
75 All = 0x3f
76 }
77
46 public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); 78 public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback);
47 public delegate void AssetReceivedDelegate(AssetBase asset); 79 public delegate void AssetReceivedDelegate(AssetBase asset);
48 80
@@ -62,13 +94,20 @@ namespace OpenSim.Region.Physics.Manager
62// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 94// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
63 95
64 /// <summary> 96 /// <summary>
65 /// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another. 97 /// A unique identifying string for this instance of the physics engine.
98 /// Useful in debug messages to distinguish one OdeScene instance from another.
99 /// Usually set to include the region name that the physics engine is acting for.
100 /// </summary>
101 public string PhysicsSceneName { get; protected set; }
102
103 /// <summary>
104 /// A string identifying the family of this physics engine. Most common values returned
105 /// are "OpenDynamicsEngine" and "BulletSim" but others are possible.
66 /// </summary> 106 /// </summary>
67 public string Name { get; protected set; } 107 public string EngineType { get; protected set; }
68 108
69 // The only thing that should register for this event is the SceneGraph 109 // The only thing that should register for this event is the SceneGraph
70 // Anything else could cause problems. 110 // Anything else could cause problems.
71
72 public event physicsCrash OnPhysicsCrash; 111 public event physicsCrash OnPhysicsCrash;
73 112
74 public static PhysicsScene Null 113 public static PhysicsScene Null
@@ -78,6 +117,14 @@ namespace OpenSim.Region.Physics.Manager
78 117
79 public RequestAssetDelegate RequestAssetMethod { get; set; } 118 public RequestAssetDelegate RequestAssetMethod { get; set; }
80 119
120 protected void Initialise(RequestAssetDelegate m, float[] terrain, float waterHeight)
121 {
122 RequestAssetMethod = m;
123 SetTerrain(terrain);
124 SetWaterLevel(waterHeight);
125
126 }
127
81 public virtual void TriggerPhysicsBasedRestart() 128 public virtual void TriggerPhysicsBasedRestart()
82 { 129 {
83 physicsCrash handler = OnPhysicsCrash; 130 physicsCrash handler = OnPhysicsCrash;
@@ -87,17 +134,17 @@ namespace OpenSim.Region.Physics.Manager
87 } 134 }
88 } 135 }
89 136
90 public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
91
92 /// <summary> 137 /// <summary>
93 /// Add an avatar 138 /// Add an avatar
94 /// </summary> 139 /// </summary>
95 /// <param name="avName"></param> 140 /// <param name="avName"></param>
96 /// <param name="position"></param> 141 /// <param name="position"></param>
142 /// <param name="velocity"></param>
97 /// <param name="size"></param> 143 /// <param name="size"></param>
98 /// <param name="isFlying"></param> 144 /// <param name="isFlying"></param>
99 /// <returns></returns> 145 /// <returns></returns>
100 public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); 146 public abstract PhysicsActor AddAvatar(
147 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying);
101 148
102 /// <summary> 149 /// <summary>
103 /// Add an avatar 150 /// Add an avatar
@@ -105,13 +152,18 @@ namespace OpenSim.Region.Physics.Manager
105 /// <param name="localID"></param> 152 /// <param name="localID"></param>
106 /// <param name="avName"></param> 153 /// <param name="avName"></param>
107 /// <param name="position"></param> 154 /// <param name="position"></param>
155 /// <param name="velocity"></param>
108 /// <param name="size"></param> 156 /// <param name="size"></param>
109 /// <param name="isFlying"></param> 157 /// <param name="isFlying"></param>
110 /// <returns></returns> 158 /// <returns></returns>
111 public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) 159 public virtual PhysicsActor AddAvatar(
160 uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
112 { 161 {
113 PhysicsActor ret = AddAvatar(avName, position, size, isFlying); 162 PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying);
114 if (ret != null) ret.LocalID = localID; 163
164 if (ret != null)
165 ret.LocalID = localID;
166
115 return ret; 167 return ret;
116 } 168 }
117 169
@@ -130,6 +182,12 @@ namespace OpenSim.Region.Physics.Manager
130 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 182 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
131 Vector3 size, Quaternion rotation, bool isPhysical, uint localid); 183 Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
132 184
185 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
186 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
187 {
188 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
189 }
190
133 public virtual float TimeDilation 191 public virtual float TimeDilation
134 { 192 {
135 get { return 1.0f; } 193 get { return 1.0f; }
@@ -279,5 +337,22 @@ namespace OpenSim.Region.Physics.Manager
279 { 337 {
280 return new List<ContactResult>(); 338 return new List<ContactResult>();
281 } 339 }
340
341 public virtual object RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter)
342 {
343 return null;
344 }
345
346 public virtual bool SupportsRaycastWorldFiltered()
347 {
348 return false;
349 }
350
351 // Extendable interface for new, physics engine specific operations
352 public virtual object Extension(string pFunct, params object[] pParams)
353 {
354 // A NOP if the extension thing is not implemented by the physics engine
355 return null;
356 }
282 } 357 }
283} 358}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs
index f480d71..da9c96c 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs
@@ -29,7 +29,7 @@ using System;
29using System.Timers; 29using System.Timers;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.Manager 32namespace OpenSim.Region.PhysicsModules.SharedBase
33{ 33{
34 [Flags] 34 [Flags]
35 public enum SenseType : uint 35 public enum SenseType : uint
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs
index f60a636..76a82fa 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.Manager 30namespace OpenSim.Region.PhysicsModules.SharedBase
31{ 31{
32 /*public class PhysicsVector 32 /*public class PhysicsVector
33 { 33 {
diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs
index f0775c1..63a8cb8 100644
--- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.Manager 30namespace OpenSim.Region.PhysicsModules.SharedBase
31{ 31{
32 public enum Vehicle : int 32 public enum Vehicle : int
33 { 33 {