aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Prioritizer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Prioritizer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs30
1 files changed, 15 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 97009a0..cbf40c8 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -35,7 +35,7 @@ using OpenSim.Region.PhysicsModules.SharedBase;
35 35
36/* 36/*
37 * Steps to add a new prioritization policy: 37 * Steps to add a new prioritization policy:
38 * 38 *
39 * - Add a new value to the UpdatePrioritizationSchemes enum. 39 * - Add a new value to the UpdatePrioritizationSchemes enum.
40 * - Specify this new value in the [InterestManagement] section of your 40 * - Specify this new value in the [InterestManagement] section of your
41 * OpenSim.ini. The name in the config file must match the enum value name 41 * OpenSim.ini. The name in the config file must match the enum value name
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Scenes
59 public class Prioritizer 59 public class Prioritizer
60 { 60 {
61 private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
62 62
63 private Scene m_scene; 63 private Scene m_scene;
64 64
65 public Prioritizer(Scene scene) 65 public Prioritizer(Scene scene)
@@ -91,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes
91 return 0; 91 return 0;
92 92
93 uint priority; 93 uint priority;
94 94
95 switch (m_scene.UpdatePrioritizationScheme) 95 switch (m_scene.UpdatePrioritizationScheme)
96 { 96 {
97/* 97/*
@@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes
116 priority = GetPriorityByBestAvatarResponsiveness(client, entity); 116 priority = GetPriorityByBestAvatarResponsiveness(client, entity);
117 break; 117 break;
118 } 118 }
119 119
120 return priority; 120 return priority;
121 } 121 }
122 122
@@ -145,7 +145,7 @@ namespace OpenSim.Region.Framework.Scenes
145 145
146 return ComputeDistancePriority(client,entity,false); 146 return ComputeDistancePriority(client,entity,false);
147 } 147 }
148 148
149 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) 149 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
150 { 150 {
151 // And anything attached to this avatar gets top priority as well 151 // And anything attached to this avatar gets top priority as well
@@ -172,7 +172,7 @@ namespace OpenSim.Region.Framework.Scenes
172 172
173 if (entity is SceneObjectPart) 173 if (entity is SceneObjectPart)
174 { 174 {
175 // Attachments are high priority, 175 // Attachments are high priority,
176 if (((SceneObjectPart)entity).ParentGroup.IsAttachment) 176 if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
177 return 2; 177 return 2;
178 178
@@ -196,7 +196,7 @@ namespace OpenSim.Region.Framework.Scenes
196 ScenePresence presence = m_scene.GetScenePresence(client.AgentId); 196 ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
197 if (presence == null) 197 if (presence == null)
198 { 198 {
199 // this shouldn't happen, it basically means that we are prioritizing 199 // this shouldn't happen, it basically means that we are prioritizing
200 // updates to send to a client that doesn't have a presence in the scene 200 // updates to send to a client that doesn't have a presence in the scene
201 // seems like there's race condition here... 201 // seems like there's race condition here...
202 202
@@ -204,7 +204,7 @@ namespace OpenSim.Region.Framework.Scenes
204 // throw new InvalidOperationException("Prioritization agent not defined"); 204 // throw new InvalidOperationException("Prioritization agent not defined");
205 return PriorityQueue.NumberOfQueues - 1; 205 return PriorityQueue.NumberOfQueues - 1;
206 } 206 }
207 207
208 // Use group position for child prims, since we are putting child prims in 208 // Use group position for child prims, since we are putting child prims in
209 // the same queue with the root of the group, the root prim (which goes into 209 // the same queue with the root of the group, the root prim (which goes into
210 // the queue first) should always be sent first, no need to adjust child prim 210 // the queue first) should always be sent first, no need to adjust child prim
@@ -227,14 +227,14 @@ namespace OpenSim.Region.Framework.Scenes
227 227
228 Vector3 presencePos = presence.AbsolutePosition; 228 Vector3 presencePos = presence.AbsolutePosition;
229 229
230 // Compute the distance... 230 // Compute the distance...
231 double distance = Vector3.Distance(presencePos, entityPos); 231 double distance = Vector3.Distance(presencePos, entityPos);
232 232
233 // And convert the distance to a priority queue, this computation gives queues 233 // And convert the distance to a priority queue, this computation gives queues
234 // at 10, 20, 40, 80, 160, 320, 640, and 1280m 234 // at 10, 20, 40, 80, 160, 320, 640, and 1280m
235 uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue 235 uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue
236 uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; 236 uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues;
237/* 237/*
238 for (int i = 0; i < queues - 1; i++) 238 for (int i = 0; i < queues - 1; i++)
239 { 239 {
240 if (distance < 30 * Math.Pow(2.0,i)) 240 if (distance < 30 * Math.Pow(2.0,i))
@@ -246,7 +246,7 @@ namespace OpenSim.Region.Framework.Scenes
246 { 246 {
247 float tmp = (float)Math.Log((double)distance) * 1.442695f - 3.321928f; 247 float tmp = (float)Math.Log((double)distance) * 1.442695f - 3.321928f;
248 // for a map identical to original: 248 // for a map identical to original:
249 // now 249 // now
250 // 1st constant is 1/(log(2)) (natural log) so we get log2(distance) 250 // 1st constant is 1/(log(2)) (natural log) so we get log2(distance)
251 // 2st constant makes it be log2(distance/10) 251 // 2st constant makes it be log2(distance/10)
252 pqueue += (uint)tmp; 252 pqueue += (uint)tmp;
@@ -265,7 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
265 // Plane equation 265 // Plane equation
266 float d = -Vector3.Dot(camPosition, camAtAxis); 266 float d = -Vector3.Dot(camPosition, camAtAxis);
267 float p = Vector3.Dot(camAtAxis, entityPos) + d; 267 float p = Vector3.Dot(camAtAxis, entityPos) + d;
268 if (p < 0.0f) 268 if (p < 0.0f)
269 pqueue++; 269 pqueue++;
270 } 270 }
271 271
@@ -291,7 +291,7 @@ namespace OpenSim.Region.Framework.Scenes
291// uint pqueue = minpqueue; 291// uint pqueue = minpqueue;
292 uint pqueue = PriorityQueue.NumberOfImmediateQueues; 292 uint pqueue = PriorityQueue.NumberOfImmediateQueues;
293 float distance; 293 float distance;
294 294
295 Vector3 presencePos = presence.AbsolutePosition; 295 Vector3 presencePos = presence.AbsolutePosition;
296 if(entity is ScenePresence) 296 if(entity is ScenePresence)
297 { 297 {
@@ -319,10 +319,10 @@ namespace OpenSim.Region.Framework.Scenes
319 { 319 {
320 float tmp = (float)Math.Log(distance) * 1.442695f - 3.321928f; 320 float tmp = (float)Math.Log(distance) * 1.442695f - 3.321928f;
321 // for a map identical to original: 321 // for a map identical to original:
322 // now 322 // now
323 // 1st constant is 1/(log(2)) (natural log) so we get log2(distance) 323 // 1st constant is 1/(log(2)) (natural log) so we get log2(distance)
324 // 2st constant makes it be log2(distance/10) 324 // 2st constant makes it be log2(distance/10)
325 325
326 pqueue += (uint)tmp; 326 pqueue += (uint)tmp;
327 if (pqueue > maxqueue) 327 if (pqueue > maxqueue)
328 pqueue = maxqueue; 328 pqueue = maxqueue;