* 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.

This commit is contained in:
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>