diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/Physics/Manager | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Region/Physics/Manager')
-rw-r--r-- | OpenSim/Region/Physics/Manager/AssemblyInfo.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/CollisionLocker.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/IMesher.cs | 70 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/Manager/IPhysicsParameters.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/NullPhysicsScene.cs | 121 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 567 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsJoint.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs | 240 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 283 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsSensor.cs | 78 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsVector.cs | 186 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/VehicleConstants.cs | 121 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/ZeroMesher.cs | 83 |
13 files changed, 0 insertions, 2008 deletions
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | |||
31 | // Information about this assembly is defined by the following | ||
32 | // attributes. | ||
33 | // | ||
34 | // change them to the information which is associated with the assembly | ||
35 | // you compile. | ||
36 | |||
37 | [assembly : AssemblyTitle("PhysicsManager")] | ||
38 | [assembly : AssemblyDescription("")] | ||
39 | [assembly : AssemblyConfiguration("")] | ||
40 | [assembly : AssemblyCompany("http://opensimulator.org")] | ||
41 | [assembly : AssemblyProduct("PhysicsManager")] | ||
42 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] | ||
43 | [assembly : AssemblyTrademark("")] | ||
44 | [assembly : AssemblyCulture("")] | ||
45 | |||
46 | // This sets the default COM visibility of types in the assembly to invisible. | ||
47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
48 | |||
49 | [assembly : ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
31 | namespace OpenSim.Region.Physics.Manager | ||
32 | { | ||
33 | public class CollisionLocker | ||
34 | { | ||
35 | private List<IntPtr> worldlock = new List<IntPtr>(); | ||
36 | |||
37 | public CollisionLocker() | ||
38 | { | ||
39 | |||
40 | } | ||
41 | |||
42 | public void dlock(IntPtr world) | ||
43 | { | ||
44 | lock (worldlock) | ||
45 | { | ||
46 | worldlock.Add(world); | ||
47 | } | ||
48 | |||
49 | } | ||
50 | |||
51 | public void dunlock(IntPtr world) | ||
52 | { | ||
53 | lock (worldlock) | ||
54 | { | ||
55 | worldlock.Remove(world); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | public bool lockquery() | ||
60 | { | ||
61 | return (worldlock.Count > 0); | ||
62 | } | ||
63 | |||
64 | public void drelease(IntPtr world) | ||
65 | { | ||
66 | lock (worldlock) | ||
67 | { | ||
68 | if (worldlock.Contains(world)) | ||
69 | worldlock.Remove(world); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.Physics.Manager | ||
34 | { | ||
35 | public interface IMesher | ||
36 | { | ||
37 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); | ||
38 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); | ||
39 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache); | ||
40 | } | ||
41 | |||
42 | // Values for level of detail to be passed to the mesher. | ||
43 | // Values origionally chosen for the LOD of sculpties (the sqrt(width*heigth) of sculpt texture) | ||
44 | // Lower level of detail reduces the number of vertices used to represent the meshed shape. | ||
45 | public enum LevelOfDetail | ||
46 | { | ||
47 | High = 32, | ||
48 | Medium = 16, | ||
49 | Low = 8, | ||
50 | VeryLow = 4 | ||
51 | } | ||
52 | |||
53 | public interface IVertex | ||
54 | { | ||
55 | } | ||
56 | |||
57 | public interface IMesh | ||
58 | { | ||
59 | List<Vector3> getVertexList(); | ||
60 | int[] getIndexListAsInt(); | ||
61 | int[] getIndexListAsIntLocked(); | ||
62 | float[] getVertexListAsFloatLocked(); | ||
63 | void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount); | ||
64 | void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount); | ||
65 | void releaseSourceMeshData(); | ||
66 | void releasePinned(); | ||
67 | void Append(IMesh newMesh); | ||
68 | void TransformLinear(float[,] matrix, float[] offset); | ||
69 | } | ||
70 | } | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.Physics.Manager | ||
34 | { | ||
35 | public struct PhysParameterEntry | ||
36 | { | ||
37 | // flags to say to apply to all or no instances (I wish one could put consts into interfaces) | ||
38 | public const uint APPLY_TO_ALL = 0xfffffff3; | ||
39 | public const uint APPLY_TO_NONE = 0xfffffff4; | ||
40 | |||
41 | // values that denote true and false values | ||
42 | public const float NUMERIC_TRUE = 1f; | ||
43 | public const float NUMERIC_FALSE = 0f; | ||
44 | |||
45 | public string name; | ||
46 | public string desc; | ||
47 | |||
48 | public PhysParameterEntry(string n, string d) | ||
49 | { | ||
50 | name = n; | ||
51 | desc = d; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | // Interface for a physics scene that implements the runtime setting and getting of physics parameters | ||
56 | public interface IPhysicsParameters | ||
57 | { | ||
58 | // Get the list of parameters this physics engine supports | ||
59 | PhysParameterEntry[] GetParameterList(); | ||
60 | |||
61 | // Set parameter on a specific or all instances. | ||
62 | // Return 'false' if not able to set the parameter. | ||
63 | bool SetPhysicsParameter(string parm, float value, uint localID); | ||
64 | |||
65 | // Get parameter. | ||
66 | // Return 'false' if not able to get the parameter. | ||
67 | bool GetPhysicsParameter(string parm, out float value); | ||
68 | |||
69 | // Get parameter from a particular object | ||
70 | // TODO: | ||
71 | // bool GetPhysicsParameter(string parm, out float value, uint localID); | ||
72 | } | ||
73 | } | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenMetaverse; | ||
34 | |||
35 | namespace OpenSim.Region.Physics.Manager | ||
36 | { | ||
37 | class NullPhysicsScene : PhysicsScene | ||
38 | { | ||
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
41 | private static int m_workIndicator; | ||
42 | |||
43 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | ||
44 | { | ||
45 | // Does nothing right now | ||
46 | } | ||
47 | |||
48 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) | ||
49 | { | ||
50 | m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); | ||
51 | return PhysicsActor.Null; | ||
52 | } | ||
53 | |||
54 | public override void RemoveAvatar(PhysicsActor actor) | ||
55 | { | ||
56 | } | ||
57 | |||
58 | public override void RemovePrim(PhysicsActor prim) | ||
59 | { | ||
60 | } | ||
61 | public override void SetWaterLevel(float baseheight) | ||
62 | { | ||
63 | |||
64 | } | ||
65 | |||
66 | /* | ||
67 | public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) | ||
68 | { | ||
69 | m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size); | ||
70 | return PhysicsActor.Null; | ||
71 | } | ||
72 | */ | ||
73 | |||
74 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
75 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid) | ||
76 | { | ||
77 | m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); | ||
78 | return PhysicsActor.Null; | ||
79 | } | ||
80 | |||
81 | public override void AddPhysicsActorTaint(PhysicsActor prim) | ||
82 | { | ||
83 | } | ||
84 | |||
85 | public override float Simulate(float timeStep) | ||
86 | { | ||
87 | m_workIndicator = (m_workIndicator + 1) % 10; | ||
88 | |||
89 | return 0f; | ||
90 | } | ||
91 | |||
92 | public override void GetResults() | ||
93 | { | ||
94 | m_log.Info("[PHYSICS]: NullPhysicsScene : GetResults()"); | ||
95 | } | ||
96 | |||
97 | public override void SetTerrain(float[] heightMap) | ||
98 | { | ||
99 | m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); | ||
100 | } | ||
101 | |||
102 | public override void DeleteTerrain() | ||
103 | { | ||
104 | } | ||
105 | |||
106 | public override bool IsThreaded | ||
107 | { | ||
108 | get { return false; } | ||
109 | } | ||
110 | |||
111 | public override void Dispose() | ||
112 | { | ||
113 | } | ||
114 | |||
115 | public override Dictionary<uint,float> GetTopColliders() | ||
116 | { | ||
117 | Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); | ||
118 | return returncolliders; | ||
119 | } | ||
120 | } | ||
121 | } \ 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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenMetaverse; | ||
34 | |||
35 | namespace OpenSim.Region.Physics.Manager | ||
36 | { | ||
37 | public delegate void PositionUpdate(Vector3 position); | ||
38 | public delegate void VelocityUpdate(Vector3 velocity); | ||
39 | public delegate void OrientationUpdate(Quaternion orientation); | ||
40 | |||
41 | public enum ActorTypes : int | ||
42 | { | ||
43 | Unknown = 0, | ||
44 | Agent = 1, | ||
45 | Prim = 2, | ||
46 | Ground = 3 | ||
47 | } | ||
48 | |||
49 | public enum PIDHoverType | ||
50 | { | ||
51 | Ground, | ||
52 | GroundAndWater, | ||
53 | Water, | ||
54 | Absolute | ||
55 | } | ||
56 | |||
57 | public struct ContactPoint | ||
58 | { | ||
59 | public Vector3 Position; | ||
60 | public Vector3 SurfaceNormal; | ||
61 | public float PenetrationDepth; | ||
62 | |||
63 | public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth) | ||
64 | { | ||
65 | Position = position; | ||
66 | SurfaceNormal = surfaceNormal; | ||
67 | PenetrationDepth = penetrationDepth; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /// <summary> | ||
72 | /// Used to pass collision information to OnCollisionUpdate listeners. | ||
73 | /// </summary> | ||
74 | public class CollisionEventUpdate : EventArgs | ||
75 | { | ||
76 | /// <summary> | ||
77 | /// Number of collision events in this update. | ||
78 | /// </summary> | ||
79 | public int Count { get { return m_objCollisionList.Count; } } | ||
80 | |||
81 | public bool CollisionsOnPreviousFrame { get; private set; } | ||
82 | |||
83 | public Dictionary<uint, ContactPoint> m_objCollisionList; | ||
84 | |||
85 | public CollisionEventUpdate(Dictionary<uint, ContactPoint> objCollisionList) | ||
86 | { | ||
87 | m_objCollisionList = objCollisionList; | ||
88 | } | ||
89 | |||
90 | public CollisionEventUpdate() | ||
91 | { | ||
92 | m_objCollisionList = new Dictionary<uint, ContactPoint>(); | ||
93 | } | ||
94 | |||
95 | public void AddCollider(uint localID, ContactPoint contact) | ||
96 | { | ||
97 | if (!m_objCollisionList.ContainsKey(localID)) | ||
98 | { | ||
99 | m_objCollisionList.Add(localID, contact); | ||
100 | } | ||
101 | else | ||
102 | { | ||
103 | if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) | ||
104 | m_objCollisionList[localID] = contact; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | /// <summary> | ||
109 | /// Clear added collision events. | ||
110 | /// </summary> | ||
111 | public void Clear() | ||
112 | { | ||
113 | m_objCollisionList.Clear(); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | public abstract class PhysicsActor | ||
118 | { | ||
119 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
120 | |||
121 | public delegate void RequestTerseUpdate(); | ||
122 | public delegate void CollisionUpdate(EventArgs e); | ||
123 | public delegate void OutOfBounds(Vector3 pos); | ||
124 | |||
125 | // disable warning: public events | ||
126 | #pragma warning disable 67 | ||
127 | public event PositionUpdate OnPositionUpdate; | ||
128 | public event VelocityUpdate OnVelocityUpdate; | ||
129 | public event OrientationUpdate OnOrientationUpdate; | ||
130 | public event RequestTerseUpdate OnRequestTerseUpdate; | ||
131 | |||
132 | /// <summary> | ||
133 | /// Subscribers to this event must synchronously handle the dictionary of collisions received, since the event | ||
134 | /// object is reused in subsequent physics frames. | ||
135 | /// </summary> | ||
136 | public event CollisionUpdate OnCollisionUpdate; | ||
137 | |||
138 | public event OutOfBounds OnOutOfBounds; | ||
139 | #pragma warning restore 67 | ||
140 | |||
141 | public static PhysicsActor Null | ||
142 | { | ||
143 | get { return new NullPhysicsActor(); } | ||
144 | } | ||
145 | |||
146 | public abstract bool Stopped { get; } | ||
147 | |||
148 | public abstract Vector3 Size { get; set; } | ||
149 | |||
150 | public abstract PrimitiveBaseShape Shape { set; } | ||
151 | |||
152 | uint m_baseLocalID; | ||
153 | public virtual uint LocalID | ||
154 | { | ||
155 | set { m_baseLocalID = value; } | ||
156 | get { return m_baseLocalID; } | ||
157 | } | ||
158 | |||
159 | public abstract bool Grabbed { set; } | ||
160 | |||
161 | public abstract bool Selected { set; } | ||
162 | |||
163 | /// <summary> | ||
164 | /// Name of this actor. | ||
165 | /// </summary> | ||
166 | /// <remarks> | ||
167 | /// XXX: Bizarrely, this cannot be "Terrain" or "Water" right now unless it really is simulating terrain or | ||
168 | /// water. This is not a problem due to the formatting of names given by prims and avatars. | ||
169 | /// </remarks> | ||
170 | public string Name { get; protected set; } | ||
171 | |||
172 | /// <summary> | ||
173 | /// This is being used by ODE joint code. | ||
174 | /// </summary> | ||
175 | public string SOPName; | ||
176 | |||
177 | public abstract void CrossingFailure(); | ||
178 | |||
179 | public abstract void link(PhysicsActor obj); | ||
180 | |||
181 | public abstract void delink(); | ||
182 | |||
183 | public abstract void LockAngularMotion(Vector3 axis); | ||
184 | |||
185 | public virtual void RequestPhysicsterseUpdate() | ||
186 | { | ||
187 | // Make a temporary copy of the event to avoid possibility of | ||
188 | // a race condition if the last subscriber unsubscribes | ||
189 | // immediately after the null check and before the event is raised. | ||
190 | RequestTerseUpdate handler = OnRequestTerseUpdate; | ||
191 | |||
192 | if (handler != null) | ||
193 | { | ||
194 | handler(); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | public virtual void RaiseOutOfBounds(Vector3 pos) | ||
199 | { | ||
200 | // Make a temporary copy of the event to avoid possibility of | ||
201 | // a race condition if the last subscriber unsubscribes | ||
202 | // immediately after the null check and before the event is raised. | ||
203 | OutOfBounds handler = OnOutOfBounds; | ||
204 | |||
205 | if (handler != null) | ||
206 | { | ||
207 | handler(pos); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | public virtual void SendCollisionUpdate(EventArgs e) | ||
212 | { | ||
213 | CollisionUpdate handler = OnCollisionUpdate; | ||
214 | |||
215 | // m_log.DebugFormat("[PHYSICS ACTOR]: Sending collision for {0}", LocalID); | ||
216 | |||
217 | if (handler != null) | ||
218 | handler(e); | ||
219 | } | ||
220 | |||
221 | public virtual void SetMaterial (int material) | ||
222 | { | ||
223 | } | ||
224 | |||
225 | /// <summary> | ||
226 | /// Position of this actor. | ||
227 | /// </summary> | ||
228 | /// <remarks> | ||
229 | /// Setting this directly moves the actor to a given position. | ||
230 | /// Getting this retrieves the position calculated by physics scene updates, using factors such as velocity and | ||
231 | /// collisions. | ||
232 | /// </remarks> | ||
233 | public abstract Vector3 Position { get; set; } | ||
234 | |||
235 | public abstract float Mass { get; } | ||
236 | public abstract Vector3 Force { get; set; } | ||
237 | |||
238 | public abstract int VehicleType { get; set; } | ||
239 | public abstract void VehicleFloatParam(int param, float value); | ||
240 | public abstract void VehicleVectorParam(int param, Vector3 value); | ||
241 | public abstract void VehicleRotationParam(int param, Quaternion rotation); | ||
242 | public abstract void VehicleFlags(int param, bool remove); | ||
243 | |||
244 | /// <summary> | ||
245 | /// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more | ||
246 | /// </summary> | ||
247 | public abstract void SetVolumeDetect(int param); | ||
248 | |||
249 | public abstract Vector3 GeometricCenter { get; } | ||
250 | public abstract Vector3 CenterOfMass { get; } | ||
251 | |||
252 | /// <summary> | ||
253 | /// The desired velocity of this actor. | ||
254 | /// </summary> | ||
255 | /// <remarks> | ||
256 | /// Setting this provides a target velocity for physics scene updates. | ||
257 | /// Getting this returns the last set target. Fetch Velocity to get the current velocity. | ||
258 | /// </remarks> | ||
259 | protected Vector3 m_targetVelocity; | ||
260 | public virtual Vector3 TargetVelocity | ||
261 | { | ||
262 | get { return m_targetVelocity; } | ||
263 | set { | ||
264 | m_targetVelocity = value; | ||
265 | Velocity = m_targetVelocity; | ||
266 | } | ||
267 | } | ||
268 | |||
269 | public abstract Vector3 Velocity { get; set; } | ||
270 | |||
271 | public abstract Vector3 Torque { get; set; } | ||
272 | public abstract float CollisionScore { get; set;} | ||
273 | public abstract Vector3 Acceleration { get; set; } | ||
274 | public abstract Quaternion Orientation { get; set; } | ||
275 | public abstract int PhysicsActorType { get; set; } | ||
276 | public abstract bool IsPhysical { get; set; } | ||
277 | public abstract bool Flying { get; set; } | ||
278 | public abstract bool SetAlwaysRun { get; set; } | ||
279 | public abstract bool ThrottleUpdates { get; set; } | ||
280 | public abstract bool IsColliding { get; set; } | ||
281 | public abstract bool CollidingGround { get; set; } | ||
282 | public abstract bool CollidingObj { get; set; } | ||
283 | public abstract bool FloatOnWater { set; } | ||
284 | public abstract Vector3 RotationalVelocity { get; set; } | ||
285 | public abstract bool Kinematic { get; set; } | ||
286 | public abstract float Buoyancy { get; set; } | ||
287 | |||
288 | // Used for MoveTo | ||
289 | public abstract Vector3 PIDTarget { set; } | ||
290 | public abstract bool PIDActive { set;} | ||
291 | public abstract float PIDTau { set; } | ||
292 | |||
293 | // Used for llSetHoverHeight and maybe vehicle height | ||
294 | // Hover Height will override MoveTo target's Z | ||
295 | public abstract bool PIDHoverActive { set;} | ||
296 | public abstract float PIDHoverHeight { set;} | ||
297 | public abstract PIDHoverType PIDHoverType { set;} | ||
298 | public abstract float PIDHoverTau { set;} | ||
299 | |||
300 | // For RotLookAt | ||
301 | public abstract Quaternion APIDTarget { set;} | ||
302 | public abstract bool APIDActive { set;} | ||
303 | public abstract float APIDStrength { set;} | ||
304 | public abstract float APIDDamping { set;} | ||
305 | |||
306 | public abstract void AddForce(Vector3 force, bool pushforce); | ||
307 | public abstract void AddAngularForce(Vector3 force, bool pushforce); | ||
308 | public abstract void SetMomentum(Vector3 momentum); | ||
309 | public abstract void SubscribeEvents(int ms); | ||
310 | public abstract void UnSubscribeEvents(); | ||
311 | public abstract bool SubscribedEvents(); | ||
312 | } | ||
313 | |||
314 | public class NullPhysicsActor : PhysicsActor | ||
315 | { | ||
316 | public override bool Stopped | ||
317 | { | ||
318 | get{ return false; } | ||
319 | } | ||
320 | |||
321 | public override Vector3 Position | ||
322 | { | ||
323 | get { return Vector3.Zero; } | ||
324 | set { return; } | ||
325 | } | ||
326 | |||
327 | public override bool SetAlwaysRun | ||
328 | { | ||
329 | get { return false; } | ||
330 | set { return; } | ||
331 | } | ||
332 | |||
333 | public override uint LocalID | ||
334 | { | ||
335 | set { return; } | ||
336 | } | ||
337 | |||
338 | public override bool Grabbed | ||
339 | { | ||
340 | set { return; } | ||
341 | } | ||
342 | |||
343 | public override bool Selected | ||
344 | { | ||
345 | set { return; } | ||
346 | } | ||
347 | |||
348 | public override float Buoyancy | ||
349 | { | ||
350 | get { return 0f; } | ||
351 | set { return; } | ||
352 | } | ||
353 | |||
354 | public override bool FloatOnWater | ||
355 | { | ||
356 | set { return; } | ||
357 | } | ||
358 | |||
359 | public override bool CollidingGround | ||
360 | { | ||
361 | get { return false; } | ||
362 | set { return; } | ||
363 | } | ||
364 | |||
365 | public override bool CollidingObj | ||
366 | { | ||
367 | get { return false; } | ||
368 | set { return; } | ||
369 | } | ||
370 | |||
371 | public override Vector3 Size | ||
372 | { | ||
373 | get { return Vector3.Zero; } | ||
374 | set { return; } | ||
375 | } | ||
376 | |||
377 | public override float Mass | ||
378 | { | ||
379 | get { return 0f; } | ||
380 | } | ||
381 | |||
382 | public override Vector3 Force | ||
383 | { | ||
384 | get { return Vector3.Zero; } | ||
385 | set { return; } | ||
386 | } | ||
387 | |||
388 | public override int VehicleType | ||
389 | { | ||
390 | get { return 0; } | ||
391 | set { return; } | ||
392 | } | ||
393 | |||
394 | public override void VehicleFloatParam(int param, float value) | ||
395 | { | ||
396 | |||
397 | } | ||
398 | |||
399 | public override void VehicleVectorParam(int param, Vector3 value) | ||
400 | { | ||
401 | |||
402 | } | ||
403 | |||
404 | public override void VehicleRotationParam(int param, Quaternion rotation) | ||
405 | { | ||
406 | |||
407 | } | ||
408 | |||
409 | public override void VehicleFlags(int param, bool remove) | ||
410 | { | ||
411 | |||
412 | } | ||
413 | |||
414 | public override void SetVolumeDetect(int param) | ||
415 | { | ||
416 | |||
417 | } | ||
418 | |||
419 | public override void SetMaterial(int material) | ||
420 | { | ||
421 | |||
422 | } | ||
423 | |||
424 | public override Vector3 CenterOfMass | ||
425 | { | ||
426 | get { return Vector3.Zero; } | ||
427 | } | ||
428 | |||
429 | public override Vector3 GeometricCenter | ||
430 | { | ||
431 | get { return Vector3.Zero; } | ||
432 | } | ||
433 | |||
434 | public override PrimitiveBaseShape Shape | ||
435 | { | ||
436 | set { return; } | ||
437 | } | ||
438 | |||
439 | public override Vector3 Velocity | ||
440 | { | ||
441 | get { return Vector3.Zero; } | ||
442 | set { return; } | ||
443 | } | ||
444 | |||
445 | public override Vector3 Torque | ||
446 | { | ||
447 | get { return Vector3.Zero; } | ||
448 | set { return; } | ||
449 | } | ||
450 | |||
451 | public override float CollisionScore | ||
452 | { | ||
453 | get { return 0f; } | ||
454 | set { } | ||
455 | } | ||
456 | |||
457 | public override void CrossingFailure() | ||
458 | { | ||
459 | } | ||
460 | |||
461 | public override Quaternion Orientation | ||
462 | { | ||
463 | get { return Quaternion.Identity; } | ||
464 | set { } | ||
465 | } | ||
466 | |||
467 | public override Vector3 Acceleration | ||
468 | { | ||
469 | get { return Vector3.Zero; } | ||
470 | set { } | ||
471 | } | ||
472 | |||
473 | public override bool IsPhysical | ||
474 | { | ||
475 | get { return false; } | ||
476 | set { return; } | ||
477 | } | ||
478 | |||
479 | public override bool Flying | ||
480 | { | ||
481 | get { return false; } | ||
482 | set { return; } | ||
483 | } | ||
484 | |||
485 | public override bool ThrottleUpdates | ||
486 | { | ||
487 | get { return false; } | ||
488 | set { return; } | ||
489 | } | ||
490 | |||
491 | public override bool IsColliding | ||
492 | { | ||
493 | get { return false; } | ||
494 | set { return; } | ||
495 | } | ||
496 | |||
497 | public override int PhysicsActorType | ||
498 | { | ||
499 | get { return (int) ActorTypes.Unknown; } | ||
500 | set { return; } | ||
501 | } | ||
502 | |||
503 | public override bool Kinematic | ||
504 | { | ||
505 | get { return true; } | ||
506 | set { return; } | ||
507 | } | ||
508 | |||
509 | public override void link(PhysicsActor obj) | ||
510 | { | ||
511 | } | ||
512 | |||
513 | public override void delink() | ||
514 | { | ||
515 | } | ||
516 | |||
517 | public override void LockAngularMotion(Vector3 axis) | ||
518 | { | ||
519 | } | ||
520 | |||
521 | public override void AddForce(Vector3 force, bool pushforce) | ||
522 | { | ||
523 | } | ||
524 | |||
525 | public override void AddAngularForce(Vector3 force, bool pushforce) | ||
526 | { | ||
527 | |||
528 | } | ||
529 | |||
530 | public override Vector3 RotationalVelocity | ||
531 | { | ||
532 | get { return Vector3.Zero; } | ||
533 | set { return; } | ||
534 | } | ||
535 | |||
536 | public override Vector3 PIDTarget { set { return; } } | ||
537 | public override bool PIDActive { set { return; } } | ||
538 | public override float PIDTau { set { return; } } | ||
539 | |||
540 | public override float PIDHoverHeight { set { return; } } | ||
541 | public override bool PIDHoverActive { set { return; } } | ||
542 | public override PIDHoverType PIDHoverType { set { return; } } | ||
543 | public override float PIDHoverTau { set { return; } } | ||
544 | |||
545 | public override Quaternion APIDTarget { set { return; } } | ||
546 | public override bool APIDActive { set { return; } } | ||
547 | public override float APIDStrength { set { return; } } | ||
548 | public override float APIDDamping { set { return; } } | ||
549 | |||
550 | public override void SetMomentum(Vector3 momentum) | ||
551 | { | ||
552 | } | ||
553 | |||
554 | public override void SubscribeEvents(int ms) | ||
555 | { | ||
556 | |||
557 | } | ||
558 | public override void UnSubscribeEvents() | ||
559 | { | ||
560 | |||
561 | } | ||
562 | public override bool SubscribedEvents() | ||
563 | { | ||
564 | return false; | ||
565 | } | ||
566 | } | ||
567 | } | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.Physics.Manager | ||
34 | { | ||
35 | public enum PhysicsJointType : int | ||
36 | { | ||
37 | Ball = 0, | ||
38 | Hinge = 1 | ||
39 | } | ||
40 | |||
41 | public class PhysicsJoint | ||
42 | { | ||
43 | 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 | ||
44 | public PhysicsJointType Type; | ||
45 | public string RawParams; | ||
46 | public List<string> BodyNames = new List<string>(); | ||
47 | public Vector3 Position; // global coords | ||
48 | public Quaternion Rotation; // global coords | ||
49 | public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation | ||
50 | public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) | ||
51 | public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body | ||
52 | 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. | ||
53 | public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs deleted file mode 100644 index 8ccfda5..0000000 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ /dev/null | |||
@@ -1,240 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using log4net; | ||
34 | using OpenSim.Framework; | ||
35 | |||
36 | namespace OpenSim.Region.Physics.Manager | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Description of MyClass. | ||
40 | /// </summary> | ||
41 | public class PhysicsPluginManager | ||
42 | { | ||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | private Dictionary<string, IPhysicsPlugin> _PhysPlugins = new Dictionary<string, IPhysicsPlugin>(); | ||
46 | private Dictionary<string, IMeshingPlugin> _MeshPlugins = new Dictionary<string, IMeshingPlugin>(); | ||
47 | |||
48 | /// <summary> | ||
49 | /// Constructor. | ||
50 | /// </summary> | ||
51 | public PhysicsPluginManager() | ||
52 | { | ||
53 | // Load "plugins", that are hard coded and not existing in form of an external lib, and hence always | ||
54 | // available | ||
55 | IMeshingPlugin plugHard; | ||
56 | plugHard = new ZeroMesherPlugin(); | ||
57 | _MeshPlugins.Add(plugHard.GetName(), plugHard); | ||
58 | |||
59 | m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); | ||
60 | } | ||
61 | |||
62 | /// <summary> | ||
63 | /// Get a physics scene for the given physics engine and mesher. | ||
64 | /// </summary> | ||
65 | /// <param name="physEngineName"></param> | ||
66 | /// <param name="meshEngineName"></param> | ||
67 | /// <param name="config"></param> | ||
68 | /// <returns></returns> | ||
69 | public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName) | ||
70 | { | ||
71 | if (String.IsNullOrEmpty(physEngineName)) | ||
72 | { | ||
73 | return PhysicsScene.Null; | ||
74 | } | ||
75 | |||
76 | if (String.IsNullOrEmpty(meshEngineName)) | ||
77 | { | ||
78 | return PhysicsScene.Null; | ||
79 | } | ||
80 | |||
81 | IMesher meshEngine = null; | ||
82 | if (_MeshPlugins.ContainsKey(meshEngineName)) | ||
83 | { | ||
84 | m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName); | ||
85 | meshEngine = _MeshPlugins[meshEngineName].GetMesher(config); | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | m_log.WarnFormat("[PHYSICS]: couldn't find meshingEngine: {0}", meshEngineName); | ||
90 | throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName)); | ||
91 | } | ||
92 | |||
93 | if (_PhysPlugins.ContainsKey(physEngineName)) | ||
94 | { | ||
95 | m_log.Info("[PHYSICS]: creating " + physEngineName); | ||
96 | PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); | ||
97 | result.Initialise(meshEngine, config); | ||
98 | return result; | ||
99 | } | ||
100 | else | ||
101 | { | ||
102 | m_log.WarnFormat("[PHYSICS]: couldn't find physicsEngine: {0}", physEngineName); | ||
103 | throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName)); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | /// <summary> | ||
108 | /// Load all plugins in assemblies at the given path | ||
109 | /// </summary> | ||
110 | /// <param name="pluginsPath"></param> | ||
111 | public void LoadPluginsFromAssemblies(string assembliesPath) | ||
112 | { | ||
113 | // Walk all assemblies (DLLs effectively) and see if they are home | ||
114 | // of a plugin that is of interest for us | ||
115 | string[] pluginFiles = Directory.GetFiles(assembliesPath, "*.dll"); | ||
116 | |||
117 | for (int i = 0; i < pluginFiles.Length; i++) | ||
118 | { | ||
119 | LoadPluginsFromAssembly(pluginFiles[i]); | ||
120 | } | ||
121 | } | ||
122 | |||
123 | /// <summary> | ||
124 | /// Load plugins from an assembly at the given path | ||
125 | /// </summary> | ||
126 | /// <param name="assemblyPath"></param> | ||
127 | public void LoadPluginsFromAssembly(string assemblyPath) | ||
128 | { | ||
129 | // TODO / NOTE | ||
130 | // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from | ||
131 | // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll' | ||
132 | // using the LoadFrom context. The use of this context can result in unexpected behavior | ||
133 | // for serialization, casting and dependency resolution. In almost all cases, it is recommended | ||
134 | // that the LoadFrom context be avoided. This can be done by installing assemblies in the | ||
135 | // Global Assembly Cache or in the ApplicationBase directory and using Assembly. | ||
136 | // Load when explicitly loading assemblies. | ||
137 | Assembly pluginAssembly = null; | ||
138 | Type[] types = null; | ||
139 | |||
140 | try | ||
141 | { | ||
142 | pluginAssembly = Assembly.LoadFrom(assemblyPath); | ||
143 | } | ||
144 | catch (Exception ex) | ||
145 | { | ||
146 | m_log.Error("[PHYSICS]: Failed to load plugin from " + assemblyPath, ex); | ||
147 | } | ||
148 | |||
149 | if (pluginAssembly != null) | ||
150 | { | ||
151 | try | ||
152 | { | ||
153 | types = pluginAssembly.GetTypes(); | ||
154 | } | ||
155 | catch (ReflectionTypeLoadException ex) | ||
156 | { | ||
157 | m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath + ": " + | ||
158 | ex.LoaderExceptions[0].Message, ex); | ||
159 | } | ||
160 | catch (Exception ex) | ||
161 | { | ||
162 | m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath, ex); | ||
163 | } | ||
164 | |||
165 | if (types != null) | ||
166 | { | ||
167 | foreach (Type pluginType in types) | ||
168 | { | ||
169 | if (pluginType.IsPublic) | ||
170 | { | ||
171 | if (!pluginType.IsAbstract) | ||
172 | { | ||
173 | Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); | ||
174 | |||
175 | if (physTypeInterface != null) | ||
176 | { | ||
177 | IPhysicsPlugin plug = | ||
178 | (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
179 | plug.Init(); | ||
180 | if (!_PhysPlugins.ContainsKey(plug.GetName())) | ||
181 | { | ||
182 | _PhysPlugins.Add(plug.GetName(), plug); | ||
183 | m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); | ||
188 | |||
189 | if (meshTypeInterface != null) | ||
190 | { | ||
191 | IMeshingPlugin plug = | ||
192 | (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
193 | if (!_MeshPlugins.ContainsKey(plug.GetName())) | ||
194 | { | ||
195 | _MeshPlugins.Add(plug.GetName(), plug); | ||
196 | m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); | ||
197 | } | ||
198 | } | ||
199 | |||
200 | physTypeInterface = null; | ||
201 | meshTypeInterface = null; | ||
202 | } | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | |||
208 | pluginAssembly = null; | ||
209 | } | ||
210 | |||
211 | //--- | ||
212 | public static void PhysicsPluginMessage(string message, bool isWarning) | ||
213 | { | ||
214 | if (isWarning) | ||
215 | { | ||
216 | m_log.Warn("[PHYSICS]: " + message); | ||
217 | } | ||
218 | else | ||
219 | { | ||
220 | m_log.Info("[PHYSICS]: " + message); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | //--- | ||
225 | } | ||
226 | |||
227 | public interface IPhysicsPlugin | ||
228 | { | ||
229 | bool Init(); | ||
230 | PhysicsScene GetScene(String sceneIdentifier); | ||
231 | string GetName(); | ||
232 | void Dispose(); | ||
233 | } | ||
234 | |||
235 | public interface IMeshingPlugin | ||
236 | { | ||
237 | string GetName(); | ||
238 | IMesher GetMesher(IConfigSource config); | ||
239 | } | ||
240 | } | ||
diff --git a/OpenSim/Region/Physics/Manager/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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenMetaverse; | ||
34 | |||
35 | namespace OpenSim.Region.Physics.Manager | ||
36 | { | ||
37 | public delegate void physicsCrash(); | ||
38 | |||
39 | public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); | ||
40 | public delegate void RayCallback(List<ContactResult> list); | ||
41 | |||
42 | public delegate void JointMoved(PhysicsJoint joint); | ||
43 | 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" | ||
45 | |||
46 | public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); | ||
47 | public delegate void AssetReceivedDelegate(AssetBase asset); | ||
48 | |||
49 | /// <summary> | ||
50 | /// Contact result from a raycast. | ||
51 | /// </summary> | ||
52 | public struct ContactResult | ||
53 | { | ||
54 | public Vector3 Pos; | ||
55 | public float Depth; | ||
56 | public uint ConsumerID; | ||
57 | public Vector3 Normal; | ||
58 | } | ||
59 | |||
60 | public abstract class PhysicsScene | ||
61 | { | ||
62 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
63 | |||
64 | /// <summary> | ||
65 | /// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another. | ||
66 | /// </summary> | ||
67 | public string Name { get; protected set; } | ||
68 | |||
69 | // The only thing that should register for this event is the SceneGraph | ||
70 | // Anything else could cause problems. | ||
71 | |||
72 | public event physicsCrash OnPhysicsCrash; | ||
73 | |||
74 | public static PhysicsScene Null | ||
75 | { | ||
76 | get { return new NullPhysicsScene(); } | ||
77 | } | ||
78 | |||
79 | public RequestAssetDelegate RequestAssetMethod { get; set; } | ||
80 | |||
81 | public virtual void TriggerPhysicsBasedRestart() | ||
82 | { | ||
83 | physicsCrash handler = OnPhysicsCrash; | ||
84 | if (handler != null) | ||
85 | { | ||
86 | OnPhysicsCrash(); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | public abstract void Initialise(IMesher meshmerizer, IConfigSource config); | ||
91 | |||
92 | /// <summary> | ||
93 | /// Add an avatar | ||
94 | /// </summary> | ||
95 | /// <param name="avName"></param> | ||
96 | /// <param name="position"></param> | ||
97 | /// <param name="size"></param> | ||
98 | /// <param name="isFlying"></param> | ||
99 | /// <returns></returns> | ||
100 | public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); | ||
101 | |||
102 | /// <summary> | ||
103 | /// Add an avatar | ||
104 | /// </summary> | ||
105 | /// <param name="localID"></param> | ||
106 | /// <param name="avName"></param> | ||
107 | /// <param name="position"></param> | ||
108 | /// <param name="size"></param> | ||
109 | /// <param name="isFlying"></param> | ||
110 | /// <returns></returns> | ||
111 | public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) | ||
112 | { | ||
113 | PhysicsActor ret = AddAvatar(avName, position, size, isFlying); | ||
114 | if (ret != null) ret.LocalID = localID; | ||
115 | return ret; | ||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// Remove an avatar. | ||
120 | /// </summary> | ||
121 | /// <param name="actor"></param> | ||
122 | public abstract void RemoveAvatar(PhysicsActor actor); | ||
123 | |||
124 | /// <summary> | ||
125 | /// Remove a prim. | ||
126 | /// </summary> | ||
127 | /// <param name="prim"></param> | ||
128 | public abstract void RemovePrim(PhysicsActor prim); | ||
129 | |||
130 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
131 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); | ||
132 | |||
133 | public virtual float TimeDilation | ||
134 | { | ||
135 | get { return 1.0f; } | ||
136 | } | ||
137 | |||
138 | public virtual bool SupportsNINJAJoints | ||
139 | { | ||
140 | get { return false; } | ||
141 | } | ||
142 | |||
143 | public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position, | ||
144 | Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) | ||
145 | { return null; } | ||
146 | |||
147 | public virtual void RequestJointDeletion(string objectNameInScene) | ||
148 | { return; } | ||
149 | |||
150 | public virtual void RemoveAllJointsConnectedToActorThreadLocked(PhysicsActor actor) | ||
151 | { return; } | ||
152 | |||
153 | public virtual void DumpJointInfo() | ||
154 | { return; } | ||
155 | |||
156 | public event JointMoved OnJointMoved; | ||
157 | |||
158 | protected virtual void DoJointMoved(PhysicsJoint joint) | ||
159 | { | ||
160 | // We need this to allow subclasses (but not other classes) to invoke the event; C# does | ||
161 | // not allow subclasses to invoke the parent class event. | ||
162 | if (OnJointMoved != null) | ||
163 | { | ||
164 | OnJointMoved(joint); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | public event JointDeactivated OnJointDeactivated; | ||
169 | |||
170 | protected virtual void DoJointDeactivated(PhysicsJoint joint) | ||
171 | { | ||
172 | // We need this to allow subclasses (but not other classes) to invoke the event; C# does | ||
173 | // not allow subclasses to invoke the parent class event. | ||
174 | if (OnJointDeactivated != null) | ||
175 | { | ||
176 | OnJointDeactivated(joint); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | public event JointErrorMessage OnJointErrorMessage; | ||
181 | |||
182 | protected virtual void DoJointErrorMessage(PhysicsJoint joint, string message) | ||
183 | { | ||
184 | // We need this to allow subclasses (but not other classes) to invoke the event; C# does | ||
185 | // not allow subclasses to invoke the parent class event. | ||
186 | if (OnJointErrorMessage != null) | ||
187 | { | ||
188 | OnJointErrorMessage(joint, message); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | public virtual Vector3 GetJointAnchor(PhysicsJoint joint) | ||
193 | { return Vector3.Zero; } | ||
194 | |||
195 | public virtual Vector3 GetJointAxis(PhysicsJoint joint) | ||
196 | { return Vector3.Zero; } | ||
197 | |||
198 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); | ||
199 | |||
200 | /// <summary> | ||
201 | /// Perform a simulation of the current physics scene over the given timestep. | ||
202 | /// </summary> | ||
203 | /// <param name="timeStep"></param> | ||
204 | /// <returns>The number of frames simulated over that period.</returns> | ||
205 | public abstract float Simulate(float timeStep); | ||
206 | |||
207 | /// <summary> | ||
208 | /// Get statistics about this scene. | ||
209 | /// </summary> | ||
210 | /// <remarks>This facility is currently experimental and subject to change.</remarks> | ||
211 | /// <returns> | ||
212 | /// A dictionary where the key is the statistic name. If no statistics are supplied then returns null. | ||
213 | /// </returns> | ||
214 | public virtual Dictionary<string, float> GetStats() { return null; } | ||
215 | |||
216 | public abstract void GetResults(); | ||
217 | |||
218 | public abstract void SetTerrain(float[] heightMap); | ||
219 | |||
220 | public abstract void SetWaterLevel(float baseheight); | ||
221 | |||
222 | public abstract void DeleteTerrain(); | ||
223 | |||
224 | public abstract void Dispose(); | ||
225 | |||
226 | public abstract Dictionary<uint, float> GetTopColliders(); | ||
227 | |||
228 | public abstract bool IsThreaded { get; } | ||
229 | |||
230 | /// <summary> | ||
231 | /// True if the physics plugin supports raycasting against the physics scene | ||
232 | /// </summary> | ||
233 | public virtual bool SupportsRayCast() | ||
234 | { | ||
235 | return false; | ||
236 | } | ||
237 | |||
238 | public virtual bool SupportsCombining() | ||
239 | { | ||
240 | return false; | ||
241 | } | ||
242 | |||
243 | public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} | ||
244 | |||
245 | public virtual void UnCombine(PhysicsScene pScene) {} | ||
246 | |||
247 | /// <summary> | ||
248 | /// Queue a raycast against the physics scene. | ||
249 | /// The provided callback method will be called when the raycast is complete | ||
250 | /// | ||
251 | /// Many physics engines don't support collision testing at the same time as | ||
252 | /// manipulating the physics scene, so we queue the request up and callback | ||
253 | /// a custom method when the raycast is complete. | ||
254 | /// This allows physics engines that give an immediate result to callback immediately | ||
255 | /// and ones that don't, to callback when it gets a result back. | ||
256 | /// | ||
257 | /// ODE for example will not allow you to change the scene while collision testing or | ||
258 | /// it asserts, 'opteration not valid for locked space'. This includes adding a ray to the scene. | ||
259 | /// | ||
260 | /// This is named RayCastWorld to not conflict with modrex's Raycast method. | ||
261 | /// </summary> | ||
262 | /// <param name="position">Origin of the ray</param> | ||
263 | /// <param name="direction">Direction of the ray</param> | ||
264 | /// <param name="length">Length of ray in meters</param> | ||
265 | /// <param name="retMethod">Method to call when the raycast is complete</param> | ||
266 | public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) | ||
267 | { | ||
268 | if (retMethod != null) | ||
269 | retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero); | ||
270 | } | ||
271 | |||
272 | public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) | ||
273 | { | ||
274 | if (retMethod != null) | ||
275 | retMethod(new List<ContactResult>()); | ||
276 | } | ||
277 | |||
278 | public virtual List<ContactResult> RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) | ||
279 | { | ||
280 | return new List<ContactResult>(); | ||
281 | } | ||
282 | } | ||
283 | } | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Timers; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Region.Physics.Manager | ||
33 | { | ||
34 | [Flags] | ||
35 | public enum SenseType : uint | ||
36 | { | ||
37 | NONE = 0, | ||
38 | AGENT = 1, | ||
39 | ACTIVE = 2, | ||
40 | PASSIVE = 3, | ||
41 | SCRIPTED = 4 | ||
42 | } | ||
43 | |||
44 | public abstract class PhysicsSensor | ||
45 | { | ||
46 | public static PhysicsSensor Null | ||
47 | { | ||
48 | get { return new NullPhysicsSensor(); } | ||
49 | } | ||
50 | public abstract Vector3 Position { get; set; } | ||
51 | public abstract void TimerCallback (object obj, ElapsedEventArgs eea); | ||
52 | public abstract float radianarc {get; set;} | ||
53 | public abstract string targetname {get; set;} | ||
54 | public abstract Guid targetKey{get;set;} | ||
55 | public abstract SenseType sensetype { get;set;} | ||
56 | public abstract float range { get;set;} | ||
57 | public abstract float rateSeconds { get;set;} | ||
58 | } | ||
59 | |||
60 | public class NullPhysicsSensor : PhysicsSensor | ||
61 | { | ||
62 | public override Vector3 Position | ||
63 | { | ||
64 | get { return Vector3.Zero; } | ||
65 | set { return; } | ||
66 | } | ||
67 | public override void TimerCallback(object obj, ElapsedEventArgs eea) | ||
68 | { | ||
69 | // don't do squat | ||
70 | } | ||
71 | public override float radianarc { get { return 0f; } set { } } | ||
72 | public override string targetname { get { return ""; } set { } } | ||
73 | public override Guid targetKey { get { return Guid.Empty; } set { } } | ||
74 | public override SenseType sensetype { get { return SenseType.NONE; } set { } } | ||
75 | public override float range { get { return 0; } set { } } | ||
76 | public override float rateSeconds { get { return 0; } set { } } | ||
77 | } | ||
78 | } | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Region.Physics.Manager | ||
31 | { | ||
32 | /*public class PhysicsVector | ||
33 | { | ||
34 | public float X; | ||
35 | public float Y; | ||
36 | public float Z; | ||
37 | |||
38 | public Vector3() | ||
39 | { | ||
40 | } | ||
41 | |||
42 | public Vector3(float x, float y, float z) | ||
43 | { | ||
44 | X = x; | ||
45 | Y = y; | ||
46 | Z = z; | ||
47 | } | ||
48 | |||
49 | public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z) | ||
50 | { | ||
51 | } | ||
52 | |||
53 | public void setValues(float x, float y, float z) | ||
54 | { | ||
55 | X = x; | ||
56 | Y = y; | ||
57 | Z = z; | ||
58 | } | ||
59 | |||
60 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); | ||
61 | |||
62 | public override string ToString() | ||
63 | { | ||
64 | return "<" + X + "," + Y + "," + Z + ">"; | ||
65 | } | ||
66 | |||
67 | /// <summary> | ||
68 | /// These routines are the easiest way to store XYZ values in an Vector3 without requiring 3 calls. | ||
69 | /// </summary> | ||
70 | /// <returns></returns> | ||
71 | public byte[] GetBytes() | ||
72 | { | ||
73 | byte[] byteArray = new byte[12]; | ||
74 | |||
75 | Buffer.BlockCopy(BitConverter.GetBytes(X), 0, byteArray, 0, 4); | ||
76 | Buffer.BlockCopy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4); | ||
77 | Buffer.BlockCopy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4); | ||
78 | |||
79 | if (!BitConverter.IsLittleEndian) | ||
80 | { | ||
81 | Array.Reverse(byteArray, 0, 4); | ||
82 | Array.Reverse(byteArray, 4, 4); | ||
83 | Array.Reverse(byteArray, 8, 4); | ||
84 | } | ||
85 | |||
86 | return byteArray; | ||
87 | } | ||
88 | |||
89 | public void FromBytes(byte[] byteArray, int pos) | ||
90 | { | ||
91 | byte[] conversionBuffer = null; | ||
92 | if (!BitConverter.IsLittleEndian) | ||
93 | { | ||
94 | // Big endian architecture | ||
95 | if (conversionBuffer == null) | ||
96 | conversionBuffer = new byte[12]; | ||
97 | |||
98 | Buffer.BlockCopy(byteArray, pos, conversionBuffer, 0, 12); | ||
99 | |||
100 | Array.Reverse(conversionBuffer, 0, 4); | ||
101 | Array.Reverse(conversionBuffer, 4, 4); | ||
102 | Array.Reverse(conversionBuffer, 8, 4); | ||
103 | |||
104 | X = BitConverter.ToSingle(conversionBuffer, 0); | ||
105 | Y = BitConverter.ToSingle(conversionBuffer, 4); | ||
106 | Z = BitConverter.ToSingle(conversionBuffer, 8); | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | // Little endian architecture | ||
111 | X = BitConverter.ToSingle(byteArray, pos); | ||
112 | Y = BitConverter.ToSingle(byteArray, pos + 4); | ||
113 | Z = BitConverter.ToSingle(byteArray, pos + 8); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | // Operations | ||
118 | public static PhysicsVector operator +(Vector3 a, Vector3 b) | ||
119 | { | ||
120 | return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z); | ||
121 | } | ||
122 | |||
123 | public static PhysicsVector operator -(Vector3 a, Vector3 b) | ||
124 | { | ||
125 | return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z); | ||
126 | } | ||
127 | |||
128 | public static PhysicsVector cross(Vector3 a, Vector3 b) | ||
129 | { | ||
130 | 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); | ||
131 | } | ||
132 | |||
133 | public float length() | ||
134 | { | ||
135 | return (float) Math.Sqrt(X*X + Y*Y + Z*Z); | ||
136 | } | ||
137 | |||
138 | public static float GetDistanceTo(Vector3 a, Vector3 b) | ||
139 | { | ||
140 | float dx = a.X - b.X; | ||
141 | float dy = a.Y - b.Y; | ||
142 | float dz = a.Z - b.Z; | ||
143 | return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz); | ||
144 | } | ||
145 | |||
146 | public static PhysicsVector operator /(Vector3 v, float f) | ||
147 | { | ||
148 | return new PhysicsVector(v.X/f, v.Y/f, v.Z/f); | ||
149 | } | ||
150 | |||
151 | public static PhysicsVector operator *(Vector3 v, float f) | ||
152 | { | ||
153 | return new PhysicsVector(v.X*f, v.Y*f, v.Z*f); | ||
154 | } | ||
155 | |||
156 | public static PhysicsVector operator *(float f, Vector3 v) | ||
157 | { | ||
158 | return v*f; | ||
159 | } | ||
160 | |||
161 | public static bool isFinite(Vector3 v) | ||
162 | { | ||
163 | if (v == null) | ||
164 | return false; | ||
165 | if (Single.IsInfinity(v.X) || Single.IsNaN(v.X)) | ||
166 | return false; | ||
167 | if (Single.IsInfinity(v.Y) || Single.IsNaN(v.Y)) | ||
168 | return false; | ||
169 | if (Single.IsInfinity(v.Z) || Single.IsNaN(v.Z)) | ||
170 | return false; | ||
171 | |||
172 | return true; | ||
173 | } | ||
174 | |||
175 | public virtual bool IsIdentical(Vector3 v, float tolerance) | ||
176 | { | ||
177 | PhysicsVector diff = this - v; | ||
178 | float d = diff.length(); | ||
179 | if (d <= tolerance) | ||
180 | return true; | ||
181 | |||
182 | return false; | ||
183 | } | ||
184 | |||
185 | }*/ | ||
186 | } | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Region.Physics.Manager | ||
31 | { | ||
32 | public enum Vehicle : int | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Turns off Vehicle Support | ||
36 | /// </summary> | ||
37 | TYPE_NONE = 0, | ||
38 | |||
39 | /// <summary> | ||
40 | /// No Angular motor, High Left right friction, No Hover, Linear Deflection 1, no angular deflection | ||
41 | /// no vertical attractor, No banking, Identity rotation frame | ||
42 | /// </summary> | ||
43 | TYPE_SLED = 1, | ||
44 | |||
45 | /// <summary> | ||
46 | /// Needs Motors to be driven by timer or control events High left/right friction, No angular friction | ||
47 | /// Linear Motor wins in a second, decays in 60 seconds. Angular motor wins in a second, decays in 8/10ths of a second | ||
48 | /// linear deflection 2 seconds | ||
49 | /// Vertical Attractor locked UP | ||
50 | /// </summary> | ||
51 | TYPE_CAR = 2, | ||
52 | TYPE_BOAT = 3, | ||
53 | TYPE_AIRPLANE = 4, | ||
54 | TYPE_BALLOON = 5, | ||
55 | LINEAR_FRICTION_TIMESCALE = 16, | ||
56 | /// <summary> | ||
57 | /// vector of timescales for exponential decay of angular velocity about three axis | ||
58 | /// </summary> | ||
59 | ANGULAR_FRICTION_TIMESCALE = 17, | ||
60 | /// <summary> | ||
61 | /// linear velocity vehicle will try for | ||
62 | /// </summary> | ||
63 | LINEAR_MOTOR_DIRECTION = 18, | ||
64 | |||
65 | /// <summary> | ||
66 | /// Offset from center of mass where linear motor forces are added | ||
67 | /// </summary> | ||
68 | LINEAR_MOTOR_OFFSET = 20, | ||
69 | /// <summary> | ||
70 | /// angular velocity that vehicle will try for | ||
71 | /// </summary> | ||
72 | ANGULAR_MOTOR_DIRECTION = 19, | ||
73 | HOVER_HEIGHT = 24, | ||
74 | HOVER_EFFICIENCY = 25, | ||
75 | HOVER_TIMESCALE = 26, | ||
76 | BUOYANCY = 27, | ||
77 | LINEAR_DEFLECTION_EFFICIENCY = 28, | ||
78 | LINEAR_DEFLECTION_TIMESCALE = 29, | ||
79 | LINEAR_MOTOR_TIMESCALE = 30, | ||
80 | LINEAR_MOTOR_DECAY_TIMESCALE = 31, | ||
81 | |||
82 | /// <summary> | ||
83 | /// slide between 0 and 1 | ||
84 | /// </summary> | ||
85 | ANGULAR_DEFLECTION_EFFICIENCY = 32, | ||
86 | ANGULAR_DEFLECTION_TIMESCALE = 33, | ||
87 | ANGULAR_MOTOR_TIMESCALE = 34, | ||
88 | ANGULAR_MOTOR_DECAY_TIMESCALE = 35, | ||
89 | VERTICAL_ATTRACTION_EFFICIENCY = 36, | ||
90 | VERTICAL_ATTRACTION_TIMESCALE = 37, | ||
91 | BANKING_EFFICIENCY = 38, | ||
92 | BANKING_MIX = 39, | ||
93 | BANKING_TIMESCALE = 40, | ||
94 | REFERENCE_FRAME = 44, | ||
95 | BLOCK_EXIT = 45, | ||
96 | ROLL_FRAME = 46 | ||
97 | |||
98 | } | ||
99 | |||
100 | [Flags] | ||
101 | public enum VehicleFlag | ||
102 | { | ||
103 | NO_DEFLECTION_UP = 1, | ||
104 | LIMIT_ROLL_ONLY = 2, | ||
105 | HOVER_WATER_ONLY = 4, | ||
106 | HOVER_TERRAIN_ONLY = 8, | ||
107 | HOVER_GLOBAL_HEIGHT = 16, | ||
108 | HOVER_UP_ONLY = 32, | ||
109 | LIMIT_MOTOR_UP = 64, | ||
110 | MOUSELOOK_STEER = 128, | ||
111 | MOUSELOOK_BANK = 256, | ||
112 | CAMERA_DECOUPLED = 512, | ||
113 | NO_X = 1024, | ||
114 | NO_Y = 2048, | ||
115 | NO_Z = 4096, | ||
116 | LOCK_HOVER_HEIGHT = 8192, | ||
117 | NO_DEFLECTION = 16392, | ||
118 | LOCK_ROTATION = 32784 | ||
119 | } | ||
120 | |||
121 | } | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using Nini.Config; | ||
32 | |||
33 | /* | ||
34 | * This is the zero mesher. | ||
35 | * Whatever you want him to mesh, he can't, telling you that by responding with a null pointer. | ||
36 | * Effectivly this is for switching off meshing and for testing as each physics machine should deal | ||
37 | * with the null pointer situation. | ||
38 | * But it's also a convenience thing, as physics machines can rely on having a mesher in any situation, even | ||
39 | * if it's a dump one like this. | ||
40 | * Note, that this mesher is *not* living in a module but in the manager itself, so | ||
41 | * it's always availabe and thus the default in case of configuration errors | ||
42 | */ | ||
43 | |||
44 | namespace OpenSim.Region.Physics.Manager | ||
45 | { | ||
46 | public class ZeroMesherPlugin : IMeshingPlugin | ||
47 | { | ||
48 | public ZeroMesherPlugin() | ||
49 | { | ||
50 | } | ||
51 | |||
52 | public string GetName() | ||
53 | { | ||
54 | return "ZeroMesher"; | ||
55 | } | ||
56 | |||
57 | public IMesher GetMesher(IConfigSource config) | ||
58 | { | ||
59 | return new ZeroMesher(); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | public class ZeroMesher : IMesher | ||
64 | { | ||
65 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) | ||
66 | { | ||
67 | return CreateMesh(primName, primShape, size, lod, false, false); | ||
68 | } | ||
69 | |||
70 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) | ||
71 | { | ||
72 | return CreateMesh(primName, primShape, size, lod, false, false); | ||
73 | } | ||
74 | |||
75 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache) | ||
76 | { | ||
77 | // Remove the reference to the encoded JPEG2000 data so it can be GCed | ||
78 | primShape.SculptData = OpenMetaverse.Utils.EmptyBytes; | ||
79 | |||
80 | return null; | ||
81 | } | ||
82 | } | ||
83 | } | ||