diff options
author | Justin Clark-Casey (justincc) | 2010-06-08 15:32:18 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-06-08 15:32:18 +0100 |
commit | db73b1c64e6f3a4ff139d89e2195327ffc2e09f5 (patch) | |
tree | 3cf04edaa107e4a55e176d5463b64a935ca92cca | |
parent | Reduce number of full updates sent on region crossing for attachments/huds to... (diff) | |
download | opensim-SC-db73b1c64e6f3a4ff139d89e2195327ffc2e09f5.zip opensim-SC-db73b1c64e6f3a4ff139d89e2195327ffc2e09f5.tar.gz opensim-SC-db73b1c64e6f3a4ff139d89e2195327ffc2e09f5.tar.bz2 opensim-SC-db73b1c64e6f3a4ff139d89e2195327ffc2e09f5.tar.xz |
Adjust object update priorities such that root prims are sent to the viewer before child prims.
This was originally a fix for huds, since child prims fail to display if the viewer doesn't receive the root prim update first.
However, on the advice of jhurliman, this has been done for all objects, both ordinary and attachments.
The separate mechanism in LLClientView which prevents child prim updates being sent out first is still present temporarily.
This is a foreport of the equivalent fix in 0.6.9-post-fixes, though that was for attachments only.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Prioritizer.cs | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 1eb0c28..4780cdd 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using log4net; | 3 | using log4net; |
4 | using Nini.Config; | 4 | using Nini.Config; |
@@ -32,6 +32,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
32 | public class Prioritizer | 32 | public class Prioritizer |
33 | { | 33 | { |
34 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 34 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
35 | |||
36 | /// <summary> | ||
37 | /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the | ||
38 | /// viewer before child prim updates. | ||
39 | /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up | ||
40 | /// being double. We do it both ways so that there is a still a priority delta even if the priority is already | ||
41 | /// double.MinValue or double.MaxValue. | ||
42 | /// </summary> | ||
43 | private double m_childPrimAdjustmentFactor = 0.05; | ||
35 | 44 | ||
36 | private Scene m_scene; | 45 | private Scene m_scene; |
37 | 46 | ||
@@ -42,21 +51,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
42 | 51 | ||
43 | public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) | 52 | public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) |
44 | { | 53 | { |
54 | double priority = 0; | ||
55 | |||
45 | switch (m_scene.UpdatePrioritizationScheme) | 56 | switch (m_scene.UpdatePrioritizationScheme) |
46 | { | 57 | { |
47 | case UpdatePrioritizationSchemes.Time: | 58 | case UpdatePrioritizationSchemes.Time: |
48 | return GetPriorityByTime(); | 59 | priority = GetPriorityByTime(); |
60 | break; | ||
49 | case UpdatePrioritizationSchemes.Distance: | 61 | case UpdatePrioritizationSchemes.Distance: |
50 | return GetPriorityByDistance(client, entity); | 62 | priority = GetPriorityByDistance(client, entity); |
63 | break; | ||
51 | case UpdatePrioritizationSchemes.SimpleAngularDistance: | 64 | case UpdatePrioritizationSchemes.SimpleAngularDistance: |
52 | return GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance | 65 | priority = GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance |
66 | break; | ||
53 | case UpdatePrioritizationSchemes.FrontBack: | 67 | case UpdatePrioritizationSchemes.FrontBack: |
54 | return GetPriorityByFrontBack(client, entity); | 68 | priority = GetPriorityByFrontBack(client, entity); |
69 | break; | ||
55 | case UpdatePrioritizationSchemes.BestAvatarResponsiveness: | 70 | case UpdatePrioritizationSchemes.BestAvatarResponsiveness: |
56 | return GetPriorityByBestAvatarResponsiveness(client, entity); | 71 | priority = GetPriorityByBestAvatarResponsiveness(client, entity); |
72 | break; | ||
57 | default: | 73 | default: |
58 | throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); | 74 | throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); |
75 | break; | ||
59 | } | 76 | } |
77 | |||
78 | // Adjust priority so that root prims are sent to the viewer first. This is especially important for | ||
79 | // attachments acting as huds, since current viewers fail to display hud child prims if their updates | ||
80 | // arrive before the root one. | ||
81 | if (entity is SceneObjectPart) | ||
82 | { | ||
83 | SceneObjectPart sop = ((SceneObjectPart)entity); | ||
84 | |||
85 | if (sop.IsRoot) | ||
86 | { | ||
87 | if (priority >= double.MinValue + m_childPrimAdjustmentFactor) | ||
88 | priority -= m_childPrimAdjustmentFactor; | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | if (priority <= double.MaxValue - m_childPrimAdjustmentFactor) | ||
93 | priority += m_childPrimAdjustmentFactor; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | return priority; | ||
60 | } | 98 | } |
61 | 99 | ||
62 | private double GetPriorityByTime() | 100 | private double GetPriorityByTime() |