scale ChildAgentThrottles with distance (internal to child server and not
root as was done before )avinationmerge
parent
ead78764ab
commit
caddabb5c4
|
@ -1184,6 +1184,7 @@ namespace OpenSim.Framework
|
||||||
void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations);
|
void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations);
|
||||||
|
|
||||||
void SetChildAgentThrottle(byte[] throttle);
|
void SetChildAgentThrottle(byte[] throttle);
|
||||||
|
void SetChildAgentThrottle(byte[] throttle,float factor);
|
||||||
|
|
||||||
void SetAgentThrottleSilent(int throttle, int setting);
|
void SetAgentThrottleSilent(int throttle, int setting);
|
||||||
int GetAgentThrottleSilent(int throttle);
|
int GetAgentThrottleSilent(int throttle);
|
||||||
|
|
|
@ -12344,7 +12344,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <param name="throttles"></param>
|
/// <param name="throttles"></param>
|
||||||
public void SetChildAgentThrottle(byte[] throttles)
|
public void SetChildAgentThrottle(byte[] throttles)
|
||||||
{
|
{
|
||||||
m_udpClient.SetThrottles(throttles);
|
SetChildAgentThrottle(throttles, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetChildAgentThrottle(byte[] throttles,float factor)
|
||||||
|
{
|
||||||
|
m_udpClient.SetThrottles(throttles, factor);
|
||||||
GenericCall2 handler = OnUpdateThrottles;
|
GenericCall2 handler = OnUpdateThrottles;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -339,6 +339,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetThrottles(byte[] throttleData)
|
public void SetThrottles(byte[] throttleData)
|
||||||
|
{
|
||||||
|
SetThrottles(throttleData, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetThrottles(byte[] throttleData, float factor)
|
||||||
{
|
{
|
||||||
byte[] adjData;
|
byte[] adjData;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
@ -359,13 +364,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.125f converts from bits to bytes
|
// 0.125f converts from bits to bytes
|
||||||
int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
float scale = 0.125f * factor;
|
||||||
int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
int resend = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
|
||||||
int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
int land = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
|
||||||
int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
int wind = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
|
||||||
int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
int cloud = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
|
||||||
int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
int task = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
|
||||||
int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
|
||||||
|
int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale);
|
||||||
|
|
||||||
// Make sure none of the throttles are set below our packet MTU,
|
// Make sure none of the throttles are set below our packet MTU,
|
||||||
// otherwise a throttle could become permanently clogged
|
// otherwise a throttle could become permanently clogged
|
||||||
|
|
|
@ -4104,7 +4104,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
CameraPosition = cAgentData.Center + offset;
|
CameraPosition = cAgentData.Center + offset;
|
||||||
|
|
||||||
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
|
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
|
||||||
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
|
{
|
||||||
|
// some scaling factor
|
||||||
|
float x = m_pos.X;
|
||||||
|
if (x > m_scene.RegionInfo.RegionSizeX)
|
||||||
|
x -= m_scene.RegionInfo.RegionSizeX;
|
||||||
|
float y = m_pos.Y;
|
||||||
|
if (y > m_scene.RegionInfo.RegionSizeY)
|
||||||
|
y -= m_scene.RegionInfo.RegionSizeY;
|
||||||
|
|
||||||
|
x = x * x + y * y;
|
||||||
|
|
||||||
|
const float distScale = 0.4f / Constants.RegionSize / Constants.RegionSize;
|
||||||
|
float factor = 1.0f - distScale * x;
|
||||||
|
if (factor < 0.2f)
|
||||||
|
factor = 0.2f;
|
||||||
|
|
||||||
|
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles,factor);
|
||||||
|
}
|
||||||
|
|
||||||
if(cAgentData.ChildrenCapSeeds != null && cAgentData.ChildrenCapSeeds.Count >0)
|
if(cAgentData.ChildrenCapSeeds != null && cAgentData.ChildrenCapSeeds.Count >0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1433,6 +1433,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SetChildAgentThrottle(byte[] throttle,float factor)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void SetAgentThrottleSilent(int throttle, int setting)
|
public void SetAgentThrottleSilent(int throttle, int setting)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -621,6 +621,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SetChildAgentThrottle(byte[] throttle, float factor)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void SetAgentThrottleSilent(int throttle, int setting)
|
public void SetAgentThrottleSilent(int throttle, int setting)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -544,6 +544,10 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SetChildAgentThrottle(byte[] throttle, float factor)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SetAgentThrottleSilent(int throttle, int setting)
|
public void SetAgentThrottleSilent(int throttle, int setting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue