diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Prioritizer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Prioritizer.cs | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index e3ed905..4595a29 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -119,16 +119,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | 119 | ||
120 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) | 120 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) |
121 | { | 121 | { |
122 | return 1; | 122 | // And anything attached to this avatar gets top priority as well |
123 | if (entity is SceneObjectPart) | ||
124 | { | ||
125 | SceneObjectPart sop = (SceneObjectPart)entity; | ||
126 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | ||
127 | return 1; | ||
128 | } | ||
129 | |||
130 | return PriorityQueue.NumberOfImmediateQueues; // first queue past the immediate queues | ||
123 | } | 131 | } |
124 | 132 | ||
125 | private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) | 133 | private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) |
126 | { | 134 | { |
135 | // And anything attached to this avatar gets top priority as well | ||
136 | if (entity is SceneObjectPart) | ||
137 | { | ||
138 | SceneObjectPart sop = (SceneObjectPart)entity; | ||
139 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | ||
140 | return 1; | ||
141 | } | ||
142 | |||
127 | return ComputeDistancePriority(client,entity,false); | 143 | return ComputeDistancePriority(client,entity,false); |
128 | } | 144 | } |
129 | 145 | ||
130 | private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) | 146 | private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) |
131 | { | 147 | { |
148 | // And anything attached to this avatar gets top priority as well | ||
149 | if (entity is SceneObjectPart) | ||
150 | { | ||
151 | SceneObjectPart sop = (SceneObjectPart)entity; | ||
152 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | ||
153 | return 1; | ||
154 | } | ||
155 | |||
132 | return ComputeDistancePriority(client,entity,true); | 156 | return ComputeDistancePriority(client,entity,true); |
133 | } | 157 | } |
134 | 158 | ||
@@ -141,18 +165,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
141 | { | 165 | { |
142 | if (!presence.IsChildAgent) | 166 | if (!presence.IsChildAgent) |
143 | { | 167 | { |
168 | // All avatars other than our own go into pqueue 1 | ||
169 | if (entity is ScenePresence) | ||
170 | return 1; | ||
171 | |||
144 | if (entity is SceneObjectPart) | 172 | if (entity is SceneObjectPart) |
145 | { | 173 | { |
174 | // Attachments are high priority, | ||
175 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | ||
176 | return 1; | ||
177 | |||
146 | // Non physical prims are lower priority than physical prims | 178 | // Non physical prims are lower priority than physical prims |
147 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | 179 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; |
148 | if (physActor == null || !physActor.IsPhysical) | 180 | if (physActor == null || !physActor.IsPhysical) |
149 | pqueue++; | 181 | pqueue++; |
150 | |||
151 | // Attachments are high priority, | ||
152 | // MIC: shouldn't these already be in the highest priority queue already | ||
153 | // since their root position is same as the avatars? | ||
154 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | ||
155 | pqueue = 1; | ||
156 | } | 182 | } |
157 | } | 183 | } |
158 | } | 184 | } |
@@ -172,7 +198,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
172 | 198 | ||
173 | // m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); | 199 | // m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); |
174 | // throw new InvalidOperationException("Prioritization agent not defined"); | 200 | // throw new InvalidOperationException("Prioritization agent not defined"); |
175 | return Int32.MaxValue; | 201 | return PriorityQueue.NumberOfQueues - 1; |
176 | } | 202 | } |
177 | 203 | ||
178 | // Use group position for child prims, since we are putting child prims in | 204 | // Use group position for child prims, since we are putting child prims in |
@@ -197,8 +223,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | 223 | ||
198 | // And convert the distance to a priority queue, this computation gives queues | 224 | // And convert the distance to a priority queue, this computation gives queues |
199 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m | 225 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m |
200 | uint pqueue = 1; | 226 | uint pqueue = PriorityQueue.NumberOfImmediateQueues; |
201 | for (int i = 0; i < 8; i++) | 227 | uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; |
228 | |||
229 | for (int i = 0; i < queues - 1; i++) | ||
202 | { | 230 | { |
203 | if (distance < 10 * Math.Pow(2.0,i)) | 231 | if (distance < 10 * Math.Pow(2.0,i)) |
204 | break; | 232 | break; |