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 | 75 | ||||
-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, 193 insertions, 3 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..aaeae86 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -59,15 +59,30 @@ namespace OpenSim.Region.Physics.Manager | |||
59 | public Vector3 Position; | 59 | public Vector3 Position; |
60 | public Vector3 SurfaceNormal; | 60 | public Vector3 SurfaceNormal; |
61 | public float PenetrationDepth; | 61 | public float PenetrationDepth; |
62 | public float RelativeSpeed; | ||
62 | 63 | ||
63 | public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth) | 64 | public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth) |
64 | { | 65 | { |
65 | Position = position; | 66 | Position = position; |
66 | SurfaceNormal = surfaceNormal; | 67 | SurfaceNormal = surfaceNormal; |
67 | PenetrationDepth = penetrationDepth; | 68 | PenetrationDepth = penetrationDepth; |
69 | RelativeSpeed = 0f; // for now let this one be set explicity | ||
68 | } | 70 | } |
69 | } | 71 | } |
70 | 72 | ||
73 | public struct ContactData | ||
74 | { | ||
75 | public float mu; | ||
76 | public float bounce; | ||
77 | public bool softcolide; | ||
78 | |||
79 | public ContactData(float _mu, float _bounce, bool _softcolide) | ||
80 | { | ||
81 | mu = _mu; | ||
82 | bounce = _bounce; | ||
83 | softcolide = _softcolide; | ||
84 | } | ||
85 | } | ||
71 | /// <summary> | 86 | /// <summary> |
72 | /// Used to pass collision information to OnCollisionUpdate listeners. | 87 | /// Used to pass collision information to OnCollisionUpdate listeners. |
73 | /// </summary> | 88 | /// </summary> |
@@ -135,6 +150,8 @@ namespace OpenSim.Region.Physics.Manager | |||
135 | /// </summary> | 150 | /// </summary> |
136 | public event CollisionUpdate OnCollisionUpdate; | 151 | public event CollisionUpdate OnCollisionUpdate; |
137 | 152 | ||
153 | public virtual void SetVehicle(object vdata) { } | ||
154 | |||
138 | public event OutOfBounds OnOutOfBounds; | 155 | public event OutOfBounds OnOutOfBounds; |
139 | #pragma warning restore 67 | 156 | #pragma warning restore 67 |
140 | 157 | ||
@@ -142,11 +159,29 @@ namespace OpenSim.Region.Physics.Manager | |||
142 | { | 159 | { |
143 | get { return new NullPhysicsActor(); } | 160 | get { return new NullPhysicsActor(); } |
144 | } | 161 | } |
162 | |||
163 | public virtual bool Building { get; set; } | ||
164 | |||
165 | public virtual void getContactData(ref ContactData cdata) | ||
166 | { | ||
167 | cdata.mu = 0; | ||
168 | cdata.bounce = 0; | ||
169 | } | ||
145 | 170 | ||
146 | public abstract bool Stopped { get; } | 171 | public abstract bool Stopped { get; } |
147 | 172 | ||
148 | public abstract Vector3 Size { get; set; } | 173 | public abstract Vector3 Size { get; set; } |
149 | 174 | ||
175 | public virtual bool Phantom { get; set; } | ||
176 | |||
177 | public virtual bool IsVolumeDtc | ||
178 | { | ||
179 | get { return false; } | ||
180 | set { return; } | ||
181 | } | ||
182 | |||
183 | public virtual byte PhysicsShapeType { get; set; } | ||
184 | |||
150 | public abstract PrimitiveBaseShape Shape { set; } | 185 | public abstract PrimitiveBaseShape Shape { set; } |
151 | 186 | ||
152 | uint m_baseLocalID; | 187 | uint m_baseLocalID; |
@@ -195,6 +230,11 @@ namespace OpenSim.Region.Physics.Manager | |||
195 | } | 230 | } |
196 | } | 231 | } |
197 | 232 | ||
233 | public virtual byte[] Serialize(bool PhysIsRunning) | ||
234 | { | ||
235 | return new byte[0]; | ||
236 | } | ||
237 | |||
198 | public virtual void RaiseOutOfBounds(Vector3 pos) | 238 | public virtual void RaiseOutOfBounds(Vector3 pos) |
199 | { | 239 | { |
200 | // Make a temporary copy of the event to avoid possibility of | 240 | // Make a temporary copy of the event to avoid possibility of |
@@ -222,6 +262,11 @@ namespace OpenSim.Region.Physics.Manager | |||
222 | { | 262 | { |
223 | } | 263 | } |
224 | 264 | ||
265 | public virtual float Density { get; set; } | ||
266 | public virtual float GravModifier { get; set; } | ||
267 | public virtual float Friction { get; set; } | ||
268 | public virtual float Bounce { get; set; } | ||
269 | |||
225 | /// <summary> | 270 | /// <summary> |
226 | /// Position of this actor. | 271 | /// Position of this actor. |
227 | /// </summary> | 272 | /// </summary> |
@@ -249,6 +294,34 @@ namespace OpenSim.Region.Physics.Manager | |||
249 | public abstract Vector3 GeometricCenter { get; } | 294 | public abstract Vector3 GeometricCenter { get; } |
250 | public abstract Vector3 CenterOfMass { get; } | 295 | public abstract Vector3 CenterOfMass { get; } |
251 | 296 | ||
297 | public virtual Vector3 OOBsize | ||
298 | { | ||
299 | get | ||
300 | { | ||
301 | Vector3 s=Size; | ||
302 | s.X *=0.5f; | ||
303 | s.Y *=0.5f; | ||
304 | s.Z *=0.5f; | ||
305 | return s; | ||
306 | } | ||
307 | } | ||
308 | |||
309 | public virtual Vector3 OOBoffset | ||
310 | { | ||
311 | get | ||
312 | { | ||
313 | return Vector3.Zero; | ||
314 | } | ||
315 | } | ||
316 | |||
317 | public virtual float OOBRadiusSQ | ||
318 | { | ||
319 | get | ||
320 | { | ||
321 | return Size.LengthSquared() * 0.25f; // ((0.5^2) | ||
322 | } | ||
323 | } | ||
324 | |||
252 | /// <summary> | 325 | /// <summary> |
253 | /// Velocity of this actor. | 326 | /// Velocity of this actor. |
254 | /// </summary> | 327 | /// </summary> |
@@ -384,7 +457,6 @@ namespace OpenSim.Region.Physics.Manager | |||
384 | 457 | ||
385 | public override void VehicleFloatParam(int param, float value) | 458 | public override void VehicleFloatParam(int param, float value) |
386 | { | 459 | { |
387 | |||
388 | } | 460 | } |
389 | 461 | ||
390 | public override void VehicleVectorParam(int param, Vector3 value) | 462 | public override void VehicleVectorParam(int param, Vector3 value) |
@@ -554,5 +626,6 @@ namespace OpenSim.Region.Physics.Manager | |||
554 | { | 626 | { |
555 | return false; | 627 | return false; |
556 | } | 628 | } |
629 | |||
557 | } | 630 | } |
558 | } | 631 | } |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index b32cd30..cfede55 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; } |
@@ -236,7 +285,7 @@ namespace OpenSim.Region.Physics.Manager | |||
236 | } | 285 | } |
237 | 286 | ||
238 | public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} | 287 | public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} |
239 | 288 | public virtual void CombineTerrain(float[] heightMap, Vector3 pOffset) {} | |
240 | public virtual void UnCombine(PhysicsScene pScene) {} | 289 | public virtual void UnCombine(PhysicsScene pScene) {} |
241 | 290 | ||
242 | /// <summary> | 291 | /// <summary> |
@@ -274,5 +323,23 @@ namespace OpenSim.Region.Physics.Manager | |||
274 | { | 323 | { |
275 | return new List<ContactResult>(); | 324 | return new List<ContactResult>(); |
276 | } | 325 | } |
326 | |||
327 | public virtual object RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
328 | { | ||
329 | return null; | ||
330 | } | ||
331 | |||
332 | public virtual bool SuportsRaycastWorldFiltered() | ||
333 | { | ||
334 | return false; | ||
335 | } | ||
336 | |||
337 | public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, RaycastCallback retMethod){} | ||
338 | public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) { } | ||
339 | public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count) | ||
340 | { | ||
341 | return new List<ContactResult>(); | ||
342 | } | ||
343 | |||
277 | } | 344 | } |
278 | } | 345 | } |
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 |