From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 3 Nov 2016 21:44:39 +1000 Subject: Initial update to OpenSim 0.8.2.1 source code. --- OpenSim/Region/Physics/Manager/AssemblyInfo.cs | 58 --- OpenSim/Region/Physics/Manager/CollisionLocker.cs | 73 --- OpenSim/Region/Physics/Manager/IMesher.cs | 70 --- .../Region/Physics/Manager/IPhysicsParameters.cs | 73 --- OpenSim/Region/Physics/Manager/NullPhysicsScene.cs | 121 ----- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 567 --------------------- OpenSim/Region/Physics/Manager/PhysicsJoint.cs | 55 -- .../Region/Physics/Manager/PhysicsPluginManager.cs | 240 --------- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 283 ---------- OpenSim/Region/Physics/Manager/PhysicsSensor.cs | 78 --- OpenSim/Region/Physics/Manager/PhysicsVector.cs | 186 ------- OpenSim/Region/Physics/Manager/VehicleConstants.cs | 121 ----- OpenSim/Region/Physics/Manager/ZeroMesher.cs | 83 --- 13 files changed, 2008 deletions(-) delete mode 100644 OpenSim/Region/Physics/Manager/AssemblyInfo.cs delete mode 100644 OpenSim/Region/Physics/Manager/CollisionLocker.cs delete mode 100644 OpenSim/Region/Physics/Manager/IMesher.cs delete mode 100755 OpenSim/Region/Physics/Manager/IPhysicsParameters.cs delete mode 100644 OpenSim/Region/Physics/Manager/NullPhysicsScene.cs delete mode 100644 OpenSim/Region/Physics/Manager/PhysicsActor.cs delete mode 100644 OpenSim/Region/Physics/Manager/PhysicsJoint.cs delete mode 100644 OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs delete mode 100644 OpenSim/Region/Physics/Manager/PhysicsScene.cs delete mode 100644 OpenSim/Region/Physics/Manager/PhysicsSensor.cs delete mode 100644 OpenSim/Region/Physics/Manager/PhysicsVector.cs delete mode 100644 OpenSim/Region/Physics/Manager/VehicleConstants.cs delete mode 100644 OpenSim/Region/Physics/Manager/ZeroMesher.cs (limited to 'OpenSim/Region/Physics/Manager') diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs deleted file mode 100644 index 36b4235..0000000 --- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Reflection; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly : AssemblyTitle("PhysicsManager")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("PhysicsManager")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. - -[assembly : ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly : AssemblyVersion("0.7.5.*")] diff --git a/OpenSim/Region/Physics/Manager/CollisionLocker.cs b/OpenSim/Region/Physics/Manager/CollisionLocker.cs deleted file mode 100644 index cace4e4..0000000 --- a/OpenSim/Region/Physics/Manager/CollisionLocker.cs +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; - -namespace OpenSim.Region.Physics.Manager -{ - public class CollisionLocker - { - private List worldlock = new List(); - - public CollisionLocker() - { - - } - - public void dlock(IntPtr world) - { - lock (worldlock) - { - worldlock.Add(world); - } - - } - - public void dunlock(IntPtr world) - { - lock (worldlock) - { - worldlock.Remove(world); - } - } - - public bool lockquery() - { - return (worldlock.Count > 0); - } - - public void drelease(IntPtr world) - { - lock (worldlock) - { - if (worldlock.Contains(world)) - worldlock.Remove(world); - } - } - } -} diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs deleted file mode 100644 index 10c4bd3..0000000 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - public interface IMesher - { - IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); - IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); - IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache); - } - - // Values for level of detail to be passed to the mesher. - // Values origionally chosen for the LOD of sculpties (the sqrt(width*heigth) of sculpt texture) - // Lower level of detail reduces the number of vertices used to represent the meshed shape. - public enum LevelOfDetail - { - High = 32, - Medium = 16, - Low = 8, - VeryLow = 4 - } - - public interface IVertex - { - } - - public interface IMesh - { - List getVertexList(); - int[] getIndexListAsInt(); - int[] getIndexListAsIntLocked(); - float[] getVertexListAsFloatLocked(); - void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount); - void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount); - void releaseSourceMeshData(); - void releasePinned(); - void Append(IMesh newMesh); - void TransformLinear(float[,] matrix, float[] offset); - } -} diff --git a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs b/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs deleted file mode 100755 index b8676ba..0000000 --- a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - public struct PhysParameterEntry - { - // flags to say to apply to all or no instances (I wish one could put consts into interfaces) - public const uint APPLY_TO_ALL = 0xfffffff3; - public const uint APPLY_TO_NONE = 0xfffffff4; - - // values that denote true and false values - public const float NUMERIC_TRUE = 1f; - public const float NUMERIC_FALSE = 0f; - - public string name; - public string desc; - - public PhysParameterEntry(string n, string d) - { - name = n; - desc = d; - } - } - - // Interface for a physics scene that implements the runtime setting and getting of physics parameters - public interface IPhysicsParameters - { - // Get the list of parameters this physics engine supports - PhysParameterEntry[] GetParameterList(); - - // Set parameter on a specific or all instances. - // Return 'false' if not able to set the parameter. - bool SetPhysicsParameter(string parm, float value, uint localID); - - // Get parameter. - // Return 'false' if not able to get the parameter. - bool GetPhysicsParameter(string parm, out float value); - - // Get parameter from a particular object - // TODO: - // bool GetPhysicsParameter(string parm, out float value, uint localID); - } -} diff --git a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs b/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs deleted file mode 100644 index 1ccf46d..0000000 --- a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - class NullPhysicsScene : PhysicsScene - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private static int m_workIndicator; - - public override void Initialise(IMesher meshmerizer, IConfigSource config) - { - // Does nothing right now - } - - public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) - { - m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); - return PhysicsActor.Null; - } - - public override void RemoveAvatar(PhysicsActor actor) - { - } - - public override void RemovePrim(PhysicsActor prim) - { - } - public override void SetWaterLevel(float baseheight) - { - - } - -/* - public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) - { - m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size); - return PhysicsActor.Null; - } -*/ - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, uint localid) - { - m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); - return PhysicsActor.Null; - } - - public override void AddPhysicsActorTaint(PhysicsActor prim) - { - } - - public override float Simulate(float timeStep) - { - m_workIndicator = (m_workIndicator + 1) % 10; - - return 0f; - } - - public override void GetResults() - { - m_log.Info("[PHYSICS]: NullPhysicsScene : GetResults()"); - } - - public override void SetTerrain(float[] heightMap) - { - m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); - } - - public override void DeleteTerrain() - { - } - - public override bool IsThreaded - { - get { return false; } - } - - public override void Dispose() - { - } - - public override Dictionary GetTopColliders() - { - Dictionary returncolliders = new Dictionary(); - return returncolliders; - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs deleted file mode 100644 index d119791..0000000 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ /dev/null @@ -1,567 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using log4net; -using System; -using System.Collections.Generic; -using System.Reflection; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - public delegate void PositionUpdate(Vector3 position); - public delegate void VelocityUpdate(Vector3 velocity); - public delegate void OrientationUpdate(Quaternion orientation); - - public enum ActorTypes : int - { - Unknown = 0, - Agent = 1, - Prim = 2, - Ground = 3 - } - - public enum PIDHoverType - { - Ground, - GroundAndWater, - Water, - Absolute - } - - public struct ContactPoint - { - public Vector3 Position; - public Vector3 SurfaceNormal; - public float PenetrationDepth; - - public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth) - { - Position = position; - SurfaceNormal = surfaceNormal; - PenetrationDepth = penetrationDepth; - } - } - - /// - /// Used to pass collision information to OnCollisionUpdate listeners. - /// - public class CollisionEventUpdate : EventArgs - { - /// - /// Number of collision events in this update. - /// - public int Count { get { return m_objCollisionList.Count; } } - - public bool CollisionsOnPreviousFrame { get; private set; } - - public Dictionary m_objCollisionList; - - public CollisionEventUpdate(Dictionary objCollisionList) - { - m_objCollisionList = objCollisionList; - } - - public CollisionEventUpdate() - { - m_objCollisionList = new Dictionary(); - } - - public void AddCollider(uint localID, ContactPoint contact) - { - if (!m_objCollisionList.ContainsKey(localID)) - { - m_objCollisionList.Add(localID, contact); - } - else - { - if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) - m_objCollisionList[localID] = contact; - } - } - - /// - /// Clear added collision events. - /// - public void Clear() - { - m_objCollisionList.Clear(); - } - } - - public abstract class PhysicsActor - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public delegate void RequestTerseUpdate(); - public delegate void CollisionUpdate(EventArgs e); - public delegate void OutOfBounds(Vector3 pos); - -// disable warning: public events -#pragma warning disable 67 - public event PositionUpdate OnPositionUpdate; - public event VelocityUpdate OnVelocityUpdate; - public event OrientationUpdate OnOrientationUpdate; - public event RequestTerseUpdate OnRequestTerseUpdate; - - /// - /// Subscribers to this event must synchronously handle the dictionary of collisions received, since the event - /// object is reused in subsequent physics frames. - /// - public event CollisionUpdate OnCollisionUpdate; - - public event OutOfBounds OnOutOfBounds; -#pragma warning restore 67 - - public static PhysicsActor Null - { - get { return new NullPhysicsActor(); } - } - - public abstract bool Stopped { get; } - - public abstract Vector3 Size { get; set; } - - public abstract PrimitiveBaseShape Shape { set; } - - uint m_baseLocalID; - public virtual uint LocalID - { - set { m_baseLocalID = value; } - get { return m_baseLocalID; } - } - - public abstract bool Grabbed { set; } - - public abstract bool Selected { set; } - - /// - /// Name of this actor. - /// - /// - /// XXX: Bizarrely, this cannot be "Terrain" or "Water" right now unless it really is simulating terrain or - /// water. This is not a problem due to the formatting of names given by prims and avatars. - /// - public string Name { get; protected set; } - - /// - /// This is being used by ODE joint code. - /// - public string SOPName; - - public abstract void CrossingFailure(); - - public abstract void link(PhysicsActor obj); - - public abstract void delink(); - - public abstract void LockAngularMotion(Vector3 axis); - - public virtual void RequestPhysicsterseUpdate() - { - // Make a temporary copy of the event to avoid possibility of - // a race condition if the last subscriber unsubscribes - // immediately after the null check and before the event is raised. - RequestTerseUpdate handler = OnRequestTerseUpdate; - - if (handler != null) - { - handler(); - } - } - - public virtual void RaiseOutOfBounds(Vector3 pos) - { - // Make a temporary copy of the event to avoid possibility of - // a race condition if the last subscriber unsubscribes - // immediately after the null check and before the event is raised. - OutOfBounds handler = OnOutOfBounds; - - if (handler != null) - { - handler(pos); - } - } - - public virtual void SendCollisionUpdate(EventArgs e) - { - CollisionUpdate handler = OnCollisionUpdate; - -// m_log.DebugFormat("[PHYSICS ACTOR]: Sending collision for {0}", LocalID); - - if (handler != null) - handler(e); - } - - public virtual void SetMaterial (int material) - { - } - - /// - /// Position of this actor. - /// - /// - /// Setting this directly moves the actor to a given position. - /// Getting this retrieves the position calculated by physics scene updates, using factors such as velocity and - /// collisions. - /// - public abstract Vector3 Position { get; set; } - - public abstract float Mass { get; } - public abstract Vector3 Force { get; set; } - - public abstract int VehicleType { get; set; } - public abstract void VehicleFloatParam(int param, float value); - public abstract void VehicleVectorParam(int param, Vector3 value); - public abstract void VehicleRotationParam(int param, Quaternion rotation); - public abstract void VehicleFlags(int param, bool remove); - - /// - /// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more - /// - public abstract void SetVolumeDetect(int param); - - public abstract Vector3 GeometricCenter { get; } - public abstract Vector3 CenterOfMass { get; } - - /// - /// The desired velocity of this actor. - /// - /// - /// Setting this provides a target velocity for physics scene updates. - /// Getting this returns the last set target. Fetch Velocity to get the current velocity. - /// - protected Vector3 m_targetVelocity; - public virtual Vector3 TargetVelocity - { - get { return m_targetVelocity; } - set { - m_targetVelocity = value; - Velocity = m_targetVelocity; - } - } - - public abstract Vector3 Velocity { get; set; } - - public abstract Vector3 Torque { get; set; } - public abstract float CollisionScore { get; set;} - public abstract Vector3 Acceleration { get; set; } - public abstract Quaternion Orientation { get; set; } - public abstract int PhysicsActorType { get; set; } - public abstract bool IsPhysical { get; set; } - public abstract bool Flying { get; set; } - public abstract bool SetAlwaysRun { get; set; } - public abstract bool ThrottleUpdates { get; set; } - public abstract bool IsColliding { get; set; } - public abstract bool CollidingGround { get; set; } - public abstract bool CollidingObj { get; set; } - public abstract bool FloatOnWater { set; } - public abstract Vector3 RotationalVelocity { get; set; } - public abstract bool Kinematic { get; set; } - public abstract float Buoyancy { get; set; } - - // Used for MoveTo - public abstract Vector3 PIDTarget { set; } - public abstract bool PIDActive { set;} - public abstract float PIDTau { set; } - - // Used for llSetHoverHeight and maybe vehicle height - // Hover Height will override MoveTo target's Z - public abstract bool PIDHoverActive { set;} - public abstract float PIDHoverHeight { set;} - public abstract PIDHoverType PIDHoverType { set;} - public abstract float PIDHoverTau { set;} - - // For RotLookAt - public abstract Quaternion APIDTarget { set;} - public abstract bool APIDActive { set;} - public abstract float APIDStrength { set;} - public abstract float APIDDamping { set;} - - public abstract void AddForce(Vector3 force, bool pushforce); - public abstract void AddAngularForce(Vector3 force, bool pushforce); - public abstract void SetMomentum(Vector3 momentum); - public abstract void SubscribeEvents(int ms); - public abstract void UnSubscribeEvents(); - public abstract bool SubscribedEvents(); - } - - public class NullPhysicsActor : PhysicsActor - { - public override bool Stopped - { - get{ return false; } - } - - public override Vector3 Position - { - get { return Vector3.Zero; } - set { return; } - } - - public override bool SetAlwaysRun - { - get { return false; } - set { return; } - } - - public override uint LocalID - { - set { return; } - } - - public override bool Grabbed - { - set { return; } - } - - public override bool Selected - { - set { return; } - } - - public override float Buoyancy - { - get { return 0f; } - set { return; } - } - - public override bool FloatOnWater - { - set { return; } - } - - public override bool CollidingGround - { - get { return false; } - set { return; } - } - - public override bool CollidingObj - { - get { return false; } - set { return; } - } - - public override Vector3 Size - { - get { return Vector3.Zero; } - set { return; } - } - - public override float Mass - { - get { return 0f; } - } - - public override Vector3 Force - { - get { return Vector3.Zero; } - set { return; } - } - - public override int VehicleType - { - get { return 0; } - set { return; } - } - - public override void VehicleFloatParam(int param, float value) - { - - } - - public override void VehicleVectorParam(int param, Vector3 value) - { - - } - - public override void VehicleRotationParam(int param, Quaternion rotation) - { - - } - - public override void VehicleFlags(int param, bool remove) - { - - } - - public override void SetVolumeDetect(int param) - { - - } - - public override void SetMaterial(int material) - { - - } - - public override Vector3 CenterOfMass - { - get { return Vector3.Zero; } - } - - public override Vector3 GeometricCenter - { - get { return Vector3.Zero; } - } - - public override PrimitiveBaseShape Shape - { - set { return; } - } - - public override Vector3 Velocity - { - get { return Vector3.Zero; } - set { return; } - } - - public override Vector3 Torque - { - get { return Vector3.Zero; } - set { return; } - } - - public override float CollisionScore - { - get { return 0f; } - set { } - } - - public override void CrossingFailure() - { - } - - public override Quaternion Orientation - { - get { return Quaternion.Identity; } - set { } - } - - public override Vector3 Acceleration - { - get { return Vector3.Zero; } - set { } - } - - public override bool IsPhysical - { - get { return false; } - set { return; } - } - - public override bool Flying - { - get { return false; } - set { return; } - } - - public override bool ThrottleUpdates - { - get { return false; } - set { return; } - } - - public override bool IsColliding - { - get { return false; } - set { return; } - } - - public override int PhysicsActorType - { - get { return (int) ActorTypes.Unknown; } - set { return; } - } - - public override bool Kinematic - { - get { return true; } - set { return; } - } - - public override void link(PhysicsActor obj) - { - } - - public override void delink() - { - } - - public override void LockAngularMotion(Vector3 axis) - { - } - - public override void AddForce(Vector3 force, bool pushforce) - { - } - - public override void AddAngularForce(Vector3 force, bool pushforce) - { - - } - - public override Vector3 RotationalVelocity - { - get { return Vector3.Zero; } - set { return; } - } - - public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive { set { return; } } - public override float PIDTau { set { return; } } - - public override float PIDHoverHeight { set { return; } } - public override bool PIDHoverActive { set { return; } } - public override PIDHoverType PIDHoverType { set { return; } } - public override float PIDHoverTau { set { return; } } - - public override Quaternion APIDTarget { set { return; } } - public override bool APIDActive { set { return; } } - public override float APIDStrength { set { return; } } - public override float APIDDamping { set { return; } } - - public override void SetMomentum(Vector3 momentum) - { - } - - public override void SubscribeEvents(int ms) - { - - } - public override void UnSubscribeEvents() - { - - } - public override bool SubscribedEvents() - { - return false; - } - } -} diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs deleted file mode 100644 index b685d04..0000000 --- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - public enum PhysicsJointType : int - { - Ball = 0, - Hinge = 1 - } - - public class PhysicsJoint - { - public virtual bool IsInPhysicsEngine { get { return false; } } // set internally to indicate if this joint has already been passed to the physics engine or is still pending - public PhysicsJointType Type; - public string RawParams; - public List BodyNames = new List(); - public Vector3 Position; // global coords - public Quaternion Rotation; // global coords - public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation - public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) - public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body - public int ErrorMessageCount; // total # of error messages printed for this joint since its creation. if too many, further error messages are suppressed to prevent flooding. - public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint - } -} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Nini.Config; -using log4net; -using OpenSim.Framework; - -namespace OpenSim.Region.Physics.Manager -{ - /// - /// Description of MyClass. - /// - public class PhysicsPluginManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Dictionary _PhysPlugins = new Dictionary(); - private Dictionary _MeshPlugins = new Dictionary(); - - /// - /// Constructor. - /// - public PhysicsPluginManager() - { - // Load "plugins", that are hard coded and not existing in form of an external lib, and hence always - // available - IMeshingPlugin plugHard; - plugHard = new ZeroMesherPlugin(); - _MeshPlugins.Add(plugHard.GetName(), plugHard); - - m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); - } - - /// - /// Get a physics scene for the given physics engine and mesher. - /// - /// - /// - /// - /// - public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName) - { - if (String.IsNullOrEmpty(physEngineName)) - { - return PhysicsScene.Null; - } - - if (String.IsNullOrEmpty(meshEngineName)) - { - return PhysicsScene.Null; - } - - IMesher meshEngine = null; - if (_MeshPlugins.ContainsKey(meshEngineName)) - { - m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName); - meshEngine = _MeshPlugins[meshEngineName].GetMesher(config); - } - else - { - m_log.WarnFormat("[PHYSICS]: couldn't find meshingEngine: {0}", meshEngineName); - throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName)); - } - - if (_PhysPlugins.ContainsKey(physEngineName)) - { - m_log.Info("[PHYSICS]: creating " + physEngineName); - PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); - result.Initialise(meshEngine, config); - return result; - } - else - { - m_log.WarnFormat("[PHYSICS]: couldn't find physicsEngine: {0}", physEngineName); - throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName)); - } - } - - /// - /// Load all plugins in assemblies at the given path - /// - /// - public void LoadPluginsFromAssemblies(string assembliesPath) - { - // Walk all assemblies (DLLs effectively) and see if they are home - // of a plugin that is of interest for us - string[] pluginFiles = Directory.GetFiles(assembliesPath, "*.dll"); - - for (int i = 0; i < pluginFiles.Length; i++) - { - LoadPluginsFromAssembly(pluginFiles[i]); - } - } - - /// - /// Load plugins from an assembly at the given path - /// - /// - public void LoadPluginsFromAssembly(string assemblyPath) - { - // TODO / NOTE - // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from - // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll' - // using the LoadFrom context. The use of this context can result in unexpected behavior - // for serialization, casting and dependency resolution. In almost all cases, it is recommended - // that the LoadFrom context be avoided. This can be done by installing assemblies in the - // Global Assembly Cache or in the ApplicationBase directory and using Assembly. - // Load when explicitly loading assemblies. - Assembly pluginAssembly = null; - Type[] types = null; - - try - { - pluginAssembly = Assembly.LoadFrom(assemblyPath); - } - catch (Exception ex) - { - m_log.Error("[PHYSICS]: Failed to load plugin from " + assemblyPath, ex); - } - - if (pluginAssembly != null) - { - try - { - types = pluginAssembly.GetTypes(); - } - catch (ReflectionTypeLoadException ex) - { - m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath + ": " + - ex.LoaderExceptions[0].Message, ex); - } - catch (Exception ex) - { - m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath, ex); - } - - if (types != null) - { - foreach (Type pluginType in types) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); - - if (physTypeInterface != null) - { - IPhysicsPlugin plug = - (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Init(); - if (!_PhysPlugins.ContainsKey(plug.GetName())) - { - _PhysPlugins.Add(plug.GetName(), plug); - m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); - } - } - - Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); - - if (meshTypeInterface != null) - { - IMeshingPlugin plug = - (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - if (!_MeshPlugins.ContainsKey(plug.GetName())) - { - _MeshPlugins.Add(plug.GetName(), plug); - m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); - } - } - - physTypeInterface = null; - meshTypeInterface = null; - } - } - } - } - } - - pluginAssembly = null; - } - - //--- - public static void PhysicsPluginMessage(string message, bool isWarning) - { - if (isWarning) - { - m_log.Warn("[PHYSICS]: " + message); - } - else - { - m_log.Info("[PHYSICS]: " + message); - } - } - - //--- - } - - public interface IPhysicsPlugin - { - bool Init(); - PhysicsScene GetScene(String sceneIdentifier); - string GetName(); - void Dispose(); - } - - public interface IMeshingPlugin - { - string GetName(); - IMesher GetMesher(IConfigSource config); - } -} diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs deleted file mode 100644 index 488900e..0000000 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - public delegate void physicsCrash(); - - public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); - public delegate void RayCallback(List list); - - public delegate void JointMoved(PhysicsJoint joint); - public delegate void JointDeactivated(PhysicsJoint joint); - public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" - - public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); - public delegate void AssetReceivedDelegate(AssetBase asset); - - /// - /// Contact result from a raycast. - /// - public struct ContactResult - { - public Vector3 Pos; - public float Depth; - public uint ConsumerID; - public Vector3 Normal; - } - - public abstract class PhysicsScene - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another. - /// - public string Name { get; protected set; } - - // The only thing that should register for this event is the SceneGraph - // Anything else could cause problems. - - public event physicsCrash OnPhysicsCrash; - - public static PhysicsScene Null - { - get { return new NullPhysicsScene(); } - } - - public RequestAssetDelegate RequestAssetMethod { get; set; } - - public virtual void TriggerPhysicsBasedRestart() - { - physicsCrash handler = OnPhysicsCrash; - if (handler != null) - { - OnPhysicsCrash(); - } - } - - public abstract void Initialise(IMesher meshmerizer, IConfigSource config); - - /// - /// Add an avatar - /// - /// - /// - /// - /// - /// - public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); - - /// - /// Add an avatar - /// - /// - /// - /// - /// - /// - /// - public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) - { - PhysicsActor ret = AddAvatar(avName, position, size, isFlying); - if (ret != null) ret.LocalID = localID; - return ret; - } - - /// - /// Remove an avatar. - /// - /// - public abstract void RemoveAvatar(PhysicsActor actor); - - /// - /// Remove a prim. - /// - /// - public abstract void RemovePrim(PhysicsActor prim); - - public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, uint localid); - - public virtual float TimeDilation - { - get { return 1.0f; } - } - - public virtual bool SupportsNINJAJoints - { - get { return false; } - } - - public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position, - Quaternion rotation, string parms, List bodyNames, string trackedBodyName, Quaternion localRotation) - { return null; } - - public virtual void RequestJointDeletion(string objectNameInScene) - { return; } - - public virtual void RemoveAllJointsConnectedToActorThreadLocked(PhysicsActor actor) - { return; } - - public virtual void DumpJointInfo() - { return; } - - public event JointMoved OnJointMoved; - - protected virtual void DoJointMoved(PhysicsJoint joint) - { - // We need this to allow subclasses (but not other classes) to invoke the event; C# does - // not allow subclasses to invoke the parent class event. - if (OnJointMoved != null) - { - OnJointMoved(joint); - } - } - - public event JointDeactivated OnJointDeactivated; - - protected virtual void DoJointDeactivated(PhysicsJoint joint) - { - // We need this to allow subclasses (but not other classes) to invoke the event; C# does - // not allow subclasses to invoke the parent class event. - if (OnJointDeactivated != null) - { - OnJointDeactivated(joint); - } - } - - public event JointErrorMessage OnJointErrorMessage; - - protected virtual void DoJointErrorMessage(PhysicsJoint joint, string message) - { - // We need this to allow subclasses (but not other classes) to invoke the event; C# does - // not allow subclasses to invoke the parent class event. - if (OnJointErrorMessage != null) - { - OnJointErrorMessage(joint, message); - } - } - - public virtual Vector3 GetJointAnchor(PhysicsJoint joint) - { return Vector3.Zero; } - - public virtual Vector3 GetJointAxis(PhysicsJoint joint) - { return Vector3.Zero; } - - public abstract void AddPhysicsActorTaint(PhysicsActor prim); - - /// - /// Perform a simulation of the current physics scene over the given timestep. - /// - /// - /// The number of frames simulated over that period. - public abstract float Simulate(float timeStep); - - /// - /// Get statistics about this scene. - /// - /// This facility is currently experimental and subject to change. - /// - /// A dictionary where the key is the statistic name. If no statistics are supplied then returns null. - /// - public virtual Dictionary GetStats() { return null; } - - public abstract void GetResults(); - - public abstract void SetTerrain(float[] heightMap); - - public abstract void SetWaterLevel(float baseheight); - - public abstract void DeleteTerrain(); - - public abstract void Dispose(); - - public abstract Dictionary GetTopColliders(); - - public abstract bool IsThreaded { get; } - - /// - /// True if the physics plugin supports raycasting against the physics scene - /// - public virtual bool SupportsRayCast() - { - 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 - /// 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 - /// Direction of the ray - /// Length of ray in meters - /// Method to call when the raycast is complete - public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) - { - if (retMethod != null) - retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero); - } - - public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) - { - if (retMethod != null) - retMethod(new List()); - } - - public virtual List RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) - { - return new List(); - } - } -} diff --git a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs b/OpenSim/Region/Physics/Manager/PhysicsSensor.cs deleted file mode 100644 index f480d71..0000000 --- a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Timers; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - [Flags] - public enum SenseType : uint - { - NONE = 0, - AGENT = 1, - ACTIVE = 2, - PASSIVE = 3, - SCRIPTED = 4 - } - - public abstract class PhysicsSensor - { - public static PhysicsSensor Null - { - get { return new NullPhysicsSensor(); } - } - public abstract Vector3 Position { get; set; } - public abstract void TimerCallback (object obj, ElapsedEventArgs eea); - public abstract float radianarc {get; set;} - public abstract string targetname {get; set;} - public abstract Guid targetKey{get;set;} - public abstract SenseType sensetype { get;set;} - public abstract float range { get;set;} - public abstract float rateSeconds { get;set;} - } - - public class NullPhysicsSensor : PhysicsSensor - { - public override Vector3 Position - { - get { return Vector3.Zero; } - set { return; } - } - public override void TimerCallback(object obj, ElapsedEventArgs eea) - { - // don't do squat - } - public override float radianarc { get { return 0f; } set { } } - public override string targetname { get { return ""; } set { } } - public override Guid targetKey { get { return Guid.Empty; } set { } } - public override SenseType sensetype { get { return SenseType.NONE; } set { } } - public override float range { get { return 0; } set { } } - public override float rateSeconds { get { return 0; } set { } } - } -} diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs deleted file mode 100644 index f60a636..0000000 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenSim.Region.Physics.Manager -{ - /*public class PhysicsVector - { - public float X; - public float Y; - public float Z; - - public Vector3() - { - } - - public Vector3(float x, float y, float z) - { - X = x; - Y = y; - Z = z; - } - - public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z) - { - } - - public void setValues(float x, float y, float z) - { - X = x; - Y = y; - Z = z; - } - - public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); - - public override string ToString() - { - return "<" + X + "," + Y + "," + Z + ">"; - } - - /// - /// These routines are the easiest way to store XYZ values in an Vector3 without requiring 3 calls. - /// - /// - public byte[] GetBytes() - { - byte[] byteArray = new byte[12]; - - Buffer.BlockCopy(BitConverter.GetBytes(X), 0, byteArray, 0, 4); - Buffer.BlockCopy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4); - Buffer.BlockCopy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4); - - if (!BitConverter.IsLittleEndian) - { - Array.Reverse(byteArray, 0, 4); - Array.Reverse(byteArray, 4, 4); - Array.Reverse(byteArray, 8, 4); - } - - return byteArray; - } - - public void FromBytes(byte[] byteArray, int pos) - { - byte[] conversionBuffer = null; - if (!BitConverter.IsLittleEndian) - { - // Big endian architecture - if (conversionBuffer == null) - conversionBuffer = new byte[12]; - - Buffer.BlockCopy(byteArray, pos, conversionBuffer, 0, 12); - - Array.Reverse(conversionBuffer, 0, 4); - Array.Reverse(conversionBuffer, 4, 4); - Array.Reverse(conversionBuffer, 8, 4); - - X = BitConverter.ToSingle(conversionBuffer, 0); - Y = BitConverter.ToSingle(conversionBuffer, 4); - Z = BitConverter.ToSingle(conversionBuffer, 8); - } - else - { - // Little endian architecture - X = BitConverter.ToSingle(byteArray, pos); - Y = BitConverter.ToSingle(byteArray, pos + 4); - Z = BitConverter.ToSingle(byteArray, pos + 8); - } - } - - // Operations - public static PhysicsVector operator +(Vector3 a, Vector3 b) - { - return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z); - } - - public static PhysicsVector operator -(Vector3 a, Vector3 b) - { - return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z); - } - - public static PhysicsVector cross(Vector3 a, Vector3 b) - { - return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X); - } - - public float length() - { - return (float) Math.Sqrt(X*X + Y*Y + Z*Z); - } - - public static float GetDistanceTo(Vector3 a, Vector3 b) - { - float dx = a.X - b.X; - float dy = a.Y - b.Y; - float dz = a.Z - b.Z; - return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz); - } - - public static PhysicsVector operator /(Vector3 v, float f) - { - return new PhysicsVector(v.X/f, v.Y/f, v.Z/f); - } - - public static PhysicsVector operator *(Vector3 v, float f) - { - return new PhysicsVector(v.X*f, v.Y*f, v.Z*f); - } - - public static PhysicsVector operator *(float f, Vector3 v) - { - return v*f; - } - - public static bool isFinite(Vector3 v) - { - if (v == null) - return false; - if (Single.IsInfinity(v.X) || Single.IsNaN(v.X)) - return false; - if (Single.IsInfinity(v.Y) || Single.IsNaN(v.Y)) - return false; - if (Single.IsInfinity(v.Z) || Single.IsNaN(v.Z)) - return false; - - return true; - } - - public virtual bool IsIdentical(Vector3 v, float tolerance) - { - PhysicsVector diff = this - v; - float d = diff.length(); - if (d <= tolerance) - return true; - - return false; - } - - }*/ -} diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/Physics/Manager/VehicleConstants.cs deleted file mode 100644 index f0775c1..0000000 --- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenSim.Region.Physics.Manager -{ - public enum Vehicle : int - { - /// - /// Turns off Vehicle Support - /// - TYPE_NONE = 0, - - /// - /// No Angular motor, High Left right friction, No Hover, Linear Deflection 1, no angular deflection - /// no vertical attractor, No banking, Identity rotation frame - /// - TYPE_SLED = 1, - - /// - /// Needs Motors to be driven by timer or control events High left/right friction, No angular friction - /// Linear Motor wins in a second, decays in 60 seconds. Angular motor wins in a second, decays in 8/10ths of a second - /// linear deflection 2 seconds - /// Vertical Attractor locked UP - /// - TYPE_CAR = 2, - TYPE_BOAT = 3, - TYPE_AIRPLANE = 4, - TYPE_BALLOON = 5, - LINEAR_FRICTION_TIMESCALE = 16, - /// - /// vector of timescales for exponential decay of angular velocity about three axis - /// - ANGULAR_FRICTION_TIMESCALE = 17, - /// - /// linear velocity vehicle will try for - /// - LINEAR_MOTOR_DIRECTION = 18, - - /// - /// Offset from center of mass where linear motor forces are added - /// - LINEAR_MOTOR_OFFSET = 20, - /// - /// angular velocity that vehicle will try for - /// - ANGULAR_MOTOR_DIRECTION = 19, - HOVER_HEIGHT = 24, - HOVER_EFFICIENCY = 25, - HOVER_TIMESCALE = 26, - BUOYANCY = 27, - LINEAR_DEFLECTION_EFFICIENCY = 28, - LINEAR_DEFLECTION_TIMESCALE = 29, - LINEAR_MOTOR_TIMESCALE = 30, - LINEAR_MOTOR_DECAY_TIMESCALE = 31, - - /// - /// slide between 0 and 1 - /// - ANGULAR_DEFLECTION_EFFICIENCY = 32, - ANGULAR_DEFLECTION_TIMESCALE = 33, - ANGULAR_MOTOR_TIMESCALE = 34, - ANGULAR_MOTOR_DECAY_TIMESCALE = 35, - VERTICAL_ATTRACTION_EFFICIENCY = 36, - VERTICAL_ATTRACTION_TIMESCALE = 37, - BANKING_EFFICIENCY = 38, - BANKING_MIX = 39, - BANKING_TIMESCALE = 40, - REFERENCE_FRAME = 44, - BLOCK_EXIT = 45, - ROLL_FRAME = 46 - - } - - [Flags] - public enum VehicleFlag - { - NO_DEFLECTION_UP = 1, - LIMIT_ROLL_ONLY = 2, - HOVER_WATER_ONLY = 4, - HOVER_TERRAIN_ONLY = 8, - HOVER_GLOBAL_HEIGHT = 16, - HOVER_UP_ONLY = 32, - LIMIT_MOTOR_UP = 64, - MOUSELOOK_STEER = 128, - MOUSELOOK_BANK = 256, - CAMERA_DECOUPLED = 512, - NO_X = 1024, - NO_Y = 2048, - NO_Z = 4096, - LOCK_HOVER_HEIGHT = 8192, - NO_DEFLECTION = 16392, - LOCK_ROTATION = 32784 - } - -} diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs deleted file mode 100644 index 270d2ec..0000000 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using OpenSim.Framework; -using OpenMetaverse; -using Nini.Config; - -/* - * This is the zero mesher. - * Whatever you want him to mesh, he can't, telling you that by responding with a null pointer. - * Effectivly this is for switching off meshing and for testing as each physics machine should deal - * with the null pointer situation. - * But it's also a convenience thing, as physics machines can rely on having a mesher in any situation, even - * if it's a dump one like this. - * Note, that this mesher is *not* living in a module but in the manager itself, so - * it's always availabe and thus the default in case of configuration errors -*/ - -namespace OpenSim.Region.Physics.Manager -{ - public class ZeroMesherPlugin : IMeshingPlugin - { - public ZeroMesherPlugin() - { - } - - public string GetName() - { - return "ZeroMesher"; - } - - public IMesher GetMesher(IConfigSource config) - { - return new ZeroMesher(); - } - } - - public class ZeroMesher : IMesher - { - public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) - { - return CreateMesh(primName, primShape, size, lod, false, false); - } - - public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) - { - return CreateMesh(primName, primShape, size, lod, false, false); - } - - public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache) - { - // Remove the reference to the encoded JPEG2000 data so it can be GCed - primShape.SculptData = OpenMetaverse.Utils.EmptyBytes; - - return null; - } - } -} -- cgit v1.1