diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 92afe39..9429544 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -238,7 +238,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
238 | private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); | 238 | private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); |
239 | private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); | 239 | private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); |
240 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); | 240 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); |
241 | private readonly HashSet<OdePrim> _taintedPrim = new HashSet<OdePrim>(); | 241 | private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>(); |
242 | private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>(); | ||
242 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); | 243 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); |
243 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); | 244 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); |
244 | private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); | 245 | private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); |
@@ -2121,6 +2122,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2121 | /// <param name="prim"></param> | 2122 | /// <param name="prim"></param> |
2122 | public void RemovePrimThreadLocked(OdePrim prim) | 2123 | public void RemovePrimThreadLocked(OdePrim prim) |
2123 | { | 2124 | { |
2125 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); | ||
2124 | lock (prim) | 2126 | lock (prim) |
2125 | { | 2127 | { |
2126 | remCollisionEventReporting(prim); | 2128 | remCollisionEventReporting(prim); |
@@ -2568,11 +2570,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2568 | if (prim is OdePrim) | 2570 | if (prim is OdePrim) |
2569 | { | 2571 | { |
2570 | OdePrim taintedprim = ((OdePrim) prim); | 2572 | OdePrim taintedprim = ((OdePrim) prim); |
2571 | lock (_taintedPrim) | 2573 | lock (_taintedPrimH) |
2572 | { | 2574 | { |
2573 | if (!(_taintedPrim.Contains(taintedprim))) | 2575 | if (!(_taintedPrimH.Contains(taintedprim))) |
2574 | _taintedPrim.Add(taintedprim); | 2576 | { |
2575 | } | 2577 | //Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName); |
2578 | _taintedPrimH.Add(taintedprim); // HashSet for searching | ||
2579 | _taintedPrimL.Add(taintedprim); // List for ordered readout | ||
2580 | } | ||
2581 | } | ||
2576 | return; | 2582 | return; |
2577 | } | 2583 | } |
2578 | else if (prim is OdeCharacter) | 2584 | else if (prim is OdeCharacter) |
@@ -2608,7 +2614,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2608 | float fps = 0; | 2614 | float fps = 0; |
2609 | //m_log.Info(timeStep.ToString()); | 2615 | //m_log.Info(timeStep.ToString()); |
2610 | step_time += timeStep; | 2616 | step_time += timeStep; |
2611 | 2617 | ||
2612 | // If We're loaded down by something else, | 2618 | // If We're loaded down by something else, |
2613 | // or debugging with the Visual Studio project on pause | 2619 | // or debugging with the Visual Studio project on pause |
2614 | // skip a few frames to catch up gracefully. | 2620 | // skip a few frames to catch up gracefully. |
@@ -2688,16 +2694,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2688 | // Modify other objects in the scene. | 2694 | // Modify other objects in the scene. |
2689 | processedtaints = false; | 2695 | processedtaints = false; |
2690 | 2696 | ||
2691 | lock (_taintedPrim) | 2697 | lock (_taintedPrimL) |
2692 | { | 2698 | { |
2693 | foreach (OdePrim prim in _taintedPrim) | 2699 | foreach (OdePrim prim in _taintedPrimL) |
2694 | { | 2700 | { |
2701 | |||
2702 | |||
2695 | if (prim.m_taintremove) | 2703 | if (prim.m_taintremove) |
2696 | { | 2704 | { |
2705 | //Console.WriteLine("Simulate calls RemovePrimThreadLocked"); | ||
2697 | RemovePrimThreadLocked(prim); | 2706 | RemovePrimThreadLocked(prim); |
2698 | } | 2707 | } |
2699 | else | 2708 | else |
2700 | { | 2709 | { |
2710 | //Console.WriteLine("Simulate calls ProcessTaints"); | ||
2701 | prim.ProcessTaints(timeStep); | 2711 | prim.ProcessTaints(timeStep); |
2702 | } | 2712 | } |
2703 | processedtaints = true; | 2713 | processedtaints = true; |
@@ -2887,7 +2897,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2887 | } | 2897 | } |
2888 | 2898 | ||
2889 | if (processedtaints) | 2899 | if (processedtaints) |
2890 | _taintedPrim.Clear(); | 2900 | //Console.WriteLine("Simulate calls Clear of _taintedPrim list"); |
2901 | _taintedPrimH.Clear(); | ||
2902 | _taintedPrimL.Clear(); | ||
2891 | } | 2903 | } |
2892 | 2904 | ||
2893 | // Move characters | 2905 | // Move characters |
@@ -3498,7 +3510,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3498 | public override void UnCombine(PhysicsScene pScene) | 3510 | public override void UnCombine(PhysicsScene pScene) |
3499 | { | 3511 | { |
3500 | IntPtr localGround = IntPtr.Zero; | 3512 | IntPtr localGround = IntPtr.Zero; |
3501 | //float[] localHeightfield; | 3513 | float[] localHeightfield; |
3502 | bool proceed = false; | 3514 | bool proceed = false; |
3503 | List<IntPtr> geomDestroyList = new List<IntPtr>(); | 3515 | List<IntPtr> geomDestroyList = new List<IntPtr>(); |
3504 | 3516 | ||
@@ -3510,7 +3522,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3510 | { | 3522 | { |
3511 | if (geom == localGround) | 3523 | if (geom == localGround) |
3512 | { | 3524 | { |
3513 | //localHeightfield = TerrainHeightFieldHeights[geom]; | 3525 | localHeightfield = TerrainHeightFieldHeights[geom]; |
3514 | proceed = true; | 3526 | proceed = true; |
3515 | } | 3527 | } |
3516 | else | 3528 | else |
@@ -3532,7 +3544,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3532 | // memory corruption | 3544 | // memory corruption |
3533 | if (TerrainHeightFieldHeights.ContainsKey(g)) | 3545 | if (TerrainHeightFieldHeights.ContainsKey(g)) |
3534 | { | 3546 | { |
3535 | //float[] removingHeightField = TerrainHeightFieldHeights[g]; | 3547 | float[] removingHeightField = TerrainHeightFieldHeights[g]; |
3536 | TerrainHeightFieldHeights.Remove(g); | 3548 | TerrainHeightFieldHeights.Remove(g); |
3537 | 3549 | ||
3538 | if (RegionTerrain.ContainsKey(g)) | 3550 | if (RegionTerrain.ContainsKey(g)) |
@@ -3544,10 +3556,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3544 | //removingHeightField = new float[0]; | 3556 | //removingHeightField = new float[0]; |
3545 | } | 3557 | } |
3546 | } | 3558 | } |
3559 | |||
3547 | } | 3560 | } |
3548 | else | 3561 | else |
3549 | { | 3562 | { |
3550 | m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); | 3563 | m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); |
3564 | |||
3551 | } | 3565 | } |
3552 | } | 3566 | } |
3553 | } | 3567 | } |