diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index cb304b6..a4690ba 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | using System; | 27 | using System; |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Linq; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using System.Runtime.InteropServices; | 31 | using System.Runtime.InteropServices; |
31 | using System.Text; | 32 | using System.Text; |
@@ -87,7 +88,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
87 | public delegate void PreStepAction(float timeStep); | 88 | public delegate void PreStepAction(float timeStep); |
88 | public delegate void PostStepAction(float timeStep); | 89 | public delegate void PostStepAction(float timeStep); |
89 | public event PreStepAction BeforeStep; | 90 | public event PreStepAction BeforeStep; |
90 | public event PreStepAction AfterStep; | 91 | public event PostStepAction AfterStep; |
91 | 92 | ||
92 | // A value of the time now so all the collision and update routines do not have to get their own | 93 | // A value of the time now so all the collision and update routines do not have to get their own |
93 | // Set to 'now' just before all the prims and actors are called for collisions and updates | 94 | // Set to 'now' just before all the prims and actors are called for collisions and updates |
@@ -697,7 +698,21 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
697 | 698 | ||
698 | public override Dictionary<uint, float> GetTopColliders() | 699 | public override Dictionary<uint, float> GetTopColliders() |
699 | { | 700 | { |
700 | return new Dictionary<uint, float>(); | 701 | Dictionary<uint, float> topColliders; |
702 | |||
703 | lock (PhysObjects) | ||
704 | { | ||
705 | foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects) | ||
706 | { | ||
707 | kvp.Value.ComputeCollisionScore(); | ||
708 | } | ||
709 | |||
710 | List<BSPhysObject> orderedPrims = new List<BSPhysObject>(PhysObjects.Values); | ||
711 | orderedPrims.OrderByDescending(p => p.CollisionScore); | ||
712 | topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); | ||
713 | } | ||
714 | |||
715 | return topColliders; | ||
701 | } | 716 | } |
702 | 717 | ||
703 | public override bool IsThreaded { get { return false; } } | 718 | public override bool IsThreaded { get { return false; } } |
@@ -748,7 +763,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
748 | 763 | ||
749 | private void TriggerPostStepEvent(float timeStep) | 764 | private void TriggerPostStepEvent(float timeStep) |
750 | { | 765 | { |
751 | PreStepAction actions = AfterStep; | 766 | PostStepAction actions = AfterStep; |
752 | if (actions != null) | 767 | if (actions != null) |
753 | actions(timeStep); | 768 | actions(timeStep); |
754 | 769 | ||
@@ -840,7 +855,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
840 | { | 855 | { |
841 | DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); | 856 | DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); |
842 | m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); | 857 | m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); |
843 | Util.PrintCallStack(DetailLog); | 858 | // Util.PrintCallStack(DetailLog); |
844 | } | 859 | } |
845 | return InTaintTime; | 860 | return InTaintTime; |
846 | } | 861 | } |