aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsScene.cs)95
1 files changed, 85 insertions, 10 deletions
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}