From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- .../PhysicsModules/SharedBase/PhysicsScene.cs | 85 ++++++++++++++++++---- 1 file changed, 70 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs') 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 public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); public delegate void RayCallback(List list); + public delegate void ProbeBoxCallback(List list); + public delegate void ProbeSphereCallback(List list); + public delegate void ProbePlaneCallback(List list); + public delegate void SitAvatarCallback(int status, uint partID, Vector3 offset, Quaternion Orientation); public delegate void JointMoved(PhysicsJoint joint); public delegate void JointDeactivated(PhysicsJoint joint); @@ -89,6 +93,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase public Vector3 Normal; } + + public abstract class PhysicsScene { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -106,6 +112,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase /// public string EngineType { get; protected set; } + public string EngineName { get; protected set; } + // The only thing that should register for this event is the SceneGraph // Anything else could cause problems. public event physicsCrash OnPhysicsCrash; @@ -143,6 +151,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase /// /// /// + public abstract PhysicsActor AddAvatar( string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying); @@ -161,12 +170,26 @@ namespace OpenSim.Region.PhysicsModules.SharedBase { PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying); - if (ret != null) + if (ret != null) ret.LocalID = localID; return ret; } + public virtual PhysicsActor AddAvatar( + uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) + { + PhysicsActor ret = AddAvatar(localID, avName, position, Vector3.Zero, size, isFlying); + return ret; + } + + public virtual PhysicsActor AddAvatar( + uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying) + { + PhysicsActor ret = AddAvatar(localID, avName, position, Vector3.Zero, size, isFlying); + return ret; + } + /// /// Remove an avatar. /// @@ -182,6 +205,19 @@ namespace OpenSim.Region.PhysicsModules.SharedBase public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical, uint localid); + public virtual PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position, + uint localid, byte[] sdata) + { + return null; + } + + public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid) + { + return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); + } + + public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid) { @@ -255,6 +291,9 @@ namespace OpenSim.Region.PhysicsModules.SharedBase public abstract void AddPhysicsActorTaint(PhysicsActor prim); + + public virtual void ProcessPreSimulation() { } + /// /// Perform a simulation of the current physics scene over the given timestep. /// @@ -293,28 +332,19 @@ namespace OpenSim.Region.PhysicsModules.SharedBase return false; } - public virtual bool SupportsCombining() - { - return false; - } - - public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} - - public virtual void UnCombine(PhysicsScene pScene) {} - /// /// Queue a raycast against the physics scene. /// The provided callback method will be called when the raycast is complete - /// - /// Many physics engines don't support collision testing at the same time as - /// manipulating the physics scene, so we queue the request up and callback + /// + /// Many physics engines don't support collision testing at the same time as + /// manipulating the physics scene, so we queue the request up and callback /// a custom method when the raycast is complete. /// This allows physics engines that give an immediate result to callback immediately /// and ones that don't, to callback when it gets a result back. - /// + /// /// ODE for example will not allow you to change the scene while collision testing or /// it asserts, 'opteration not valid for locked space'. This includes adding a ray to the scene. - /// + /// /// This is named RayCastWorld to not conflict with modrex's Raycast method. /// /// Origin of the ray @@ -348,6 +378,31 @@ namespace OpenSim.Region.PhysicsModules.SharedBase return false; } + public virtual List RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags flags) + { + return new List(); + } + + public virtual List BoxProbe(Vector3 position, Vector3 size, Quaternion orientation, int Count, RayFilterFlags flags) + { + return new List(); + } + + public virtual List SphereProbe(Vector3 position, float radius, int Count, RayFilterFlags flags) + { + return new List(); + } + + public virtual List PlaneProbe(PhysicsActor actor, Vector4 plane, int Count, RayFilterFlags flags) + { + return new List(); + } + + public virtual int SitAvatar(PhysicsActor actor, Vector3 AbsolutePosition, Vector3 CameraPosition, Vector3 offset, Vector3 AvatarSize, SitAvatarCallback PhysicsSitResponse) + { + return 0; + } + // Extendable interface for new, physics engine specific operations public virtual object Extension(string pFunct, params object[] pParams) { -- cgit v1.1