diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs | 85 |
1 files changed, 70 insertions, 15 deletions
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs index 32691fc..e8d6334 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs | |||
@@ -41,6 +41,10 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
41 | 41 | ||
42 | public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); | 42 | public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); |
43 | public delegate void RayCallback(List<ContactResult> list); | 43 | public delegate void RayCallback(List<ContactResult> list); |
44 | public delegate void ProbeBoxCallback(List<ContactResult> list); | ||
45 | public delegate void ProbeSphereCallback(List<ContactResult> list); | ||
46 | public delegate void ProbePlaneCallback(List<ContactResult> list); | ||
47 | public delegate void SitAvatarCallback(int status, uint partID, Vector3 offset, Quaternion Orientation); | ||
44 | 48 | ||
45 | public delegate void JointMoved(PhysicsJoint joint); | 49 | public delegate void JointMoved(PhysicsJoint joint); |
46 | public delegate void JointDeactivated(PhysicsJoint joint); | 50 | public delegate void JointDeactivated(PhysicsJoint joint); |
@@ -89,6 +93,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
89 | public Vector3 Normal; | 93 | public Vector3 Normal; |
90 | } | 94 | } |
91 | 95 | ||
96 | |||
97 | |||
92 | public abstract class PhysicsScene | 98 | public abstract class PhysicsScene |
93 | { | 99 | { |
94 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 100 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -106,6 +112,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
106 | /// </summary> | 112 | /// </summary> |
107 | public string EngineType { get; protected set; } | 113 | public string EngineType { get; protected set; } |
108 | 114 | ||
115 | public string EngineName { get; protected set; } | ||
116 | |||
109 | // The only thing that should register for this event is the SceneGraph | 117 | // The only thing that should register for this event is the SceneGraph |
110 | // Anything else could cause problems. | 118 | // Anything else could cause problems. |
111 | public event physicsCrash OnPhysicsCrash; | 119 | public event physicsCrash OnPhysicsCrash; |
@@ -143,6 +151,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
143 | /// <param name="size"></param> | 151 | /// <param name="size"></param> |
144 | /// <param name="isFlying"></param> | 152 | /// <param name="isFlying"></param> |
145 | /// <returns></returns> | 153 | /// <returns></returns> |
154 | |||
146 | public abstract PhysicsActor AddAvatar( | 155 | public abstract PhysicsActor AddAvatar( |
147 | string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying); | 156 | string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying); |
148 | 157 | ||
@@ -161,12 +170,26 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
161 | { | 170 | { |
162 | PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying); | 171 | PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying); |
163 | 172 | ||
164 | if (ret != null) | 173 | if (ret != null) |
165 | ret.LocalID = localID; | 174 | ret.LocalID = localID; |
166 | 175 | ||
167 | return ret; | 176 | return ret; |
168 | } | 177 | } |
169 | 178 | ||
179 | public virtual PhysicsActor AddAvatar( | ||
180 | uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) | ||
181 | { | ||
182 | PhysicsActor ret = AddAvatar(localID, avName, position, Vector3.Zero, size, isFlying); | ||
183 | return ret; | ||
184 | } | ||
185 | |||
186 | public virtual PhysicsActor AddAvatar( | ||
187 | uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying) | ||
188 | { | ||
189 | PhysicsActor ret = AddAvatar(localID, avName, position, Vector3.Zero, size, isFlying); | ||
190 | return ret; | ||
191 | } | ||
192 | |||
170 | /// <summary> | 193 | /// <summary> |
171 | /// Remove an avatar. | 194 | /// Remove an avatar. |
172 | /// </summary> | 195 | /// </summary> |
@@ -182,6 +205,19 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
182 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 205 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
183 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); | 206 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); |
184 | 207 | ||
208 | public virtual PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position, | ||
209 | uint localid, byte[] sdata) | ||
210 | { | ||
211 | return null; | ||
212 | } | ||
213 | |||
214 | public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
215 | Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid) | ||
216 | { | ||
217 | return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); | ||
218 | } | ||
219 | |||
220 | |||
185 | public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 221 | public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
186 | Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid) | 222 | Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid) |
187 | { | 223 | { |
@@ -255,6 +291,9 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
255 | 291 | ||
256 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); | 292 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); |
257 | 293 | ||
294 | |||
295 | public virtual void ProcessPreSimulation() { } | ||
296 | |||
258 | /// <summary> | 297 | /// <summary> |
259 | /// Perform a simulation of the current physics scene over the given timestep. | 298 | /// Perform a simulation of the current physics scene over the given timestep. |
260 | /// </summary> | 299 | /// </summary> |
@@ -293,28 +332,19 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
293 | return false; | 332 | return false; |
294 | } | 333 | } |
295 | 334 | ||
296 | public virtual bool SupportsCombining() | ||
297 | { | ||
298 | return false; | ||
299 | } | ||
300 | |||
301 | public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} | ||
302 | |||
303 | public virtual void UnCombine(PhysicsScene pScene) {} | ||
304 | |||
305 | /// <summary> | 335 | /// <summary> |
306 | /// Queue a raycast against the physics scene. | 336 | /// Queue a raycast against the physics scene. |
307 | /// The provided callback method will be called when the raycast is complete | 337 | /// The provided callback method will be called when the raycast is complete |
308 | /// | 338 | /// |
309 | /// Many physics engines don't support collision testing at the same time as | 339 | /// Many physics engines don't support collision testing at the same time as |
310 | /// manipulating the physics scene, so we queue the request up and callback | 340 | /// manipulating the physics scene, so we queue the request up and callback |
311 | /// a custom method when the raycast is complete. | 341 | /// a custom method when the raycast is complete. |
312 | /// This allows physics engines that give an immediate result to callback immediately | 342 | /// This allows physics engines that give an immediate result to callback immediately |
313 | /// and ones that don't, to callback when it gets a result back. | 343 | /// and ones that don't, to callback when it gets a result back. |
314 | /// | 344 | /// |
315 | /// ODE for example will not allow you to change the scene while collision testing or | 345 | /// ODE for example will not allow you to change the scene while collision testing or |
316 | /// it asserts, 'opteration not valid for locked space'. This includes adding a ray to the scene. | 346 | /// it asserts, 'opteration not valid for locked space'. This includes adding a ray to the scene. |
317 | /// | 347 | /// |
318 | /// This is named RayCastWorld to not conflict with modrex's Raycast method. | 348 | /// This is named RayCastWorld to not conflict with modrex's Raycast method. |
319 | /// </summary> | 349 | /// </summary> |
320 | /// <param name="position">Origin of the ray</param> | 350 | /// <param name="position">Origin of the ray</param> |
@@ -348,6 +378,31 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
348 | return false; | 378 | return false; |
349 | } | 379 | } |
350 | 380 | ||
381 | public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags flags) | ||
382 | { | ||
383 | return new List<ContactResult>(); | ||
384 | } | ||
385 | |||
386 | public virtual List<ContactResult> BoxProbe(Vector3 position, Vector3 size, Quaternion orientation, int Count, RayFilterFlags flags) | ||
387 | { | ||
388 | return new List<ContactResult>(); | ||
389 | } | ||
390 | |||
391 | public virtual List<ContactResult> SphereProbe(Vector3 position, float radius, int Count, RayFilterFlags flags) | ||
392 | { | ||
393 | return new List<ContactResult>(); | ||
394 | } | ||
395 | |||
396 | public virtual List<ContactResult> PlaneProbe(PhysicsActor actor, Vector4 plane, int Count, RayFilterFlags flags) | ||
397 | { | ||
398 | return new List<ContactResult>(); | ||
399 | } | ||
400 | |||
401 | public virtual int SitAvatar(PhysicsActor actor, Vector3 AbsolutePosition, Vector3 CameraPosition, Vector3 offset, Vector3 AvatarSize, SitAvatarCallback PhysicsSitResponse) | ||
402 | { | ||
403 | return 0; | ||
404 | } | ||
405 | |||
351 | // Extendable interface for new, physics engine specific operations | 406 | // Extendable interface for new, physics engine specific operations |
352 | public virtual object Extension(string pFunct, params object[] pParams) | 407 | public virtual object Extension(string pFunct, params object[] pParams) |
353 | { | 408 | { |