From 2d2bea4aa75ff6e82384f0842fe3719bf946b1cc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 26 Dec 2013 22:45:59 -0800 Subject: varregion: many more updates removing the constant RegionSize and replacing with a passed region size. This time in the map code and grid services code. --- .../EntityTransfer/EntityTransferModule.cs | 43 +++++++++--------- .../ServiceConnectorsOut/Grid/RegionCache.cs | 2 +- .../Grid/RemoteGridServiceConnector.cs | 2 +- .../Neighbour/LocalNeighbourServiceConnector.cs | 2 +- .../World/Archiver/ArchiveWriteRequest.cs | 2 +- .../CoreModules/World/LegacyMap/MapImageModule.cs | 34 ++++++++------ .../World/LegacyMap/ShadedMapTileRenderer.cs | 34 ++++++++------ .../World/LegacyMap/TexturedMapTileRenderer.cs | 49 +++++++++++--------- .../World/Objects/BuySell/BuySellModule.cs | 11 ++--- .../World/Terrain/FloodBrushes/NoiseArea.cs | 2 +- .../World/Terrain/PaintBrushes/NoiseSphere.cs | 2 +- .../World/Warp3DMap/Warp3DImageModule.cs | 4 +- .../CoreModules/World/WorldMap/MapSearchModule.cs | 4 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 37 +++++++-------- OpenSim/Region/Framework/Scenes/Scene.cs | 53 +--------------------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 20 ++++---- .../Server/IRCClientView.cs | 2 +- .../OptionalModules/Avatar/Chat/IRCConnector.cs | 2 + .../OptionalModules/Avatar/Chat/RegionState.cs | 2 + OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | 2 +- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 1 + .../Shared/Api/Implementation/LSL_Api.cs | 2 +- .../Shared/Api/Implementation/OSSL_Api.cs | 4 +- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++-- 25 files changed, 149 insertions(+), 179 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 2aa43bc..eb08257 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -337,6 +337,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer "[ENTITY TRANSFER MODULE]: Received teleport cancel request from {0} in {1}", client.Name, Scene.Name); } + // Attempt to teleport the ScenePresence to the specified position in the specified region (spec'ed by its handle). public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) { if (sp.Scene.Permissions.IsGridGod(sp.UUID)) @@ -478,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination) { uint x = 0, y = 0; - Utils.LongToUInts(regionHandle, out x, out y); + Util.RegionHandleToWorldLoc(regionHandle, out x, out y); GridRegion reg = Scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); if (reg != null) @@ -532,8 +533,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY); MapBlockData block = new MapBlockData(); - block.X = (ushort)Util.WorldToRegionLoc(regX); - block.Y = (ushort)Util.WorldToRegionLoc(regY); + block.X = (ushort)regX; + block.Y = (ushort)regY; block.Access = 254; // == not there List blocks = new List(); @@ -1505,7 +1506,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.Scene.RequestTeleportLocation( agent.ControllingClient, - Utils.UIntsToLong(regionX * (uint)Constants.RegionSize, regionY * (uint)Constants.RegionSize), + Util.RegionLocToHandle(regionX, regionY), position, agent.Lookat, (uint)Constants.TeleportFlags.ViaLocation); @@ -1515,11 +1516,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (im != null) { UUID gotoLocation = Util.BuildFakeParcelID( - Util.UIntsToLong( - (regionX * - (uint)Constants.RegionSize), - (regionY * - (uint)Constants.RegionSize)), + Util.RegionLocToHandle(regionX, regionY), (uint)(int)position.X, (uint)(int)position.Y, (uint)(int)position.Z); @@ -1991,8 +1988,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize; return new Vector3(shiftx, shifty, 0f); */ - return new Vector3(sp.Scene.RegionInfo.RegionLocX - neighbour.RegionLocX, - sp.Scene.RegionInfo.RegionLocY - neighbour.RegionLocY, + return new Vector3( sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX, + sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, 0f); } @@ -2172,16 +2169,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // view to include everything in the megaregion if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) { - int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; + // The area to check is as big as the current region. + // We presume all adjacent regions are the same size as this region. + uint dd = Math.Max((uint)avatar.DrawDistance, + Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY)); - int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); - int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); + uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2; + uint startY = Util.RegionToWorldLoc(pRegionLocY) - dd + Constants.RegionSize/2; - int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); - int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); + uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2; + uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2; List neighbours = - avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY); + avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); return neighbours; @@ -2194,10 +2194,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer List neighbours = pScene.GridService.GetRegionRange( m_regionInfo.ScopeID, - (int)swCorner.X * (int)Constants.RegionSize, - (int)neCorner.X * (int)Constants.RegionSize, - (int)swCorner.Y * (int)Constants.RegionSize, - (int)neCorner.Y * (int)Constants.RegionSize); + (int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X), + (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y) ); neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); @@ -2300,7 +2298,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer double objectWorldLocY = (double)scene.RegionInfo.WorldLocY + attemptedPosition.Y; // Ask the grid service for the region that contains the passed address - GridRegion destination = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID, objectWorldLocX, objectWorldLocY); + GridRegion destination = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID, + objectWorldLocX, objectWorldLocY); Vector3 pos = Vector3.Zero; if (destination != null) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs index 33ff7ea..ae76288 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs @@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return new List(m_neighbours.Values); } - // Get a region given its base coordinates. + // Get a region given its base coordinates (in meters). // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST // be the base coordinate of the region. // The snapping is technically unnecessary but is harmless because regions are always diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index ac81337..ae5081c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return rinfo; } - // Get a region given its base coordinates. + // Get a region given its base world coordinates (in meters). // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST // be the base coordinate of the region. // The coordinates are world coords (meters), NOT region units. diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs index fd89428..56d9937 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour if (s.RegionInfo.RegionHandle == regionHandle) { m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}", - thisRegion.RegionName, s.Name, x / Constants.RegionSize, y / Constants.RegionSize); + thisRegion.RegionName, s.Name, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y) ); //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); return s.IncomingHelloNeighbour(thisRegion); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index a990898..9f39aa2 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs @@ -533,7 +533,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (isMegaregion) size = rcMod.GetSizeOfMegaregion(scene.RegionInfo.RegionID); else - size = new Vector2((float)Constants.RegionSize, (float)Constants.RegionSize); + size = new Vector2((float)scene.RegionInfo.RegionSizeX, (float)scene.RegionInfo.RegionSizeY); xtw.WriteElementString("is_megaregion", isMegaregion.ToString()); xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 40638f8..1007e0b 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs @@ -102,7 +102,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap terrainRenderer.Initialise(m_scene, m_config); - mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, + System.Drawing.Imaging.PixelFormat.Format24bppRgb); //long t = System.Environment.TickCount; //for (int i = 0; i < 10; ++i) { terrainRenderer.TerrainToBitmap(mapbmp); @@ -273,7 +274,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) { int tc = 0; - double[,] hm = whichScene.Heightmap.GetDoubles(); + ITerrainChannel hm = whichScene.Heightmap; tc = Environment.TickCount; m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); EntityBase[] objs = whichScene.GetEntities(); @@ -356,7 +357,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap Vector3 pos = part.GetWorldPosition(); // skip prim outside of retion - if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) + if (!m_scene.PositionIsInCurrentRegion(pos)) continue; // skip prim in non-finite position @@ -399,9 +400,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap int mapdrawendY = (int)(pos.Y + scale.Y); // If object is beyond the edge of the map, don't draw it to avoid errors - if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1) - || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0 - || mapdrawendY > ((int)Constants.RegionSize - 1)) + if (mapdrawstartX < 0 + || mapdrawstartX > (hm.Width - 1) + || mapdrawendX < 0 + || mapdrawendX > (hm.Width - 1) + || mapdrawstartY < 0 + || mapdrawstartY > (hm.Height - 1) + || mapdrawendY < 0 + || mapdrawendY > (hm.Height - 1)) continue; #region obb face reconstruction part duex @@ -523,11 +529,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap for (int i = 0; i < FaceA.Length; i++) { Point[] working = new Point[5]; - working[0] = project(FaceA[i], axPos); - working[1] = project(FaceB[i], axPos); - working[2] = project(FaceD[i], axPos); - working[3] = project(FaceC[i], axPos); - working[4] = project(FaceA[i], axPos); + working[0] = project(hm, FaceA[i], axPos); + working[1] = project(hm, FaceB[i], axPos); + working[2] = project(hm, FaceD[i], axPos); + working[3] = project(hm, FaceC[i], axPos); + working[4] = project(hm, FaceA[i], axPos); face workingface = new face(); workingface.pts = working; @@ -595,17 +601,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap return mapbmp; } - private Point project(Vector3 point3d, Vector3 originpos) + private Point project(ITerrainChannel hm, Vector3 point3d, Vector3 originpos) { Point returnpt = new Point(); //originpos = point3d; //int d = (int)(256f / 1.5f); //Vector3 topos = new Vector3(0, 0, 0); - // float z = -point3d.z - topos.z; + // float z = -point3d.z - topos.z; returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); - returnpt.Y = (int)(((int)Constants.RegionSize - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); + returnpt.Y = (int)((hm.Width - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); return returnpt; } diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs index 992bff3..9b939c9 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs @@ -31,6 +31,7 @@ using System.Reflection; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.LegacyMap @@ -39,8 +40,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap { private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95); - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]"; private Scene m_scene; //private IConfigSource m_config; // not used currently @@ -53,19 +54,26 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap public void TerrainToBitmap(Bitmap mapbmp) { + m_log.DebugFormat("{0} Generating Maptile Step 1: Terrain", LogHeader); int tc = Environment.TickCount; - m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain"); - double[,] hm = m_scene.Heightmap.GetDoubles(); + ITerrainChannel hm = m_scene.Heightmap; + + if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) + { + m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", + LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); + } + bool ShadowDebugContinue = true; bool terraincorruptedwarningsaid = false; float low = 255; float high = 0; - for (int x = 0; x < (int)Constants.RegionSize; x++) + for (int x = 0; x < hm.Width; x++) { - for (int y = 0; y < (int)Constants.RegionSize; y++) + for (int y = 0; y < hm.Height; y++) { float hmval = (float)hm[x, y]; if (hmval < low) @@ -77,12 +85,12 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; - for (int x = 0; x < (int)Constants.RegionSize; x++) + for (int x = 0; x < hm.Width; x++) { - for (int y = 0; y < (int)Constants.RegionSize; y++) + for (int y = 0; y < hm.Height; y++) { // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left - int yr = ((int)Constants.RegionSize - 1) - y; + int yr = ((int)hm.Height - 1) - y; float heightvalue = (float)hm[x, y]; @@ -109,12 +117,12 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap // . // // Shade the terrain for shadows - if (x < ((int)Constants.RegionSize - 1) && yr < ((int)Constants.RegionSize - 1)) + if (x < (hm.Width - 1) && yr < (hm.Height - 1)) { float hfvalue = (float)hm[x, y]; float hfvaluecompare = 0f; - if ((x + 1 < (int)Constants.RegionSize) && (y + 1 < (int)Constants.RegionSize)) + if ((x + 1 < hm.Width) && (y + 1 < hm.Height)) { hfvaluecompare = (float)hm[x + 1, y + 1]; // light from north-east => look at land height there } @@ -179,7 +187,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap if (ShadowDebugContinue) { - if ((x - 1 > 0) && (yr + 1 < (int)Constants.RegionSize)) + if ((x - 1 > 0) && (yr + 1 < hm.Height)) { color = mapbmp.GetPixel(x - 1, yr + 1); int r = color.R; @@ -233,7 +241,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap terraincorruptedwarningsaid = true; } Color black = Color.Black; - mapbmp.SetPixel(x, ((int)Constants.RegionSize - y) - 1, black); + mapbmp.SetPixel(x, (hm.Width - y) - 1, black); } } } diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index d13c2ef..413ac64 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs @@ -34,6 +34,8 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; using OpenSim.Framework; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.LegacyMap @@ -122,8 +124,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap { #region Constants - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly string LogHeader = "[TEXTURED MAPTILE RENDERER]"; // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank"). // The color-values were choosen because they "look right" (at least to me) ;-) @@ -173,7 +175,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap private Bitmap fetchTexture(UUID id) { AssetBase asset = m_scene.AssetService.Get(id.ToString()); - m_log.DebugFormat("[TexturedMapTileRenderer]: Fetched texture {0}, found: {1}", id, asset != null); + m_log.DebugFormat("{0} Fetched texture {1}, found: {2}", LogHeader, id, asset != null); if (asset == null) return null; ManagedImage managedImage; @@ -188,18 +190,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap } catch (DllNotFoundException) { - m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id); - + m_log.ErrorFormat("{0} OpenJpeg is not installed correctly on this system. Asset Data is empty for {1}", LogHeader, id); } catch (IndexOutOfRangeException) { - m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); - + m_log.ErrorFormat("{0} OpenJpeg was unable to encode this. Asset Data is empty for {1}", LogHeader, id); } catch (Exception) { - m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); - + m_log.ErrorFormat("{0} OpenJpeg was unable to encode this. Asset Data is empty for {1}", LogHeader, id); } return null; @@ -267,8 +266,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap // the heigthfield might have some jumps in values. Rendered land is smooth, though, // as a slope is rendered at that place. So average 4 neighbour values to emulate that. - private float getHeight(double[,] hm, int x, int y) { - if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) + private float getHeight(ITerrainChannel hm, int x, int y) { + if (x < (hm.Width - 1) && y < (hm.Height - 1)) return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); else return (float)hm[x, y]; @@ -278,7 +277,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap public void TerrainToBitmap(Bitmap mapbmp) { int tc = Environment.TickCount; - m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain"); + m_log.DebugFormat("{0} Generating Maptile Step 1: Terrain", LogHeader); + + ITerrainChannel hm = m_scene.Heightmap; + + if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) + { + m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", + LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); + } // These textures should be in the AssetCache anyway, as every client conneting to this // region needs them. Except on start, when the map is recreated (before anyone connected), @@ -306,19 +313,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap float waterHeight = (float)settings.WaterHeight; - double[,] hm = m_scene.Heightmap.GetDoubles(); - - for (int x = 0; x < (int)Constants.RegionSize; x++) + for (int x = 0; x < hm.Width; x++) { - float columnRatio = x / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation - for (int y = 0; y < (int)Constants.RegionSize; y++) + float columnRatio = x / (hm.Width - 1); // 0 - 1, for interpolation + for (int y = 0; y < hm.Height; y++) { - float rowRatio = y / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation + float rowRatio = y / (hm.Height - 1); // 0 - 1, for interpolation // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left - int yr = ((int)Constants.RegionSize - 1) - y; + int yr = (hm.Height - 1) - y; - float heightvalue = getHeight(hm, x, y); + float heightvalue = getHeight(m_scene.Heightmap, x, y); if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) heightvalue = 0; @@ -368,9 +373,9 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap } // Shade the terrain for shadows - if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) + if (x < (hm.Width - 1) && y < (hm.Height - 1)) { - float hfvaluecompare = getHeight(hm, x + 1, y + 1); // light from north-east => look at land height there + float hfvaluecompare = getHeight(m_scene.Heightmap, x + 1, y + 1); // light from north-east => look at land height there if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare)) hfvaluecompare = 0f; diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 22a53a8..e8eaeb7 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -151,14 +151,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell break; case 2: // Sell a copy - Vector3 inventoryStoredPosition = new Vector3 - (((group.AbsolutePosition.X > (int)Constants.RegionSize) - ? 250 - : group.AbsolutePosition.X) - , - (group.AbsolutePosition.X > (int)Constants.RegionSize) - ? 250 - : group.AbsolutePosition.X, + Vector3 inventoryStoredPosition = new Vector3( + Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6), + Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6), group.AbsolutePosition.Z); Vector3 originalPosition = group.AbsolutePosition; diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs index 630473e..b6c635c 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes { if (fillArea[x, y]) { - double noise = TerrainUtil.PerlinNoise2D((double) x / Constants.RegionSize, (double) y / Constants.RegionSize, 8, 1.0); + double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); map[x, y] += noise * strength; } diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs index 989b7d8..e7df3f8 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes z *= z; z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); - double noise = TerrainUtil.PerlinNoise2D(x / (double) Constants.RegionSize, y / (double) Constants.RegionSize, 8, 1.0); + double noise = TerrainUtil.PerlinNoise2D(x / (double) map.Width, y / (double) map.Height, 8, 1.0); if (z > 0.0) map[x, y] += noise * z * duration; diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index ed2b06a..6d9e31b 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -128,7 +128,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap public Bitmap CreateMapTile() { Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); - Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize); + Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, + (int)Constants.RegionSize, (int)Constants.RegionSize, + (float)Constants.RegionSize, (float)Constants.RegionSize); return CreateMapTile(viewport, false); } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 708a9a2..1fb1aba 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -184,8 +184,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap data.Name = info.RegionName; data.RegionFlags = 0; // TODO not used? data.WaterHeight = 0; // not used - data.X = (ushort)(info.RegionLocX / Constants.RegionSize); - data.Y = (ushort)(info.RegionLocY / Constants.RegionSize); + data.X = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocX); + data.Y = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocY); blocks.Add(data); } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index cd315b1..4badb12 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -277,11 +277,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { List mapBlocks = new List(); ; + // Get regions that are within 8 regions of here List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize, - (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize, - (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize, - (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize); + (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 8), + (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 8), + (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 8), + (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) ); foreach (GridRegion r in regions) { MapBlockData block = new MapBlockData(); @@ -1011,17 +1012,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // on an unloaded square. // But make sure: Look whether the one we requested is in there List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - minX * (int)Constants.RegionSize, - maxX * (int)Constants.RegionSize, - minY * (int)Constants.RegionSize, - maxY * (int)Constants.RegionSize); + (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX), + (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) ); if (regions != null) { foreach (GridRegion r in regions) { - if ((r.RegionLocX == minX * (int)Constants.RegionSize) && - (r.RegionLocY == minY * (int)Constants.RegionSize)) + if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) + && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) ) { // found it => add it to response MapBlockData block = new MapBlockData(); @@ -1055,10 +1054,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { List mapBlocks = new List(); List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - (minX - 4) * (int)Constants.RegionSize, - (maxX + 4) * (int)Constants.RegionSize, - (minY - 4) * (int)Constants.RegionSize, - (maxY + 4) * (int)Constants.RegionSize); + (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)), + (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) ); foreach (GridRegion r in regions) { MapBlockData block = new MapBlockData(); @@ -1086,8 +1083,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap break; } block.Name = r.RegionName; - block.X = (ushort)(r.RegionLocX / Constants.RegionSize); - block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); + block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX); + block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY); } public Hashtable OnHTTPThrottled(Hashtable keysvals) @@ -1218,10 +1215,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap List mapBlocks = new List(); List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - (int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize, - (int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize, - (int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize, - (int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize); + (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 9), + (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 9), + (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 9), + (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 9)); List textures = new List(); List bitImages = new List(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 10421ff..5a7e2dd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1099,8 +1099,6 @@ namespace OpenSim.Region.Framework.Scenes /// True after all operations complete, throws exceptions otherwise. public override void OtherRegionUp(GridRegion otherRegion) { - // uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize); - // uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize); uint xcell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocX); uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY); @@ -2450,9 +2448,9 @@ namespace OpenSim.Region.Framework.Scenes int xx = (int)Math.Floor(pos.X); int yy = (int)Math.Floor(pos.Y); if (xx < 0 - || xx > RegionInfo.RegionSizeX + || xx >= RegionInfo.RegionSizeX || yy < 0 - || yy > RegionInfo.RegionSizeY) + || yy >= RegionInfo.RegionSizeY) ret = false; return ret; @@ -4581,53 +4579,6 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = GetScenePresence(remoteClient.AgentId); if (sp != null) { - /* - uint regionX = RegionInfo.LegacyRegionLocX; - uint regionY = RegionInfo.LegacyRegionLocY; - - Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY); - Utils.LongToUInts(regionHandle, out regionX, out regionY); - - int shiftx = (int) regionX - (int) RegionInfo.LegacyRegionLocX * (int)Constants.RegionSize; - int shifty = (int) regionY - (int) RegionInfo.LegacyRegionLocY * (int)Constants.RegionSize; - */ - - uint regionX, regionY; - Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY); - - int shiftx = (int) regionX - (int)RegionInfo.WorldLocX; - int shifty = (int) regionY - (int)RegionInfo.WorldLocY; - - position.X += shiftx; - position.Y += shifty; - - bool result = false; - - if (TestBorderCross(position,Cardinals.N)) - result = true; - - if (TestBorderCross(position, Cardinals.S)) - result = true; - - if (TestBorderCross(position, Cardinals.E)) - result = true; - - if (TestBorderCross(position, Cardinals.W)) - result = true; - - // bordercross if position is outside of region - - if (!result) - { - regionHandle = RegionInfo.RegionHandle; - } - else - { - // not in this region, undo the shift! - position.X -= shiftx; - position.Y -= shifty; - } - if (EntityTransferModule != null) { EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f95220d..b059ecf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes { public abstract class SceneBase : IScene { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string LogHeader = "[SCENE]"; #region Events diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d4cbf7d..44c476c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -331,7 +331,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); + Vector3 minScale = new Vector3(Constants.MaximumRegionSize, Constants.MaximumRegionSize, Constants.MaximumRegionSize); Vector3 maxScale = Vector3.Zero; Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); @@ -517,14 +517,14 @@ namespace OpenSim.Region.Framework.Scenes m_scene.CrossPrimGroupIntoNewRegion(val, this, true); // Normalize - if (val.X >= Constants.RegionSize) - val.X -= Constants.RegionSize; - if (val.Y >= Constants.RegionSize) - val.Y -= Constants.RegionSize; + if (val.X >= m_scene.RegionInfo.RegionSizeX) + val.X -= m_scene.RegionInfo.RegionSizeX; + if (val.Y >= m_scene.RegionInfo.RegionSizeY) + val.Y -= m_scene.RegionInfo.RegionSizeY; if (val.X < 0) - val.X += Constants.RegionSize; + val.X += m_scene.RegionInfo.RegionSizeX; if (val.Y < 0) - val.Y += Constants.RegionSize; + val.Y += m_scene.RegionInfo.RegionSizeY; // If it's deleted, crossing was successful if (IsDeleted) @@ -572,9 +572,9 @@ namespace OpenSim.Region.Framework.Scenes } } Vector3 oldp = AbsolutePosition; - val.X = Util.Clamp(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f); - val.Y = Util.Clamp(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f); - val.Z = Util.Clamp(oldp.Z, 0.5f, 4096.0f); + val.X = Util.Clamp(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f); + val.Y = Util.Clamp(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f); + val.Z = Util.Clamp(oldp.Z, 0.5f, Constants.RegionHeight); } } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index b3fdd22..c8320d0 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -516,7 +516,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public Vector3 StartPos { - get { return new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 50); } + get { return new Vector3(m_scene.RegionInfo.RegionSizeX * 0.5f, m_scene.RegionInfo.RegionSizeY * 0.5f, 50f); } set { } } diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs index c5cba8e..f5bd44d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs @@ -52,6 +52,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat // Local constants + // This computation is not the real region center if the region is larger than 256. + // This computation isn't fixed because there is not a handle back to the region. private static readonly Vector3 CenterOfRegion = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20); private static readonly char[] CS_SPACE = { ' ' }; diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs index d4fe5e0..5505001 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs @@ -44,6 +44,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // This computation is not the real region center if the region is larger than 256. + // This computation isn't fixed because there is not a handle back to the region. private static readonly OpenMetaverse.Vector3 CenterOfRegion = new OpenMetaverse.Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20); private const int DEBUG_CHANNEL = 2147483647; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs index 17ebed2..aca1ed4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs @@ -1311,7 +1311,7 @@ private sealed class BulletConstraintXNA : BulletConstraint /* TODO */ ConfigurationParameters[] configparms = new ConfigurationParameters[1]; configparms[0] = parms; - Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); + Vector3 worldExtent = maxPosition; m_maxCollisions = maxCollisions; m_maxUpdatesPerFrame = maxUpdates; specialCollisionObjects = new Dictionary(); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 83ef1f6..fe014fc 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -208,6 +208,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters Name = EngineType + "/" + RegionName; } + // Old version of initialization that assumes legacy sized regions (256x256) public override void Initialise(IMesher meshmerizer, IConfigSource config) { m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up."); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6861865..674885c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4333,7 +4333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); UUID agentId = new UUID(); - ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); + ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y); if (UUID.TryParse(agent, out agentId)) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4fb0856..31ea067 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -814,8 +814,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { - // ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); - ulong regionHandle = Util.RegionWorldLocToHandle(Util.RegionToWorldLoc((uint)regionX), Util.RegionToWorldLoc((uint)regionY)); + // ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); + ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY); m_host.AddScriptLPS(1); UUID agentId = new UUID(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e3f3fc7..d81cddc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -713,16 +713,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } private void Save() { + /* Remove temporarily until we have a handle to the region size if (Position.x > ((int)Constants.RegionSize - 1)) Position.x = ((int)Constants.RegionSize - 1); - if (Position.x < 0) - Position.x = 0; if (Position.y > ((int)Constants.RegionSize - 1)) Position.y = ((int)Constants.RegionSize - 1); - if (Position.y < 0) - Position.y = 0; + */ if (Position.z > Constants.RegionHeight) Position.z = Constants.RegionHeight; + if (Position.x < 0) + Position.x = 0; + if (Position.y < 0) + Position.y = 0; if (Position.z < 0) Position.z = 0; prim.OSSL.llSetPos(Position); -- cgit v1.1