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)
parent
3919c80505
commit
032c637c10
|
@ -390,6 +390,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
|
void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
|
||||||
{
|
{
|
||||||
// TODO: don't create new blocks if recycling an old packet
|
// TODO: don't create new blocks if recycling an old packet
|
||||||
|
bool discardableEffects = true;
|
||||||
ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
|
ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
|
||||||
for (int i = 0; i < args.Count; i++)
|
for (int i = 0; i < args.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -401,15 +402,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
effect.Type = args[i].Type;
|
effect.Type = args[i].Type;
|
||||||
effect.TypeData = args[i].TypeData;
|
effect.TypeData = args[i].TypeData;
|
||||||
effectBlockArray[i] = effect;
|
effectBlockArray[i] = effect;
|
||||||
|
|
||||||
|
if ((EffectType)effect.Type != EffectType.LookAt && (EffectType)effect.Type != EffectType.Beam)
|
||||||
|
discardableEffects = false;
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[YYY]: VE {0} {1} {2}", effect.AgentID, effect.Duration, (EffectType)effect.Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
ForEachClient(
|
ForEachScenePresence(sp =>
|
||||||
delegate(IClientAPI client)
|
|
||||||
{
|
{
|
||||||
if (client.AgentId != remoteClient.AgentId)
|
if (sp.ControllingClient.AgentId != remoteClient.AgentId)
|
||||||
client.SendViewerEffect(effectBlockArray);
|
{
|
||||||
|
if (!discardableEffects ||
|
||||||
|
(discardableEffects && ShouldSendDiscardableEffect(remoteClient, sp)))
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[YYY]: Sending to {0}", sp.UUID);
|
||||||
|
sp.ControllingClient.SendViewerEffect(effectBlockArray);
|
||||||
}
|
}
|
||||||
);
|
//else
|
||||||
|
// m_log.DebugFormat("[YYY]: Not sending to {0}", sp.UUID);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other)
|
||||||
|
{
|
||||||
|
return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue