diff options
author | Justin Clark-Casey (justincc) | 2012-06-01 00:26:11 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-01 00:26:11 +0100 |
commit | 878b67b333320070f643dfdd11e0a9c6ff453543 (patch) | |
tree | 40b1a6e59821ccd91e3c14be543b02bbfd35cbb8 /OpenSim/Region/Physics | |
parent | Add an optional mechanism for physics modules to collect and return arbitrary... (diff) | |
download | opensim-SC_OLD-878b67b333320070f643dfdd11e0a9c6ff453543.zip opensim-SC_OLD-878b67b333320070f643dfdd11e0a9c6ff453543.tar.gz opensim-SC_OLD-878b67b333320070f643dfdd11e0a9c6ff453543.tar.bz2 opensim-SC_OLD-878b67b333320070f643dfdd11e0a9c6ff453543.tar.xz |
Fix OdeScene.GetTopColliders() to return the top 25 colliders rather than the first 25 that had non-zero collision scores.
Also zeros collisions scores on all prims after report collection, not just the top 25.
As before, this collision scores are only reset after a report is requested, which may give unrealistic numbers on the first request.
So to see more realistic scores, ignore the first report and then refresh the request after a couple of seconds or so.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index fa65945..25b3266 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -30,20 +30,21 @@ | |||
30 | 30 | ||
31 | using System; | 31 | using System; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using System.Diagnostics; | ||
34 | using System.IO; | ||
35 | using System.Linq; | ||
33 | using System.Reflection; | 36 | using System.Reflection; |
34 | using System.Runtime.InteropServices; | 37 | using System.Runtime.InteropServices; |
35 | using System.Threading; | 38 | using System.Threading; |
36 | using System.IO; | ||
37 | using System.Diagnostics; | ||
38 | using log4net; | 39 | using log4net; |
39 | using Nini.Config; | 40 | using Nini.Config; |
40 | using Ode.NET; | 41 | using Ode.NET; |
42 | using OpenMetaverse; | ||
41 | #if USE_DRAWSTUFF | 43 | #if USE_DRAWSTUFF |
42 | using Drawstuff.NET; | 44 | using Drawstuff.NET; |
43 | #endif | 45 | #endif |
44 | using OpenSim.Framework; | 46 | using OpenSim.Framework; |
45 | using OpenSim.Region.Physics.Manager; | 47 | using OpenSim.Region.Physics.Manager; |
46 | using OpenMetaverse; | ||
47 | 48 | ||
48 | namespace OpenSim.Region.Physics.OdePlugin | 49 | namespace OpenSim.Region.Physics.OdePlugin |
49 | { | 50 | { |
@@ -3868,26 +3869,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3868 | 3869 | ||
3869 | public override Dictionary<uint, float> GetTopColliders() | 3870 | public override Dictionary<uint, float> GetTopColliders() |
3870 | { | 3871 | { |
3871 | Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); | 3872 | Dictionary<uint, float> topColliders; |
3872 | int cnt = 0; | 3873 | |
3873 | lock (_prims) | 3874 | lock (_prims) |
3874 | { | 3875 | { |
3875 | foreach (OdePrim prm in _prims) | 3876 | List<OdePrim> orderedPrims = new List<OdePrim>(_prims); |
3876 | { | 3877 | orderedPrims.OrderByDescending(p => p.CollisionScore).Take(25); |
3877 | if (prm.CollisionScore > 0) | 3878 | topColliders = orderedPrims.ToDictionary(p => p.LocalID, p => p.CollisionScore); |
3878 | { | 3879 | |
3879 | returncolliders.Add(prm.LocalID, prm.CollisionScore); | 3880 | foreach (OdePrim p in _prims) |
3880 | cnt++; | 3881 | p.CollisionScore = 0; |
3881 | prm.CollisionScore = 0f; | ||
3882 | if (cnt > 25) | ||
3883 | { | ||
3884 | break; | ||
3885 | } | ||
3886 | } | ||
3887 | } | ||
3888 | } | 3882 | } |
3889 | 3883 | ||
3890 | return returncolliders; | 3884 | return topColliders; |
3891 | } | 3885 | } |
3892 | 3886 | ||
3893 | public override bool SupportsRayCast() | 3887 | public override bool SupportsRayCast() |