forked from bit/DotRecastNetSim
typo
This commit is contained in:
parent
4be459b296
commit
b7a160b93a
|
@ -29,8 +29,8 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
||||||
{
|
{
|
||||||
ZipArchiveEntry graphReferences = file.GetEntry(filename);
|
ZipArchiveEntry graphReferences = file.GetEntry(filename);
|
||||||
using var entryStream = graphReferences.Open();
|
using var entryStream = graphReferences.Open();
|
||||||
using var bis = new BinaryReader(entryStream);
|
using var br = new BinaryReader(entryStream);
|
||||||
RcByteBuffer buffer = IOUtils.ToByteBuffer(bis);
|
RcByteBuffer buffer = IOUtils.ToByteBuffer(br);
|
||||||
buffer.Order(RcByteOrder.LITTLE_ENDIAN);
|
buffer.Order(RcByteOrder.LITTLE_ENDIAN);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1908,11 +1908,11 @@ namespace DotRecast.Detour.TileCache
|
||||||
public byte[] CompressTileCacheLayer(IRcCompressor comp, DtTileCacheLayer layer, RcByteOrder order, bool cCompatibility)
|
public byte[] CompressTileCacheLayer(IRcCompressor comp, DtTileCacheLayer layer, RcByteOrder order, bool cCompatibility)
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream();
|
using var ms = new MemoryStream();
|
||||||
using var baos = new BinaryWriter(ms);
|
using var bw = new BinaryWriter(ms);
|
||||||
DtTileCacheLayerHeaderWriter hw = new DtTileCacheLayerHeaderWriter();
|
DtTileCacheLayerHeaderWriter hw = new DtTileCacheLayerHeaderWriter();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
hw.Write(baos, layer.header, order, cCompatibility);
|
hw.Write(bw, layer.header, order, cCompatibility);
|
||||||
int gridSize = layer.header.width * layer.header.height;
|
int gridSize = layer.header.width * layer.header.height;
|
||||||
byte[] buffer = new byte[gridSize * 3];
|
byte[] buffer = new byte[gridSize * 3];
|
||||||
for (int i = 0; i < gridSize; i++)
|
for (int i = 0; i < gridSize; i++)
|
||||||
|
@ -1923,7 +1923,7 @@ namespace DotRecast.Detour.TileCache
|
||||||
}
|
}
|
||||||
|
|
||||||
var compressed = comp.Compress(buffer);
|
var compressed = comp.Compress(buffer);
|
||||||
baos.Write(compressed);
|
bw.Write(compressed);
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
|
|
|
@ -68,13 +68,13 @@ namespace DotRecast.Detour.Io
|
||||||
|
|
||||||
NavMeshTileHeader tileHeader = new NavMeshTileHeader();
|
NavMeshTileHeader tileHeader = new NavMeshTileHeader();
|
||||||
tileHeader.tileRef = mesh.GetTileRef(tile);
|
tileHeader.tileRef = mesh.GetTileRef(tile);
|
||||||
using MemoryStream bb = new MemoryStream();
|
using MemoryStream msw = new MemoryStream();
|
||||||
using BinaryWriter baos = new BinaryWriter(bb);
|
using BinaryWriter bw = new BinaryWriter(msw);
|
||||||
writer.Write(baos, tile.data, order, cCompatibility);
|
writer.Write(bw, tile.data, order, cCompatibility);
|
||||||
baos.Flush();
|
bw.Flush();
|
||||||
baos.Close();
|
bw.Close();
|
||||||
|
|
||||||
byte[] ba = bb.ToArray();
|
byte[] ba = msw.ToArray();
|
||||||
tileHeader.dataSize = ba.Length;
|
tileHeader.dataSize = ba.Length;
|
||||||
Write(stream, tileHeader.tileRef, order);
|
Write(stream, tileHeader.tileRef, order);
|
||||||
Write(stream, tileHeader.dataSize, order);
|
Write(stream, tileHeader.dataSize, order);
|
||||||
|
|
|
@ -37,15 +37,15 @@ namespace DotRecast.Detour.Io
|
||||||
|
|
||||||
public static byte[] ToByteArray(BinaryReader inputStream)
|
public static byte[] ToByteArray(BinaryReader inputStream)
|
||||||
{
|
{
|
||||||
using var baos = new MemoryStream();
|
using var msw = new MemoryStream();
|
||||||
byte[] buffer = new byte[4096];
|
byte[] buffer = new byte[4096];
|
||||||
int l;
|
int l;
|
||||||
while ((l = inputStream.Read(buffer)) > 0)
|
while ((l = inputStream.Read(buffer)) > 0)
|
||||||
{
|
{
|
||||||
baos.Write(buffer, 0, l);
|
msw.Write(buffer, 0, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
return baos.ToArray();
|
return msw.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -212,15 +212,15 @@ public class ModernOpenGLDraw : IOpenGLDraw
|
||||||
if (currentPrim == DebugDrawPrimitives.QUADS)
|
if (currentPrim == DebugDrawPrimitives.QUADS)
|
||||||
{
|
{
|
||||||
using var unmanagedElems = new UnmanagedMemoryStream(pElems, eboSize, eboSize, FileAccess.Write);
|
using var unmanagedElems = new UnmanagedMemoryStream(pElems, eboSize, eboSize, FileAccess.Write);
|
||||||
using var elems = new BinaryWriter(unmanagedElems);
|
using var bw = new BinaryWriter(unmanagedElems);
|
||||||
for (int i = 0; i < vertices.Count; i += 4)
|
for (int i = 0; i < vertices.Count; i += 4)
|
||||||
{
|
{
|
||||||
elems.Write(i);
|
bw.Write(i);
|
||||||
elems.Write(i + 1);
|
bw.Write(i + 1);
|
||||||
elems.Write(i + 2);
|
bw.Write(i + 2);
|
||||||
elems.Write(i);
|
bw.Write(i);
|
||||||
elems.Write(i + 2);
|
bw.Write(i + 2);
|
||||||
elems.Write(i + 3);
|
bw.Write(i + 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -23,11 +23,11 @@ public class DynamicNavMeshTest
|
||||||
{
|
{
|
||||||
byte[] bytes = Loader.ToBytes("test_tiles.voxels");
|
byte[] bytes = Loader.ToBytes("test_tiles.voxels");
|
||||||
using var ms = new MemoryStream(bytes);
|
using var ms = new MemoryStream(bytes);
|
||||||
using var bis = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
|
|
||||||
// load voxels from file
|
// load voxels from file
|
||||||
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
||||||
VoxelFile f = reader.Read(bis);
|
VoxelFile f = reader.Read(br);
|
||||||
// create dynamic navmesh
|
// create dynamic navmesh
|
||||||
DynamicNavMesh mesh = new DynamicNavMesh(f);
|
DynamicNavMesh mesh = new DynamicNavMesh(f);
|
||||||
// build navmesh asynchronously using multiple threads
|
// build navmesh asynchronously using multiple threads
|
||||||
|
|
|
@ -31,10 +31,10 @@ public class VoxelFileReaderTest
|
||||||
{
|
{
|
||||||
byte[] bytes = Loader.ToBytes("test.voxels");
|
byte[] bytes = Loader.ToBytes("test.voxels");
|
||||||
using var ms = new MemoryStream(bytes);
|
using var ms = new MemoryStream(bytes);
|
||||||
using var bis = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
|
|
||||||
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
||||||
VoxelFile f = reader.Read(bis);
|
VoxelFile f = reader.Read(br);
|
||||||
Assert.That(f.useTiles, Is.False);
|
Assert.That(f.useTiles, Is.False);
|
||||||
Assert.That(f.bounds, Is.EqualTo(new float[] { -100.0f, 0f, -100f, 100f, 5f, 100f }));
|
Assert.That(f.bounds, Is.EqualTo(new float[] { -100.0f, 0f, -100f, 100f, 5f, 100f }));
|
||||||
Assert.That(f.cellSize, Is.EqualTo(0.25f));
|
Assert.That(f.cellSize, Is.EqualTo(0.25f));
|
||||||
|
@ -57,10 +57,10 @@ public class VoxelFileReaderTest
|
||||||
{
|
{
|
||||||
byte[] bytes = Loader.ToBytes("test_tiles.voxels");
|
byte[] bytes = Loader.ToBytes("test_tiles.voxels");
|
||||||
using var ms = new MemoryStream(bytes);
|
using var ms = new MemoryStream(bytes);
|
||||||
using var bis = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
|
|
||||||
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
||||||
VoxelFile f = reader.Read(bis);
|
VoxelFile f = reader.Read(br);
|
||||||
|
|
||||||
Assert.That(f.useTiles, Is.True);
|
Assert.That(f.useTiles, Is.True);
|
||||||
Assert.That(f.bounds, Is.EqualTo(new float[] { -100.0f, 0f, -100f, 100f, 5f, 100f }));
|
Assert.That(f.bounds, Is.EqualTo(new float[] { -100.0f, 0f, -100f, 100f, 5f, 100f }));
|
||||||
|
|
|
@ -32,9 +32,9 @@ public class VoxelFileReaderWriterTest
|
||||||
{
|
{
|
||||||
byte[] bytes = Loader.ToBytes("test.voxels");
|
byte[] bytes = Loader.ToBytes("test.voxels");
|
||||||
using var ms = new MemoryStream(bytes);
|
using var ms = new MemoryStream(bytes);
|
||||||
using var bis = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
|
|
||||||
VoxelFile f = ReadWriteRead(bis, compression);
|
VoxelFile f = ReadWriteRead(br, compression);
|
||||||
Assert.That(f.useTiles, Is.False);
|
Assert.That(f.useTiles, Is.False);
|
||||||
Assert.That(f.bounds, Is.EqualTo(new[] { -100.0f, 0f, -100f, 100f, 5f, 100f }));
|
Assert.That(f.bounds, Is.EqualTo(new[] { -100.0f, 0f, -100f, 100f, 5f, 100f }));
|
||||||
Assert.That(f.cellSize, Is.EqualTo(0.25f));
|
Assert.That(f.cellSize, Is.EqualTo(0.25f));
|
||||||
|
@ -60,9 +60,9 @@ public class VoxelFileReaderWriterTest
|
||||||
{
|
{
|
||||||
byte[] bytes = Loader.ToBytes("test_tiles.voxels");
|
byte[] bytes = Loader.ToBytes("test_tiles.voxels");
|
||||||
using var ms = new MemoryStream(bytes);
|
using var ms = new MemoryStream(bytes);
|
||||||
using var bis = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
|
|
||||||
VoxelFile f = ReadWriteRead(bis, compression);
|
VoxelFile f = ReadWriteRead(br, compression);
|
||||||
|
|
||||||
Assert.That(f.useTiles, Is.True);
|
Assert.That(f.useTiles, Is.True);
|
||||||
Assert.That(f.bounds, Is.EqualTo(new[] { -100.0f, 0f, -100f, 100f, 5f, 100f }));
|
Assert.That(f.bounds, Is.EqualTo(new[] { -100.0f, 0f, -100f, 100f, 5f, 100f }));
|
||||||
|
@ -90,13 +90,13 @@ public class VoxelFileReaderWriterTest
|
||||||
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
||||||
VoxelFile f = reader.Read(bis);
|
VoxelFile f = reader.Read(bis);
|
||||||
|
|
||||||
using var msOut = new MemoryStream();
|
using var msw = new MemoryStream();
|
||||||
using var bwOut = new BinaryWriter(msOut);
|
using var bw = new BinaryWriter(msw);
|
||||||
VoxelFileWriter writer = new VoxelFileWriter(DtVoxelTileLZ4ForTestCompressor.Shared);
|
VoxelFileWriter writer = new VoxelFileWriter(DtVoxelTileLZ4ForTestCompressor.Shared);
|
||||||
writer.Write(bwOut, f, compression);
|
writer.Write(bw, f, compression);
|
||||||
|
|
||||||
using var msIn = new MemoryStream(msOut.ToArray());
|
using var msr = new MemoryStream(msw.ToArray());
|
||||||
using var brIn = new BinaryReader(msIn);
|
using var br = new BinaryReader(msr);
|
||||||
return reader.Read(brIn);
|
return reader.Read(br);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -94,11 +94,11 @@ public class VoxelQueryTest
|
||||||
{
|
{
|
||||||
var bytes = Loader.ToBytes("test_tiles.voxels");
|
var bytes = Loader.ToBytes("test_tiles.voxels");
|
||||||
using var ms = new MemoryStream(bytes);
|
using var ms = new MemoryStream(bytes);
|
||||||
using var bis = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
|
|
||||||
// load voxels from file
|
// load voxels from file
|
||||||
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared);
|
||||||
VoxelFile f = reader.Read(bis);
|
VoxelFile f = reader.Read(br);
|
||||||
// create dynamic navmesh
|
// create dynamic navmesh
|
||||||
var mesh = new DynamicNavMesh(f);
|
var mesh = new DynamicNavMesh(f);
|
||||||
// build navmesh asynchronously using multiple threads
|
// build navmesh asynchronously using multiple threads
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class UnityAStarPathfindingImporterTest
|
||||||
string filename = $"all_tiles_navmesh_{filePostfix}.bin";
|
string filename = $"all_tiles_navmesh_{filePostfix}.bin";
|
||||||
string filepath = Path.Combine("test-output", filename);
|
string filepath = Path.Combine("test-output", filename);
|
||||||
using var fs = new FileStream(filename, FileMode.Create);
|
using var fs = new FileStream(filename, FileMode.Create);
|
||||||
using var os = new BinaryWriter(fs);
|
using var bw = new BinaryWriter(fs);
|
||||||
writer.Write(os, mesh, RcByteOrder.LITTLE_ENDIAN, true);
|
writer.Write(bw, mesh, RcByteOrder.LITTLE_ENDIAN, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -63,15 +63,15 @@ public class MeshDataReaderWriterTest
|
||||||
public void Test(bool cCompatibility, RcByteOrder order)
|
public void Test(bool cCompatibility, RcByteOrder order)
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream();
|
using var ms = new MemoryStream();
|
||||||
using var bwos = new BinaryWriter(ms);
|
using var bw = new BinaryWriter(ms);
|
||||||
|
|
||||||
DtMeshDataWriter writer = new DtMeshDataWriter();
|
DtMeshDataWriter writer = new DtMeshDataWriter();
|
||||||
writer.Write(bwos, meshData, order, cCompatibility);
|
writer.Write(bw, meshData, order, cCompatibility);
|
||||||
ms.Seek(0, SeekOrigin.Begin);
|
ms.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
using var bris = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
DtMeshDataReader reader = new DtMeshDataReader();
|
DtMeshDataReader reader = new DtMeshDataReader();
|
||||||
DtMeshData readData = reader.Read(bris, VERTS_PER_POLYGON);
|
DtMeshData readData = reader.Read(br, VERTS_PER_POLYGON);
|
||||||
|
|
||||||
Assert.That(readData.header.vertCount, Is.EqualTo(meshData.header.vertCount));
|
Assert.That(readData.header.vertCount, Is.EqualTo(meshData.header.vertCount));
|
||||||
Assert.That(readData.header.polyCount, Is.EqualTo(meshData.header.polyCount));
|
Assert.That(readData.header.polyCount, Is.EqualTo(meshData.header.polyCount));
|
||||||
|
|
|
@ -34,8 +34,8 @@ public class MeshSetReaderTest
|
||||||
{
|
{
|
||||||
byte[] @is = Loader.ToBytes("all_tiles_navmesh.bin");
|
byte[] @is = Loader.ToBytes("all_tiles_navmesh.bin");
|
||||||
using var ms = new MemoryStream(@is);
|
using var ms = new MemoryStream(@is);
|
||||||
using var bris = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
DtNavMesh mesh = reader.Read(bris, 6);
|
DtNavMesh mesh = reader.Read(br, 6);
|
||||||
Assert.That(mesh.GetMaxTiles(), Is.EqualTo(128));
|
Assert.That(mesh.GetMaxTiles(), Is.EqualTo(128));
|
||||||
Assert.That(mesh.GetParams().maxPolys, Is.EqualTo(0x8000));
|
Assert.That(mesh.GetParams().maxPolys, Is.EqualTo(0x8000));
|
||||||
Assert.That(mesh.GetParams().tileWidth, Is.EqualTo(9.6f).Within(0.001f));
|
Assert.That(mesh.GetParams().tileWidth, Is.EqualTo(9.6f).Within(0.001f));
|
||||||
|
@ -62,9 +62,9 @@ public class MeshSetReaderTest
|
||||||
{
|
{
|
||||||
byte[] @is = Loader.ToBytes("dungeon_all_tiles_navmesh.bin");
|
byte[] @is = Loader.ToBytes("dungeon_all_tiles_navmesh.bin");
|
||||||
using var ms = new MemoryStream(@is);
|
using var ms = new MemoryStream(@is);
|
||||||
using var bris = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
|
|
||||||
DtNavMesh mesh = reader.Read(bris, 6);
|
DtNavMesh mesh = reader.Read(br, 6);
|
||||||
Assert.That(mesh.GetMaxTiles(), Is.EqualTo(128));
|
Assert.That(mesh.GetMaxTiles(), Is.EqualTo(128));
|
||||||
Assert.That(mesh.GetParams().maxPolys, Is.EqualTo(0x8000));
|
Assert.That(mesh.GetParams().maxPolys, Is.EqualTo(0x8000));
|
||||||
Assert.That(mesh.GetParams().tileWidth, Is.EqualTo(9.6f).Within(0.001f));
|
Assert.That(mesh.GetParams().tileWidth, Is.EqualTo(9.6f).Within(0.001f));
|
||||||
|
@ -91,9 +91,9 @@ public class MeshSetReaderTest
|
||||||
{
|
{
|
||||||
byte[] @is = Loader.ToBytes("dungeon_all_tiles_navmesh_32bit.bin");
|
byte[] @is = Loader.ToBytes("dungeon_all_tiles_navmesh_32bit.bin");
|
||||||
using var ms = new MemoryStream(@is);
|
using var ms = new MemoryStream(@is);
|
||||||
using var bris = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
|
|
||||||
DtNavMesh mesh = reader.Read32Bit(bris, 6);
|
DtNavMesh mesh = reader.Read32Bit(br, 6);
|
||||||
Assert.That(mesh.GetMaxTiles(), Is.EqualTo(128));
|
Assert.That(mesh.GetMaxTiles(), Is.EqualTo(128));
|
||||||
Assert.That(mesh.GetParams().maxPolys, Is.EqualTo(0x8000));
|
Assert.That(mesh.GetParams().maxPolys, Is.EqualTo(0x8000));
|
||||||
Assert.That(mesh.GetParams().tileWidth, Is.EqualTo(9.6f).Within(0.001f));
|
Assert.That(mesh.GetParams().tileWidth, Is.EqualTo(9.6f).Within(0.001f));
|
||||||
|
|
|
@ -91,12 +91,12 @@ public class MeshSetReaderWriterTest
|
||||||
}
|
}
|
||||||
|
|
||||||
using var ms = new MemoryStream();
|
using var ms = new MemoryStream();
|
||||||
using var os = new BinaryWriter(ms);
|
using var bw = new BinaryWriter(ms);
|
||||||
writer.Write(os, mesh, RcByteOrder.LITTLE_ENDIAN, true);
|
writer.Write(bw, mesh, RcByteOrder.LITTLE_ENDIAN, true);
|
||||||
ms.Seek(0, SeekOrigin.Begin);
|
ms.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
using var @is = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
mesh = reader.Read(@is, 6);
|
mesh = reader.Read(br, 6);
|
||||||
Assert.That(mesh.GetMaxTiles(), Is.EqualTo(128));
|
Assert.That(mesh.GetMaxTiles(), Is.EqualTo(128));
|
||||||
Assert.That(mesh.GetParams().maxPolys, Is.EqualTo(0x8000));
|
Assert.That(mesh.GetParams().maxPolys, Is.EqualTo(0x8000));
|
||||||
Assert.That(mesh.GetParams().tileWidth, Is.EqualTo(9.6f).Within(0.001f));
|
Assert.That(mesh.GetParams().tileWidth, Is.EqualTo(9.6f).Within(0.001f));
|
||||||
|
|
|
@ -36,8 +36,8 @@ public class TileCacheReaderTest
|
||||||
public void TestNavmesh()
|
public void TestNavmesh()
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream(Loader.ToBytes("all_tiles_tilecache.bin"));
|
using var ms = new MemoryStream(Loader.ToBytes("all_tiles_tilecache.bin"));
|
||||||
using var @is = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
DtTileCache tc = reader.Read(@is, 6, null);
|
DtTileCache tc = reader.Read(br, 6, null);
|
||||||
Assert.That(tc.GetNavMesh().GetMaxTiles(), Is.EqualTo(256));
|
Assert.That(tc.GetNavMesh().GetMaxTiles(), Is.EqualTo(256));
|
||||||
Assert.That(tc.GetNavMesh().GetParams().maxPolys, Is.EqualTo(16384));
|
Assert.That(tc.GetNavMesh().GetParams().maxPolys, Is.EqualTo(16384));
|
||||||
Assert.That(tc.GetNavMesh().GetParams().tileWidth, Is.EqualTo(14.4f).Within(0.001f));
|
Assert.That(tc.GetNavMesh().GetParams().tileWidth, Is.EqualTo(14.4f).Within(0.001f));
|
||||||
|
@ -134,8 +134,8 @@ public class TileCacheReaderTest
|
||||||
public void TestDungeon()
|
public void TestDungeon()
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream(Loader.ToBytes("dungeon_all_tiles_tilecache.bin"));
|
using var ms = new MemoryStream(Loader.ToBytes("dungeon_all_tiles_tilecache.bin"));
|
||||||
using var @is = new BinaryReader(ms);
|
using var br = new BinaryReader(ms);
|
||||||
DtTileCache tc = reader.Read(@is, 6, null);
|
DtTileCache tc = reader.Read(br, 6, null);
|
||||||
Assert.That(tc.GetNavMesh().GetMaxTiles(), Is.EqualTo(256));
|
Assert.That(tc.GetNavMesh().GetMaxTiles(), Is.EqualTo(256));
|
||||||
Assert.That(tc.GetNavMesh().GetParams().maxPolys, Is.EqualTo(16384));
|
Assert.That(tc.GetNavMesh().GetParams().maxPolys, Is.EqualTo(16384));
|
||||||
Assert.That(tc.GetNavMesh().GetParams().tileWidth, Is.EqualTo(14.4f).Within(0.001f));
|
Assert.That(tc.GetNavMesh().GetParams().tileWidth, Is.EqualTo(14.4f).Within(0.001f));
|
||||||
|
|
|
@ -61,13 +61,13 @@ public class TileCacheReaderWriterTest : AbstractTileCacheTest
|
||||||
tc.BuildNavMeshTile(refs);
|
tc.BuildNavMeshTile(refs);
|
||||||
}
|
}
|
||||||
|
|
||||||
using var msout = new MemoryStream();
|
using var msw = new MemoryStream();
|
||||||
using var baos = new BinaryWriter(msout);
|
using var bw = new BinaryWriter(msw);
|
||||||
writer.Write(baos, tc, RcByteOrder.LITTLE_ENDIAN, cCompatibility);
|
writer.Write(bw, tc, RcByteOrder.LITTLE_ENDIAN, cCompatibility);
|
||||||
|
|
||||||
using var msis = new MemoryStream(msout.ToArray());
|
using var msr = new MemoryStream(msw.ToArray());
|
||||||
using var bais = new BinaryReader(msis);
|
using var br = new BinaryReader(msr);
|
||||||
tc = reader.Read(bais, 6, null);
|
tc = reader.Read(br, 6, null);
|
||||||
Assert.That(tc.GetNavMesh().GetMaxTiles(), Is.EqualTo(256));
|
Assert.That(tc.GetNavMesh().GetMaxTiles(), Is.EqualTo(256));
|
||||||
Assert.That(tc.GetNavMesh().GetParams().maxPolys, Is.EqualTo(16384));
|
Assert.That(tc.GetNavMesh().GetParams().maxPolys, Is.EqualTo(16384));
|
||||||
Assert.That(tc.GetNavMesh().GetParams().tileWidth, Is.EqualTo(14.4f).Within(0.001f));
|
Assert.That(tc.GetNavMesh().GetParams().tileWidth, Is.EqualTo(14.4f).Within(0.001f));
|
||||||
|
|
|
@ -38,9 +38,9 @@ public class TileCacheFindPathTest : AbstractTileCacheTest
|
||||||
|
|
||||||
public TileCacheFindPathTest()
|
public TileCacheFindPathTest()
|
||||||
{
|
{
|
||||||
using var msis = new MemoryStream(Loader.ToBytes("dungeon_all_tiles_tilecache.bin"));
|
using var msr = new MemoryStream(Loader.ToBytes("dungeon_all_tiles_tilecache.bin"));
|
||||||
using var @is = new BinaryReader(msis);
|
using var br = new BinaryReader(msr);
|
||||||
DtTileCache tcC = new DtTileCacheReader(DtTileCacheCompressorFactory.Shared).Read(@is, 6, new TestTileCacheMeshProcess());
|
DtTileCache tcC = new DtTileCacheReader(DtTileCacheCompressorFactory.Shared).Read(br, 6, new TestTileCacheMeshProcess());
|
||||||
navmesh = tcC.GetNavMesh();
|
navmesh = tcC.GetNavMesh();
|
||||||
query = new DtNavMeshQuery(navmesh);
|
query = new DtNavMeshQuery(navmesh);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue