diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/TerrainCompressor.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs index 897ce65..8d79a86 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | |||
@@ -46,12 +46,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
46 | { | 46 | { |
47 | public static class OpenSimTerrainCompressor | 47 | public static class OpenSimTerrainCompressor |
48 | { | 48 | { |
49 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | #pragma warning disable 414 | ||
52 | private static string LogHeader = "[TERRAIN COMPRESSOR]"; | ||
53 | #pragma warning restore 414 | ||
54 | |||
55 | private const float OO_SQRT2 = 0.7071068f; | 49 | private const float OO_SQRT2 = 0.7071068f; |
56 | private const int END_OF_PATCHES = 97; | 50 | private const int END_OF_PATCHES = 97; |
57 | private const int STRIDE = 264; | 51 | private const int STRIDE = 264; |
@@ -175,16 +169,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
175 | 169 | ||
176 | BitPack bitpack = new BitPack(data, 0); | 170 | BitPack bitpack = new BitPack(data, 0); |
177 | bitpack.PackBits(STRIDE, 16); | 171 | bitpack.PackBits(STRIDE, 16); |
178 | bitpack.PackBits(16, 8); | 172 | bitpack.PackBitsFromByte(16); |
179 | bitpack.PackBits(landPacketType, 8); | 173 | bitpack.PackBitsFromByte(landPacketType); |
180 | 174 | ||
181 | for (int i = 0; i < x.Length; i++) | 175 | for (int i = 0; i < x.Length; i++) |
182 | { | 176 | { |
183 | CreatePatchFromTerrainData(bitpack, terrData, x[i], y[i]); | 177 | CreatePatchFromTerrainData(bitpack, terrData, x[i], y[i]); |
178 | |||
184 | if (bitpack.BytePos > 980 && i != x.Length - 1) | 179 | if (bitpack.BytePos > 980 && i != x.Length - 1) |
185 | { | 180 | { |
186 | //finish this packet | 181 | //finish this packet |
187 | bitpack.PackBits(END_OF_PATCHES, 8); | 182 | bitpack.PackBitsFromByte(END_OF_PATCHES); |
188 | 183 | ||
189 | layer.LayerData.Data = new byte[bitpack.BytePos + 1]; | 184 | layer.LayerData.Data = new byte[bitpack.BytePos + 1]; |
190 | Buffer.BlockCopy(bitpack.Data, 0, layer.LayerData.Data, 0, bitpack.BytePos + 1); | 185 | Buffer.BlockCopy(bitpack.Data, 0, layer.LayerData.Data, 0, bitpack.BytePos + 1); |
@@ -196,12 +191,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
196 | 191 | ||
197 | bitpack = new BitPack(data, 0); | 192 | bitpack = new BitPack(data, 0); |
198 | bitpack.PackBits(STRIDE, 16); | 193 | bitpack.PackBits(STRIDE, 16); |
199 | bitpack.PackBits(16, 8); | 194 | bitpack.PackBitsFromByte(16); |
200 | bitpack.PackBits(landPacketType, 8); | 195 | bitpack.PackBitsFromByte(landPacketType); |
201 | } | 196 | } |
202 | } | 197 | } |
203 | 198 | ||
204 | bitpack.PackBits(END_OF_PATCHES, 8); | 199 | bitpack.PackBitsFromByte(END_OF_PATCHES); |
205 | 200 | ||
206 | layer.LayerData.Data = new byte[bitpack.BytePos + 1]; | 201 | layer.LayerData.Data = new byte[bitpack.BytePos + 1]; |
207 | Buffer.BlockCopy(bitpack.Data, 0, layer.LayerData.Data, 0, bitpack.BytePos + 1); | 202 | Buffer.BlockCopy(bitpack.Data, 0, layer.LayerData.Data, 0, bitpack.BytePos + 1); |
@@ -231,7 +226,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
231 | header.PatchIDs += (patchX << 5); | 226 | header.PatchIDs += (patchX << 5); |
232 | } | 227 | } |
233 | 228 | ||
234 | if (Math.Round((double)frange, 2) == 1.0) | 229 | if (Math.Round(frange, 2) == 1.0) |
235 | { | 230 | { |
236 | // flat terrain speed up things | 231 | // flat terrain speed up things |
237 | output.PackBitsFromByte(0); //QuantWBits | 232 | output.PackBitsFromByte(0); //QuantWBits |
@@ -264,9 +259,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
264 | int startx = patchX * 16; | 259 | int startx = patchX * 16; |
265 | int starty = patchY * 16; | 260 | int starty = patchY * 16; |
266 | 261 | ||
267 | for (int j = starty; j < starty + 16; j++) | 262 | for (int i = startx; i < startx + 16; i++) |
268 | { | 263 | { |
269 | for (int i = startx; i < startx + 16; i++) | 264 | for (int j = starty; j < starty + 16; j++) |
270 | { | 265 | { |
271 | float val = terrData[i, j]; | 266 | float val = terrData[i, j]; |
272 | if (val > zmax) zmax = val; | 267 | if (val > zmax) zmax = val; |
@@ -399,7 +394,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
399 | wbits = (prequant >> 1); | 394 | wbits = (prequant >> 1); |
400 | 395 | ||
401 | dct16x16(block, iout, ref wbits); | 396 | dct16x16(block, iout, ref wbits); |
402 | |||
403 | return iout; | 397 | return iout; |
404 | } | 398 | } |
405 | 399 | ||