diff options
Diffstat (limited to 'OpenSim/Region/Physics/Manager')
-rw-r--r-- | OpenSim/Region/Physics/Manager/IMesher.cs | 11 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/Manager/IPhysicsParameters.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 39 |
3 files changed, 111 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index 1181b8d..3a9ca1b 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs | |||
@@ -38,6 +38,17 @@ namespace OpenSim.Region.Physics.Manager | |||
38 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); | 38 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); |
39 | } | 39 | } |
40 | 40 | ||
41 | // Values for level of detail to be passed to the mesher. | ||
42 | // Values origionally chosen for the LOD of sculpties (the sqrt(width*heigth) of sculpt texture) | ||
43 | // Lower level of detail reduces the number of vertices used to represent the meshed shape. | ||
44 | public enum LevelOfDetail | ||
45 | { | ||
46 | High = 32, | ||
47 | Medium = 16, | ||
48 | Low = 8, | ||
49 | VeryLow = 4 | ||
50 | } | ||
51 | |||
41 | public interface IVertex | 52 | public interface IVertex |
42 | { | 53 | { |
43 | } | 54 | } |
diff --git a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs b/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs new file mode 100755 index 0000000..b8676ba --- /dev/null +++ b/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs | |||
@@ -0,0 +1,73 @@ | |||
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/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index de22fae..72b01ac 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -37,6 +37,18 @@ namespace OpenSim.Region.Physics.Manager | |||
37 | public delegate void physicsCrash(); | 37 | public delegate void physicsCrash(); |
38 | 38 | ||
39 | public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); | 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 | /// <summary> | ||
43 | /// Contact result from a raycast. | ||
44 | /// </summary> | ||
45 | public struct ContactResult | ||
46 | { | ||
47 | public Vector3 Pos; | ||
48 | public float Depth; | ||
49 | public uint ConsumerID; | ||
50 | public Vector3 Normal; | ||
51 | } | ||
40 | 52 | ||
41 | public abstract class PhysicsScene | 53 | public abstract class PhysicsScene |
42 | { | 54 | { |
@@ -61,7 +73,6 @@ namespace OpenSim.Region.Physics.Manager | |||
61 | } | 73 | } |
62 | } | 74 | } |
63 | 75 | ||
64 | |||
65 | public abstract void Initialise(IMesher meshmerizer, IConfigSource config); | 76 | public abstract void Initialise(IMesher meshmerizer, IConfigSource config); |
66 | 77 | ||
67 | public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); | 78 | public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); |
@@ -75,6 +86,10 @@ namespace OpenSim.Region.Physics.Manager | |||
75 | 86 | ||
76 | public abstract void RemoveAvatar(PhysicsActor actor); | 87 | public abstract void RemoveAvatar(PhysicsActor actor); |
77 | 88 | ||
89 | /// <summary> | ||
90 | /// Remove a prim from the physics scene. | ||
91 | /// </summary> | ||
92 | /// <param name="prim"></param> | ||
78 | public abstract void RemovePrim(PhysicsActor prim); | 93 | public abstract void RemovePrim(PhysicsActor prim); |
79 | 94 | ||
80 | //public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 95 | //public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
@@ -83,17 +98,6 @@ namespace OpenSim.Region.Physics.Manager | |||
83 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 98 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
84 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); | 99 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); |
85 | 100 | ||
86 | public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
87 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid) | ||
88 | { | ||
89 | PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); | ||
90 | |||
91 | if (ret != null) | ||
92 | ret.LocalID = localID; | ||
93 | |||
94 | return ret; | ||
95 | } | ||
96 | |||
97 | public virtual float TimeDilation | 101 | public virtual float TimeDilation |
98 | { | 102 | { |
99 | get { return 1.0f; } | 103 | get { return 1.0f; } |
@@ -226,6 +230,17 @@ namespace OpenSim.Region.Physics.Manager | |||
226 | retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero); | 230 | retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero); |
227 | } | 231 | } |
228 | 232 | ||
233 | public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) | ||
234 | { | ||
235 | if (retMethod != null) | ||
236 | retMethod(new List<ContactResult>()); | ||
237 | } | ||
238 | |||
239 | public virtual List<ContactResult> RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) | ||
240 | { | ||
241 | return new List<ContactResult>(); | ||
242 | } | ||
243 | |||
229 | private class NullPhysicsScene : PhysicsScene | 244 | private class NullPhysicsScene : PhysicsScene |
230 | { | 245 | { |
231 | private static int m_workIndicator; | 246 | private static int m_workIndicator; |