diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 106 |
1 files changed, 103 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 488900e..d24ab2a 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -38,11 +38,44 @@ namespace OpenSim.Region.Physics.Manager | |||
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); | 40 | public delegate void RayCallback(List<ContactResult> list); |
41 | public delegate void ProbeBoxCallback(List<ContactResult> list); | ||
42 | public delegate void ProbeSphereCallback(List<ContactResult> list); | ||
43 | public delegate void ProbePlaneCallback(List<ContactResult> list); | ||
44 | public delegate void SitAvatarCallback(int status, uint partID, Vector3 offset, Quaternion Orientation); | ||
41 | 45 | ||
42 | public delegate void JointMoved(PhysicsJoint joint); | 46 | public delegate void JointMoved(PhysicsJoint joint); |
43 | public delegate void JointDeactivated(PhysicsJoint joint); | 47 | 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" | 48 | 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 | 49 | ||
50 | public enum RayFilterFlags:ushort | ||
51 | { | ||
52 | // the flags | ||
53 | water = 0x01, | ||
54 | land = 0x02, | ||
55 | agent = 0x04, | ||
56 | nonphysical = 0x08, | ||
57 | physical = 0x10, | ||
58 | phantom = 0x20, | ||
59 | volumedtc = 0x40, | ||
60 | |||
61 | // ray cast colision control (may only work for meshs) | ||
62 | ContactsUnImportant = 0x2000, | ||
63 | BackFaceCull = 0x4000, | ||
64 | ClosestHit = 0x8000, | ||
65 | |||
66 | // some combinations | ||
67 | LSLPhanton = phantom | volumedtc, | ||
68 | PrimsNonPhantom = nonphysical | physical, | ||
69 | PrimsNonPhantomAgents = nonphysical | physical | agent, | ||
70 | |||
71 | AllPrims = nonphysical | phantom | volumedtc | physical, | ||
72 | AllButLand = agent | nonphysical | physical | phantom | volumedtc, | ||
73 | |||
74 | ClosestAndBackCull = ClosestHit | BackFaceCull, | ||
75 | |||
76 | All = 0x3f | ||
77 | } | ||
78 | |||
46 | public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); | 79 | public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); |
47 | public delegate void AssetReceivedDelegate(AssetBase asset); | 80 | public delegate void AssetReceivedDelegate(AssetBase asset); |
48 | 81 | ||
@@ -57,6 +90,8 @@ namespace OpenSim.Region.Physics.Manager | |||
57 | public Vector3 Normal; | 90 | public Vector3 Normal; |
58 | } | 91 | } |
59 | 92 | ||
93 | |||
94 | |||
60 | public abstract class PhysicsScene | 95 | public abstract class PhysicsScene |
61 | { | 96 | { |
62 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 97 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -97,8 +132,10 @@ namespace OpenSim.Region.Physics.Manager | |||
97 | /// <param name="size"></param> | 132 | /// <param name="size"></param> |
98 | /// <param name="isFlying"></param> | 133 | /// <param name="isFlying"></param> |
99 | /// <returns></returns> | 134 | /// <returns></returns> |
100 | public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); | 135 | public virtual PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
101 | 136 | { | |
137 | return null; | ||
138 | } | ||
102 | /// <summary> | 139 | /// <summary> |
103 | /// Add an avatar | 140 | /// Add an avatar |
104 | /// </summary> | 141 | /// </summary> |
@@ -115,6 +152,12 @@ namespace OpenSim.Region.Physics.Manager | |||
115 | return ret; | 152 | return ret; |
116 | } | 153 | } |
117 | 154 | ||
155 | public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying) | ||
156 | { | ||
157 | PhysicsActor ret = AddAvatar(localID, avName, position, size, isFlying); | ||
158 | return ret; | ||
159 | } | ||
160 | |||
118 | /// <summary> | 161 | /// <summary> |
119 | /// Remove an avatar. | 162 | /// Remove an avatar. |
120 | /// </summary> | 163 | /// </summary> |
@@ -130,6 +173,25 @@ namespace OpenSim.Region.Physics.Manager | |||
130 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 173 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
131 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); | 174 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid); |
132 | 175 | ||
176 | public virtual PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position, | ||
177 | uint localid, byte[] sdata) | ||
178 | { | ||
179 | return null; | ||
180 | } | ||
181 | |||
182 | public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
183 | Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid) | ||
184 | { | ||
185 | return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); | ||
186 | } | ||
187 | |||
188 | |||
189 | public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
190 | Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid) | ||
191 | { | ||
192 | return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); | ||
193 | } | ||
194 | |||
133 | public virtual float TimeDilation | 195 | public virtual float TimeDilation |
134 | { | 196 | { |
135 | get { return 1.0f; } | 197 | get { return 1.0f; } |
@@ -197,6 +259,9 @@ namespace OpenSim.Region.Physics.Manager | |||
197 | 259 | ||
198 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); | 260 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); |
199 | 261 | ||
262 | |||
263 | public virtual void PrepareSimulation() { } | ||
264 | |||
200 | /// <summary> | 265 | /// <summary> |
201 | /// Perform a simulation of the current physics scene over the given timestep. | 266 | /// Perform a simulation of the current physics scene over the given timestep. |
202 | /// </summary> | 267 | /// </summary> |
@@ -241,7 +306,7 @@ namespace OpenSim.Region.Physics.Manager | |||
241 | } | 306 | } |
242 | 307 | ||
243 | public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} | 308 | public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {} |
244 | 309 | public virtual void CombineTerrain(float[] heightMap, Vector3 pOffset) {} | |
245 | public virtual void UnCombine(PhysicsScene pScene) {} | 310 | public virtual void UnCombine(PhysicsScene pScene) {} |
246 | 311 | ||
247 | /// <summary> | 312 | /// <summary> |
@@ -279,5 +344,40 @@ namespace OpenSim.Region.Physics.Manager | |||
279 | { | 344 | { |
280 | return new List<ContactResult>(); | 345 | return new List<ContactResult>(); |
281 | } | 346 | } |
347 | |||
348 | public virtual object RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
349 | { | ||
350 | return null; | ||
351 | } | ||
352 | |||
353 | public virtual bool SuportsRaycastWorldFiltered() | ||
354 | { | ||
355 | return false; | ||
356 | } | ||
357 | |||
358 | public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags flags) | ||
359 | { | ||
360 | return new List<ContactResult>(); | ||
361 | } | ||
362 | |||
363 | public virtual List<ContactResult> BoxProbe(Vector3 position, Vector3 size, Quaternion orientation, int Count, RayFilterFlags flags) | ||
364 | { | ||
365 | return new List<ContactResult>(); | ||
366 | } | ||
367 | |||
368 | public virtual List<ContactResult> SphereProbe(Vector3 position, float radius, int Count, RayFilterFlags flags) | ||
369 | { | ||
370 | return new List<ContactResult>(); | ||
371 | } | ||
372 | |||
373 | public virtual List<ContactResult> PlaneProbe(PhysicsActor actor, Vector4 plane, int Count, RayFilterFlags flags) | ||
374 | { | ||
375 | return new List<ContactResult>(); | ||
376 | } | ||
377 | |||
378 | public virtual int SitAvatar(PhysicsActor actor, Vector3 AbsolutePosition, Vector3 CameraPosition, Vector3 offset, Vector3 AvatarSize, SitAvatarCallback PhysicsSitResponse) | ||
379 | { | ||
380 | return 0; | ||
381 | } | ||
282 | } | 382 | } |
283 | } | 383 | } |