varregion: More tweeking to only sending patches within avatar draw distance.

Still has problems with child avatars.
bullet-2.82
Robert Adams 2014-03-20 22:10:27 -07:00
parent db5a42ffac
commit 22dade6463
3 changed files with 20 additions and 18 deletions

View File

@ -820,7 +820,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agentCircuit.Id0 = currentAgentCircuit.Id0; agentCircuit.Id0 = currentAgentCircuit.Id0;
} }
if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) // if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
if (NeedsNewAgent(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
// brand new agent, let's create a new caps seed // brand new agent, let's create a new caps seed
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
@ -894,7 +895,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
IClientIPEndpoint ipepClient; IClientIPEndpoint ipepClient;
string capsPath = String.Empty; string capsPath = String.Empty;
if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) if (NeedsNewAgent(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}", "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}",
@ -1070,7 +1071,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
{ {
if (!sp.Scene.IncomingPreCloseClient(sp)) if (!sp.Scene.IncomingPreCloseClient(sp))
return; return;
@ -1140,7 +1141,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
IClientIPEndpoint ipepClient; IClientIPEndpoint ipepClient;
string capsPath = String.Empty; string capsPath = String.Empty;
if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) if (NeedsNewAgent(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}",
@ -1236,7 +1237,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.MakeChildAgent(); sp.MakeChildAgent();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
{ {
if (!sp.Scene.IncomingPreCloseClient(sp)) if (!sp.Scene.IncomingPreCloseClient(sp))
return; return;
@ -2366,7 +2367,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
// The area to check is as big as the current region. // The area to check is as big as the current region.
// We presume all adjacent regions are the same size as this region. // We presume all adjacent regions are the same size as this region.
uint dd = Math.Max((uint)avatar.DrawDistance, uint dd = Math.Max((uint)avatar.Scene.DefaultDrawDistance,
Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY)); Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY));
uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2; uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2;

View File

@ -1054,7 +1054,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
if (presence == null) if (presence == null)
return ret; return ret;
// See if there are patches within our view distance to send. // Compute the area of patches within our draw distance
int startX = (((int) (presence.AbsolutePosition.X - presence.DrawDistance))/Constants.TerrainPatchSize) - 2; int startX = (((int) (presence.AbsolutePosition.X - presence.DrawDistance))/Constants.TerrainPatchSize) - 2;
startX = Math.Max(startX, 0); startX = Math.Max(startX, 0);
startX = Math.Min(startX, (int)m_scene.RegionInfo.RegionSizeX/Constants.TerrainPatchSize); startX = Math.Min(startX, (int)m_scene.RegionInfo.RegionSizeX/Constants.TerrainPatchSize);
@ -1067,8 +1067,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
int endY = (((int) (presence.AbsolutePosition.Y + presence.DrawDistance))/Constants.TerrainPatchSize) + 2; int endY = (((int) (presence.AbsolutePosition.Y + presence.DrawDistance))/Constants.TerrainPatchSize) + 2;
endY = Math.Max(endY, 0); endY = Math.Max(endY, 0);
endY = Math.Min(endY, (int)m_scene.RegionInfo.RegionSizeY/Constants.TerrainPatchSize); endY = Math.Min(endY, (int)m_scene.RegionInfo.RegionSizeY/Constants.TerrainPatchSize);
// m_log.DebugFormat("{0} GetModifiedPatchesInViewDistance. start=<{1},{2}>, end=<{3},{4}>", m_log.DebugFormat("{0} GetModifiedPatchesInViewDistance. ddist={1}, start=<{2},{3}>, end=<{4},{5}>",
// LogHeader, startX, startY, endX, endY); LogHeader, presence.DrawDistance, startX, startY, endX, endY);
for (int x = startX; x < endX; x++) for (int x = startX; x < endX; x++)
{ {
for (int y = startY; y < endY; y++) for (int y = startY; y < endY; y++)

View File

@ -873,7 +873,8 @@ namespace OpenSim.Region.Framework.Scenes
m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; m_sendCoarseLocationsMethod = SendCoarseLocationsDefault;
Animator = new ScenePresenceAnimator(this); Animator = new ScenePresenceAnimator(this);
PresenceType = type; PresenceType = type;
DrawDistance = world.DefaultDrawDistance; // DrawDistance = world.DefaultDrawDistance;
DrawDistance = Constants.RegionSize;
RegionHandle = world.RegionInfo.RegionHandle; RegionHandle = world.RegionInfo.RegionHandle;
ControllingClient = client; ControllingClient = client;
Firstname = ControllingClient.FirstName; Firstname = ControllingClient.FirstName;
@ -1918,8 +1919,8 @@ namespace OpenSim.Region.Framework.Scenes
// When we get to the point of re-computing neighbors everytime this // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the // changes, then start using the agent's drawdistance rather than the
// region's draw distance. // region's draw distance.
// DrawDistance = agentData.Far; DrawDistance = agentData.Far;
DrawDistance = Scene.DefaultDrawDistance; // DrawDistance = Scene.DefaultDrawDistance;
m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
@ -2277,8 +2278,8 @@ namespace OpenSim.Region.Framework.Scenes
// When we get to the point of re-computing neighbors everytime this // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the // changes, then start using the agent's drawdistance rather than the
// region's draw distance. // region's draw distance.
// DrawDistance = agentData.Far; DrawDistance = agentData.Far;
DrawDistance = Scene.DefaultDrawDistance; // DrawDistance = Scene.DefaultDrawDistance;
// Check if Client has camera in 'follow cam' or 'build' mode. // Check if Client has camera in 'follow cam' or 'build' mode.
Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
@ -3824,8 +3825,8 @@ namespace OpenSim.Region.Framework.Scenes
// When we get to the point of re-computing neighbors everytime this // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the // changes, then start using the agent's drawdistance rather than the
// region's draw distance. // region's draw distance.
// DrawDistance = cAgentData.Far; DrawDistance = cAgentData.Far;
DrawDistance = Scene.DefaultDrawDistance; // DrawDistance = Scene.DefaultDrawDistance;
if (cAgentData.Position != marker) // UGH!! if (cAgentData.Position != marker) // UGH!!
m_pos = cAgentData.Position + offset; m_pos = cAgentData.Position + offset;
@ -3935,8 +3936,8 @@ namespace OpenSim.Region.Framework.Scenes
// When we get to the point of re-computing neighbors everytime this // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the // changes, then start using the agent's drawdistance rather than the
// region's draw distance. // region's draw distance.
// DrawDistance = cAgent.Far; DrawDistance = cAgent.Far;
DrawDistance = Scene.DefaultDrawDistance; // DrawDistance = Scene.DefaultDrawDistance;
if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
ControllingClient.SetChildAgentThrottle(cAgent.Throttles); ControllingClient.SetChildAgentThrottle(cAgent.Throttles);