aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs74
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs64
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs21
7 files changed, 26 insertions, 185 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index fbb99b0..6ad949c 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -173,7 +173,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
173 private BannedRegionCache m_bannedRegionCache = new BannedRegionCache(); 173 private BannedRegionCache m_bannedRegionCache = new BannedRegionCache();
174 174
175 private IEventQueue m_eqModule; 175 private IEventQueue m_eqModule;
176 private IRegionCombinerModule m_regionCombinerModule;
177 176
178 #region ISharedRegionModule 177 #region ISharedRegionModule
179 178
@@ -339,7 +338,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
339 return; 338 return;
340 339
341 m_eqModule = Scene.RequestModuleInterface<IEventQueue>(); 340 m_eqModule = Scene.RequestModuleInterface<IEventQueue>();
342 m_regionCombinerModule = Scene.RequestModuleInterface<IRegionCombinerModule>();
343 } 341 }
344 342
345 #endregion 343 #endregion
@@ -1341,18 +1339,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1341 protected virtual bool NeedsNewAgent(float viewdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, 1339 protected virtual bool NeedsNewAgent(float viewdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
1342 int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) 1340 int oldsizeX, int oldsizeY, int newsizeX, int newsizeY)
1343 { 1341 {
1344 if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
1345 {
1346 Vector2 swCorner, neCorner;
1347 GetMegaregionViewRange(out swCorner, out neCorner);
1348
1349 m_log.DebugFormat(
1350 "[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1} to {2} with new agent check for {3},{4}",
1351 Scene.Name, swCorner, neCorner, newRegionX, newRegionY);
1352
1353 return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y);
1354 }
1355
1356 return Util.IsOutsideView(viewdist, oldRegionX, newRegionX, oldRegionY, newRegionY, 1342 return Util.IsOutsideView(viewdist, oldRegionX, newRegionX, oldRegionY, newRegionY,
1357 oldsizeX, oldsizeY, newsizeX, newsizeY); 1343 oldsizeX, oldsizeY, newsizeX, newsizeY);
1358 } 1344 }
@@ -2385,13 +2371,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2385 { 2371 {
2386 Vector2 extent = Vector2.Zero; 2372 Vector2 extent = Vector2.Zero;
2387 2373
2388 if (m_regionCombinerModule != null)
2389 {
2390 Vector2 megaRegionSize = m_regionCombinerModule.GetSizeOfMegaregion(Scene.RegionInfo.RegionID);
2391 extent.X = (float)Util.WorldToRegionLoc((uint)megaRegionSize.X);
2392 extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y);
2393 }
2394
2395 swCorner.X = Scene.RegionInfo.RegionLocX - 1; 2374 swCorner.X = Scene.RegionInfo.RegionLocX - 1;
2396 swCorner.Y = Scene.RegionInfo.RegionLocY - 1; 2375 swCorner.Y = Scene.RegionInfo.RegionLocY - 1;
2397 neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; 2376 neCorner.X = Scene.RegionInfo.RegionLocX + extent.X;
@@ -2411,46 +2390,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2411 RegionInfo m_regionInfo = pScene.RegionInfo; 2390 RegionInfo m_regionInfo = pScene.RegionInfo;
2412 List<GridRegion> neighbours; 2391 List<GridRegion> neighbours;
2413 2392
2414 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't 2393 uint dd = (uint)avatar.RegionViewDistance;
2415 // clear what should be done with a "far view" given that megaregions already extended the
2416 // view to include everything in the megaregion
2417 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
2418 {
2419 uint dd = (uint)avatar.RegionViewDistance;
2420 2394
2421 // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors 2395 // until avatar movement updates client connections, we need to seend at least this current region imediate neighbors
2422 uint ddX = Math.Max(dd, Constants.RegionSize); 2396 uint ddX = Math.Max(dd, Constants.RegionSize);
2423 uint ddY = Math.Max(dd, Constants.RegionSize); 2397 uint ddY = Math.Max(dd, Constants.RegionSize);
2424 2398
2425 ddX--; 2399 ddX--;
2426 ddY--; 2400 ddY--;
2427 2401
2428 // reference to region edges. Should be avatar position 2402 // reference to region edges. Should be avatar position
2429 uint startX = Util.RegionToWorldLoc(pRegionLocX); 2403 uint startX = Util.RegionToWorldLoc(pRegionLocX);
2430 uint endX = startX + m_regionInfo.RegionSizeX; 2404 uint endX = startX + m_regionInfo.RegionSizeX;
2431 uint startY = Util.RegionToWorldLoc(pRegionLocY); 2405 uint startY = Util.RegionToWorldLoc(pRegionLocY);
2432 uint endY = startY + m_regionInfo.RegionSizeY; 2406 uint endY = startY + m_regionInfo.RegionSizeY;
2433 2407
2434 startX -= ddX; 2408 startX -= ddX;
2435 startY -= ddY; 2409 startY -= ddY;
2436 endX += ddX; 2410 endX += ddX;
2437 endY += ddY; 2411 endY += ddY;
2438 2412
2439 neighbours 2413 neighbours
2440 = avatar.Scene.GridService.GetRegionRange( 2414 = avatar.Scene.GridService.GetRegionRange(
2441 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); 2415 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
2442 }
2443 else
2444 {
2445 Vector2 swCorner, neCorner;
2446 GetMegaregionViewRange(out swCorner, out neCorner);
2447
2448 neighbours
2449 = pScene.GridService.GetRegionRange(
2450 m_regionInfo.ScopeID,
2451 (int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X),
2452 (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y));
2453 }
2454 2416
2455 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). 2417 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1).
2456 neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); 2418 neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID );
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
index cb2c7f1..6c8f37b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
@@ -522,22 +522,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
522 522
523 protected static void WriteRegionInfo(Scene scene, XmlTextWriter xtw) 523 protected static void WriteRegionInfo(Scene scene, XmlTextWriter xtw)
524 { 524 {
525 bool isMegaregion;
526 Vector2 size; 525 Vector2 size;
527 526
528 IRegionCombinerModule rcMod = scene.RequestModuleInterface<IRegionCombinerModule>(); 527 size = new Vector2((float)scene.RegionInfo.RegionSizeX, (float)scene.RegionInfo.RegionSizeY);
529
530 if (rcMod != null)
531 isMegaregion = rcMod.IsRootForMegaregion(scene.RegionInfo.RegionID);
532 else
533 isMegaregion = false;
534
535 if (isMegaregion)
536 size = rcMod.GetSizeOfMegaregion(scene.RegionInfo.RegionID);
537 else
538 size = new Vector2((float)scene.RegionInfo.RegionSizeX, (float)scene.RegionInfo.RegionSizeY);
539 528
540 xtw.WriteElementString("is_megaregion", isMegaregion.ToString());
541 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); 529 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
542 } 530 }
543 531
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index ca94f42..150d4ec 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -53,7 +53,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 54
55 public Scene Scene { get; private set; } 55 public Scene Scene { get; private set; }
56 public IRegionCombinerModule RegionCombinerModule { get; private set; }
57 56
58 /// <value> 57 /// <value>
59 /// The file used to load and save an opensimulator archive if no filename has been specified 58 /// The file used to load and save an opensimulator archive if no filename has been specified
@@ -85,7 +84,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
85 84
86 public void RegionLoaded(Scene scene) 85 public void RegionLoaded(Scene scene)
87 { 86 {
88 RegionCombinerModule = scene.RequestModuleInterface<IRegionCombinerModule>();
89 } 87 }
90 88
91 public void RemoveRegion(Scene scene) 89 public void RemoveRegion(Scene scene)
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs
deleted file mode 100644
index c6f531e..0000000
--- a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Text;
32using OpenSim.Region.Framework.Scenes;
33using System.IO;
34using OpenMetaverse;
35
36namespace OpenSim.Region.Framework.Interfaces
37{
38 public interface IRegionCombinerModule
39 {
40 /// <summary>
41 /// Does the given id belong to the root region of a megaregion?
42 /// </summary>
43 bool IsRootForMegaregion(UUID regionId);
44
45 /// <summary>
46 /// Gets the size of megaregion.
47 /// </summary>
48 /// <remarks>
49 /// Returns size in meters.
50 /// Do not rely on this method remaining the same - this area is actively under development.
51 /// </remarks>
52 /// <param name="sceneId">
53 /// The id of the root region for a megaregion.
54 /// This may change in the future to allow any region id that makes up a megaregion.
55 /// Currently, will throw an exception if this does not match a root region.
56 /// </param>
57 Vector2 GetSizeOfMegaregion(UUID regionId);
58
59 /// <summary>
60 /// Tests to see of position (relative to the region) is within the megaregion
61 /// </summary>
62 bool PositionIsInMegaregion(UUID currentRegion, int xx, int yy);
63 }
64} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fac5547..37352af 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2925,18 +2925,8 @@ namespace OpenSim.Region.Framework.Scenes
2925 if (xx < 0 || yy < 0) 2925 if (xx < 0 || yy < 0)
2926 return false; 2926 return false;
2927 2927
2928 IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); 2928 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY )
2929 if (regionCombinerModule == null) 2929 ret = true;
2930 {
2931 // Regular region. Just check for region size
2932 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY )
2933 ret = true;
2934 }
2935 else
2936 {
2937 // We're in a mega-region so see if we are still in that larger region
2938 ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy);
2939 }
2940 return ret; 2930 return ret;
2941 } 2931 }
2942 2932
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3167282..7c1a7631 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2910,11 +2910,7 @@ namespace OpenSim.Region.Framework.Scenes
2910 2910
2911 // Allow move to another sub-region within a megaregion 2911 // Allow move to another sub-region within a megaregion
2912 Vector2 regionSize; 2912 Vector2 regionSize;
2913 IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>(); 2913 regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
2914 if (regionCombinerModule != null)
2915 regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
2916 else
2917 regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
2918 2914
2919 if (pos.X < 0 || pos.X >= regionSize.X 2915 if (pos.X < 0 || pos.X >= regionSize.X
2920 || pos.Y < 0 || pos.Y >= regionSize.Y 2916 || pos.Y < 0 || pos.Y >= regionSize.Y
@@ -2923,21 +2919,7 @@ namespace OpenSim.Region.Framework.Scenes
2923 2919
2924 float terrainHeight; 2920 float terrainHeight;
2925 Scene targetScene = m_scene; 2921 Scene targetScene = m_scene;
2926 // Get terrain height for sub-region in a megaregion if necessary 2922 terrainHeight = m_scene.GetGroundHeight(pos.X, pos.Y);
2927 if (regionCombinerModule != null)
2928 {
2929 int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X);
2930 int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y);
2931 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y);
2932 // If X and Y is NaN, target_region will be null
2933 if (target_region == null)
2934 return;
2935 UUID target_regionID = target_region.RegionID;
2936 SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene);
2937 terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)];
2938 }
2939 else
2940 terrainHeight = m_scene.GetGroundHeight(pos.X, pos.Y);
2941 2923
2942 // dont try to land underground 2924 // dont try to land underground
2943 terrainHeight += Appearance.AvatarHeight * 0.5f + 0.2f; 2925 terrainHeight += Appearance.AvatarHeight * 0.5f + 0.2f;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7a2b24f..319f14c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3347,24 +3347,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3347 CheckThreatLevel(ThreatLevel.None, "osGetRegionSize"); 3347 CheckThreatLevel(ThreatLevel.None, "osGetRegionSize");
3348 m_host.AddScriptLPS(1); 3348 m_host.AddScriptLPS(1);
3349 3349
3350 bool isMegaregion; 3350 Scene scene = m_ScriptEngine.World;
3351 IRegionCombinerModule rcMod = World.RequestModuleInterface<IRegionCombinerModule>(); 3351 GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID);
3352 if (rcMod != null) 3352 return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeY, (float)Constants.RegionHeight);
3353 isMegaregion = rcMod.IsRootForMegaregion(World.RegionInfo.RegionID);
3354 else
3355 isMegaregion = false;
3356
3357 if (isMegaregion)
3358 {
3359 Vector2 size = rcMod.GetSizeOfMegaregion(World.RegionInfo.RegionID);
3360 return new LSL_Vector(size.X, size.Y, Constants.RegionHeight);
3361 }
3362 else
3363 {
3364 Scene scene = m_ScriptEngine.World;
3365 GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID);
3366 return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeY, (float)Constants.RegionHeight);
3367 }
3368 } 3353 }
3369 3354
3370 public int osGetSimulatorMemory() 3355 public int osGetSimulatorMemory()