diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/TerrainCompressor.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs index dd1f26b..897ce65 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | |||
@@ -52,11 +52,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
52 | private static string LogHeader = "[TERRAIN COMPRESSOR]"; | 52 | private static string LogHeader = "[TERRAIN COMPRESSOR]"; |
53 | #pragma warning restore 414 | 53 | #pragma warning restore 414 |
54 | 54 | ||
55 | public const int END_OF_PATCHES = 97; | ||
56 | |||
57 | private const float OO_SQRT2 = 0.7071068f; | 55 | private const float OO_SQRT2 = 0.7071068f; |
56 | private const int END_OF_PATCHES = 97; | ||
58 | private const int STRIDE = 264; | 57 | private const int STRIDE = 264; |
59 | |||
60 | private const int ZERO_CODE = 0x0; | 58 | private const int ZERO_CODE = 0x0; |
61 | private const int ZERO_EOB = 0x2; | 59 | private const int ZERO_EOB = 0x2; |
62 | private const int POSITIVE_VALUE = 0x6; | 60 | private const int POSITIVE_VALUE = 0x6; |
@@ -236,13 +234,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
236 | if (Math.Round((double)frange, 2) == 1.0) | 234 | if (Math.Round((double)frange, 2) == 1.0) |
237 | { | 235 | { |
238 | // flat terrain speed up things | 236 | // flat terrain speed up things |
239 | 237 | output.PackBitsFromByte(0); //QuantWBits | |
240 | header.DCOffset -= 0.5f; | 238 | output.PackFloat(header.DCOffset - 0.5f); |
241 | 239 | output.PackBitsFromByte(1); //range low | |
242 | header.QuantWBits = 0x00; | 240 | output.PackBitsFromByte(0); //range high |
243 | output.PackBits(header.QuantWBits, 8); | ||
244 | output.PackFloat(header.DCOffset); | ||
245 | output.PackBits(1, 16); | ||
246 | if (largeRegion) | 241 | if (largeRegion) |
247 | output.PackBits(header.PatchIDs, 32); | 242 | output.PackBits(header.PatchIDs, 32); |
248 | else | 243 | else |
@@ -296,7 +291,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
296 | header.QuantWBits &= 0xf0; | 291 | header.QuantWBits &= 0xf0; |
297 | header.QuantWBits |= (wbits - 2); | 292 | header.QuantWBits |= (wbits - 2); |
298 | 293 | ||
299 | output.PackBits(header.QuantWBits, 8); | 294 | output.PackBitsFromByte((byte)header.QuantWBits); |
300 | output.PackFloat(header.DCOffset); | 295 | output.PackFloat(header.DCOffset); |
301 | output.PackBits(header.Range, 16); | 296 | output.PackBits(header.Range, 16); |
302 | if (largeRegion) | 297 | if (largeRegion) |
@@ -341,11 +336,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
341 | return; | 336 | return; |
342 | } | 337 | } |
343 | 338 | ||
344 | while(i < j) | 339 | i = j - i; |
340 | while(i > 8) | ||
345 | { | 341 | { |
346 | output.PackBits(ZERO_CODE, 1); | 342 | output.PackBitsFromByte(ZERO_CODE); |
347 | ++i; | 343 | i -= 8; |
348 | } | 344 | } |
345 | if( i > 0) | ||
346 | output.PackBitsFromByte(ZERO_CODE, i); | ||
347 | i = j; | ||
349 | continue; | 348 | continue; |
350 | } | 349 | } |
351 | 350 | ||