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 083b7db..78831f8 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>(); |
@@ -2112,6 +2113,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2112 | /// <param name="prim"></param> | 2113 | /// <param name="prim"></param> |
2113 | public void RemovePrimThreadLocked(OdePrim prim) | 2114 | public void RemovePrimThreadLocked(OdePrim prim) |
2114 | { | 2115 | { |
2116 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); | ||
2115 | lock (prim) | 2117 | lock (prim) |
2116 | { | 2118 | { |
2117 | remCollisionEventReporting(prim); | 2119 | remCollisionEventReporting(prim); |
@@ -2559,11 +2561,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2559 | if (prim is OdePrim) | 2561 | if (prim is OdePrim) |
2560 | { | 2562 | { |
2561 | OdePrim taintedprim = ((OdePrim) prim); | 2563 | OdePrim taintedprim = ((OdePrim) prim); |
2562 | lock (_taintedPrim) | 2564 | lock (_taintedPrimH) |
2563 | { | 2565 | { |
2564 | if (!(_taintedPrim.Contains(taintedprim))) | 2566 | if (!(_taintedPrimH.Contains(taintedprim))) |
2565 | _taintedPrim.Add(taintedprim); | 2567 | { |
2566 | } | 2568 | //Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName); |
2569 | _taintedPrimH.Add(taintedprim); // HashSet for searching | ||
2570 | _taintedPrimL.Add(taintedprim); // List for ordered readout | ||
2571 | } | ||
2572 | } | ||
2567 | return; | 2573 | return; |
2568 | } | 2574 | } |
2569 | else if (prim is OdeCharacter) | 2575 | else if (prim is OdeCharacter) |
@@ -2599,7 +2605,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2599 | float fps = 0; | 2605 | float fps = 0; |
2600 | //m_log.Info(timeStep.ToString()); | 2606 | //m_log.Info(timeStep.ToString()); |
2601 | step_time += timeStep; | 2607 | step_time += timeStep; |
2602 | 2608 | ||
2603 | // If We're loaded down by something else, | 2609 | // If We're loaded down by something else, |
2604 | // or debugging with the Visual Studio project on pause | 2610 | // or debugging with the Visual Studio project on pause |
2605 | // skip a few frames to catch up gracefully. | 2611 | // skip a few frames to catch up gracefully. |
@@ -2679,16 +2685,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2679 | // Modify other objects in the scene. | 2685 | // Modify other objects in the scene. |
2680 | processedtaints = false; | 2686 | processedtaints = false; |
2681 | 2687 | ||
2682 | lock (_taintedPrim) | 2688 | lock (_taintedPrimL) |
2683 | { | 2689 | { |
2684 | foreach (OdePrim prim in _taintedPrim) | 2690 | foreach (OdePrim prim in _taintedPrimL) |
2685 | { | 2691 | { |
2692 | |||
2693 | |||
2686 | if (prim.m_taintremove) | 2694 | if (prim.m_taintremove) |
2687 | { | 2695 | { |
2696 | //Console.WriteLine("Simulate calls RemovePrimThreadLocked"); | ||
2688 | RemovePrimThreadLocked(prim); | 2697 | RemovePrimThreadLocked(prim); |
2689 | } | 2698 | } |
2690 | else | 2699 | else |
2691 | { | 2700 | { |
2701 | //Console.WriteLine("Simulate calls ProcessTaints"); | ||
2692 | prim.ProcessTaints(timeStep); | 2702 | prim.ProcessTaints(timeStep); |
2693 | } | 2703 | } |
2694 | processedtaints = true; | 2704 | processedtaints = true; |
@@ -2878,7 +2888,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2878 | } | 2888 | } |
2879 | 2889 | ||
2880 | if (processedtaints) | 2890 | if (processedtaints) |
2881 | _taintedPrim.Clear(); | 2891 | //Console.WriteLine("Simulate calls Clear of _taintedPrim list"); |
2892 | _taintedPrimH.Clear(); | ||
2893 | _taintedPrimL.Clear(); | ||
2882 | } | 2894 | } |
2883 | 2895 | ||
2884 | // Move characters | 2896 | // Move characters |
@@ -3477,7 +3489,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3477 | public override void UnCombine(PhysicsScene pScene) | 3489 | public override void UnCombine(PhysicsScene pScene) |
3478 | { | 3490 | { |
3479 | IntPtr localGround = IntPtr.Zero; | 3491 | IntPtr localGround = IntPtr.Zero; |
3480 | //float[] localHeightfield; | 3492 | float[] localHeightfield; |
3481 | bool proceed = false; | 3493 | bool proceed = false; |
3482 | List<IntPtr> geomDestroyList = new List<IntPtr>(); | 3494 | List<IntPtr> geomDestroyList = new List<IntPtr>(); |
3483 | 3495 | ||
@@ -3489,7 +3501,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3489 | { | 3501 | { |
3490 | if (geom == localGround) | 3502 | if (geom == localGround) |
3491 | { | 3503 | { |
3492 | //localHeightfield = TerrainHeightFieldHeights[geom]; | 3504 | localHeightfield = TerrainHeightFieldHeights[geom]; |
3493 | proceed = true; | 3505 | proceed = true; |
3494 | } | 3506 | } |
3495 | else | 3507 | else |
@@ -3511,7 +3523,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3511 | // memory corruption | 3523 | // memory corruption |
3512 | if (TerrainHeightFieldHeights.ContainsKey(g)) | 3524 | if (TerrainHeightFieldHeights.ContainsKey(g)) |
3513 | { | 3525 | { |
3514 | //float[] removingHeightField = TerrainHeightFieldHeights[g]; | 3526 | float[] removingHeightField = TerrainHeightFieldHeights[g]; |
3515 | TerrainHeightFieldHeights.Remove(g); | 3527 | TerrainHeightFieldHeights.Remove(g); |
3516 | 3528 | ||
3517 | if (RegionTerrain.ContainsKey(g)) | 3529 | if (RegionTerrain.ContainsKey(g)) |
@@ -3523,10 +3535,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3523 | //removingHeightField = new float[0]; | 3535 | //removingHeightField = new float[0]; |
3524 | } | 3536 | } |
3525 | } | 3537 | } |
3538 | |||
3526 | } | 3539 | } |
3527 | else | 3540 | else |
3528 | { | 3541 | { |
3529 | m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); | 3542 | m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); |
3543 | |||
3530 | } | 3544 | } |
3531 | } | 3545 | } |
3532 | } | 3546 | } |