add option MaxRegionsViewDistance to control the maximum range to tell viewer to connect to Neighbour regions, since that is diferent from view range

LSLKeyTest
UbitUmarov 2016-01-26 20:39:37 +00:00
parent 66be75556b
commit 109723dc2d
3 changed files with 48 additions and 7 deletions

View File

@ -801,7 +801,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
int newSizeX = finalDestination.RegionSizeX;
int newSizeY = finalDestination.RegionSizeY;
bool OutSideViewRange = NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY,
bool OutSideViewRange = NeedsNewAgent(sp.RegionViewDistance, oldRegionX, newRegionX, oldRegionY, newRegionY,
oldSizeX, oldSizeY, newSizeX, newSizeY);
if (OutSideViewRange)
@ -1338,7 +1338,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// This returns 'true' if the new region already has a child agent for our
// incoming agent. The implication is that, if 'false', we have to create the
// child and then teleport into the region.
protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
protected virtual bool NeedsNewAgent(float viewdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
int oldsizeX, int oldsizeY, int newsizeX, int newsizeY)
{
if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
@ -1353,7 +1353,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y);
}
return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY,
return Util.IsOutsideView(viewdist, oldRegionX, newRegionX, oldRegionY, newRegionY,
oldsizeX, oldsizeY, newsizeX, newsizeY);
}
@ -2449,7 +2449,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// view to include everything in the megaregion
if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
{
uint dd = (uint)avatar.DrawDistance;
uint dd = (uint)avatar.RegionViewDistance;
// until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors
uint ddX = Math.Max(dd, Constants.RegionSize);

View File

@ -296,6 +296,12 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_maxDrawDistance; }
}
protected float m_maxRegionViewDistance = 255f;
public float MaxRegionViewDistance
{
get { return m_maxRegionViewDistance; }
}
private List<string> m_AllowedViewers = new List<string>();
private List<string> m_BannedViewers = new List<string>();
@ -972,6 +978,7 @@ namespace OpenSim.Region.Framework.Scenes
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance);
m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance);
m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance);
LegacySitOffsets = startupConfig.GetBoolean("LegacyOpenSimSitOffsets", LegacySitOffsets);

View File

@ -583,6 +583,14 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public float RegionViewDistance
{
get
{
return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance);
}
}
public bool AllowMovement { get; set; }
private bool m_setAlwaysRun;
@ -3566,7 +3574,33 @@ namespace OpenSim.Region.Framework.Scenes
|| (!m_pos.ApproxEquals(m_lastPosition, POSITION_SMALLTOLERANCE) && Velocity.LengthSquared() < LOWVELOCITYSQ )
) )
{
SendTerseUpdateToAllClients();
/*
if (!IsSatOnObject)
{
// this does need to be more complex later
Vector3 vel = Velocity;
Vector3 dpos = m_pos - m_lastPosition;
if( Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE ||
Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE ||
Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE ||
Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE ||
Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE ||
Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE ||
Math.Abs(dpos.X) > POSITION_LARGETOLERANCE ||
Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE ||
Math.Abs(dpos.Z) > POSITION_LARGETOLERANCE ||
( (Math.Abs(dpos.X) > POSITION_SMALLTOLERANCE ||
Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE ||
Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE)
&& vel.LengthSquared() < LOWVELOCITYSQ
))
{
*/
SendTerseUpdateToAllClients();
// }
}
CheckForSignificantMovement();
}
@ -4184,7 +4218,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY,
if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY,
regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY))
{
byebyeRegions.Add(handle);
@ -4195,7 +4229,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY,
if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY,
(int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY))
{
byebyeRegions.Add(handle);