From bff26ccdbb94fbdf9623b0b00a16ef88549e648e Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sat, 8 Aug 2009 00:10:19 -0400
Subject: * 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.
---
.../Region/ClientStack/LindenUDP/LLClientView.cs | 37 ++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ClientStack')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 9142b36..d8f786b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -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);
@@ -1516,6 +1516,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
///
+ /// Munges heightfield into the LLUDP backed in restricted heightfield.
+ ///
+ /// float array in the base; Constants.RegionSize
+ /// float array in the base 256
+ 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;
+ }
+
+ }
+
+ ///
/// Send the wind matrix to the client
///
/// 16x16 array of wind speeds
--
cgit v1.1