Parameterizes the view distance used to compute and manage

child agents in neighbor regions. This means you can extend
the view on a simulator beyond the default 3x3 regions.

This uses a region default draw distance and should be
replaced at some point by the avatar specified draw distance.
That will require more careful, dynamic recomputation of child
agents every time the draw distance changes.

WARNING: this is experimental and has known instabilities. specifically
all regions "within site" should be running the same default draw distance
or agents will not be closed correctly.
This commit is contained in:
Mic Bowman
2011-02-22 13:23:54 -08:00
parent af22b7cb1a
commit 5a16fa882c
6 changed files with 73 additions and 21 deletions

View File

@@ -83,6 +83,13 @@ namespace OpenSim.Region.Framework.Scenes
public bool m_useFlySlow;
public bool m_usePreJump;
public bool m_seeIntoRegionFromNeighbor;
protected float m_defaultDrawDistance = 255.0f;
public float DefaultDrawDistance
{
get { return m_defaultDrawDistance; }
}
// TODO: need to figure out how allow client agents but deny
// root agents when ACL denies access to root agent
public bool m_strictAccessControl = true;
@@ -627,6 +634,8 @@ namespace OpenSim.Region.Framework.Scenes
//
IConfig startupConfig = m_config.Configs["Startup"];
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
// TODO: Change default to true once the feature is supported

View File

@@ -626,7 +626,7 @@ namespace OpenSim.Region.Framework.Scenes
Utils.LongToUInts(handle, out x, out y);
x = x / Constants.RegionSize;
y = y / Constants.RegionSize;
if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY))
if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY))
{
old.Add(handle);
}
@@ -700,6 +700,7 @@ namespace OpenSim.Region.Framework.Scenes
private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this()
{
m_DrawDistance = world.DefaultDrawDistance;
m_rootRegionHandle = reginfo.RegionHandle;
m_controllingClient = client;
m_firstname = m_controllingClient.FirstName;
@@ -1279,7 +1280,11 @@ namespace OpenSim.Region.Framework.Scenes
m_CameraUpAxis = agentData.CameraUpAxis;
// The Agent's Draw distance setting
m_DrawDistance = agentData.Far;
// When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the
// region's draw distance.
// m_DrawDistance = agentData.Far;
m_DrawDistance = Scene.DefaultDrawDistance;
// Check if Client has camera in 'follow cam' or 'build' mode.
Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation);
@@ -2913,7 +2918,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(x, newRegionX, y, newRegionY))
if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY))
{
byebyeRegions.Add(handle);
}
@@ -2989,7 +2994,12 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 offset = new Vector3(shiftx, shifty, 0f);
m_DrawDistance = cAgentData.Far;
// When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the
// region's draw distance.
// m_DrawDistance = cAgentData.Far;
m_DrawDistance = Scene.DefaultDrawDistance;
if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!!
m_pos = cAgentData.Position + offset;
@@ -3139,7 +3149,11 @@ namespace OpenSim.Region.Framework.Scenes
m_CameraLeftAxis = cAgent.LeftAxis;
m_CameraUpAxis = cAgent.UpAxis;
m_DrawDistance = cAgent.Far;
// When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the
// region's draw distance.
// m_DrawDistance = cAgent.Far;
m_DrawDistance = Scene.DefaultDrawDistance;
if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
ControllingClient.SetChildAgentThrottle(cAgent.Throttles);