diff options
Diffstat (limited to 'OpenSim/Region/Physics/Manager')
-rw-r--r-- | OpenSim/Region/Physics/Manager/IMesher.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 44 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 69 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/VehicleConstants.cs | 45 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/ZeroMesher.cs | 5 |
5 files changed, 163 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index 3a9ca1b..c32cf38 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs | |||
@@ -36,6 +36,7 @@ namespace OpenSim.Region.Physics.Manager | |||
36 | { | 36 | { |
37 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); | 37 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); |
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 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical,bool convex); | ||
39 | } | 40 | } |
40 | 41 | ||
41 | // Values for level of detail to be passed to the mesher. | 42 | // Values for level of detail to be passed to the mesher. |
@@ -65,5 +66,6 @@ namespace OpenSim.Region.Physics.Manager | |||
65 | void releasePinned(); | 66 | void releasePinned(); |
66 | void Append(IMesh newMesh); | 67 | void Append(IMesh newMesh); |
67 | void TransformLinear(float[,] matrix, float[] offset); | 68 | void TransformLinear(float[,] matrix, float[] offset); |
69 | Vector3 GetCentroid(); | ||
68 | } | 70 | } |
69 | } | 71 | } |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 0587054..b66d7f1 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -68,6 +68,19 @@ namespace OpenSim.Region.Physics.Manager | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | public struct ContactData | ||
72 | { | ||
73 | public float mu; | ||
74 | public float bounce; | ||
75 | public bool softcolide; | ||
76 | |||
77 | public ContactData(float _mu, float _bounce, bool _softcolide) | ||
78 | { | ||
79 | mu = _mu; | ||
80 | bounce = _bounce; | ||
81 | softcolide = _softcolide; | ||
82 | } | ||
83 | } | ||
71 | /// <summary> | 84 | /// <summary> |
72 | /// Used to pass collision information to OnCollisionUpdate listeners. | 85 | /// Used to pass collision information to OnCollisionUpdate listeners. |
73 | /// </summary> | 86 | /// </summary> |
@@ -135,6 +148,8 @@ namespace OpenSim.Region.Physics.Manager | |||
135 | /// </summary> | 148 | /// </summary> |
136 | public event CollisionUpdate OnCollisionUpdate; | 149 | public event CollisionUpdate OnCollisionUpdate; |
137 | 150 | ||
151 | public virtual void SetVehicle(object vdata) { } | ||
152 | |||
138 | public event OutOfBounds OnOutOfBounds; | 153 | public event OutOfBounds OnOutOfBounds; |
139 | #pragma warning restore 67 | 154 | #pragma warning restore 67 |
140 | 155 | ||
@@ -142,11 +157,29 @@ namespace OpenSim.Region.Physics.Manager | |||
142 | { | 157 | { |
143 | get { return new NullPhysicsActor(); } | 158 | get { return new NullPhysicsActor(); } |
144 | } | 159 | } |
160 | |||
161 | public virtual bool Building { get; set; } | ||
162 | |||
163 | public virtual void getContactData(ref ContactData cdata) | ||
164 | { | ||
165 | cdata.mu = 0; | ||
166 | cdata.bounce = 0; | ||
167 | } | ||
145 | 168 | ||
146 | public abstract bool Stopped { get; } | 169 | public abstract bool Stopped { get; } |
147 | 170 | ||
148 | public abstract Vector3 Size { get; set; } | 171 | public abstract Vector3 Size { get; set; } |
149 | 172 | ||
173 | public virtual bool Phantom { get; set; } | ||
174 | |||
175 | public virtual bool IsVolumeDtc | ||
176 | { | ||
177 | get { return false; } | ||
178 | set { return; } | ||
179 | } | ||
180 | |||
181 | public virtual byte PhysicsShapeType { get; set; } | ||
182 | |||
150 | public abstract PrimitiveBaseShape Shape { set; } | 183 | public abstract PrimitiveBaseShape Shape { set; } |
151 | 184 | ||
152 | uint m_baseLocalID; | 185 | uint m_baseLocalID; |
@@ -195,6 +228,11 @@ namespace OpenSim.Region.Physics.Manager | |||
195 | } | 228 | } |
196 | } | 229 | } |
197 | 230 | ||
231 | public virtual byte[] Serialize(bool PhysIsRunning) | ||
232 | { | ||
233 | return new byte[0]; | ||
234 | } | ||
235 | |||
198 | public virtual void RaiseOutOfBounds(Vector3 pos) | 236 | public virtual void RaiseOutOfBounds(Vector3 pos) |
199 | { | 237 | { |
200 | // Make a temporary copy of the event to avoid possibility of | 238 | // Make a temporary copy of the event to avoid possibility of |
@@ -222,6 +260,11 @@ namespace OpenSim.Region.Physics.Manager | |||
222 | { | 260 | { |
223 | } | 261 | } |
224 | 262 | ||
263 | public virtual float Density { get; set; } | ||
264 | public virtual float GravModifier { get; set; } | ||
265 | public virtual float Friction { get; set; } | ||
266 | public virtual float Bounce { get; set; } | ||
267 | |||
225 | /// <summary> | 268 | /// <summary> |
226 | /// Position of this actor. | 269 | /// Position of this actor. |
227 | /// </summary> | 270 | /// </summary> |
@@ -554,5 +597,6 @@ namespace OpenSim.Region.Physics.Manager | |||
554 | { | 597 | { |
555 | return false; | 598 | return false; |
556 | } | 599 | } |
600 | |||
557 | } | 601 | } |
558 | } | 602 | } |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 2a6163c..d10a2aa 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -43,6 +43,34 @@ namespace OpenSim.Region.Physics.Manager | |||
43 | public delegate void JointDeactivated(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" | 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 | 45 | ||
46 | public enum RayFilterFlags:ushort | ||
47 | { | ||
48 | // the flags | ||
49 | water = 0x01, | ||
50 | land = 0x02, | ||
51 | agent = 0x04, | ||
52 | nonphysical = 0x08, | ||
53 | physical = 0x10, | ||
54 | phantom = 0x20, | ||
55 | volumedtc = 0x40, | ||
56 | |||
57 | // ray cast colision control (may only work for meshs) | ||
58 | BackFaceCull = 0x4000, | ||
59 | ClosestHit = 0x8000, | ||
60 | |||
61 | // some combinations | ||
62 | LSLPhanton = phantom | volumedtc, | ||
63 | PrimsNonPhantom = nonphysical | physical, | ||
64 | PrimsNonPhantomAgents = nonphysical | physical | agent, | ||
65 | |||
66 | AllPrims = nonphysical | phantom | volumedtc | physical, | ||
67 | AllButLand = agent | nonphysical | physical | phantom | volumedtc, | ||
68 | |||
69 | ClosestAndBackCull = ClosestHit | BackFaceCull, | ||
70 | |||
71 | All = 0x3f | ||
72 | } | ||
73 | |||
46 | /// <summary> | 74 | /// <summary> |
47 | /// Contact result from a raycast. | 75 | /// Contact result from a raycast. |
48 | /// </summary> | 76 | /// </summary> |
@@ -54,6 +82,8 @@ namespace OpenSim.Region.Physics.Manager | |||
54 | public Vector3 Normal; | 82 | public Vector3 Normal; |
55 | } | 83 | } |
56 | 84 | ||
85 | |||
86 | |||
57 | public abstract class PhysicsScene | 87 | public abstract class PhysicsScene |
58 | { | 88 | { |
59 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 89 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -125,6 +155,25 @@ namespace OpenSim.Region.Physics.Manager | |||
125 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 155 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
126 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); | 156 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); |
127 | 157 | ||
158 | public virtual PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position, | ||
159 | uint localid, byte[] sdata) | ||
160 | { | ||
161 | return null; | ||
162 | } | ||
163 | |||
164 | public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
165 | Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid) | ||
166 | { | ||
167 | return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); | ||
168 | } | ||
169 | |||
170 | |||
171 | public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
172 | Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid) | ||
173 | { | ||
174 | return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); | ||
175 | } | ||
176 | |||
128 | public virtual float TimeDilation | 177 | public virtual float TimeDilation |
129 | { | 178 | { |
130 | get { return 1.0f; } | 179 | get { return 1.0f; } |
@@ -222,7 +271,7 @@ namespace OpenSim.Region.Physics.Manager | |||
222 | } | 271 | } |
223 | 272 | ||
224 | public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} | 273 | public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} |
225 | 274 | public virtual void CombineTerrain(float[] heightMap, Vector3 pOffset) {} | |
226 | public virtual void UnCombine(PhysicsScene pScene) {} | 275 | public virtual void UnCombine(PhysicsScene pScene) {} |
227 | 276 | ||
228 | /// <summary> | 277 | /// <summary> |
@@ -260,5 +309,23 @@ namespace OpenSim.Region.Physics.Manager | |||
260 | { | 309 | { |
261 | return new List<ContactResult>(); | 310 | return new List<ContactResult>(); |
262 | } | 311 | } |
312 | |||
313 | public virtual object RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
314 | { | ||
315 | return null; | ||
316 | } | ||
317 | |||
318 | public virtual bool SuportsRaycastWorldFiltered() | ||
319 | { | ||
320 | return false; | ||
321 | } | ||
322 | |||
323 | public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, RaycastCallback retMethod){} | ||
324 | public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) { } | ||
325 | public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count) | ||
326 | { | ||
327 | return new List<ContactResult>(); | ||
328 | } | ||
329 | |||
263 | } | 330 | } |
264 | } | 331 | } |
diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/Physics/Manager/VehicleConstants.cs index f0775c1..8e24b4c 100644 --- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs +++ b/OpenSim/Region/Physics/Manager/VehicleConstants.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenMetaverse; | ||
29 | 30 | ||
30 | namespace OpenSim.Region.Physics.Manager | 31 | namespace OpenSim.Region.Physics.Manager |
31 | { | 32 | { |
@@ -117,5 +118,47 @@ namespace OpenSim.Region.Physics.Manager | |||
117 | NO_DEFLECTION = 16392, | 118 | NO_DEFLECTION = 16392, |
118 | LOCK_ROTATION = 32784 | 119 | LOCK_ROTATION = 32784 |
119 | } | 120 | } |
120 | 121 | ||
122 | public struct VehicleData | ||
123 | { | ||
124 | public Vehicle m_type; | ||
125 | public VehicleFlag m_flags; | ||
126 | |||
127 | // Linear properties | ||
128 | public Vector3 m_linearMotorDirection; | ||
129 | public Vector3 m_linearFrictionTimescale; | ||
130 | public float m_linearMotorDecayTimescale; | ||
131 | public float m_linearMotorTimescale; | ||
132 | public Vector3 m_linearMotorOffset; | ||
133 | |||
134 | //Angular properties | ||
135 | public Vector3 m_angularMotorDirection; | ||
136 | public float m_angularMotorTimescale; | ||
137 | public float m_angularMotorDecayTimescale; | ||
138 | public Vector3 m_angularFrictionTimescale; | ||
139 | |||
140 | //Deflection properties | ||
141 | public float m_angularDeflectionEfficiency; | ||
142 | public float m_angularDeflectionTimescale; | ||
143 | public float m_linearDeflectionEfficiency; | ||
144 | public float m_linearDeflectionTimescale; | ||
145 | |||
146 | //Banking properties | ||
147 | public float m_bankingEfficiency; | ||
148 | public float m_bankingMix; | ||
149 | public float m_bankingTimescale; | ||
150 | |||
151 | //Hover and Buoyancy properties | ||
152 | public float m_VhoverHeight; | ||
153 | public float m_VhoverEfficiency; | ||
154 | public float m_VhoverTimescale; | ||
155 | public float m_VehicleBuoyancy; | ||
156 | |||
157 | //Attractor properties | ||
158 | public float m_verticalAttractionEfficiency; | ||
159 | public float m_verticalAttractionTimescale; | ||
160 | |||
161 | // Axis | ||
162 | public Quaternion m_referenceFrame; | ||
163 | } | ||
121 | } | 164 | } |
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs index ba19db6..8a3b50b 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs | |||
@@ -67,6 +67,11 @@ namespace OpenSim.Region.Physics.Manager | |||
67 | return CreateMesh(primName, primShape, size, lod, false); | 67 | return CreateMesh(primName, primShape, size, lod, false); |
68 | } | 68 | } |
69 | 69 | ||
70 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) | ||
71 | { | ||
72 | return CreateMesh(primName, primShape, size, lod, false); | ||
73 | } | ||
74 | |||
70 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) | 75 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) |
71 | { | 76 | { |
72 | // Remove the reference to the encoded JPEG2000 data so it can be GCed | 77 | // Remove the reference to the encoded JPEG2000 data so it can be GCed |