From ead78764abfe3d91f79b55ec200bd0d5e8ca2151 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Nov 2014 19:03:25 +0000 Subject: [PATCH] allow drawdistance to change between 32 and MaxDrawDistance, configurable value default to 256, so should have no effect. Next steps needed: reduce client udp Throttles with distance, update childreen connections with significat movement and view range changes, Make disconnect be delayed in time, make disconnects be receiving region action not sender on region changes. Allow distance less than 256 to only connect to visible regions, even none. Make this be relative to camera and not agent position or region centers as it is now. --- .../ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- .../EntityTransfer/EntityTransferModule.cs | 14 ++++++++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 15 ++++++++++++--- .../Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++-------- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4b15e9fbc7..b9646c7525 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5765,8 +5765,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack - // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold - || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed + // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold + || (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed ; //if (movementSignificant) //{ diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 274eb7f29d..b32a169c97 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2352,11 +2352,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; - int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); - int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); + dd--; - int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); - int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); + // region center + int endX = (int)pRegionLocX * (int)Constants.RegionSize + (int)(Constants.RegionSize / 2); + int endY = (int)pRegionLocY * (int)Constants.RegionSize + (int)(Constants.RegionSize / 2); + + int startX = endX - dd; + int startY = endY - dd; + + endX += dd; + endY += dd; if (startX < 0) startX = 0; if (startY < 0) startY = 0; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9e2f52cfd9..eb34f557aa 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -227,6 +227,13 @@ namespace OpenSim.Region.Framework.Scenes get { return m_defaultDrawDistance; } } +// protected float m_maxDrawDistance = 512.0f; + protected float m_maxDrawDistance = 256.0f; + public float MaxDrawDistance + { + get { return m_maxDrawDistance; } + } + private List m_AllowedViewers = new List(); private List m_BannedViewers = new List(); @@ -862,7 +869,8 @@ namespace OpenSim.Region.Framework.Scenes StartDisabled = startupConfig.GetBoolean("StartDisabled", false); - m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); + m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); + m_defaultDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); if (!UseBackup) m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); @@ -1069,7 +1077,7 @@ namespace OpenSim.Region.Framework.Scenes BordersLocked = true; Border northBorder = new Border(); - northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- + northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, RegionInfo.RegionSizeY); //<--- northBorder.CrossDirection = Cardinals.N; NorthBorders.Add(northBorder); @@ -1079,7 +1087,7 @@ namespace OpenSim.Region.Framework.Scenes SouthBorders.Add(southBorder); Border eastBorder = new Border(); - eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- + eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, RegionInfo.RegionSizeX); //<--- eastBorder.CrossDirection = Cardinals.E; EastBorders.Add(eastBorder); @@ -1092,6 +1100,7 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); + } #endregion diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c58847b3a7..6a9e0caf5c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2061,8 +2061,10 @@ namespace OpenSim.Region.Framework.Scenes // 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. - // DrawDistance = agentData.Far; - DrawDistance = Scene.DefaultDrawDistance; + + DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); + +// DrawDistance = Scene.DefaultDrawDistance; m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; @@ -2417,8 +2419,7 @@ namespace OpenSim.Region.Framework.Scenes // 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. - // DrawDistance = agentData.Far; - DrawDistance = Scene.DefaultDrawDistance; + DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); // Check if Client has camera in 'follow cam' or 'build' mode. Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); @@ -4011,6 +4012,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (ulong handle in byebyeRegions) { RemoveNeighbourRegion(handle); + Scene.CapsModule.DropChildSeed(UUID, handle); } } @@ -4087,8 +4089,8 @@ namespace OpenSim.Region.Framework.Scenes // 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. - // DrawDistance = cAgentData.Far; - DrawDistance = Scene.DefaultDrawDistance; + DrawDistance = cAgentData.Far; +// DrawDistance = Scene.DefaultDrawDistance; if (cAgentData.Position != marker) // UGH!! m_pos = cAgentData.Position + offset; @@ -4204,8 +4206,8 @@ namespace OpenSim.Region.Framework.Scenes // 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. - // DrawDistance = cAgent.Far; - DrawDistance = Scene.DefaultDrawDistance; + DrawDistance = cAgent.Far; + //DrawDistance = Scene.DefaultDrawDistance; if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0) {