diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 94223d8..b7afa27 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 |
@@ -3488,7 +3500,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3488 | { | 3500 | { |
3489 | if (geom == localGround) | 3501 | if (geom == localGround) |
3490 | { | 3502 | { |
3491 | //localHeightfield = TerrainHeightFieldHeights[geom]; | 3503 | localHeightfield = TerrainHeightFieldHeights[geom]; |
3492 | proceed = true; | 3504 | proceed = true; |
3493 | } | 3505 | } |
3494 | else | 3506 | else |
@@ -3510,7 +3522,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3510 | // memory corruption | 3522 | // memory corruption |
3511 | if (TerrainHeightFieldHeights.ContainsKey(g)) | 3523 | if (TerrainHeightFieldHeights.ContainsKey(g)) |
3512 | { | 3524 | { |
3513 | //float[] removingHeightField = TerrainHeightFieldHeights[g]; | 3525 | float[] removingHeightField = TerrainHeightFieldHeights[g]; |
3514 | TerrainHeightFieldHeights.Remove(g); | 3526 | TerrainHeightFieldHeights.Remove(g); |
3515 | 3527 | ||
3516 | if (RegionTerrain.ContainsKey(g)) | 3528 | if (RegionTerrain.ContainsKey(g)) |
@@ -3519,17 +3531,27 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3519 | } | 3531 | } |
3520 | 3532 | ||
3521 | d.GeomDestroy(g); | 3533 | d.GeomDestroy(g); |
3522 | //removingHeightField = new float[0]; | 3534 | removingHeightField = new float[0]; |
3523 | } | 3535 | |
3536 | |||
3537 | |||
3538 | } | ||
3539 | |||
3524 | } | 3540 | } |
3541 | |||
3525 | } | 3542 | } |
3526 | else | 3543 | else |
3527 | { | 3544 | { |
3528 | m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); | 3545 | m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); |
3546 | |||
3529 | } | 3547 | } |
3530 | } | 3548 | |
3549 | } | ||
3550 | |||
3531 | } | 3551 | } |
3532 | } | 3552 | } |
3553 | |||
3554 | |||
3533 | 3555 | ||
3534 | public override void SetWaterLevel(float baseheight) | 3556 | public override void SetWaterLevel(float baseheight) |
3535 | { | 3557 | { |