diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Prioritizer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Prioritizer.cs | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index ddae073..c0405ad 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -91,6 +91,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
91 | return 0; | 91 | return 0; |
92 | 92 | ||
93 | uint priority; | 93 | uint priority; |
94 | |||
95 | |||
96 | // HACK | ||
97 | return GetPriorityByBestAvatarResponsiveness(client, entity); | ||
98 | |||
94 | 99 | ||
95 | switch (m_scene.UpdatePrioritizationScheme) | 100 | switch (m_scene.UpdatePrioritizationScheme) |
96 | { | 101 | { |
@@ -157,30 +162,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
157 | 162 | ||
158 | private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) | 163 | private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) |
159 | { | 164 | { |
160 | uint pqueue = ComputeDistancePriority(client,entity,false); | 165 | uint pqueue = 2; // keep compiler happy |
161 | 166 | ||
162 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); | 167 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); |
163 | if (presence != null) | 168 | if (presence != null) |
164 | { | 169 | { |
165 | if (!presence.IsChildAgent) | 170 | // All avatars other than our own go into pqueue 1 |
171 | if (entity is ScenePresence) | ||
172 | return 1; | ||
173 | |||
174 | if (entity is SceneObjectPart) | ||
166 | { | 175 | { |
167 | // All avatars other than our own go into pqueue 1 | 176 | // Attachments are high priority, |
168 | if (entity is ScenePresence) | 177 | if (((SceneObjectPart)entity).ParentGroup.IsAttachment) |
169 | return 1; | 178 | return 2; |
170 | 179 | ||
171 | if (entity is SceneObjectPart) | 180 | pqueue = ComputeDistancePriority(client, entity, false); |
172 | { | 181 | |
173 | // Attachments are high priority, | 182 | // Non physical prims are lower priority than physical prims |
174 | if (((SceneObjectPart)entity).ParentGroup.IsAttachment) | 183 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; |
175 | return 1; | 184 | if (physActor == null || !physActor.IsPhysical) |
176 | 185 | pqueue++; | |
177 | // Non physical prims are lower priority than physical prims | ||
178 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | ||
179 | if (physActor == null || !physActor.IsPhysical) | ||
180 | pqueue++; | ||
181 | } | ||
182 | } | 186 | } |
183 | } | 187 | } |
188 | else | ||
189 | pqueue = ComputeDistancePriority(client, entity, false); | ||
184 | 190 | ||
185 | return pqueue; | 191 | return pqueue; |
186 | } | 192 | } |
@@ -227,16 +233,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
227 | 233 | ||
228 | // And convert the distance to a priority queue, this computation gives queues | 234 | // And convert the distance to a priority queue, this computation gives queues |
229 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m | 235 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m |
230 | uint pqueue = PriorityQueue.NumberOfImmediateQueues; | 236 | uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue |
231 | uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; | 237 | uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; |
232 | 238 | /* | |
233 | for (int i = 0; i < queues - 1; i++) | 239 | for (int i = 0; i < queues - 1; i++) |
234 | { | 240 | { |
235 | if (distance < 30 * Math.Pow(2.0,i)) | 241 | if (distance < 30 * Math.Pow(2.0,i)) |
236 | break; | 242 | break; |
237 | pqueue++; | 243 | pqueue++; |
238 | } | 244 | } |
239 | 245 | */ | |
246 | if (distance > 10f) | ||
247 | { | ||
248 | float tmp = (float)Math.Log((double)distance) * 1.4426950408889634073599246810019f - 3.3219280948873623478703194294894f; | ||
249 | // for a map identical to original: | ||
250 | // now | ||
251 | // 1st constant is 1/(log(2)) (natural log) so we get log2(distance) | ||
252 | // 2st constant makes it be log2(distance/10) | ||
253 | pqueue += (uint)tmp; | ||
254 | if (pqueue > queues - 1) | ||
255 | pqueue = queues - 1; | ||
256 | } | ||
257 | |||
240 | // If this is a root agent, then determine front & back | 258 | // If this is a root agent, then determine front & back |
241 | // Bump up the priority queue (drop the priority) for any objects behind the avatar | 259 | // Bump up the priority queue (drop the priority) for any objects behind the avatar |
242 | if (useFrontBack && ! presence.IsChildAgent) | 260 | if (useFrontBack && ! presence.IsChildAgent) |