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.varregion
parent
e5f7c8b6e8
commit
2d2bea4aa7
|
@ -342,6 +342,11 @@ namespace OpenSim.Framework
|
|||
return Utils.UIntsToLong(X, Y);
|
||||
}
|
||||
|
||||
public static ulong RegionLocToHandle(uint X, uint Y)
|
||||
{
|
||||
return Utils.UIntsToLong(Util.RegionToWorldLoc(X), Util.RegionToWorldLoc(Y));
|
||||
}
|
||||
|
||||
public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y)
|
||||
{
|
||||
X = (uint)(handle >> 32);
|
||||
|
|
|
@ -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<MapBlockData> blocks = new List<MapBlockData>();
|
||||
|
@ -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<GridRegion> 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<GridRegion> 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)
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
return new List<GridRegion>(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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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,7 +601,7 @@ 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;
|
||||
|
@ -605,7 +611,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
|||
// 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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,11 +277,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
{
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
|
||||
|
||||
// Get regions that are within 8 regions of here
|
||||
List<GridRegion> 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<GridRegion> 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<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> 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<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> 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<AssetBase> textures = new List<AssetBase>();
|
||||
List<Image> bitImages = new List<Image>();
|
||||
|
||||
|
|
|
@ -1099,8 +1099,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>True after all operations complete, throws exceptions otherwise.</returns>
|
||||
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);
|
||||
|
|
|
@ -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<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f);
|
||||
val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f);
|
||||
val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f);
|
||||
val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f);
|
||||
val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f);
|
||||
val.Z = Util.Clamp<float>(oldp.Z, 0.5f, Constants.RegionHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 { }
|
||||
}
|
||||
|
||||
|
|
|
@ -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 = { ' ' };
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<uint, GhostObject>();
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -815,7 +815,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
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.RegionLocToHandle((uint)regionX, (uint)regionY);
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID agentId = new UUID();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
|
||||
{
|
||||
Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
|
||||
Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
|
||||
Vector3d maxPosition = minPosition + new Vector3d(regionInfo.RegionSizeX, regionInfo.RegionSizeY, Constants.RegionHeight);
|
||||
|
||||
OSDMap extraData = new OSDMap
|
||||
{
|
||||
|
@ -156,15 +156,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
|
||||
{
|
||||
const int NEIGHBOR_RADIUS = 128;
|
||||
|
||||
GridRegion region = GetRegionByUUID(scopeID, regionID);
|
||||
|
||||
int NEIGHBOR_RADIUS = Math.Max(region.RegionSizeX, region.RegionSizeY) / 2;
|
||||
|
||||
if (region != null)
|
||||
{
|
||||
List<GridRegion> regions = GetRegionRange(scopeID,
|
||||
region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + (int)Constants.RegionSize + NEIGHBOR_RADIUS,
|
||||
region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + (int)Constants.RegionSize + NEIGHBOR_RADIUS);
|
||||
region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + region.RegionSizeX + NEIGHBOR_RADIUS,
|
||||
region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + region.RegionSizeY + NEIGHBOR_RADIUS);
|
||||
|
||||
for (int i = 0; i < regions.Count; i++)
|
||||
{
|
||||
|
@ -229,7 +229,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
else
|
||||
{
|
||||
// m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}",
|
||||
// x / Constants.RegionSize, y / Constants.RegionSize);
|
||||
// Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,8 +313,10 @@ namespace OpenSim.Services.GridService
|
|||
if (region != null)
|
||||
{
|
||||
// Not really? Maybe?
|
||||
List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1,
|
||||
region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID);
|
||||
// The adjacent regions are presumed to be the same size as the current region
|
||||
List<RegionData> rdatas = m_Database.Get(
|
||||
region.posX - region.sizeX - 1, region.posY - region.sizeY - 1,
|
||||
region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID);
|
||||
|
||||
foreach (RegionData rdata in rdatas)
|
||||
{
|
||||
|
@ -642,20 +644,20 @@ namespace OpenSim.Services.GridService
|
|||
return;
|
||||
}
|
||||
|
||||
int x, y;
|
||||
if (!int.TryParse(cmd[3], out x))
|
||||
uint x, y;
|
||||
if (!uint.TryParse(cmd[3], out x))
|
||||
{
|
||||
MainConsole.Instance.Output("x-coord must be an integer");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(cmd[4], out y))
|
||||
if (!uint.TryParse(cmd[4], out y))
|
||||
{
|
||||
MainConsole.Instance.Output("y-coord must be an integer");
|
||||
return;
|
||||
}
|
||||
|
||||
RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero);
|
||||
RegionData region = m_Database.Get((int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y), UUID.Zero);
|
||||
if (region == null)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y);
|
||||
|
|
|
@ -183,8 +183,8 @@ namespace OpenSim.Services.GridService
|
|||
public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
|
||||
{
|
||||
string reason = string.Empty;
|
||||
int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize;
|
||||
return TryLinkRegionToCoords(scopeID, regionDescriptor, xloc, 0, out reason);
|
||||
uint xloc = Util.RegionToWorldLoc((uint)random.Next(0, Int16.MaxValue));
|
||||
return TryLinkRegionToCoords(scopeID, regionDescriptor, (int)xloc, 0, out reason);
|
||||
}
|
||||
|
||||
private static Random random = new Random();
|
||||
|
@ -260,7 +260,7 @@ namespace OpenSim.Services.GridService
|
|||
{
|
||||
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}",
|
||||
((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
|
||||
remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
|
||||
remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc));
|
||||
|
||||
reason = string.Empty;
|
||||
Uri uri = null;
|
||||
|
@ -311,7 +311,7 @@ namespace OpenSim.Services.GridService
|
|||
if (region != null)
|
||||
{
|
||||
m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}",
|
||||
regInfo.RegionLocX / Constants.RegionSize, regInfo.RegionLocY / Constants.RegionSize,
|
||||
Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY),
|
||||
region.RegionName, region.RegionID);
|
||||
reason = "Coordinates are already in use";
|
||||
return false;
|
||||
|
@ -347,7 +347,7 @@ namespace OpenSim.Services.GridService
|
|||
if (region != null)
|
||||
{
|
||||
m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}",
|
||||
region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
|
||||
Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY));
|
||||
regInfo = region;
|
||||
return true;
|
||||
}
|
||||
|
@ -424,10 +424,10 @@ namespace OpenSim.Services.GridService
|
|||
// {
|
||||
// uint ux = 0, uy = 0;
|
||||
// Utils.LongToUInts(realHandle, out ux, out uy);
|
||||
// x = ux / Constants.RegionSize;
|
||||
// y = uy / Constants.RegionSize;
|
||||
// x = Util.WorldToRegionLoc(ux);
|
||||
// y = Util.WorldToRegionLoc(uy);
|
||||
//
|
||||
// const uint limit = (4096 - 1) * Constants.RegionSize;
|
||||
// const uint limit = Util.RegionToWorldLoc(4096 - 1);
|
||||
// uint xmin = ux - limit;
|
||||
// uint xmax = ux + limit;
|
||||
// uint ymin = uy - limit;
|
||||
|
@ -502,9 +502,14 @@ namespace OpenSim.Services.GridService
|
|||
MainConsole.Instance.Output(new string('-', 72));
|
||||
foreach (RegionData r in regions)
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n",
|
||||
r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY,
|
||||
r.posX / Constants.RegionSize, r.posY / Constants.RegionSize)));
|
||||
MainConsole.Instance.Output(
|
||||
String.Format("{0}\n{2,-32} {1}\n",
|
||||
r.RegionName, r.RegionID,
|
||||
String.Format("{0},{1} ({2},{3})", r.posX, r.posY,
|
||||
Util.WorldToRegionLoc((uint)r.posX), Util.WorldToRegionLoc((uint)r.posY)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -529,8 +534,8 @@ namespace OpenSim.Services.GridService
|
|||
int xloc, yloc;
|
||||
string serverURI;
|
||||
string remoteName = null;
|
||||
xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
|
||||
yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
|
||||
xloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[0]));
|
||||
yloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[1]));
|
||||
serverURI = cmdparams[2];
|
||||
if (cmdparams.Length > 3)
|
||||
remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3);
|
||||
|
@ -601,13 +606,13 @@ namespace OpenSim.Services.GridService
|
|||
{
|
||||
// old format
|
||||
GridRegion regInfo;
|
||||
int xloc, yloc;
|
||||
uint xloc, yloc;
|
||||
uint externalPort;
|
||||
string externalHostName;
|
||||
try
|
||||
{
|
||||
xloc = Convert.ToInt32(cmdparams[0]);
|
||||
yloc = Convert.ToInt32(cmdparams[1]);
|
||||
xloc = Convert.ToUInt32(cmdparams[0]);
|
||||
yloc = Convert.ToUInt32(cmdparams[1]);
|
||||
externalPort = Convert.ToUInt32(cmdparams[3]);
|
||||
externalHostName = cmdparams[2];
|
||||
//internalPort = Convert.ToUInt32(cmdparams[4]);
|
||||
|
@ -621,10 +626,11 @@ namespace OpenSim.Services.GridService
|
|||
}
|
||||
|
||||
// Convert cell coordinates given by the user to meters
|
||||
xloc = xloc * (int)Constants.RegionSize;
|
||||
yloc = yloc * (int)Constants.RegionSize;
|
||||
xloc = Util.RegionToWorldLoc(xloc);
|
||||
yloc = Util.RegionToWorldLoc(yloc);
|
||||
string reason = string.Empty;
|
||||
if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
||||
if (TryCreateLink(UUID.Zero, (int)xloc, (int)yloc,
|
||||
string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
||||
{
|
||||
// What is this? The GridRegion instance will be discarded anyway,
|
||||
// which effectively ignores any local name given with the command.
|
||||
|
@ -704,13 +710,13 @@ namespace OpenSim.Services.GridService
|
|||
private void ReadLinkFromConfig(IConfig config)
|
||||
{
|
||||
GridRegion regInfo;
|
||||
int xloc, yloc;
|
||||
uint xloc, yloc;
|
||||
uint externalPort;
|
||||
string externalHostName;
|
||||
uint realXLoc, realYLoc;
|
||||
|
||||
xloc = Convert.ToInt32(config.GetString("xloc", "0"));
|
||||
yloc = Convert.ToInt32(config.GetString("yloc", "0"));
|
||||
xloc = Convert.ToUInt32(config.GetString("xloc", "0"));
|
||||
yloc = Convert.ToUInt32(config.GetString("yloc", "0"));
|
||||
externalPort = Convert.ToUInt32(config.GetString("externalPort", "0"));
|
||||
externalHostName = config.GetString("externalHostName", "");
|
||||
realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0"));
|
||||
|
@ -718,18 +724,19 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
if (m_enableAutoMapping)
|
||||
{
|
||||
xloc = (int)((xloc % 100) + m_autoMappingX);
|
||||
yloc = (int)((yloc % 100) + m_autoMappingY);
|
||||
xloc = (xloc % 100) + m_autoMappingX;
|
||||
yloc = (yloc % 100) + m_autoMappingY;
|
||||
}
|
||||
|
||||
if (((realXLoc == 0) && (realYLoc == 0)) ||
|
||||
(((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
|
||||
((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
|
||||
{
|
||||
xloc = xloc * (int)Constants.RegionSize;
|
||||
yloc = yloc * (int)Constants.RegionSize;
|
||||
xloc = Util.RegionToWorldLoc(xloc);
|
||||
yloc = Util.RegionToWorldLoc(yloc);
|
||||
string reason = string.Empty;
|
||||
if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
||||
if (TryCreateLink(UUID.Zero, (int)xloc, (int)yloc,
|
||||
string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
||||
{
|
||||
regInfo.RegionName = config.GetString("localName", "");
|
||||
}
|
||||
|
|
|
@ -223,6 +223,7 @@ namespace OpenSim.Services.Interfaces
|
|||
m_serverURI = string.Empty;
|
||||
}
|
||||
|
||||
/*
|
||||
public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||
{
|
||||
m_regionLocX = regionLocX;
|
||||
|
@ -245,6 +246,7 @@ namespace OpenSim.Services.Interfaces
|
|||
|
||||
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
|
||||
}
|
||||
*/
|
||||
|
||||
public GridRegion(uint xcell, uint ycell)
|
||||
{
|
||||
|
|
|
@ -362,7 +362,6 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
private void FillOutHomeData(GridUserInfo pinfo, GridRegion home)
|
||||
{
|
||||
// int x = 1000 * (int)Constants.RegionSize, y = 1000 * (int)Constants.RegionSize;
|
||||
int x = (int)Util.RegionToWorldLoc(1000);
|
||||
int y = (int)Util.RegionToWorldLoc(1000);
|
||||
if (home != null)
|
||||
|
@ -438,22 +437,22 @@ namespace OpenSim.Services.LLLoginService
|
|||
ErrorReason = "key";
|
||||
welcomeMessage = "Welcome to OpenSim!";
|
||||
seedCapability = String.Empty;
|
||||
home = "{'region_handle':[r"
|
||||
+ Util.RegionToWorldLoc(1000).ToString()
|
||||
+ ",r"
|
||||
+ Util.RegionToWorldLoc(1000).ToString()
|
||||
+ "], 'position':[r"
|
||||
+ userProfile.homepos.X.ToString()
|
||||
+ ",r"
|
||||
+ userProfile.homepos.Y.ToString()
|
||||
+ ",r"
|
||||
+ userProfile.homepos.Z.ToString()
|
||||
+ "], 'look_at':[r"
|
||||
+ userProfile.homelookat.X.ToString()
|
||||
+ ",r"
|
||||
+ userProfile.homelookat.Y.ToString()
|
||||
+ ",r"
|
||||
+ userProfile.homelookat.Z.ToString()
|
||||
home = "{'region_handle':["
|
||||
+ "r" + Util.RegionToWorldLoc(1000).ToString()
|
||||
+ ","
|
||||
+ "r" + Util.RegionToWorldLoc(1000).ToString()
|
||||
+ "], 'position':["
|
||||
+ "r" + userProfile.homepos.X.ToString()
|
||||
+ ","
|
||||
+ "r" + userProfile.homepos.Y.ToString()
|
||||
+ ","
|
||||
+ "r" + userProfile.homepos.Z.ToString()
|
||||
+ "], 'look_at':["
|
||||
+ "r" + userProfile.homelookat.X.ToString()
|
||||
+ ","
|
||||
+ "r" + userProfile.homelookat.Y.ToString()
|
||||
+ ","
|
||||
+ "r" + userProfile.homelookat.Z.ToString()
|
||||
+ "]}";
|
||||
lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
|
||||
RegionX = (uint) 255232;
|
||||
|
|
|
@ -150,16 +150,16 @@ namespace OpenSim.Tests.Clients.GridClient
|
|||
|
||||
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
|
||||
regions = m_Connector.GetRegionRange(UUID.Zero,
|
||||
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize,
|
||||
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize);
|
||||
(int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002),
|
||||
(int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002) );
|
||||
if (regions == null)
|
||||
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
|
||||
else
|
||||
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
|
||||
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
|
||||
regions = m_Connector.GetRegionRange(UUID.Zero,
|
||||
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize,
|
||||
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize);
|
||||
(int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950),
|
||||
(int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950) );
|
||||
if (regions == null)
|
||||
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue