* More tweaking of the various services to work with nonstandard region sizes. * Now, what's available of the terrain will show and it'll be truncated if it's larger on Linden Clients. Parcel minimum is 64 (256/4) for the client to accept it.

arthursv
Teravus Ovares (Dan Olivares) 2009-08-08 00:10:19 -04:00
parent 0b0ed200f6
commit bff26ccdbb
4 changed files with 62 additions and 10 deletions

View File

@ -1457,7 +1457,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//}
for (int x = 0; x < 16; x++)
{
SendLayerData(x, y, map);
SendLayerData(x, y, LLHeightFieldMoronize(map));
Thread.Sleep(35);
}
}
@ -1503,7 +1503,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
patches[0] = patchx + 0 + patchy * 16;
LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(map, patches);
LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(((map.Length==65536)? map : LLHeightFieldMoronize(map)), patches);
layerpack.Header.Zerocoded = true;
OutPacket(layerpack, ThrottleOutPacketType.Land);
@ -1515,6 +1515,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
/// <summary>
/// Munges heightfield into the LLUDP backed in restricted heightfield.
/// </summary>
/// <param name="map">float array in the base; Constants.RegionSize</param>
/// <returns>float array in the base 256</returns>
internal float[] LLHeightFieldMoronize(float[] map)
{
if (map.Length == 65536)
return map;
else
{
float[] returnmap = new float[65536];
if (map.Length < 65535)
{
// rebase the vector stride to 256
for (int i = 0; i < Constants.RegionSize; i++)
Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, (int)Constants.RegionSize);
}
else
{
for (int i = 0; i < 256; i++)
Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, 256);
}
//Array.Copy(map,0,returnmap,0,(map.Length < 65536)? map.Length : 65536);
return returnmap;
}
}
/// <summary>
/// Send the wind matrix to the client
/// </summary>

View File

@ -60,7 +60,10 @@ namespace OpenSim.Region.CoreModules.World.Land
private LandChannel landChannel;
private Scene m_scene;
private readonly int[,] m_landIDList = new int[64, 64];
// Minimum for parcels to work is 64m even if we don't actually use them.
private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64;
private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax];
private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
private bool m_landPrimCountTainted;
@ -456,9 +459,9 @@ namespace OpenSim.Region.CoreModules.World.Land
new_land.landData.LocalID = newLandLocalID;
bool[,] landBitmap = new_land.getLandBitmap();
for (int x = 0; x < 64; x++)
for (int x = 0; x < landArrayMax; x++)
{
for (int y = 0; y < 64; y++)
for (int y = 0; y < landArrayMax; y++)
{
if (landBitmap[x, y])
{
@ -581,10 +584,17 @@ namespace OpenSim.Region.CoreModules.World.Land
}
lock (m_landIDList)
{
if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
return m_landList[m_landIDList[x / 4, y / 4]];
else
try
{
if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
return m_landList[m_landIDList[x / 4, y / 4]];
else
return null;
}
catch (IndexOutOfRangeException)
{
return null;
}
}
}
@ -941,6 +951,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
for (int y = 0; y < inc_y; y++)
{
ILandObject currentParcel = GetLandObject(start_x + x, start_y + y);
if (currentParcel != null)
@ -951,6 +962,7 @@ namespace OpenSim.Region.CoreModules.World.Land
temp.Add(currentParcel);
}
}
}
}

View File

@ -44,7 +44,8 @@ namespace OpenSim.Region.CoreModules.World.Land
#region Member Variables
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool[,] m_landBitmap = new bool[64,64];
private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64;
private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax];
protected LandData m_landData = new LandData();
protected Scene m_scene;
@ -630,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Land
private bool[,] convertBytesToLandBitmap()
{
bool[,] tempConvertMap = new bool[64,64];
bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax];
tempConvertMap.Initialize();
byte tempByte = 0;
int x = 0, y = 0, i = 0, bitNum = 0;

View File

@ -2494,6 +2494,12 @@ namespace OpenSim.Region.Framework.Scenes
if (!agent.child)
{
if (agent.startpos.X > (int)Constants.RegionSize - 1)
agent.startpos.X = (int)Constants.RegionSize - 1;
if (agent.startpos.Y > (int)Constants.RegionSize - 1)
agent.startpos.Y = (int)Constants.RegionSize - 1;
// Honor parcel landing type and position.
ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
if (land != null)