diff options
author | Melanie | 2011-12-14 19:50:43 +0000 |
---|---|---|
committer | Melanie | 2011-12-14 19:50:43 +0000 |
commit | 69f29cb53e2b622a64a8fb46d0afea0700a3f35d (patch) | |
tree | 501f9a0590657353cb1305e9414fe8f8b52bbc0a /OpenSim/Region | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Simplify some manipulation of _taintedActors in OdeScene (diff) | |
download | opensim-SC-69f29cb53e2b622a64a8fb46d0afea0700a3f35d.zip opensim-SC-69f29cb53e2b622a64a8fb46d0afea0700a3f35d.tar.gz opensim-SC-69f29cb53e2b622a64a8fb46d0afea0700a3f35d.tar.bz2 opensim-SC-69f29cb53e2b622a64a8fb46d0afea0700a3f35d.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 78 |
1 files changed, 20 insertions, 58 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index c1a3e61..a6c2eca 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -205,27 +205,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
205 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); | 205 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); |
206 | 206 | ||
207 | /// <summary> | 207 | /// <summary> |
208 | /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH | 208 | /// Prims that the simulator has created/deleted/updated and so need updating in ODE. |
209 | /// </summary> | 209 | /// </summary> |
210 | private readonly Object _taintedPrimLock = new Object(); | 210 | private readonly HashSet<OdePrim> _taintedPrims = new HashSet<OdePrim>(); |
211 | |||
212 | /// <summary> | ||
213 | /// List of tainted prims. | ||
214 | /// </summary> | ||
215 | /// <remarks> | ||
216 | /// A tainted prim is one that has taints to process before performing any other operations. The list is | ||
217 | /// cleared after processing. | ||
218 | /// </remarks> | ||
219 | private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>(); | ||
220 | |||
221 | /// <summary> | ||
222 | /// HashSet of tainted prims. | ||
223 | /// </summary> | ||
224 | /// <remarks> | ||
225 | /// A tainted prim is one that has taints to process before performing any other operations. The hashset is | ||
226 | /// cleared after processing. | ||
227 | /// </remarks> | ||
228 | private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>(); | ||
229 | 211 | ||
230 | /// <summary> | 212 | /// <summary> |
231 | /// Record a character that has taints to be processed. | 213 | /// Record a character that has taints to be processed. |
@@ -767,7 +749,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
767 | } | 749 | } |
768 | catch (AccessViolationException) | 750 | catch (AccessViolationException) |
769 | { | 751 | { |
770 | m_log.Warn("[ODE SCENE]: Unable to collide test a space"); | 752 | m_log.Error("[ODE SCENE]: Unable to collide test a space"); |
771 | return; | 753 | return; |
772 | } | 754 | } |
773 | //Colliding a space or a geom with a space or a geom. so drill down | 755 | //Colliding a space or a geom with a space or a geom. so drill down |
@@ -829,7 +811,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
829 | } | 811 | } |
830 | catch (Exception e) | 812 | catch (Exception e) |
831 | { | 813 | { |
832 | m_log.WarnFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message); | 814 | m_log.ErrorFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message); |
833 | return; | 815 | return; |
834 | } | 816 | } |
835 | 817 | ||
@@ -1554,7 +1536,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1554 | } | 1536 | } |
1555 | catch (AccessViolationException) | 1537 | catch (AccessViolationException) |
1556 | { | 1538 | { |
1557 | m_log.WarnFormat("[ODE SCENE]: Unable to space collide {0}", Name); | 1539 | m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name); |
1558 | } | 1540 | } |
1559 | 1541 | ||
1560 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); | 1542 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); |
@@ -1585,13 +1567,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1585 | removeprims = new List<OdePrim>(); | 1567 | removeprims = new List<OdePrim>(); |
1586 | } | 1568 | } |
1587 | removeprims.Add(chr); | 1569 | removeprims.Add(chr); |
1588 | m_log.Debug("[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); | 1570 | m_log.Error( |
1571 | "[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); | ||
1589 | } | 1572 | } |
1590 | } | 1573 | } |
1591 | } | 1574 | } |
1592 | catch (AccessViolationException) | 1575 | catch (AccessViolationException) |
1593 | { | 1576 | { |
1594 | m_log.Warn("[ODE SCENE]: Unable to space collide"); | 1577 | m_log.Error("[ODE SCENE]: Unable to space collide"); |
1595 | } | 1578 | } |
1596 | } | 1579 | } |
1597 | } | 1580 | } |
@@ -2621,29 +2604,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2621 | if (actor is OdePrim) | 2604 | if (actor is OdePrim) |
2622 | { | 2605 | { |
2623 | OdePrim taintedprim = ((OdePrim)actor); | 2606 | OdePrim taintedprim = ((OdePrim)actor); |
2624 | lock (_taintedPrimLock) | 2607 | lock (_taintedPrims) |
2625 | { | 2608 | _taintedPrims.Add(taintedprim); |
2626 | if (!(_taintedPrimH.Contains(taintedprim))) | ||
2627 | { | ||
2628 | #if SPAM | ||
2629 | Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | ||
2630 | #endif | ||
2631 | _taintedPrimH.Add(taintedprim); // HashSet for searching | ||
2632 | _taintedPrimL.Add(taintedprim); // List for ordered readout | ||
2633 | } | ||
2634 | } | ||
2635 | } | 2609 | } |
2636 | else if (actor is OdeCharacter) | 2610 | else if (actor is OdeCharacter) |
2637 | { | 2611 | { |
2638 | OdeCharacter taintedchar = ((OdeCharacter)actor); | 2612 | OdeCharacter taintedchar = ((OdeCharacter)actor); |
2639 | lock (_taintedActors) | 2613 | lock (_taintedActors) |
2640 | { | 2614 | { |
2641 | if (!(_taintedActors.Contains(taintedchar))) | 2615 | _taintedActors.Add(taintedchar); |
2642 | { | 2616 | if (taintedchar.bad) |
2643 | _taintedActors.Add(taintedchar); | 2617 | m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid); |
2644 | if (taintedchar.bad) | ||
2645 | m_log.DebugFormat("[ODE SCENE]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid); | ||
2646 | } | ||
2647 | } | 2618 | } |
2648 | } | 2619 | } |
2649 | } | 2620 | } |
@@ -2740,19 +2711,15 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2740 | { | 2711 | { |
2741 | lock (_taintedActors) | 2712 | lock (_taintedActors) |
2742 | { | 2713 | { |
2743 | if (_taintedActors.Count > 0) | 2714 | foreach (OdeCharacter character in _taintedActors) |
2744 | { | 2715 | character.ProcessTaints(); |
2745 | foreach (OdeCharacter character in _taintedActors) | ||
2746 | character.ProcessTaints(); | ||
2747 | 2716 | ||
2748 | if (_taintedActors.Count > 0) | 2717 | _taintedActors.Clear(); |
2749 | _taintedActors.Clear(); | ||
2750 | } | ||
2751 | } | 2718 | } |
2752 | 2719 | ||
2753 | lock (_taintedPrimLock) | 2720 | lock (_taintedPrims) |
2754 | { | 2721 | { |
2755 | foreach (OdePrim prim in _taintedPrimL) | 2722 | foreach (OdePrim prim in _taintedPrims) |
2756 | { | 2723 | { |
2757 | if (prim.m_taintremove) | 2724 | if (prim.m_taintremove) |
2758 | { | 2725 | { |
@@ -2777,12 +2744,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2777 | if (SupportsNINJAJoints) | 2744 | if (SupportsNINJAJoints) |
2778 | SimulatePendingNINJAJoints(); | 2745 | SimulatePendingNINJAJoints(); |
2779 | 2746 | ||
2780 | if (_taintedPrimL.Count > 0) | 2747 | _taintedPrims.Clear(); |
2781 | { | ||
2782 | //Console.WriteLine("Simulate calls Clear of _taintedPrim list"); | ||
2783 | _taintedPrimH.Clear(); | ||
2784 | _taintedPrimL.Clear(); | ||
2785 | } | ||
2786 | } | 2748 | } |
2787 | 2749 | ||
2788 | // Move characters | 2750 | // Move characters |
@@ -2854,7 +2816,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2854 | foreach (OdeCharacter actor in _characters) | 2816 | foreach (OdeCharacter actor in _characters) |
2855 | { | 2817 | { |
2856 | if (actor.bad) | 2818 | if (actor.bad) |
2857 | m_log.WarnFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); | 2819 | m_log.ErrorFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); |
2858 | 2820 | ||
2859 | actor.UpdatePositionAndVelocity(defects); | 2821 | actor.UpdatePositionAndVelocity(defects); |
2860 | } | 2822 | } |