diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
5 files changed, 57 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 51897d7..e622e0c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -319,7 +319,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
319 | agentCircuit.Id0 = currentAgentCircuit.Id0; | 319 | agentCircuit.Id0 = currentAgentCircuit.Id0; |
320 | } | 320 | } |
321 | 321 | ||
322 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 322 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
323 | { | 323 | { |
324 | // brand new agent, let's create a new caps seed | 324 | // brand new agent, let's create a new caps seed |
325 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 325 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
@@ -337,7 +337,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
337 | // OK, it got this agent. Let's close some child agents | 337 | // OK, it got this agent. Let's close some child agents |
338 | sp.CloseChildAgents(newRegionX, newRegionY); | 338 | sp.CloseChildAgents(newRegionX, newRegionY); |
339 | IClientIPEndpoint ipepClient; | 339 | IClientIPEndpoint ipepClient; |
340 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 340 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
341 | { | 341 | { |
342 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | 342 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); |
343 | #region IP Translation for NAT | 343 | #region IP Translation for NAT |
@@ -448,7 +448,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
448 | 448 | ||
449 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 449 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
450 | 450 | ||
451 | if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 451 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
452 | { | 452 | { |
453 | Thread.Sleep(5000); | 453 | Thread.Sleep(5000); |
454 | sp.Close(); | 454 | sp.Close(); |
@@ -522,14 +522,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
522 | return region; | 522 | return region; |
523 | } | 523 | } |
524 | 524 | ||
525 | protected virtual bool NeedsNewAgent(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | 525 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) |
526 | { | 526 | { |
527 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | 527 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); |
528 | } | 528 | } |
529 | 529 | ||
530 | protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 530 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
531 | { | 531 | { |
532 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | 532 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); |
533 | } | 533 | } |
534 | 534 | ||
535 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) | 535 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) |
@@ -1072,7 +1072,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1072 | 1072 | ||
1073 | if (m_regionInfo != null) | 1073 | if (m_regionInfo != null) |
1074 | { | 1074 | { |
1075 | neighbours = RequestNeighbours(sp.Scene, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 1075 | neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
1076 | } | 1076 | } |
1077 | else | 1077 | else |
1078 | { | 1078 | { |
@@ -1298,8 +1298,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1298 | /// <param name="pRegionLocX"></param> | 1298 | /// <param name="pRegionLocX"></param> |
1299 | /// <param name="pRegionLocY"></param> | 1299 | /// <param name="pRegionLocY"></param> |
1300 | /// <returns></returns> | 1300 | /// <returns></returns> |
1301 | protected List<GridRegion> RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) | 1301 | protected List<GridRegion> RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) |
1302 | { | 1302 | { |
1303 | Scene pScene = avatar.Scene; | ||
1303 | RegionInfo m_regionInfo = pScene.RegionInfo; | 1304 | RegionInfo m_regionInfo = pScene.RegionInfo; |
1304 | 1305 | ||
1305 | Border[] northBorders = pScene.NorthBorders.ToArray(); | 1306 | Border[] northBorders = pScene.NorthBorders.ToArray(); |
@@ -1307,10 +1308,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1307 | Border[] eastBorders = pScene.EastBorders.ToArray(); | 1308 | Border[] eastBorders = pScene.EastBorders.ToArray(); |
1308 | Border[] westBorders = pScene.WestBorders.ToArray(); | 1309 | Border[] westBorders = pScene.WestBorders.ToArray(); |
1309 | 1310 | ||
1310 | // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. | 1311 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't |
1312 | // clear what should be done with a "far view" given that megaregions already extended the | ||
1313 | // view to include everything in the megaregion | ||
1311 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) | 1314 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) |
1312 | { | 1315 | { |
1313 | return pScene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); | 1316 | int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; |
1317 | |||
1318 | int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); | ||
1319 | int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); | ||
1320 | |||
1321 | int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); | ||
1322 | int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); | ||
1323 | |||
1324 | List<GridRegion> neighbours = | ||
1325 | avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY); | ||
1326 | |||
1327 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); | ||
1328 | return neighbours; | ||
1314 | } | 1329 | } |
1315 | else | 1330 | else |
1316 | { | 1331 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index c75bc0a..5a80100 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -130,9 +130,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
130 | return region; | 130 | return region; |
131 | } | 131 | } |
132 | 132 | ||
133 | protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 133 | protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
134 | { | 134 | { |
135 | if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 135 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
136 | return true; | 136 | return true; |
137 | 137 | ||
138 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 138 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 0163060..fcf571d 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -604,6 +604,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
604 | { | 604 | { |
605 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 1"); | 605 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 1"); |
606 | } | 606 | } |
607 | item.Owner = remoteClient.AgentId; | ||
607 | 608 | ||
608 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 609 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
609 | 610 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2815f29..2e116a2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -83,6 +83,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
83 | public bool m_useFlySlow; | 83 | public bool m_useFlySlow; |
84 | public bool m_usePreJump; | 84 | public bool m_usePreJump; |
85 | public bool m_seeIntoRegionFromNeighbor; | 85 | public bool m_seeIntoRegionFromNeighbor; |
86 | |||
87 | protected float m_defaultDrawDistance = 255.0f; | ||
88 | public float DefaultDrawDistance | ||
89 | { | ||
90 | get { return m_defaultDrawDistance; } | ||
91 | } | ||
92 | |||
86 | // TODO: need to figure out how allow client agents but deny | 93 | // TODO: need to figure out how allow client agents but deny |
87 | // root agents when ACL denies access to root agent | 94 | // root agents when ACL denies access to root agent |
88 | public bool m_strictAccessControl = true; | 95 | public bool m_strictAccessControl = true; |
@@ -649,6 +656,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
649 | // | 656 | // |
650 | IConfig startupConfig = m_config.Configs["Startup"]; | 657 | IConfig startupConfig = m_config.Configs["Startup"]; |
651 | 658 | ||
659 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | ||
660 | |||
652 | //Animation states | 661 | //Animation states |
653 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 662 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
654 | // TODO: Change default to true once the feature is supported | 663 | // TODO: Change default to true once the feature is supported |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fd03e93..e7056ba 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -690,7 +690,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
690 | Utils.LongToUInts(handle, out x, out y); | 690 | Utils.LongToUInts(handle, out x, out y); |
691 | x = x / Constants.RegionSize; | 691 | x = x / Constants.RegionSize; |
692 | y = y / Constants.RegionSize; | 692 | y = y / Constants.RegionSize; |
693 | if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) | 693 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) |
694 | { | 694 | { |
695 | old.Add(handle); | 695 | old.Add(handle); |
696 | } | 696 | } |
@@ -764,6 +764,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
764 | 764 | ||
765 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() | 765 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() |
766 | { | 766 | { |
767 | m_DrawDistance = world.DefaultDrawDistance; | ||
767 | m_rootRegionHandle = reginfo.RegionHandle; | 768 | m_rootRegionHandle = reginfo.RegionHandle; |
768 | m_controllingClient = client; | 769 | m_controllingClient = client; |
769 | m_firstname = m_controllingClient.FirstName; | 770 | m_firstname = m_controllingClient.FirstName; |
@@ -1429,7 +1430,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1429 | m_CameraUpAxis = agentData.CameraUpAxis; | 1430 | m_CameraUpAxis = agentData.CameraUpAxis; |
1430 | 1431 | ||
1431 | // The Agent's Draw distance setting | 1432 | // The Agent's Draw distance setting |
1432 | m_DrawDistance = agentData.Far; | 1433 | // When we get to the point of re-computing neighbors everytime this |
1434 | // changes, then start using the agent's drawdistance rather than the | ||
1435 | // region's draw distance. | ||
1436 | // m_DrawDistance = agentData.Far; | ||
1437 | m_DrawDistance = Scene.DefaultDrawDistance; | ||
1433 | 1438 | ||
1434 | // Check if Client has camera in 'follow cam' or 'build' mode. | 1439 | // Check if Client has camera in 'follow cam' or 'build' mode. |
1435 | Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); | 1440 | Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); |
@@ -3289,7 +3294,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3289 | 3294 | ||
3290 | //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 3295 | //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); |
3291 | //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | 3296 | //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); |
3292 | if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) | 3297 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) |
3293 | { | 3298 | { |
3294 | byebyeRegions.Add(handle); | 3299 | byebyeRegions.Add(handle); |
3295 | } | 3300 | } |
@@ -3365,7 +3370,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3365 | 3370 | ||
3366 | Vector3 offset = new Vector3(shiftx, shifty, 0f); | 3371 | Vector3 offset = new Vector3(shiftx, shifty, 0f); |
3367 | 3372 | ||
3368 | m_DrawDistance = cAgentData.Far; | 3373 | // When we get to the point of re-computing neighbors everytime this |
3374 | // changes, then start using the agent's drawdistance rather than the | ||
3375 | // region's draw distance. | ||
3376 | // m_DrawDistance = cAgentData.Far; | ||
3377 | m_DrawDistance = Scene.DefaultDrawDistance; | ||
3378 | |||
3369 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! | 3379 | if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! |
3370 | m_pos = cAgentData.Position + offset; | 3380 | m_pos = cAgentData.Position + offset; |
3371 | 3381 | ||
@@ -3516,7 +3526,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3516 | m_CameraLeftAxis = cAgent.LeftAxis; | 3526 | m_CameraLeftAxis = cAgent.LeftAxis; |
3517 | m_CameraUpAxis = cAgent.UpAxis; | 3527 | m_CameraUpAxis = cAgent.UpAxis; |
3518 | 3528 | ||
3519 | m_DrawDistance = cAgent.Far; | 3529 | // When we get to the point of re-computing neighbors everytime this |
3530 | // changes, then start using the agent's drawdistance rather than the | ||
3531 | // region's draw distance. | ||
3532 | // m_DrawDistance = cAgent.Far; | ||
3533 | m_DrawDistance = Scene.DefaultDrawDistance; | ||
3520 | 3534 | ||
3521 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) | 3535 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) |
3522 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); | 3536 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); |