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);
|
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)
|
public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y)
|
||||||
{
|
{
|
||||||
X = (uint)(handle >> 32);
|
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);
|
"[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)
|
public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags)
|
||||||
{
|
{
|
||||||
if (sp.Scene.Permissions.IsGridGod(sp.UUID))
|
if (sp.Scene.Permissions.IsGridGod(sp.UUID))
|
||||||
|
@ -478,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination)
|
Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination)
|
||||||
{
|
{
|
||||||
uint x = 0, y = 0;
|
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);
|
GridRegion reg = Scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||||
|
|
||||||
if (reg != null)
|
if (reg != null)
|
||||||
|
@ -532,8 +533,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY);
|
Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY);
|
||||||
|
|
||||||
MapBlockData block = new MapBlockData();
|
MapBlockData block = new MapBlockData();
|
||||||
block.X = (ushort)Util.WorldToRegionLoc(regX);
|
block.X = (ushort)regX;
|
||||||
block.Y = (ushort)Util.WorldToRegionLoc(regY);
|
block.Y = (ushort)regY;
|
||||||
block.Access = 254; // == not there
|
block.Access = 254; // == not there
|
||||||
|
|
||||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||||
|
@ -1505,7 +1506,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
agent.Scene.RequestTeleportLocation(
|
agent.Scene.RequestTeleportLocation(
|
||||||
agent.ControllingClient,
|
agent.ControllingClient,
|
||||||
Utils.UIntsToLong(regionX * (uint)Constants.RegionSize, regionY * (uint)Constants.RegionSize),
|
Util.RegionLocToHandle(regionX, regionY),
|
||||||
position,
|
position,
|
||||||
agent.Lookat,
|
agent.Lookat,
|
||||||
(uint)Constants.TeleportFlags.ViaLocation);
|
(uint)Constants.TeleportFlags.ViaLocation);
|
||||||
|
@ -1515,11 +1516,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (im != null)
|
if (im != null)
|
||||||
{
|
{
|
||||||
UUID gotoLocation = Util.BuildFakeParcelID(
|
UUID gotoLocation = Util.BuildFakeParcelID(
|
||||||
Util.UIntsToLong(
|
Util.RegionLocToHandle(regionX, regionY),
|
||||||
(regionX *
|
|
||||||
(uint)Constants.RegionSize),
|
|
||||||
(regionY *
|
|
||||||
(uint)Constants.RegionSize)),
|
|
||||||
(uint)(int)position.X,
|
(uint)(int)position.X,
|
||||||
(uint)(int)position.Y,
|
(uint)(int)position.Y,
|
||||||
(uint)(int)position.Z);
|
(uint)(int)position.Z);
|
||||||
|
@ -1991,8 +1988,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize;
|
int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize;
|
||||||
return new Vector3(shiftx, shifty, 0f);
|
return new Vector3(shiftx, shifty, 0f);
|
||||||
*/
|
*/
|
||||||
return new Vector3(sp.Scene.RegionInfo.RegionLocX - neighbour.RegionLocX,
|
return new Vector3( sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
|
||||||
sp.Scene.RegionInfo.RegionLocY - neighbour.RegionLocY,
|
sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
|
||||||
0f);
|
0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2172,16 +2169,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// view to include everything in the megaregion
|
// view to include everything in the megaregion
|
||||||
if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
|
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);
|
uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2;
|
||||||
int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2);
|
uint startY = Util.RegionToWorldLoc(pRegionLocY) - dd + Constants.RegionSize/2;
|
||||||
|
|
||||||
int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
|
uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2;
|
||||||
int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
|
uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2;
|
||||||
|
|
||||||
List<GridRegion> neighbours =
|
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; });
|
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
|
||||||
return neighbours;
|
return neighbours;
|
||||||
|
@ -2194,10 +2194,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
List<GridRegion> neighbours
|
List<GridRegion> neighbours
|
||||||
= pScene.GridService.GetRegionRange(
|
= pScene.GridService.GetRegionRange(
|
||||||
m_regionInfo.ScopeID,
|
m_regionInfo.ScopeID,
|
||||||
(int)swCorner.X * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X),
|
||||||
(int)neCorner.X * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y) );
|
||||||
(int)swCorner.Y * (int)Constants.RegionSize,
|
|
||||||
(int)neCorner.Y * (int)Constants.RegionSize);
|
|
||||||
|
|
||||||
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
|
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;
|
double objectWorldLocY = (double)scene.RegionInfo.WorldLocY + attemptedPosition.Y;
|
||||||
|
|
||||||
// Ask the grid service for the region that contains the passed address
|
// 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;
|
Vector3 pos = Vector3.Zero;
|
||||||
if (destination != null)
|
if (destination != null)
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
return new List<GridRegion>(m_neighbours.Values);
|
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
|
// NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
|
||||||
// be the base coordinate of the region.
|
// be the base coordinate of the region.
|
||||||
// The snapping is technically unnecessary but is harmless because regions are always
|
// The snapping is technically unnecessary but is harmless because regions are always
|
||||||
|
|
|
@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
return rinfo;
|
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
|
// NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
|
||||||
// be the base coordinate of the region.
|
// be the base coordinate of the region.
|
||||||
// The coordinates are world coords (meters), NOT region units.
|
// The coordinates are world coords (meters), NOT region units.
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}",
|
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");
|
//m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour");
|
||||||
return s.IncomingHelloNeighbour(thisRegion);
|
return s.IncomingHelloNeighbour(thisRegion);
|
||||||
|
|
|
@ -533,7 +533,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
if (isMegaregion)
|
if (isMegaregion)
|
||||||
size = rcMod.GetSizeOfMegaregion(scene.RegionInfo.RegionID);
|
size = rcMod.GetSizeOfMegaregion(scene.RegionInfo.RegionID);
|
||||||
else
|
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("is_megaregion", isMegaregion.ToString());
|
||||||
xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
|
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);
|
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;
|
//long t = System.Environment.TickCount;
|
||||||
//for (int i = 0; i < 10; ++i) {
|
//for (int i = 0; i < 10; ++i) {
|
||||||
terrainRenderer.TerrainToBitmap(mapbmp);
|
terrainRenderer.TerrainToBitmap(mapbmp);
|
||||||
|
@ -273,7 +274,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
|
private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
|
||||||
{
|
{
|
||||||
int tc = 0;
|
int tc = 0;
|
||||||
double[,] hm = whichScene.Heightmap.GetDoubles();
|
ITerrainChannel hm = whichScene.Heightmap;
|
||||||
tc = Environment.TickCount;
|
tc = Environment.TickCount;
|
||||||
m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
|
m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
|
||||||
EntityBase[] objs = whichScene.GetEntities();
|
EntityBase[] objs = whichScene.GetEntities();
|
||||||
|
@ -356,7 +357,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
Vector3 pos = part.GetWorldPosition();
|
Vector3 pos = part.GetWorldPosition();
|
||||||
|
|
||||||
// skip prim outside of retion
|
// skip prim outside of retion
|
||||||
if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f)
|
if (!m_scene.PositionIsInCurrentRegion(pos))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip prim in non-finite position
|
// skip prim in non-finite position
|
||||||
|
@ -399,9 +400,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
int mapdrawendY = (int)(pos.Y + scale.Y);
|
int mapdrawendY = (int)(pos.Y + scale.Y);
|
||||||
|
|
||||||
// If object is beyond the edge of the map, don't draw it to avoid errors
|
// 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)
|
if (mapdrawstartX < 0
|
||||||
|| mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0
|
|| mapdrawstartX > (hm.Width - 1)
|
||||||
|| mapdrawendY > ((int)Constants.RegionSize - 1))
|
|| mapdrawendX < 0
|
||||||
|
|| mapdrawendX > (hm.Width - 1)
|
||||||
|
|| mapdrawstartY < 0
|
||||||
|
|| mapdrawstartY > (hm.Height - 1)
|
||||||
|
|| mapdrawendY < 0
|
||||||
|
|| mapdrawendY > (hm.Height - 1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#region obb face reconstruction part duex
|
#region obb face reconstruction part duex
|
||||||
|
@ -523,11 +529,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
for (int i = 0; i < FaceA.Length; i++)
|
for (int i = 0; i < FaceA.Length; i++)
|
||||||
{
|
{
|
||||||
Point[] working = new Point[5];
|
Point[] working = new Point[5];
|
||||||
working[0] = project(FaceA[i], axPos);
|
working[0] = project(hm, FaceA[i], axPos);
|
||||||
working[1] = project(FaceB[i], axPos);
|
working[1] = project(hm, FaceB[i], axPos);
|
||||||
working[2] = project(FaceD[i], axPos);
|
working[2] = project(hm, FaceD[i], axPos);
|
||||||
working[3] = project(FaceC[i], axPos);
|
working[3] = project(hm, FaceC[i], axPos);
|
||||||
working[4] = project(FaceA[i], axPos);
|
working[4] = project(hm, FaceA[i], axPos);
|
||||||
|
|
||||||
face workingface = new face();
|
face workingface = new face();
|
||||||
workingface.pts = working;
|
workingface.pts = working;
|
||||||
|
@ -595,7 +601,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
return mapbmp;
|
return mapbmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point project(Vector3 point3d, Vector3 originpos)
|
private Point project(ITerrainChannel hm, Vector3 point3d, Vector3 originpos)
|
||||||
{
|
{
|
||||||
Point returnpt = new Point();
|
Point returnpt = new Point();
|
||||||
//originpos = point3d;
|
//originpos = point3d;
|
||||||
|
@ -605,7 +611,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
// 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.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;
|
return returnpt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.LegacyMap
|
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 Color WATER_COLOR = Color.FromArgb(29, 71, 95);
|
||||||
|
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]";
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
//private IConfigSource m_config; // not used currently
|
//private IConfigSource m_config; // not used currently
|
||||||
|
@ -53,19 +54,26 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
|
|
||||||
public void TerrainToBitmap(Bitmap mapbmp)
|
public void TerrainToBitmap(Bitmap mapbmp)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("{0} Generating Maptile Step 1: Terrain", LogHeader);
|
||||||
int tc = Environment.TickCount;
|
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 ShadowDebugContinue = true;
|
||||||
|
|
||||||
bool terraincorruptedwarningsaid = false;
|
bool terraincorruptedwarningsaid = false;
|
||||||
|
|
||||||
float low = 255;
|
float low = 255;
|
||||||
float high = 0;
|
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];
|
float hmval = (float)hm[x, y];
|
||||||
if (hmval < low)
|
if (hmval < low)
|
||||||
|
@ -77,12 +85,12 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
|
|
||||||
float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
|
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
|
// 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];
|
float heightvalue = (float)hm[x, y];
|
||||||
|
|
||||||
|
@ -109,12 +117,12 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
// .
|
// .
|
||||||
//
|
//
|
||||||
// Shade the terrain for shadows
|
// 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 hfvalue = (float)hm[x, y];
|
||||||
float hfvaluecompare = 0f;
|
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
|
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 (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);
|
color = mapbmp.GetPixel(x - 1, yr + 1);
|
||||||
int r = color.R;
|
int r = color.R;
|
||||||
|
@ -233,7 +241,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
terraincorruptedwarningsaid = true;
|
terraincorruptedwarningsaid = true;
|
||||||
}
|
}
|
||||||
Color black = Color.Black;
|
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;
|
||||||
using OpenMetaverse.Imaging;
|
using OpenMetaverse.Imaging;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.LegacyMap
|
namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
|
@ -122,8 +124,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
{
|
{
|
||||||
#region Constants
|
#region Constants
|
||||||
|
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
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").
|
// 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) ;-)
|
// 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)
|
private Bitmap fetchTexture(UUID id)
|
||||||
{
|
{
|
||||||
AssetBase asset = m_scene.AssetService.Get(id.ToString());
|
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;
|
if (asset == null) return null;
|
||||||
|
|
||||||
ManagedImage managedImage;
|
ManagedImage managedImage;
|
||||||
|
@ -188,18 +190,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
}
|
}
|
||||||
catch (DllNotFoundException)
|
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)
|
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)
|
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;
|
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,
|
// 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.
|
// 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) {
|
private float getHeight(ITerrainChannel hm, int x, int y) {
|
||||||
if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1))
|
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);
|
return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112);
|
||||||
else
|
else
|
||||||
return (float)hm[x, y];
|
return (float)hm[x, y];
|
||||||
|
@ -278,7 +277,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
public void TerrainToBitmap(Bitmap mapbmp)
|
public void TerrainToBitmap(Bitmap mapbmp)
|
||||||
{
|
{
|
||||||
int tc = Environment.TickCount;
|
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
|
// 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),
|
// 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;
|
float waterHeight = (float)settings.WaterHeight;
|
||||||
|
|
||||||
double[,] hm = m_scene.Heightmap.GetDoubles();
|
for (int x = 0; x < hm.Width; x++)
|
||||||
|
|
||||||
for (int x = 0; x < (int)Constants.RegionSize; x++)
|
|
||||||
{
|
{
|
||||||
float columnRatio = x / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation
|
float columnRatio = x / (hm.Width - 1); // 0 - 1, for interpolation
|
||||||
for (int y = 0; y < (int)Constants.RegionSize; y++)
|
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
|
// 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))
|
if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
|
||||||
heightvalue = 0;
|
heightvalue = 0;
|
||||||
|
|
||||||
|
@ -368,9 +373,9 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shade the terrain for shadows
|
// 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))
|
if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare))
|
||||||
hfvaluecompare = 0f;
|
hfvaluecompare = 0f;
|
||||||
|
|
||||||
|
|
|
@ -151,14 +151,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // Sell a copy
|
case 2: // Sell a copy
|
||||||
Vector3 inventoryStoredPosition = new Vector3
|
Vector3 inventoryStoredPosition = new Vector3(
|
||||||
(((group.AbsolutePosition.X > (int)Constants.RegionSize)
|
Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6),
|
||||||
? 250
|
Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6),
|
||||||
: group.AbsolutePosition.X)
|
|
||||||
,
|
|
||||||
(group.AbsolutePosition.X > (int)Constants.RegionSize)
|
|
||||||
? 250
|
|
||||||
: group.AbsolutePosition.X,
|
|
||||||
group.AbsolutePosition.Z);
|
group.AbsolutePosition.Z);
|
||||||
|
|
||||||
Vector3 originalPosition = group.AbsolutePosition;
|
Vector3 originalPosition = group.AbsolutePosition;
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
|
||||||
{
|
{
|
||||||
if (fillArea[x, y])
|
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;
|
map[x, y] += noise * strength;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes
|
||||||
z *= z;
|
z *= z;
|
||||||
z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
|
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)
|
if (z > 0.0)
|
||||||
map[x, y] += noise * z * duration;
|
map[x, y] += noise * z * duration;
|
||||||
|
|
|
@ -128,7 +128,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
public Bitmap CreateMapTile()
|
public Bitmap CreateMapTile()
|
||||||
{
|
{
|
||||||
Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f);
|
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);
|
return CreateMapTile(viewport, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,8 +184,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
data.Name = info.RegionName;
|
data.Name = info.RegionName;
|
||||||
data.RegionFlags = 0; // TODO not used?
|
data.RegionFlags = 0; // TODO not used?
|
||||||
data.WaterHeight = 0; // not used
|
data.WaterHeight = 0; // not used
|
||||||
data.X = (ushort)(info.RegionLocX / Constants.RegionSize);
|
data.X = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocX);
|
||||||
data.Y = (ushort)(info.RegionLocY / Constants.RegionSize);
|
data.Y = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocY);
|
||||||
blocks.Add(data);
|
blocks.Add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,11 +277,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
{
|
{
|
||||||
List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
|
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,
|
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||||
(int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 8),
|
||||||
(int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 8),
|
||||||
(int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 8),
|
||||||
(int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize);
|
(int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) );
|
||||||
foreach (GridRegion r in regions)
|
foreach (GridRegion r in regions)
|
||||||
{
|
{
|
||||||
MapBlockData block = new MapBlockData();
|
MapBlockData block = new MapBlockData();
|
||||||
|
@ -1011,17 +1012,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
// on an unloaded square.
|
// on an unloaded square.
|
||||||
// But make sure: Look whether the one we requested is in there
|
// But make sure: Look whether the one we requested is in there
|
||||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||||
minX * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX),
|
||||||
maxX * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) );
|
||||||
minY * (int)Constants.RegionSize,
|
|
||||||
maxY * (int)Constants.RegionSize);
|
|
||||||
|
|
||||||
if (regions != null)
|
if (regions != null)
|
||||||
{
|
{
|
||||||
foreach (GridRegion r in regions)
|
foreach (GridRegion r in regions)
|
||||||
{
|
{
|
||||||
if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
|
if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX)
|
||||||
(r.RegionLocY == minY * (int)Constants.RegionSize))
|
&& r.RegionLocY == Util.RegionToWorldLoc((uint)minY) )
|
||||||
{
|
{
|
||||||
// found it => add it to response
|
// found it => add it to response
|
||||||
MapBlockData block = new MapBlockData();
|
MapBlockData block = new MapBlockData();
|
||||||
|
@ -1055,10 +1054,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
{
|
{
|
||||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||||
(minX - 4) * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)),
|
||||||
(maxX + 4) * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) );
|
||||||
(minY - 4) * (int)Constants.RegionSize,
|
|
||||||
(maxY + 4) * (int)Constants.RegionSize);
|
|
||||||
foreach (GridRegion r in regions)
|
foreach (GridRegion r in regions)
|
||||||
{
|
{
|
||||||
MapBlockData block = new MapBlockData();
|
MapBlockData block = new MapBlockData();
|
||||||
|
@ -1086,8 +1083,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
block.Name = r.RegionName;
|
block.Name = r.RegionName;
|
||||||
block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
|
block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX);
|
||||||
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
|
block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hashtable OnHTTPThrottled(Hashtable keysvals)
|
public Hashtable OnHTTPThrottled(Hashtable keysvals)
|
||||||
|
@ -1218,10 +1215,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||||
(int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 9),
|
||||||
(int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 9),
|
||||||
(int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 9),
|
||||||
(int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize);
|
(int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 9));
|
||||||
List<AssetBase> textures = new List<AssetBase>();
|
List<AssetBase> textures = new List<AssetBase>();
|
||||||
List<Image> bitImages = new List<Image>();
|
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>
|
/// <returns>True after all operations complete, throws exceptions otherwise.</returns>
|
||||||
public override void OtherRegionUp(GridRegion otherRegion)
|
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 xcell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocX);
|
||||||
uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY);
|
uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY);
|
||||||
|
|
||||||
|
@ -2450,9 +2448,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
int xx = (int)Math.Floor(pos.X);
|
int xx = (int)Math.Floor(pos.X);
|
||||||
int yy = (int)Math.Floor(pos.Y);
|
int yy = (int)Math.Floor(pos.Y);
|
||||||
if (xx < 0
|
if (xx < 0
|
||||||
|| xx > RegionInfo.RegionSizeX
|
|| xx >= RegionInfo.RegionSizeX
|
||||||
|| yy < 0
|
|| yy < 0
|
||||||
|| yy > RegionInfo.RegionSizeY)
|
|| yy >= RegionInfo.RegionSizeY)
|
||||||
ret = false;
|
ret = false;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -4581,53 +4579,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ScenePresence sp = GetScenePresence(remoteClient.AgentId);
|
ScenePresence sp = GetScenePresence(remoteClient.AgentId);
|
||||||
if (sp != null)
|
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)
|
if (EntityTransferModule != null)
|
||||||
{
|
{
|
||||||
EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
|
EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
|
||||||
|
|
|
@ -331,7 +331,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
get
|
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 maxScale = Vector3.Zero;
|
||||||
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
|
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);
|
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
|
||||||
|
|
||||||
// Normalize
|
// Normalize
|
||||||
if (val.X >= Constants.RegionSize)
|
if (val.X >= m_scene.RegionInfo.RegionSizeX)
|
||||||
val.X -= Constants.RegionSize;
|
val.X -= m_scene.RegionInfo.RegionSizeX;
|
||||||
if (val.Y >= Constants.RegionSize)
|
if (val.Y >= m_scene.RegionInfo.RegionSizeY)
|
||||||
val.Y -= Constants.RegionSize;
|
val.Y -= m_scene.RegionInfo.RegionSizeY;
|
||||||
if (val.X < 0)
|
if (val.X < 0)
|
||||||
val.X += Constants.RegionSize;
|
val.X += m_scene.RegionInfo.RegionSizeX;
|
||||||
if (val.Y < 0)
|
if (val.Y < 0)
|
||||||
val.Y += Constants.RegionSize;
|
val.Y += m_scene.RegionInfo.RegionSizeY;
|
||||||
|
|
||||||
// If it's deleted, crossing was successful
|
// If it's deleted, crossing was successful
|
||||||
if (IsDeleted)
|
if (IsDeleted)
|
||||||
|
@ -572,9 +572,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vector3 oldp = AbsolutePosition;
|
Vector3 oldp = AbsolutePosition;
|
||||||
val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f);
|
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)Constants.RegionSize - 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, 4096.0f);
|
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
|
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 { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
// Local constants
|
// 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 Vector3 CenterOfRegion = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20);
|
||||||
private static readonly char[] CS_SPACE = { ' ' };
|
private static readonly char[] CS_SPACE = { ' ' };
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
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 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;
|
private const int DEBUG_CHANNEL = 2147483647;
|
||||||
|
|
||||||
|
|
|
@ -1311,7 +1311,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
||||||
/* TODO */
|
/* TODO */
|
||||||
ConfigurationParameters[] configparms = new ConfigurationParameters[1];
|
ConfigurationParameters[] configparms = new ConfigurationParameters[1];
|
||||||
configparms[0] = parms;
|
configparms[0] = parms;
|
||||||
Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
|
Vector3 worldExtent = maxPosition;
|
||||||
m_maxCollisions = maxCollisions;
|
m_maxCollisions = maxCollisions;
|
||||||
m_maxUpdatesPerFrame = maxUpdates;
|
m_maxUpdatesPerFrame = maxUpdates;
|
||||||
specialCollisionObjects = new Dictionary<uint, GhostObject>();
|
specialCollisionObjects = new Dictionary<uint, GhostObject>();
|
||||||
|
|
|
@ -208,6 +208,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
Name = EngineType + "/" + RegionName;
|
Name = EngineType + "/" + RegionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Old version of initialization that assumes legacy sized regions (256x256)
|
||||||
public override void Initialise(IMesher meshmerizer, IConfigSource config)
|
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.");
|
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);
|
m_host.AddScriptLPS(1);
|
||||||
UUID agentId = new UUID();
|
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))
|
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)
|
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.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);
|
m_host.AddScriptLPS(1);
|
||||||
UUID agentId = new UUID();
|
UUID agentId = new UUID();
|
||||||
|
|
|
@ -713,16 +713,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
}
|
}
|
||||||
private void Save()
|
private void Save()
|
||||||
{
|
{
|
||||||
|
/* Remove temporarily until we have a handle to the region size
|
||||||
if (Position.x > ((int)Constants.RegionSize - 1))
|
if (Position.x > ((int)Constants.RegionSize - 1))
|
||||||
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))
|
if (Position.y > ((int)Constants.RegionSize - 1))
|
||||||
Position.y = ((int)Constants.RegionSize - 1);
|
Position.y = ((int)Constants.RegionSize - 1);
|
||||||
if (Position.y < 0)
|
*/
|
||||||
Position.y = 0;
|
|
||||||
if (Position.z > Constants.RegionHeight)
|
if (Position.z > Constants.RegionHeight)
|
||||||
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)
|
if (Position.z < 0)
|
||||||
Position.z = 0;
|
Position.z = 0;
|
||||||
prim.OSSL.llSetPos(Position);
|
prim.OSSL.llSetPos(Position);
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
|
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
|
||||||
{
|
{
|
||||||
Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
|
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
|
OSDMap extraData = new OSDMap
|
||||||
{
|
{
|
||||||
|
@ -156,15 +156,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
|
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
|
||||||
{
|
{
|
||||||
const int NEIGHBOR_RADIUS = 128;
|
|
||||||
|
|
||||||
GridRegion region = GetRegionByUUID(scopeID, regionID);
|
GridRegion region = GetRegionByUUID(scopeID, regionID);
|
||||||
|
|
||||||
|
int NEIGHBOR_RADIUS = Math.Max(region.RegionSizeX, region.RegionSizeY) / 2;
|
||||||
|
|
||||||
if (region != null)
|
if (region != null)
|
||||||
{
|
{
|
||||||
List<GridRegion> regions = GetRegionRange(scopeID,
|
List<GridRegion> regions = GetRegionRange(scopeID,
|
||||||
region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + (int)Constants.RegionSize + NEIGHBOR_RADIUS,
|
region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + region.RegionSizeX + NEIGHBOR_RADIUS,
|
||||||
region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + (int)Constants.RegionSize + NEIGHBOR_RADIUS);
|
region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + region.RegionSizeY + NEIGHBOR_RADIUS);
|
||||||
|
|
||||||
for (int i = 0; i < regions.Count; i++)
|
for (int i = 0; i < regions.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -229,7 +229,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}",
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,8 +313,10 @@ namespace OpenSim.Services.GridService
|
||||||
if (region != null)
|
if (region != null)
|
||||||
{
|
{
|
||||||
// Not really? Maybe?
|
// Not really? Maybe?
|
||||||
List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1,
|
// The adjacent regions are presumed to be the same size as the current region
|
||||||
region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID);
|
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)
|
foreach (RegionData rdata in rdatas)
|
||||||
{
|
{
|
||||||
|
@ -642,20 +644,20 @@ namespace OpenSim.Services.GridService
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x, y;
|
uint x, y;
|
||||||
if (!int.TryParse(cmd[3], out x))
|
if (!uint.TryParse(cmd[3], out x))
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("x-coord must be an integer");
|
MainConsole.Instance.Output("x-coord must be an integer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!int.TryParse(cmd[4], out y))
|
if (!uint.TryParse(cmd[4], out y))
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("y-coord must be an integer");
|
MainConsole.Instance.Output("y-coord must be an integer");
|
||||||
return;
|
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)
|
if (region == null)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y);
|
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)
|
public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
|
||||||
{
|
{
|
||||||
string reason = string.Empty;
|
string reason = string.Empty;
|
||||||
int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize;
|
uint xloc = Util.RegionToWorldLoc((uint)random.Next(0, Int16.MaxValue));
|
||||||
return TryLinkRegionToCoords(scopeID, regionDescriptor, xloc, 0, out reason);
|
return TryLinkRegionToCoords(scopeID, regionDescriptor, (int)xloc, 0, out reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Random random = new Random();
|
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}",
|
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}",
|
||||||
((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
|
((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
|
||||||
remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
|
remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc));
|
||||||
|
|
||||||
reason = string.Empty;
|
reason = string.Empty;
|
||||||
Uri uri = null;
|
Uri uri = null;
|
||||||
|
@ -311,7 +311,7 @@ namespace OpenSim.Services.GridService
|
||||||
if (region != null)
|
if (region != null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}",
|
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);
|
region.RegionName, region.RegionID);
|
||||||
reason = "Coordinates are already in use";
|
reason = "Coordinates are already in use";
|
||||||
return false;
|
return false;
|
||||||
|
@ -347,7 +347,7 @@ namespace OpenSim.Services.GridService
|
||||||
if (region != null)
|
if (region != null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}",
|
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;
|
regInfo = region;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -424,10 +424,10 @@ namespace OpenSim.Services.GridService
|
||||||
// {
|
// {
|
||||||
// uint ux = 0, uy = 0;
|
// uint ux = 0, uy = 0;
|
||||||
// Utils.LongToUInts(realHandle, out ux, out uy);
|
// Utils.LongToUInts(realHandle, out ux, out uy);
|
||||||
// x = ux / Constants.RegionSize;
|
// x = Util.WorldToRegionLoc(ux);
|
||||||
// y = uy / Constants.RegionSize;
|
// y = Util.WorldToRegionLoc(uy);
|
||||||
//
|
//
|
||||||
// const uint limit = (4096 - 1) * Constants.RegionSize;
|
// const uint limit = Util.RegionToWorldLoc(4096 - 1);
|
||||||
// uint xmin = ux - limit;
|
// uint xmin = ux - limit;
|
||||||
// uint xmax = ux + limit;
|
// uint xmax = ux + limit;
|
||||||
// uint ymin = uy - limit;
|
// uint ymin = uy - limit;
|
||||||
|
@ -502,9 +502,14 @@ namespace OpenSim.Services.GridService
|
||||||
MainConsole.Instance.Output(new string('-', 72));
|
MainConsole.Instance.Output(new string('-', 72));
|
||||||
foreach (RegionData r in regions)
|
foreach (RegionData r in regions)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n",
|
MainConsole.Instance.Output(
|
||||||
r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY,
|
String.Format("{0}\n{2,-32} {1}\n",
|
||||||
r.posX / Constants.RegionSize, r.posY / Constants.RegionSize)));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -529,8 +534,8 @@ namespace OpenSim.Services.GridService
|
||||||
int xloc, yloc;
|
int xloc, yloc;
|
||||||
string serverURI;
|
string serverURI;
|
||||||
string remoteName = null;
|
string remoteName = null;
|
||||||
xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
|
xloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[0]));
|
||||||
yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
|
yloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[1]));
|
||||||
serverURI = cmdparams[2];
|
serverURI = cmdparams[2];
|
||||||
if (cmdparams.Length > 3)
|
if (cmdparams.Length > 3)
|
||||||
remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3);
|
remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3);
|
||||||
|
@ -601,13 +606,13 @@ namespace OpenSim.Services.GridService
|
||||||
{
|
{
|
||||||
// old format
|
// old format
|
||||||
GridRegion regInfo;
|
GridRegion regInfo;
|
||||||
int xloc, yloc;
|
uint xloc, yloc;
|
||||||
uint externalPort;
|
uint externalPort;
|
||||||
string externalHostName;
|
string externalHostName;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
xloc = Convert.ToInt32(cmdparams[0]);
|
xloc = Convert.ToUInt32(cmdparams[0]);
|
||||||
yloc = Convert.ToInt32(cmdparams[1]);
|
yloc = Convert.ToUInt32(cmdparams[1]);
|
||||||
externalPort = Convert.ToUInt32(cmdparams[3]);
|
externalPort = Convert.ToUInt32(cmdparams[3]);
|
||||||
externalHostName = cmdparams[2];
|
externalHostName = cmdparams[2];
|
||||||
//internalPort = Convert.ToUInt32(cmdparams[4]);
|
//internalPort = Convert.ToUInt32(cmdparams[4]);
|
||||||
|
@ -621,10 +626,11 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert cell coordinates given by the user to meters
|
// Convert cell coordinates given by the user to meters
|
||||||
xloc = xloc * (int)Constants.RegionSize;
|
xloc = Util.RegionToWorldLoc(xloc);
|
||||||
yloc = yloc * (int)Constants.RegionSize;
|
yloc = Util.RegionToWorldLoc(yloc);
|
||||||
string reason = string.Empty;
|
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,
|
// What is this? The GridRegion instance will be discarded anyway,
|
||||||
// which effectively ignores any local name given with the command.
|
// which effectively ignores any local name given with the command.
|
||||||
|
@ -704,13 +710,13 @@ namespace OpenSim.Services.GridService
|
||||||
private void ReadLinkFromConfig(IConfig config)
|
private void ReadLinkFromConfig(IConfig config)
|
||||||
{
|
{
|
||||||
GridRegion regInfo;
|
GridRegion regInfo;
|
||||||
int xloc, yloc;
|
uint xloc, yloc;
|
||||||
uint externalPort;
|
uint externalPort;
|
||||||
string externalHostName;
|
string externalHostName;
|
||||||
uint realXLoc, realYLoc;
|
uint realXLoc, realYLoc;
|
||||||
|
|
||||||
xloc = Convert.ToInt32(config.GetString("xloc", "0"));
|
xloc = Convert.ToUInt32(config.GetString("xloc", "0"));
|
||||||
yloc = Convert.ToInt32(config.GetString("yloc", "0"));
|
yloc = Convert.ToUInt32(config.GetString("yloc", "0"));
|
||||||
externalPort = Convert.ToUInt32(config.GetString("externalPort", "0"));
|
externalPort = Convert.ToUInt32(config.GetString("externalPort", "0"));
|
||||||
externalHostName = config.GetString("externalHostName", "");
|
externalHostName = config.GetString("externalHostName", "");
|
||||||
realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0"));
|
realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0"));
|
||||||
|
@ -718,18 +724,19 @@ namespace OpenSim.Services.GridService
|
||||||
|
|
||||||
if (m_enableAutoMapping)
|
if (m_enableAutoMapping)
|
||||||
{
|
{
|
||||||
xloc = (int)((xloc % 100) + m_autoMappingX);
|
xloc = (xloc % 100) + m_autoMappingX;
|
||||||
yloc = (int)((yloc % 100) + m_autoMappingY);
|
yloc = (yloc % 100) + m_autoMappingY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((realXLoc == 0) && (realYLoc == 0)) ||
|
if (((realXLoc == 0) && (realYLoc == 0)) ||
|
||||||
(((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
|
(((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
|
||||||
((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
|
((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
|
||||||
{
|
{
|
||||||
xloc = xloc * (int)Constants.RegionSize;
|
xloc = Util.RegionToWorldLoc(xloc);
|
||||||
yloc = yloc * (int)Constants.RegionSize;
|
yloc = Util.RegionToWorldLoc(yloc);
|
||||||
string reason = string.Empty;
|
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", "");
|
regInfo.RegionName = config.GetString("localName", "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
m_serverURI = string.Empty;
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||||
{
|
{
|
||||||
m_regionLocX = regionLocX;
|
m_regionLocX = regionLocX;
|
||||||
|
@ -245,6 +246,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
|
|
||||||
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
|
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public GridRegion(uint xcell, uint ycell)
|
public GridRegion(uint xcell, uint ycell)
|
||||||
{
|
{
|
||||||
|
|
|
@ -362,7 +362,6 @@ namespace OpenSim.Services.LLLoginService
|
||||||
|
|
||||||
private void FillOutHomeData(GridUserInfo pinfo, GridRegion home)
|
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 x = (int)Util.RegionToWorldLoc(1000);
|
||||||
int y = (int)Util.RegionToWorldLoc(1000);
|
int y = (int)Util.RegionToWorldLoc(1000);
|
||||||
if (home != null)
|
if (home != null)
|
||||||
|
@ -438,22 +437,22 @@ namespace OpenSim.Services.LLLoginService
|
||||||
ErrorReason = "key";
|
ErrorReason = "key";
|
||||||
welcomeMessage = "Welcome to OpenSim!";
|
welcomeMessage = "Welcome to OpenSim!";
|
||||||
seedCapability = String.Empty;
|
seedCapability = String.Empty;
|
||||||
home = "{'region_handle':[r"
|
home = "{'region_handle':["
|
||||||
+ Util.RegionToWorldLoc(1000).ToString()
|
+ "r" + Util.RegionToWorldLoc(1000).ToString()
|
||||||
+ ",r"
|
+ ","
|
||||||
+ Util.RegionToWorldLoc(1000).ToString()
|
+ "r" + Util.RegionToWorldLoc(1000).ToString()
|
||||||
+ "], 'position':[r"
|
+ "], 'position':["
|
||||||
+ userProfile.homepos.X.ToString()
|
+ "r" + userProfile.homepos.X.ToString()
|
||||||
+ ",r"
|
+ ","
|
||||||
+ userProfile.homepos.Y.ToString()
|
+ "r" + userProfile.homepos.Y.ToString()
|
||||||
+ ",r"
|
+ ","
|
||||||
+ userProfile.homepos.Z.ToString()
|
+ "r" + userProfile.homepos.Z.ToString()
|
||||||
+ "], 'look_at':[r"
|
+ "], 'look_at':["
|
||||||
+ userProfile.homelookat.X.ToString()
|
+ "r" + userProfile.homelookat.X.ToString()
|
||||||
+ ",r"
|
+ ","
|
||||||
+ userProfile.homelookat.Y.ToString()
|
+ "r" + userProfile.homelookat.Y.ToString()
|
||||||
+ ",r"
|
+ ","
|
||||||
+ userProfile.homelookat.Z.ToString()
|
+ "r" + userProfile.homelookat.Z.ToString()
|
||||||
+ "]}";
|
+ "]}";
|
||||||
lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
|
lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
|
||||||
RegionX = (uint) 255232;
|
RegionX = (uint) 255232;
|
||||||
|
|
|
@ -150,16 +150,16 @@ namespace OpenSim.Tests.Clients.GridClient
|
||||||
|
|
||||||
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
|
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
|
||||||
regions = m_Connector.GetRegionRange(UUID.Zero,
|
regions = m_Connector.GetRegionRange(UUID.Zero,
|
||||||
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize,
|
(int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002),
|
||||||
900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize);
|
(int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002) );
|
||||||
if (regions == null)
|
if (regions == null)
|
||||||
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
|
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
|
||||||
else
|
else
|
||||||
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
|
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
|
||||||
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
|
Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
|
||||||
regions = m_Connector.GetRegionRange(UUID.Zero,
|
regions = m_Connector.GetRegionRange(UUID.Zero,
|
||||||
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize,
|
(int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950),
|
||||||
900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize);
|
(int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950) );
|
||||||
if (regions == null)
|
if (regions == null)
|
||||||
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
|
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue