diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4775b1f..817ed43 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -350,6 +350,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
350 | protected int m_reprioritizationLastTime; | 350 | protected int m_reprioritizationLastTime; |
351 | protected bool m_reprioritizationBusy; | 351 | protected bool m_reprioritizationBusy; |
352 | protected Vector3 m_reprioritizationLastPosition; | 352 | protected Vector3 m_reprioritizationLastPosition; |
353 | protected float m_reprioritizationLastDrawDistance; | ||
353 | 354 | ||
354 | private Quaternion m_headrotation = Quaternion.Identity; | 355 | private Quaternion m_headrotation = Quaternion.Identity; |
355 | 356 | ||
@@ -1047,6 +1048,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1047 | AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = | 1048 | AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = |
1048 | m_reprioritizationLastPosition = ControllingClient.StartPos; | 1049 | m_reprioritizationLastPosition = ControllingClient.StartPos; |
1049 | 1050 | ||
1051 | m_reprioritizationLastDrawDistance = DrawDistance; | ||
1052 | |||
1050 | // disable updates workjobs for now | 1053 | // disable updates workjobs for now |
1051 | childUpdatesBusy = true; | 1054 | childUpdatesBusy = true; |
1052 | m_reprioritizationBusy = true; | 1055 | m_reprioritizationBusy = true; |
@@ -2130,6 +2133,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2130 | 2133 | ||
2131 | // priority uses avatar position only | 2134 | // priority uses avatar position only |
2132 | m_reprioritizationLastPosition = AbsolutePosition; | 2135 | m_reprioritizationLastPosition = AbsolutePosition; |
2136 | m_reprioritizationLastDrawDistance = DrawDistance; | ||
2133 | m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it | 2137 | m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it |
2134 | m_reprioritizationBusy = false; | 2138 | m_reprioritizationBusy = false; |
2135 | 2139 | ||
@@ -3986,24 +3990,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3986 | if(m_reprioritizationBusy) | 3990 | if(m_reprioritizationBusy) |
3987 | return; | 3991 | return; |
3988 | 3992 | ||
3993 | float limit = Scene.ReprioritizationDistance; | ||
3994 | bool byDrawdistance = Scene.ObjectsCullingByDistance; | ||
3995 | if(byDrawdistance) | ||
3996 | byDrawdistance = (Math.Abs(DrawDistance-m_reprioritizationLastDrawDistance) > 0.5f * limit); | ||
3997 | |||
3989 | int tdiff = Util.EnvironmentTickCountSubtract(m_reprioritizationLastTime); | 3998 | int tdiff = Util.EnvironmentTickCountSubtract(m_reprioritizationLastTime); |
3990 | if(tdiff < Scene.ReprioritizationInterval) | 3999 | if(!byDrawdistance && tdiff < Scene.ReprioritizationInterval) |
3991 | return; | 4000 | return; |
3992 | // priority uses avatar position | 4001 | // priority uses avatar position |
3993 | Vector3 pos = AbsolutePosition; | 4002 | Vector3 pos = AbsolutePosition; |
3994 | Vector3 diff = pos - m_reprioritizationLastPosition; | 4003 | Vector3 diff = pos - m_reprioritizationLastPosition; |
3995 | float limit; | ||
3996 | if(IsChildAgent) | ||
3997 | limit = (float)Scene.ChildReprioritizationDistance; | ||
3998 | else | ||
3999 | limit = (float)Scene.RootReprioritizationDistance; | ||
4000 | |||
4001 | limit *= limit; | 4004 | limit *= limit; |
4002 | if (diff.LengthSquared() < limit) | 4005 | if (!byDrawdistance && diff.LengthSquared() < limit) |
4003 | return; | 4006 | return; |
4004 | 4007 | ||
4005 | m_reprioritizationBusy = true; | 4008 | m_reprioritizationBusy = true; |
4006 | m_reprioritizationLastPosition = pos; | 4009 | m_reprioritizationLastPosition = pos; |
4010 | m_reprioritizationLastDrawDistance = DrawDistance; | ||
4007 | 4011 | ||
4008 | Util.FireAndForget( | 4012 | Util.FireAndForget( |
4009 | o => | 4013 | o => |