* Remove hard coded 256 limitations from various places. There's no more 256m limitation within the OpenSimulator framework, however, the LLClient ClientView does not support regions larger then 256 meters so, if you try and make your region larger by setting Constants.RegionSize = 512; in OpenSim.Framework.Constants.cs, the terrain will not display on clients using the LLUDP protocol

This commit is contained in:
Teravus Ovares (Dan Olivares)
2009-08-07 18:40:56 -04:00
parent a1a09297bc
commit c8a68fb3fb
14 changed files with 126 additions and 74 deletions

View File

@@ -34,6 +34,7 @@ using DotNetOpenMail.SmtpAuth;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@@ -205,8 +206,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
if (part != null)
{
ObjectRegionName = s.RegionInfo.RegionName;
uint localX = (s.RegionInfo.RegionLocX * 256);
uint localY = (s.RegionInfo.RegionLocY * 256);
uint localX = (s.RegionInfo.RegionLocX * (int)Constants.RegionSize);
uint localY = (s.RegionInfo.RegionLocY * (int)Constants.RegionSize);
ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")";
return part;
}

View File

@@ -27,6 +27,7 @@
using System;
using NUnit.Framework;
using OpenSim.Framework;
using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes;
using OpenSim.Region.Framework.Scenes;
@@ -38,12 +39,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
[Test]
public void BrushTest()
{
bool[,] allowMask = new bool[256, 256];
bool[,] allowMask = new bool[(int)Constants.RegionSize, 256];
int x;
int y;
for (x=0; x<128; x++)
for (x = 0; x < (int)((int)Constants.RegionSize * 0.5f); x++)
{
for (y=0; y<256; y++)
for (y = 0; y < (int)Constants.RegionSize; y++)
{
allowMask[x,y] = true;
}
@@ -52,20 +53,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
//
// Test RaiseSphere
//
TerrainChannel map = new TerrainChannel(256, 256);
TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
ITerrainPaintableEffect effect = new RaiseSphere();
effect.PaintEffect(map, allowMask, 128.0, 128.0, -1.0, 2, 0.1);
Assert.That(map[127, 128] > 0.0, "Raise brush should raising value at this point (127,128).");
Assert.That(map[124, 128] > 0.0, "Raise brush should raising value at this point (124,128).");
Assert.That(map[123, 128] == 0.0, "Raise brush should not change value at this point (123,128).");
Assert.That(map[128, 128] == 0.0, "Raise brush should not change value at this point (128,128).");
Assert.That(map[0, 128] == 0.0, "Raise brush should not change value at this point (0,128).");
effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 2, 0.1);
Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (127,128).");
Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (124,128).");
Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (123,128).");
Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (128,128).");
Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (0,128).");
//
// Test LowerSphere
//
map = new TerrainChannel(256, 256);
map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
for (x=0; x<map.Width; x++)
{
for (y=0; y<map.Height; y++)
@@ -75,19 +76,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
}
effect = new LowerSphere();
effect.PaintEffect(map, allowMask, 128.0, 128.0, -1.0, 2, 6.0);
Assert.That(map[127, 128] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
Assert.That(map[127, 128] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
Assert.That(map[124, 128] < 1.0, "Lower brush should lowering value at this point (124,128).");
Assert.That(map[123, 128] == 1.0, "Lower brush should not change value at this point (123,128).");
Assert.That(map[128, 128] == 1.0, "Lower brush should not change value at this point (128,128).");
Assert.That(map[0, 128] == 1.0, "Lower brush should not change value at this point (0,128).");
effect.PaintEffect(map, allowMask, ((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), -1.0, 2, 6.0);
Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] < 1.0, "Lower brush should lowering value at this point (124,128).");
Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (123,128).");
Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (128,128).");
Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (0,128).");
}
[Test]
public void TerrainChannelTest()
{
TerrainChannel x = new TerrainChannel(256, 256);
TerrainChannel x = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
Assert.That(x[0, 0] == 0.0, "Terrain not initialising correctly.");
x[0, 0] = 1.0;

View File

@@ -33,6 +33,7 @@ using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.Imaging;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@@ -97,7 +98,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
}
terrainRenderer.Initialise(m_scene, m_config);
Bitmap mapbmp = new Bitmap(256, 256);
Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize);
//long t = System.Environment.TickCount;
//for (int i = 0; i < 10; ++i) {
terrainRenderer.TerrainToBitmap(mapbmp);

View File

@@ -30,6 +30,7 @@ using System.Drawing;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.World.WorldMap
@@ -60,9 +61,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
float low = 255;
float high = 0;
for (int x = 0; x < 256; x++)
for (int x = 0; x < (int)Constants.RegionSize; x++)
{
for (int y = 0; y < 256; y++)
for (int y = 0; y < (int)Constants.RegionSize; y++)
{
float hmval = (float)hm[x, y];
if (hmval < low)
@@ -74,12 +75,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
for (int x = 0; x < 256; x++)
for (int x = 0; x < (int)Constants.RegionSize; x++)
{
for (int y = 0; y < 256; y++)
for (int y = 0; y < (int)Constants.RegionSize; y++)
{
// Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left
int yr = 255 - y;
int yr = ((int)Constants.RegionSize - 1) - y;
float heightvalue = (float)hm[x, y];
@@ -111,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
float hfvalue = (float)hm[x, y];
float hfvaluecompare = 0f;
if ((x + 1 < 256) && (y + 1 < 256))
if ((x + 1 < (int)Constants.RegionSize) && (y + 1 < (int)Constants.RegionSize))
{
hfvaluecompare = (float)hm[x + 1, y + 1]; // light from north-east => look at land height there
}
@@ -176,7 +177,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (ShadowDebugContinue)
{
if ((x - 1 > 0) && (yr + 1 < 256))
if ((x - 1 > 0) && (yr + 1 < (int)Constants.RegionSize))
{
color = mapbmp.GetPixel(x - 1, yr + 1);
int r = color.R;
@@ -231,7 +232,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
terraincorruptedwarningsaid = true;
}
Color black = Color.Black;
mapbmp.SetPixel(x, (256 - y) - 1, black);
mapbmp.SetPixel(x, ((int)Constants.RegionSize - y) - 1, black);
}
}
}

View File

@@ -306,15 +306,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
double[,] hm = m_scene.Heightmap.GetDoubles();
for (int x = 0; x < 256; x++)
for (int x = 0; x < (int)Constants.RegionSize; x++)
{
float columnRatio = x / 255f; // 0 - 1, for interpolation
for (int y = 0; y < 256; y++)
float columnRatio = x / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation
for (int y = 0; y < (int)Constants.RegionSize; y++)
{
float rowRatio = y / 255f; // 0 - 1, for interpolation
float rowRatio = y / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation
// Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left
int yr = 255 - y;
int yr = ((int)Constants.RegionSize - 1) - y;
float heightvalue = getHeight(hm, x, y);
if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
@@ -366,7 +366,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
}
// Shade the terrain for shadows
if (x < 255 && y < 255)
if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1))
{
float hfvaluecompare = getHeight(hm, x + 1, y + 1); // light from north-east => look at land height there
if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare))