forked from bit/DotRecastNetSim
for unity3d
This commit is contained in:
parent
51ae1549ec
commit
4a3e52350d
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace DotRecast.Core
|
namespace DotRecast.Core.Compression
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Core of FastLZ compression algorithm.
|
* Core of FastLZ compression algorithm.
|
||||||
|
@ -27,7 +27,7 @@ namespace DotRecast.Core
|
||||||
* This is refactored code of <a href="https://code.google.com/p/jfastlz/">jfastlz</a>
|
* This is refactored code of <a href="https://code.google.com/p/jfastlz/">jfastlz</a>
|
||||||
* library written by William Kinney.
|
* library written by William Kinney.
|
||||||
*/
|
*/
|
||||||
public static class FastLz
|
public static class FastLZ
|
||||||
{
|
{
|
||||||
private const int MAX_DISTANCE = 8191;
|
private const int MAX_DISTANCE = 8191;
|
||||||
private const int MAX_FARDISTANCE = 65535 + MAX_DISTANCE - 1;
|
private const int MAX_FARDISTANCE = 65535 + MAX_DISTANCE - 1;
|
|
@ -5,4 +5,5 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -19,6 +19,7 @@ freely, subject to the following restrictions:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
|
using DotRecast.Core.Compression;
|
||||||
|
|
||||||
namespace DotRecast.Detour.TileCache.Io.Compress
|
namespace DotRecast.Detour.TileCache.Io.Compress
|
||||||
{
|
{
|
||||||
|
@ -28,7 +29,6 @@ namespace DotRecast.Detour.TileCache.Io.Compress
|
||||||
|
|
||||||
private DtTileCacheFastLzCompressor()
|
private DtTileCacheFastLzCompressor()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Decompress(byte[] buf)
|
public byte[] Decompress(byte[] buf)
|
||||||
|
@ -39,14 +39,14 @@ namespace DotRecast.Detour.TileCache.Io.Compress
|
||||||
public byte[] Decompress(byte[] buf, int offset, int len, int outputlen)
|
public byte[] Decompress(byte[] buf, int offset, int len, int outputlen)
|
||||||
{
|
{
|
||||||
byte[] output = new byte[outputlen];
|
byte[] output = new byte[outputlen];
|
||||||
FastLz.Decompress(buf, offset, len, output, 0, outputlen);
|
FastLZ.Decompress(buf, offset, len, output, 0, outputlen);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Compress(byte[] buf)
|
public byte[] Compress(byte[] buf)
|
||||||
{
|
{
|
||||||
byte[] output = new byte[FastLz.CalculateOutputBufferLength(buf.Length)];
|
byte[] output = new byte[FastLZ.CalculateOutputBufferLength(buf.Length)];
|
||||||
int len = FastLz.Compress(buf, 0, buf.Length, output, 0, output.Length);
|
int len = FastLZ.Compress(buf, 0, buf.Length, output, 0, output.Length);
|
||||||
return RcArrayUtils.CopyOf(output, len);
|
return RcArrayUtils.CopyOf(output, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue