aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2013-07-20 15:42:01 -0700
committerDiva Canto2013-07-21 09:01:09 -0700
commit032c637c10ee16f5a3b9b690de812701f3badee6 (patch)
treed1b4b20204647b425c24c25a0412ac8f6037a26c /OpenSim/Region
parentA couple of small optimizations over the previous commit (diff)
downloadopensim-SC_OLD-032c637c10ee16f5a3b9b690de812701f3badee6.zip
opensim-SC_OLD-032c637c10ee16f5a3b9b690de812701f3badee6.tar.gz
opensim-SC_OLD-032c637c10ee16f5a3b9b690de812701f3badee6.tar.bz2
opensim-SC_OLD-032c637c10ee16f5a3b9b690de812701f3badee6.tar.xz
Filter certain viewer effects depending on distance between the avatar that is generating the effect and the cameras of the observers. In particular, this applies to LookAt (which is really verbose and occurs every time users move the mouse) and Beam (which doesn't occur that often, but that can be extremely noisy (10.sec) when it happens)
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs32
1 files changed, 25 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index df43271..998c19e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -390,6 +390,7 @@ namespace OpenSim.Region.Framework.Scenes
390 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) 390 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
391 { 391 {
392 // TODO: don't create new blocks if recycling an old packet 392 // TODO: don't create new blocks if recycling an old packet
393 bool discardableEffects = true;
393 ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; 394 ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
394 for (int i = 0; i < args.Count; i++) 395 for (int i = 0; i < args.Count; i++)
395 { 396 {
@@ -401,17 +402,34 @@ namespace OpenSim.Region.Framework.Scenes
401 effect.Type = args[i].Type; 402 effect.Type = args[i].Type;
402 effect.TypeData = args[i].TypeData; 403 effect.TypeData = args[i].TypeData;
403 effectBlockArray[i] = effect; 404 effectBlockArray[i] = effect;
405
406 if ((EffectType)effect.Type != EffectType.LookAt && (EffectType)effect.Type != EffectType.Beam)
407 discardableEffects = false;
408
409 //m_log.DebugFormat("[YYY]: VE {0} {1} {2}", effect.AgentID, effect.Duration, (EffectType)effect.Type);
404 } 410 }
405 411
406 ForEachClient( 412 ForEachScenePresence(sp =>
407 delegate(IClientAPI client)
408 { 413 {
409 if (client.AgentId != remoteClient.AgentId) 414 if (sp.ControllingClient.AgentId != remoteClient.AgentId)
410 client.SendViewerEffect(effectBlockArray); 415 {
411 } 416 if (!discardableEffects ||
412 ); 417 (discardableEffects && ShouldSendDiscardableEffect(remoteClient, sp)))
418 {
419 //m_log.DebugFormat("[YYY]: Sending to {0}", sp.UUID);
420 sp.ControllingClient.SendViewerEffect(effectBlockArray);
421 }
422 //else
423 // m_log.DebugFormat("[YYY]: Not sending to {0}", sp.UUID);
424 }
425 });
413 } 426 }
414 427
428 private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other)
429 {
430 return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10;
431 }
432
415 /// <summary> 433 /// <summary>
416 /// Tell the client about the various child items and folders contained in the requested folder. 434 /// Tell the client about the various child items and folders contained in the requested folder.
417 /// </summary> 435 /// </summary>