diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs b/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs index 38f18c8..efb11ed 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs +++ b/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs @@ -22,7 +22,7 @@ using DotRecast.Detour.Io; namespace DotRecast.Detour.Dynamic.Io { - public class VoxelFileWriter : DetourWriter + public class VoxelFileWriter : DtWriter { private readonly LZ4VoxelTileCompressor compressor = new LZ4VoxelTileCompressor(); diff --git a/src/DotRecast.Detour.TileCache/CompressedTile.cs b/src/DotRecast.Detour.TileCache/DtCompressedTile.cs similarity index 89% rename from src/DotRecast.Detour.TileCache/CompressedTile.cs rename to src/DotRecast.Detour.TileCache/DtCompressedTile.cs index 494b765..fed69e0 100644 --- a/src/DotRecast.Detour.TileCache/CompressedTile.cs +++ b/src/DotRecast.Detour.TileCache/DtCompressedTile.cs @@ -20,20 +20,20 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public class CompressedTile + public class DtCompressedTile { public readonly int index; public int salt; /// < Counter describing modifications to the tile. - public TileCacheLayerHeader header; + public DtTileCacheLayerHeader header; public byte[] data; public int compressed; // offset of compressed data public int flags; - public CompressedTile next; + public DtCompressedTile next; - public CompressedTile(int index) + public DtCompressedTile(int index) { this.index = index; salt = 1; diff --git a/src/DotRecast.Detour.TileCache/LayerMonotoneRegion.cs b/src/DotRecast.Detour.TileCache/DtLayerMonotoneRegion.cs similarity index 51% rename from src/DotRecast.Detour.TileCache/LayerMonotoneRegion.cs rename to src/DotRecast.Detour.TileCache/DtLayerMonotoneRegion.cs index 7973884..2add1a2 100644 --- a/src/DotRecast.Detour.TileCache/LayerMonotoneRegion.cs +++ b/src/DotRecast.Detour.TileCache/DtLayerMonotoneRegion.cs @@ -2,10 +2,12 @@ namespace DotRecast.Detour.TileCache { - public class LayerMonotoneRegion + public class DtLayerMonotoneRegion { + public const int DT_LAYER_MAX_NEIS = 16; + public int area; - public List neis = new List(16); + public List neis = new List(DT_LAYER_MAX_NEIS); public int regId; public int areaId; }; diff --git a/src/DotRecast.Detour.TileCache/LayerSweepSpan.cs b/src/DotRecast.Detour.TileCache/DtLayerSweepSpan.cs similarity index 83% rename from src/DotRecast.Detour.TileCache/LayerSweepSpan.cs rename to src/DotRecast.Detour.TileCache/DtLayerSweepSpan.cs index 909abcf..c14167b 100644 --- a/src/DotRecast.Detour.TileCache/LayerSweepSpan.cs +++ b/src/DotRecast.Detour.TileCache/DtLayerSweepSpan.cs @@ -1,6 +1,6 @@ namespace DotRecast.Detour.TileCache { - public class LayerSweepSpan + public class DtLayerSweepSpan { public int ns; // number samples public int id; // region id diff --git a/src/DotRecast.Detour.TileCache/TempContour.cs b/src/DotRecast.Detour.TileCache/DtTempContour.cs similarity index 88% rename from src/DotRecast.Detour.TileCache/TempContour.cs rename to src/DotRecast.Detour.TileCache/DtTempContour.cs index 797afcd..6ac055e 100644 --- a/src/DotRecast.Detour.TileCache/TempContour.cs +++ b/src/DotRecast.Detour.TileCache/DtTempContour.cs @@ -2,13 +2,13 @@ namespace DotRecast.Detour.TileCache { - public class TempContour + public class DtTempContour { public List verts; public int nverts; public List poly; - public TempContour() + public DtTempContour() { verts = new List(); nverts = 0; diff --git a/src/DotRecast.Detour.TileCache/TileCache.cs b/src/DotRecast.Detour.TileCache/DtTileCache.cs similarity index 86% rename from src/DotRecast.Detour.TileCache/TileCache.cs rename to src/DotRecast.Detour.TileCache/DtTileCache.cs index 46b7446..bffe03f 100644 --- a/src/DotRecast.Detour.TileCache/TileCache.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCache.cs @@ -26,7 +26,7 @@ using static DotRecast.Core.RcMath; namespace DotRecast.Detour.TileCache { - public class TileCache + public class DtTileCache { int m_tileLutSize; @@ -34,13 +34,13 @@ namespace DotRecast.Detour.TileCache int m_tileLutMask; /// < Tile hash lookup mask. - private readonly CompressedTile[] m_posLookup; + private readonly DtCompressedTile[] m_posLookup; /// < Tile hash lookup. - private CompressedTile m_nextFreeTile; + private DtCompressedTile m_nextFreeTile; /// < Freelist of tiles. - private readonly CompressedTile[] m_tiles; + private readonly DtCompressedTile[] m_tiles; /// < List of tiles. // TODO: (PP) replace with list private readonly int m_saltBits; @@ -51,20 +51,20 @@ namespace DotRecast.Detour.TileCache /// < Number of tile bits in the tile ID. private readonly DtNavMesh m_navmesh; - private readonly TileCacheParams m_params; + private readonly DtTileCacheParams m_params; private readonly TileCacheStorageParams m_storageParams; - private readonly ITileCacheCompressor m_tcomp; - private readonly ITileCacheMeshProcess m_tmproc; + private readonly IDtTileCacheCompressor m_tcomp; + private readonly IDtTileCacheMeshProcess m_tmproc; - private readonly List m_obstacles = new List(); - private TileCacheObstacle m_nextFreeObstacle; + private readonly List m_obstacles = new List(); + private DtTileCacheObstacle m_nextFreeObstacle; private readonly List m_reqs = new List(); private readonly List m_update = new List(); - private readonly TileCacheBuilder builder = new TileCacheBuilder(); - private readonly TileCacheLayerHeaderReader tileReader = new TileCacheLayerHeaderReader(); + private readonly DtTileCacheBuilder builder = new DtTileCacheBuilder(); + private readonly DtTileCacheLayerHeaderReader tileReader = new DtTileCacheLayerHeaderReader(); private bool Contains(List a, long v) { @@ -111,8 +111,8 @@ namespace DotRecast.Detour.TileCache return (int)(refs & tileMask); } - public TileCache(TileCacheParams option, TileCacheStorageParams storageParams, DtNavMesh navmesh, - ITileCacheCompressor tcomp, ITileCacheMeshProcess tmprocs) + public DtTileCache(DtTileCacheParams option, TileCacheStorageParams storageParams, DtNavMesh navmesh, + IDtTileCacheCompressor tcomp, IDtTileCacheMeshProcess tmprocs) { m_params = option; m_storageParams = storageParams; @@ -127,11 +127,11 @@ namespace DotRecast.Detour.TileCache } m_tileLutMask = m_tileLutSize - 1; - m_tiles = new CompressedTile[m_params.maxTiles]; - m_posLookup = new CompressedTile[m_tileLutSize]; + m_tiles = new DtCompressedTile[m_params.maxTiles]; + m_posLookup = new DtCompressedTile[m_tileLutSize]; for (int i = m_params.maxTiles - 1; i >= 0; --i) { - m_tiles[i] = new CompressedTile(i); + m_tiles[i] = new DtCompressedTile(i); m_tiles[i].next = m_nextFreeTile; m_nextFreeTile = m_tiles[i]; } @@ -144,7 +144,7 @@ namespace DotRecast.Detour.TileCache } } - public CompressedTile GetTileByRef(long refs) + public DtCompressedTile GetTileByRef(long refs) { if (refs == 0) { @@ -158,7 +158,7 @@ namespace DotRecast.Detour.TileCache return null; } - CompressedTile tile = m_tiles[tileIndex]; + DtCompressedTile tile = m_tiles[tileIndex]; if (tile.salt != tileSalt) { return null; @@ -173,7 +173,7 @@ namespace DotRecast.Detour.TileCache // Find tile based on hash. int h = DtNavMesh.ComputeTileHash(tx, ty, m_tileLutMask); - CompressedTile tile = m_posLookup[h]; + DtCompressedTile tile = m_posLookup[h]; while (tile != null) { if (tile.header != null && tile.header.tx == tx && tile.header.ty == ty) @@ -187,11 +187,11 @@ namespace DotRecast.Detour.TileCache return tiles; } - CompressedTile GetTileAt(int tx, int ty, int tlayer) + DtCompressedTile GetTileAt(int tx, int ty, int tlayer) { // Find tile based on hash. int h = DtNavMesh.ComputeTileHash(tx, ty, m_tileLutMask); - CompressedTile tile = m_posLookup[h]; + DtCompressedTile tile = m_posLookup[h]; while (tile != null) { if (tile.header != null && tile.header.tx == tx && tile.header.ty == ty && tile.header.tlayer == tlayer) @@ -205,7 +205,7 @@ namespace DotRecast.Detour.TileCache return null; } - public long GetTileRef(CompressedTile tile) + public long GetTileRef(DtCompressedTile tile) { if (tile == null) { @@ -216,7 +216,7 @@ namespace DotRecast.Detour.TileCache return EncodeTileId(tile.salt, it); } - public long GetObstacleRef(TileCacheObstacle ob) + public long GetObstacleRef(DtTileCacheObstacle ob) { if (ob == null) { @@ -227,7 +227,7 @@ namespace DotRecast.Detour.TileCache return EncodeObstacleId(ob.salt, idx); } - public TileCacheObstacle GetObstacleByRef(long refs) + public DtTileCacheObstacle GetObstacleByRef(long refs) { if (refs == 0) { @@ -240,7 +240,7 @@ namespace DotRecast.Detour.TileCache return null; } - TileCacheObstacle ob = m_obstacles[idx]; + DtTileCacheObstacle ob = m_obstacles[idx]; int salt = DecodeObstacleIdSalt(refs); if (ob.salt != salt) { @@ -255,7 +255,7 @@ namespace DotRecast.Detour.TileCache // Make sure the data is in right format. RcByteBuffer buf = new RcByteBuffer(data); buf.Order(m_storageParams.byteOrder); - TileCacheLayerHeader header = tileReader.Read(buf, m_storageParams.cCompatibility); + DtTileCacheLayerHeader header = tileReader.Read(buf, m_storageParams.cCompatibility); // Make sure the location is free. if (GetTileAt(header.tx, header.ty, header.tlayer) != null) { @@ -263,7 +263,7 @@ namespace DotRecast.Detour.TileCache } // Allocate a tile. - CompressedTile tile = null; + DtCompressedTile tile = null; if (m_nextFreeTile != null) { tile = m_nextFreeTile; @@ -310,7 +310,7 @@ namespace DotRecast.Detour.TileCache throw new Exception("Invalid tile index"); } - CompressedTile tile = m_tiles[tileIndex]; + DtCompressedTile tile = m_tiles[tileIndex]; if (tile.salt != tileSalt) { throw new Exception("Invalid tile salt"); @@ -318,8 +318,8 @@ namespace DotRecast.Detour.TileCache // Remove tile from hash lookup. int h = DtNavMesh.ComputeTileHash(tile.header.tx, tile.header.ty, m_tileLutMask); - CompressedTile prev = null; - CompressedTile cur = m_posLookup[h]; + DtCompressedTile prev = null; + DtCompressedTile cur = m_posLookup[h]; while (cur != null) { if (cur == tile) @@ -360,7 +360,7 @@ namespace DotRecast.Detour.TileCache // Cylinder obstacle public long AddObstacle(RcVec3f pos, float radius, float height) { - TileCacheObstacle ob = AllocObstacle(); + DtTileCacheObstacle ob = AllocObstacle(); ob.type = TileCacheObstacleType.CYLINDER; ob.pos = pos; @@ -373,7 +373,7 @@ namespace DotRecast.Detour.TileCache // Aabb obstacle public long AddBoxObstacle(RcVec3f bmin, RcVec3f bmax) { - TileCacheObstacle ob = AllocObstacle(); + DtTileCacheObstacle ob = AllocObstacle(); ob.type = TileCacheObstacleType.BOX; ob.bmin = bmin; @@ -385,7 +385,7 @@ namespace DotRecast.Detour.TileCache // Box obstacle: can be rotated in Y public long AddBoxObstacle(RcVec3f center, RcVec3f extents, float yRadians) { - TileCacheObstacle ob = AllocObstacle(); + DtTileCacheObstacle ob = AllocObstacle(); ob.type = TileCacheObstacleType.ORIENTED_BOX; ob.center = center; ob.extents = extents; @@ -396,7 +396,7 @@ namespace DotRecast.Detour.TileCache return AddObstacleRequest(ob).refs; } - private ObstacleRequest AddObstacleRequest(TileCacheObstacle ob) + private ObstacleRequest AddObstacleRequest(DtTileCacheObstacle ob) { ObstacleRequest req = new ObstacleRequest(); req.action = ObstacleRequestAction.REQUEST_ADD; @@ -418,12 +418,12 @@ namespace DotRecast.Detour.TileCache m_reqs.Add(req); } - private TileCacheObstacle AllocObstacle() + private DtTileCacheObstacle AllocObstacle() { - TileCacheObstacle o = m_nextFreeObstacle; + DtTileCacheObstacle o = m_nextFreeObstacle; if (o == null) { - o = new TileCacheObstacle(m_obstacles.Count); + o = new DtTileCacheObstacle(m_obstacles.Count); m_obstacles.Add(o); } else @@ -454,7 +454,7 @@ namespace DotRecast.Detour.TileCache List tiles = GetTilesAt(tx, ty); foreach (long i in tiles) { - CompressedTile tile = m_tiles[DecodeTileIdTile(i)]; + DtCompressedTile tile = m_tiles[DecodeTileIdTile(i)]; RcVec3f tbmin = new RcVec3f(); RcVec3f tbmax = new RcVec3f(); CalcTightTileBounds(tile.header, ref tbmin, ref tbmax); @@ -489,7 +489,7 @@ namespace DotRecast.Detour.TileCache continue; } - TileCacheObstacle ob = m_obstacles[idx]; + DtTileCacheObstacle ob = m_obstacles[idx]; int salt = DecodeObstacleIdSalt(req.refs); if (ob.salt != salt) { @@ -547,7 +547,7 @@ namespace DotRecast.Detour.TileCache // Update obstacle states. for (int i = 0; i < m_obstacles.Count; ++i) { - TileCacheObstacle ob = m_obstacles[i]; + DtTileCacheObstacle ob = m_obstacles[i]; if (ob.state == ObstacleState.DT_OBSTACLE_PROCESSING || ob.state == ObstacleState.DT_OBSTACLE_REMOVING) { @@ -591,7 +591,7 @@ namespace DotRecast.Detour.TileCache throw new Exception("Invalid tile index"); } - CompressedTile tile = m_tiles[idx]; + DtCompressedTile tile = m_tiles[idx]; int salt = DecodeTileIdSalt(refs); if (tile.salt != salt) { @@ -601,12 +601,12 @@ namespace DotRecast.Detour.TileCache int walkableClimbVx = (int)(m_params.walkableClimb / m_params.ch); // Decompress tile layer data. - TileCacheLayer layer = DecompressTile(tile); + DtTileCacheLayer layer = DecompressTile(tile); // Rasterize obstacles. for (int i = 0; i < m_obstacles.Count; ++i) { - TileCacheObstacle ob = m_obstacles[i]; + DtTileCacheObstacle ob = m_obstacles[i]; if (ob.state == ObstacleState.DT_OBSTACLE_EMPTY || ob.state == ObstacleState.DT_OBSTACLE_REMOVING) { continue; @@ -631,9 +631,9 @@ namespace DotRecast.Detour.TileCache // Build navmesh builder.BuildTileCacheRegions(layer, walkableClimbVx); - TileCacheContourSet lcset = builder.BuildTileCacheContours(layer, walkableClimbVx, + DtTileCacheContourSet lcset = builder.BuildTileCacheContours(layer, walkableClimbVx, m_params.maxSimplificationError); - TileCachePolyMesh polyMesh = builder.BuildTileCachePolyMesh(lcset, m_navmesh.GetMaxVertsPerPoly()); + DtTileCachePolyMesh polyMesh = builder.BuildTileCachePolyMesh(lcset, m_navmesh.GetMaxVertsPerPoly()); // Early out if the mesh tile is empty. if (polyMesh.npolys == 0) { @@ -675,14 +675,14 @@ namespace DotRecast.Detour.TileCache } } - public TileCacheLayer DecompressTile(CompressedTile tile) + public DtTileCacheLayer DecompressTile(DtCompressedTile tile) { - TileCacheLayer layer = builder.DecompressTileCacheLayer(m_tcomp, tile.data, m_storageParams.byteOrder, + DtTileCacheLayer layer = builder.DecompressTileCacheLayer(m_tcomp, tile.data, m_storageParams.byteOrder, m_storageParams.cCompatibility); return layer; } - void CalcTightTileBounds(TileCacheLayerHeader header, ref RcVec3f bmin, ref RcVec3f bmax) + void CalcTightTileBounds(DtTileCacheLayerHeader header, ref RcVec3f bmin, ref RcVec3f bmax) { float cs = m_params.cs; bmin.x = header.bmin.x + header.minx * cs; @@ -693,7 +693,7 @@ namespace DotRecast.Detour.TileCache bmax.z = header.bmin.z + (header.maxy + 1) * cs; } - void GetObstacleBounds(TileCacheObstacle ob, ref RcVec3f bmin, ref RcVec3f bmax) + void GetObstacleBounds(DtTileCacheObstacle ob, ref RcVec3f bmin, ref RcVec3f bmax) { if (ob.type == TileCacheObstacleType.CYLINDER) { @@ -721,12 +721,12 @@ namespace DotRecast.Detour.TileCache } } - public TileCacheParams GetParams() + public DtTileCacheParams GetParams() { return m_params; } - public ITileCacheCompressor GetCompressor() + public IDtTileCacheCompressor GetCompressor() { return m_tcomp; } @@ -736,7 +736,7 @@ namespace DotRecast.Detour.TileCache return m_params.maxTiles; } - public CompressedTile GetTile(int i) + public DtCompressedTile GetTile(int i) { return m_tiles[i]; } diff --git a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs b/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs similarity index 95% rename from src/DotRecast.Detour.TileCache/TileCacheBuilder.cs rename to src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs index 4d5b850..777b557 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs @@ -28,7 +28,7 @@ using static DotRecast.Core.RcMath; namespace DotRecast.Detour.TileCache { - public class TileCacheBuilder + public class DtTileCacheBuilder { public const int DT_TILECACHE_NULL_AREA = 0; public const int DT_TILECACHE_WALKABLE_AREA = 63; @@ -36,19 +36,19 @@ namespace DotRecast.Detour.TileCache private static readonly int[] DirOffsetX = { -1, 0, 1, 0, }; private static readonly int[] DirOffsetY = { 0, 1, 0, -1 }; - private readonly TileCacheLayerHeaderReader reader = new TileCacheLayerHeaderReader(); + private readonly DtTileCacheLayerHeaderReader reader = new DtTileCacheLayerHeaderReader(); - public void BuildTileCacheRegions(TileCacheLayer layer, int walkableClimb) + public void BuildTileCacheRegions(DtTileCacheLayer layer, int walkableClimb) { int w = layer.header.width; int h = layer.header.height; Array.Fill(layer.regs, (short)0x00FF); int nsweeps = w; - LayerSweepSpan[] sweeps = new LayerSweepSpan[nsweeps]; + DtLayerSweepSpan[] sweeps = new DtLayerSweepSpan[nsweeps]; for (int i = 0; i < sweeps.Length; i++) { - sweeps[i] = new LayerSweepSpan(); + sweeps[i] = new DtLayerSweepSpan(); } // Partition walkable area into monotone regions. @@ -152,11 +152,11 @@ namespace DotRecast.Detour.TileCache // Allocate and init layer regions. int nregs = regId; - LayerMonotoneRegion[] regs = new LayerMonotoneRegion[nregs]; + DtLayerMonotoneRegion[] regs = new DtLayerMonotoneRegion[nregs]; for (int i = 0; i < nregs; ++i) { - regs[i] = new LayerMonotoneRegion(); + regs[i] = new DtLayerMonotoneRegion(); regs[i].regId = 0xff; } @@ -193,13 +193,13 @@ namespace DotRecast.Detour.TileCache for (int i = 0; i < nregs; ++i) { - LayerMonotoneRegion reg = regs[i]; + DtLayerMonotoneRegion reg = regs[i]; int merge = -1; int mergea = 0; foreach (int nei in reg.neis) { - LayerMonotoneRegion regn = regs[nei]; + DtLayerMonotoneRegion regn = regs[nei]; if (reg.regId == regn.regId) continue; if (reg.areaId != regn.areaId) @@ -254,7 +254,7 @@ namespace DotRecast.Detour.TileCache a.Add(v); } - bool IsConnected(TileCacheLayer layer, int ia, int ib, int walkableClimb) + bool IsConnected(DtTileCacheLayer layer, int ia, int ib, int walkableClimb) { if (layer.areas[ia] != layer.areas[ib]) return false; @@ -263,12 +263,12 @@ namespace DotRecast.Detour.TileCache return true; } - bool CanMerge(int oldRegId, int newRegId, LayerMonotoneRegion[] regs, int nregs) + bool CanMerge(int oldRegId, int newRegId, DtLayerMonotoneRegion[] regs, int nregs) { int count = 0; for (int i = 0; i < nregs; ++i) { - LayerMonotoneRegion reg = regs[i]; + DtLayerMonotoneRegion reg = regs[i]; if (reg.regId != oldRegId) continue; foreach (int nei in reg.neis) @@ -281,7 +281,7 @@ namespace DotRecast.Detour.TileCache return count == 1; } - private void AppendVertex(TempContour cont, int x, int y, int z, int r) + private void AppendVertex(DtTempContour cont, int x, int y, int z, int r) { // Try to merge with existing segments. if (cont.nverts > 1) @@ -315,7 +315,7 @@ namespace DotRecast.Detour.TileCache cont.nverts++; } - private int GetNeighbourReg(TileCacheLayer layer, int ax, int ay, int dir) + private int GetNeighbourReg(DtTileCacheLayer layer, int ax, int ay, int dir) { int w = layer.header.width; int ia = ax + ay * w; @@ -348,7 +348,7 @@ namespace DotRecast.Detour.TileCache return DirOffsetY[dir & 0x03]; } - private void WalkContour(TileCacheLayer layer, int x, int y, TempContour cont) + private void WalkContour(DtTileCacheLayer layer, int x, int y, DtTempContour cont) { int w = layer.header.width; int h = layer.header.height; @@ -454,7 +454,7 @@ namespace DotRecast.Detour.TileCache return dx * dx + dz * dz; } - private void SimplifyContour(TempContour cont, float maxError) + private void SimplifyContour(DtTempContour cont, float maxError) { cont.poly.Clear(); @@ -583,7 +583,7 @@ namespace DotRecast.Detour.TileCache } } - static Tuple GetCornerHeight(TileCacheLayer layer, int x, int y, int z, int walkableClimb) + static Tuple GetCornerHeight(DtTileCacheLayer layer, int x, int y, int z, int walkableClimb) { int w = layer.header.width; int h = layer.header.height; @@ -633,21 +633,21 @@ namespace DotRecast.Detour.TileCache } // TODO: move this somewhere else, once the layer meshing is done. - public TileCacheContourSet BuildTileCacheContours(TileCacheLayer layer, int walkableClimb, float maxError) + public DtTileCacheContourSet BuildTileCacheContours(DtTileCacheLayer layer, int walkableClimb, float maxError) { int w = layer.header.width; int h = layer.header.height; - TileCacheContourSet lcset = new TileCacheContourSet(); + DtTileCacheContourSet lcset = new DtTileCacheContourSet(); lcset.nconts = layer.regCount; - lcset.conts = new TileCacheContour[lcset.nconts]; + lcset.conts = new DtTileCacheContour[lcset.nconts]; for (int i = 0; i < lcset.nconts; i++) { - lcset.conts[i] = new TileCacheContour(); + lcset.conts[i] = new DtTileCacheContour(); } // Allocate temp buffer for contour tracing. - TempContour temp = new TempContour(); + DtTempContour temp = new DtTempContour(); // Find contours. for (int y = 0; y < h; ++y) @@ -659,7 +659,7 @@ namespace DotRecast.Detour.TileCache if (ri == 0xff) continue; - TileCacheContour cont = lcset.conts[ri]; + DtTileCacheContour cont = lcset.conts[ri]; if (cont.nverts > 0) continue; @@ -744,7 +744,7 @@ namespace DotRecast.Detour.TileCache return i; } - private void BuildMeshAdjacency(int[] polys, int npolys, int[] verts, int nverts, TileCacheContourSet lcset, + private void BuildMeshAdjacency(int[] polys, int npolys, int[] verts, int nverts, DtTileCacheContourSet lcset, int maxVertsPerPoly) { // Based on code by Eric Lengyel from: @@ -841,7 +841,7 @@ namespace DotRecast.Detour.TileCache // Mark portal edges. for (int i = 0; i < lcset.nconts; ++i) { - TileCacheContour cont = lcset.conts[i]; + DtTileCacheContour cont = lcset.conts[i]; if (cont.nverts < 3) continue; @@ -1291,7 +1291,7 @@ namespace DotRecast.Detour.TileCache return arr.Count; } - private bool CanRemoveVertex(TileCachePolyMesh mesh, int rem) + private bool CanRemoveVertex(DtTileCachePolyMesh mesh, int rem) { // Count number of polygons to remove. int maxVertsPerPoly = mesh.nvp; @@ -1389,7 +1389,7 @@ namespace DotRecast.Detour.TileCache return true; } - private void RemoveVertex(TileCachePolyMesh mesh, int rem, int maxTris) + private void RemoveVertex(DtTileCachePolyMesh mesh, int rem, int maxTris) { // Count number of polygons to remove. int maxVertsPerPoly = mesh.nvp; @@ -1628,7 +1628,7 @@ namespace DotRecast.Detour.TileCache } } - public TileCachePolyMesh BuildTileCachePolyMesh(TileCacheContourSet lcset, int maxVertsPerPoly) + public DtTileCachePolyMesh BuildTileCachePolyMesh(DtTileCacheContourSet lcset, int maxVertsPerPoly) { int maxVertices = 0; int maxTris = 0; @@ -1645,7 +1645,7 @@ namespace DotRecast.Detour.TileCache // TODO: warn about too many vertices? - TileCachePolyMesh mesh = new TileCachePolyMesh(maxVertsPerPoly); + DtTileCachePolyMesh mesh = new DtTileCachePolyMesh(maxVertsPerPoly); int[] vflags = new int[maxVertices]; @@ -1672,7 +1672,7 @@ namespace DotRecast.Detour.TileCache for (int i = 0; i < lcset.nconts; ++i) { - TileCacheContour cont = lcset.conts[i]; + DtTileCacheContour cont = lcset.conts[i]; // Skip null contours. if (cont.nverts < 3) @@ -1802,7 +1802,7 @@ namespace DotRecast.Detour.TileCache return mesh; } - public void MarkCylinderArea(TileCacheLayer layer, RcVec3f orig, float cs, float ch, RcVec3f pos, float radius, float height, int areaId) + public void MarkCylinderArea(DtTileCacheLayer layer, RcVec3f orig, float cs, float ch, RcVec3f pos, float radius, float height, int areaId) { RcVec3f bmin = new RcVec3f(); RcVec3f bmax = new RcVec3f(); @@ -1863,7 +1863,7 @@ namespace DotRecast.Detour.TileCache } } - public void MarkBoxArea(TileCacheLayer layer, RcVec3f orig, float cs, float ch, RcVec3f bmin, RcVec3f bmax, int areaId) + public void MarkBoxArea(DtTileCacheLayer layer, RcVec3f orig, float cs, float ch, RcVec3f bmin, RcVec3f bmax, int areaId) { int w = layer.header.width; int h = layer.header.height; @@ -1907,11 +1907,11 @@ namespace DotRecast.Detour.TileCache } } - public byte[] CompressTileCacheLayer(TileCacheLayer layer, RcByteOrder order, bool cCompatibility) + public byte[] CompressTileCacheLayer(DtTileCacheLayer layer, RcByteOrder order, bool cCompatibility) { using var ms = new MemoryStream(); using var baos = new BinaryWriter(ms); - TileCacheLayerHeaderWriter hw = new TileCacheLayerHeaderWriter(); + DtTileCacheLayerHeaderWriter hw = new DtTileCacheLayerHeaderWriter(); try { hw.Write(baos, layer.header, order, cCompatibility); @@ -1924,7 +1924,7 @@ namespace DotRecast.Detour.TileCache buffer[gridSize * 2 + i] = (byte)layer.cons[i]; } - baos.Write(TileCacheCompressorFactory.Get(cCompatibility).Compress(buffer)); + baos.Write(DtTileCacheCompressorFactory.Get(cCompatibility).Compress(buffer)); return ms.ToArray(); } catch (IOException e) @@ -1933,12 +1933,12 @@ namespace DotRecast.Detour.TileCache } } - public byte[] CompressTileCacheLayer(TileCacheLayerHeader header, int[] heights, int[] areas, int[] cons, + public byte[] CompressTileCacheLayer(DtTileCacheLayerHeader header, int[] heights, int[] areas, int[] cons, RcByteOrder order, bool cCompatibility) { using var ms = new MemoryStream(); using var baos = new BinaryWriter(ms); - TileCacheLayerHeaderWriter hw = new TileCacheLayerHeaderWriter(); + DtTileCacheLayerHeaderWriter hw = new DtTileCacheLayerHeaderWriter(); try { hw.Write(baos, header, order, cCompatibility); @@ -1951,7 +1951,7 @@ namespace DotRecast.Detour.TileCache buffer[gridSize * 2 + i] = (byte)cons[i]; } - baos.Write(TileCacheCompressorFactory.Get(cCompatibility).Compress(buffer)); + baos.Write(DtTileCacheCompressorFactory.Get(cCompatibility).Compress(buffer)); return ms.ToArray(); } catch (IOException e) @@ -1960,12 +1960,12 @@ namespace DotRecast.Detour.TileCache } } - public TileCacheLayer DecompressTileCacheLayer(ITileCacheCompressor comp, byte[] compressed, RcByteOrder order, + public DtTileCacheLayer DecompressTileCacheLayer(IDtTileCacheCompressor comp, byte[] compressed, RcByteOrder order, bool cCompatibility) { RcByteBuffer buf = new RcByteBuffer(compressed); buf.Order(order); - TileCacheLayer layer = new TileCacheLayer(); + DtTileCacheLayer layer = new DtTileCacheLayer(); try { layer.header = reader.Read(buf, cCompatibility); @@ -1991,7 +1991,7 @@ namespace DotRecast.Detour.TileCache return layer; } - public void MarkBoxArea(TileCacheLayer layer, RcVec3f orig, float cs, float ch, RcVec3f center, RcVec3f extents, + public void MarkBoxArea(DtTileCacheLayer layer, RcVec3f orig, float cs, float ch, RcVec3f center, RcVec3f extents, float[] rotAux, int areaId) { int w = layer.header.width; diff --git a/src/DotRecast.Detour.TileCache/TileCacheContour.cs b/src/DotRecast.Detour.TileCache/DtTileCacheContour.cs similarity index 96% rename from src/DotRecast.Detour.TileCache/TileCacheContour.cs rename to src/DotRecast.Detour.TileCache/DtTileCacheContour.cs index e1a7b77..4ddcf27 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheContour.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheContour.cs @@ -20,7 +20,7 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public class TileCacheContour + public class DtTileCacheContour { public int nverts; public int[] verts; diff --git a/src/DotRecast.Detour.TileCache/TileCacheContourSet.cs b/src/DotRecast.Detour.TileCache/DtTileCacheContourSet.cs similarity index 92% rename from src/DotRecast.Detour.TileCache/TileCacheContourSet.cs rename to src/DotRecast.Detour.TileCache/DtTileCacheContourSet.cs index 98fc0c3..270c865 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheContourSet.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheContourSet.cs @@ -20,9 +20,9 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public class TileCacheContourSet + public class DtTileCacheContourSet { public int nconts; - public TileCacheContour[] conts; + public DtTileCacheContour[] conts; } } \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheLayer.cs b/src/DotRecast.Detour.TileCache/DtTileCacheLayer.cs similarity index 93% rename from src/DotRecast.Detour.TileCache/TileCacheLayer.cs rename to src/DotRecast.Detour.TileCache/DtTileCacheLayer.cs index 15ca42e..09ca45e 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheLayer.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheLayer.cs @@ -20,9 +20,9 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public class TileCacheLayer + public class DtTileCacheLayer { - public TileCacheLayerHeader header; + public DtTileCacheLayerHeader header; public int regCount; /// < Region count. diff --git a/src/DotRecast.Detour.TileCache/TileCacheLayerHeader.cs b/src/DotRecast.Detour.TileCache/DtTileCacheLayerHeader.cs similarity index 97% rename from src/DotRecast.Detour.TileCache/TileCacheLayerHeader.cs rename to src/DotRecast.Detour.TileCache/DtTileCacheLayerHeader.cs index aa89114..818f4e4 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheLayerHeader.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheLayerHeader.cs @@ -22,7 +22,7 @@ using DotRecast.Core; namespace DotRecast.Detour.TileCache { - public class TileCacheLayerHeader + public class DtTileCacheLayerHeader { public const int DT_TILECACHE_MAGIC = 'D' << 24 | 'T' << 16 | 'L' << 8 | 'R'; diff --git a/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs b/src/DotRecast.Detour.TileCache/DtTileCacheObstacle.cs similarity index 93% rename from src/DotRecast.Detour.TileCache/TileCacheObstacle.cs rename to src/DotRecast.Detour.TileCache/DtTileCacheObstacle.cs index 62b1cd7..def2e0d 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheObstacle.cs @@ -23,7 +23,7 @@ using DotRecast.Core; namespace DotRecast.Detour.TileCache { - public class TileCacheObstacle + public class DtTileCacheObstacle { public readonly int index; public TileCacheObstacleType type; @@ -38,9 +38,9 @@ namespace DotRecast.Detour.TileCache public readonly List pending = new List(); public int salt; public ObstacleState state = ObstacleState.DT_OBSTACLE_EMPTY; - public TileCacheObstacle next; + public DtTileCacheObstacle next; - public TileCacheObstacle(int index) + public DtTileCacheObstacle(int index) { salt = 1; this.index = index; diff --git a/src/DotRecast.Detour.TileCache/TileCacheParams.cs b/src/DotRecast.Detour.TileCache/DtTileCacheParams.cs similarity index 97% rename from src/DotRecast.Detour.TileCache/TileCacheParams.cs rename to src/DotRecast.Detour.TileCache/DtTileCacheParams.cs index 3b767bb..53d79e8 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheParams.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheParams.cs @@ -22,7 +22,7 @@ using DotRecast.Core; namespace DotRecast.Detour.TileCache { - public class TileCacheParams + public class DtTileCacheParams { public RcVec3f orig = new RcVec3f(); public float cs, ch; diff --git a/src/DotRecast.Detour.TileCache/TileCachePolyMesh.cs b/src/DotRecast.Detour.TileCache/DtTileCachePolyMesh.cs similarity index 94% rename from src/DotRecast.Detour.TileCache/TileCachePolyMesh.cs rename to src/DotRecast.Detour.TileCache/DtTileCachePolyMesh.cs index 9a58ad6..b80cd73 100644 --- a/src/DotRecast.Detour.TileCache/TileCachePolyMesh.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCachePolyMesh.cs @@ -20,7 +20,7 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public class TileCachePolyMesh + public class DtTileCachePolyMesh { public int nvp; public int nverts; @@ -41,7 +41,7 @@ namespace DotRecast.Detour.TileCache public int[] areas; /// < Area ID of polygons. - public TileCachePolyMesh(int nvp) + public DtTileCachePolyMesh(int nvp) { this.nvp = nvp; } diff --git a/src/DotRecast.Detour.TileCache/ITileCacheCompressor.cs b/src/DotRecast.Detour.TileCache/IDtTileCacheCompressor.cs similarity index 96% rename from src/DotRecast.Detour.TileCache/ITileCacheCompressor.cs rename to src/DotRecast.Detour.TileCache/IDtTileCacheCompressor.cs index ce42f4b..6efbaa2 100644 --- a/src/DotRecast.Detour.TileCache/ITileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/IDtTileCacheCompressor.cs @@ -20,7 +20,7 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public interface ITileCacheCompressor + public interface IDtTileCacheCompressor { byte[] Decompress(byte[] buf, int offset, int len, int outputlen); diff --git a/src/DotRecast.Detour.TileCache/ITileCacheMeshProcess.cs b/src/DotRecast.Detour.TileCache/IDtTileCacheMeshProcess.cs similarity index 95% rename from src/DotRecast.Detour.TileCache/ITileCacheMeshProcess.cs rename to src/DotRecast.Detour.TileCache/IDtTileCacheMeshProcess.cs index 603a8e8..a854692 100644 --- a/src/DotRecast.Detour.TileCache/ITileCacheMeshProcess.cs +++ b/src/DotRecast.Detour.TileCache/IDtTileCacheMeshProcess.cs @@ -20,7 +20,7 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public interface ITileCacheMeshProcess + public interface IDtTileCacheMeshProcess { void Process(DtNavMeshCreateParams option); } diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs b/src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheCompressorFactory.cs similarity index 82% rename from src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs rename to src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheCompressorFactory.cs index 5dbdd5e..f893c36 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheCompressorFactory.cs @@ -20,14 +20,14 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache.Io.Compress { - public static class TileCacheCompressorFactory + public static class DtTileCacheCompressorFactory { - public static ITileCacheCompressor Get(bool cCompatibility) + public static IDtTileCacheCompressor Get(bool cCompatibility) { if (cCompatibility) - return new FastLzTileCacheCompressor(); + return new DtTileCacheFastLzCompressor(); - return new LZ4TileCacheCompressor(); + return new DtTileCacheLZ4Compressor(); } } } \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs b/src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheFastLzCompressor.cs similarity index 95% rename from src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs rename to src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheFastLzCompressor.cs index c14624f..44bf899 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheFastLzCompressor.cs @@ -22,7 +22,7 @@ using DotRecast.Core; namespace DotRecast.Detour.TileCache.Io.Compress { - public class FastLzTileCacheCompressor : ITileCacheCompressor + public class DtTileCacheFastLzCompressor : IDtTileCacheCompressor { public byte[] Decompress(byte[] buf, int offset, int len, int outputlen) { diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs b/src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheLZ4Compressor.cs similarity index 95% rename from src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs rename to src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheLZ4Compressor.cs index e117dae..0b898cf 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/DtTileCacheLZ4Compressor.cs @@ -22,7 +22,7 @@ using K4os.Compression.LZ4; namespace DotRecast.Detour.TileCache.Io.Compress { - public class LZ4TileCacheCompressor : ITileCacheCompressor + public class DtTileCacheLZ4Compressor : IDtTileCacheCompressor { public byte[] Decompress(byte[] buf, int offset, int len, int outputlen) { diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs b/src/DotRecast.Detour.TileCache/Io/DtTileCacheLayerHeaderReader.cs similarity index 86% rename from src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs rename to src/DotRecast.Detour.TileCache/Io/DtTileCacheLayerHeaderReader.cs index adc9203..31be877 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs +++ b/src/DotRecast.Detour.TileCache/Io/DtTileCacheLayerHeaderReader.cs @@ -23,17 +23,17 @@ using DotRecast.Core; namespace DotRecast.Detour.TileCache.Io { - public class TileCacheLayerHeaderReader + public class DtTileCacheLayerHeaderReader { - public TileCacheLayerHeader Read(RcByteBuffer data, bool cCompatibility) + public DtTileCacheLayerHeader Read(RcByteBuffer data, bool cCompatibility) { - TileCacheLayerHeader header = new TileCacheLayerHeader(); + DtTileCacheLayerHeader header = new DtTileCacheLayerHeader(); header.magic = data.GetInt(); header.version = data.GetInt(); - if (header.magic != TileCacheLayerHeader.DT_TILECACHE_MAGIC) + if (header.magic != DtTileCacheLayerHeader.DT_TILECACHE_MAGIC) throw new IOException("Invalid magic"); - if (header.version != TileCacheLayerHeader.DT_TILECACHE_VERSION) + if (header.version != DtTileCacheLayerHeader.DT_TILECACHE_VERSION) throw new IOException("Invalid version"); header.tx = data.GetInt(); diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs b/src/DotRecast.Detour.TileCache/Io/DtTileCacheLayerHeaderWriter.cs similarity index 92% rename from src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs rename to src/DotRecast.Detour.TileCache/Io/DtTileCacheLayerHeaderWriter.cs index 9eb51ce..ed720c1 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs +++ b/src/DotRecast.Detour.TileCache/Io/DtTileCacheLayerHeaderWriter.cs @@ -24,9 +24,9 @@ using DotRecast.Detour.Io; namespace DotRecast.Detour.TileCache.Io { - public class TileCacheLayerHeaderWriter : DetourWriter + public class DtTileCacheLayerHeaderWriter : DtWriter { - public void Write(BinaryWriter stream, TileCacheLayerHeader header, RcByteOrder order, bool cCompatibility) + public void Write(BinaryWriter stream, DtTileCacheLayerHeader header, RcByteOrder order, bool cCompatibility) { Write(stream, header.magic, order); Write(stream, header.version, order); diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs b/src/DotRecast.Detour.TileCache/Io/DtTileCacheReader.cs similarity index 73% rename from src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs rename to src/DotRecast.Detour.TileCache/Io/DtTileCacheReader.cs index df75e8d..f7e3f59 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs +++ b/src/DotRecast.Detour.TileCache/Io/DtTileCacheReader.cs @@ -25,24 +25,24 @@ using DotRecast.Detour.TileCache.Io.Compress; namespace DotRecast.Detour.TileCache.Io { - public class TileCacheReader + public class DtTileCacheReader { - private readonly NavMeshParamReader paramReader = new NavMeshParamReader(); + private readonly DtNavMeshParamsReader paramReader = new DtNavMeshParamsReader(); - public TileCache Read(BinaryReader @is, int maxVertPerPoly, ITileCacheMeshProcess meshProcessor) + public DtTileCache Read(BinaryReader @is, int maxVertPerPoly, IDtTileCacheMeshProcess meshProcessor) { RcByteBuffer bb = IOUtils.ToByteBuffer(@is); return Read(bb, maxVertPerPoly, meshProcessor); } - public TileCache Read(RcByteBuffer bb, int maxVertPerPoly, ITileCacheMeshProcess meshProcessor) + public DtTileCache Read(RcByteBuffer bb, int maxVertPerPoly, IDtTileCacheMeshProcess meshProcessor) { - TileCacheSetHeader header = new TileCacheSetHeader(); + DtTileCacheSetHeader header = new DtTileCacheSetHeader(); header.magic = bb.GetInt(); - if (header.magic != TileCacheSetHeader.TILECACHESET_MAGIC) + if (header.magic != DtTileCacheSetHeader.TILECACHESET_MAGIC) { header.magic = IOUtils.SwapEndianness(header.magic); - if (header.magic != TileCacheSetHeader.TILECACHESET_MAGIC) + if (header.magic != DtTileCacheSetHeader.TILECACHESET_MAGIC) { throw new IOException("Invalid magic"); } @@ -51,21 +51,21 @@ namespace DotRecast.Detour.TileCache.Io } header.version = bb.GetInt(); - if (header.version != TileCacheSetHeader.TILECACHESET_VERSION) + if (header.version != DtTileCacheSetHeader.TILECACHESET_VERSION) { - if (header.version != TileCacheSetHeader.TILECACHESET_VERSION_RECAST4J) + if (header.version != DtTileCacheSetHeader.TILECACHESET_VERSION_RECAST4J) { throw new IOException("Invalid version"); } } - bool cCompatibility = header.version == TileCacheSetHeader.TILECACHESET_VERSION; + bool cCompatibility = header.version == DtTileCacheSetHeader.TILECACHESET_VERSION; header.numTiles = bb.GetInt(); header.meshParams = paramReader.Read(bb); header.cacheParams = ReadCacheParams(bb, cCompatibility); DtNavMesh mesh = new DtNavMesh(header.meshParams, maxVertPerPoly); - ITileCacheCompressor compressor = TileCacheCompressorFactory.Get(cCompatibility); - TileCache tc = new TileCache(header.cacheParams, new TileCacheStorageParams(bb.Order(), cCompatibility), mesh, + IDtTileCacheCompressor compressor = DtTileCacheCompressorFactory.Get(cCompatibility); + DtTileCache tc = new DtTileCache(header.cacheParams, new TileCacheStorageParams(bb.Order(), cCompatibility), mesh, compressor, meshProcessor); // Read tiles. for (int i = 0; i < header.numTiles; ++i) @@ -88,9 +88,9 @@ namespace DotRecast.Detour.TileCache.Io return tc; } - private TileCacheParams ReadCacheParams(RcByteBuffer bb, bool cCompatibility) + private DtTileCacheParams ReadCacheParams(RcByteBuffer bb, bool cCompatibility) { - TileCacheParams option = new TileCacheParams(); + DtTileCacheParams option = new DtTileCacheParams(); option.orig.x = bb.GetFloat(); option.orig.y = bb.GetFloat(); diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheSetHeader.cs b/src/DotRecast.Detour.TileCache/Io/DtTileCacheSetHeader.cs similarity index 92% rename from src/DotRecast.Detour.TileCache/Io/TileCacheSetHeader.cs rename to src/DotRecast.Detour.TileCache/Io/DtTileCacheSetHeader.cs index 4336e1b..c1ecc9a 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheSetHeader.cs +++ b/src/DotRecast.Detour.TileCache/Io/DtTileCacheSetHeader.cs @@ -20,7 +20,7 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache.Io { - public class TileCacheSetHeader + public class DtTileCacheSetHeader { public const int TILECACHESET_MAGIC = 'T' << 24 | 'S' << 16 | 'E' << 8 | 'T'; // 'TSET'; public const int TILECACHESET_VERSION = 1; @@ -30,6 +30,6 @@ namespace DotRecast.Detour.TileCache.Io public int version; public int numTiles; public DtNavMeshParams meshParams = new DtNavMeshParams(); - public TileCacheParams cacheParams = new TileCacheParams(); + public DtTileCacheParams cacheParams = new DtTileCacheParams(); } } \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs b/src/DotRecast.Detour.TileCache/Io/DtTileCacheWriter.cs similarity index 76% rename from src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs rename to src/DotRecast.Detour.TileCache/Io/DtTileCacheWriter.cs index 385e98b..1fb34f7 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs +++ b/src/DotRecast.Detour.TileCache/Io/DtTileCacheWriter.cs @@ -24,21 +24,21 @@ using DotRecast.Detour.Io; namespace DotRecast.Detour.TileCache.Io { - public class TileCacheWriter : DetourWriter + public class DtTileCacheWriter : DtWriter { - private readonly NavMeshParamWriter paramWriter = new NavMeshParamWriter(); - private readonly TileCacheBuilder builder = new TileCacheBuilder(); + private readonly DtNavMeshParamWriter paramWriter = new DtNavMeshParamWriter(); + private readonly DtTileCacheBuilder builder = new DtTileCacheBuilder(); - public void Write(BinaryWriter stream, TileCache cache, RcByteOrder order, bool cCompatibility) + public void Write(BinaryWriter stream, DtTileCache cache, RcByteOrder order, bool cCompatibility) { - Write(stream, TileCacheSetHeader.TILECACHESET_MAGIC, order); + Write(stream, DtTileCacheSetHeader.TILECACHESET_MAGIC, order); Write(stream, cCompatibility - ? TileCacheSetHeader.TILECACHESET_VERSION - : TileCacheSetHeader.TILECACHESET_VERSION_RECAST4J, order); + ? DtTileCacheSetHeader.TILECACHESET_VERSION + : DtTileCacheSetHeader.TILECACHESET_VERSION_RECAST4J, order); int numTiles = 0; for (int i = 0; i < cache.GetTileCount(); ++i) { - CompressedTile tile = cache.GetTile(i); + DtCompressedTile tile = cache.GetTile(i); if (tile == null || tile.data == null) continue; numTiles++; @@ -49,19 +49,19 @@ namespace DotRecast.Detour.TileCache.Io WriteCacheParams(stream, cache.GetParams(), order); for (int i = 0; i < cache.GetTileCount(); i++) { - CompressedTile tile = cache.GetTile(i); + DtCompressedTile tile = cache.GetTile(i); if (tile == null || tile.data == null) continue; Write(stream, (int)cache.GetTileRef(tile), order); byte[] data = tile.data; - TileCacheLayer layer = cache.DecompressTile(tile); + DtTileCacheLayer layer = cache.DecompressTile(tile); data = builder.CompressTileCacheLayer(layer, order, cCompatibility); Write(stream, data.Length, order); stream.Write(data); } } - private void WriteCacheParams(BinaryWriter stream, TileCacheParams option, RcByteOrder order) + private void WriteCacheParams(BinaryWriter stream, DtTileCacheParams option, RcByteOrder order) { Write(stream, option.orig.x, order); Write(stream, option.orig.y, order); diff --git a/src/DotRecast.Detour/Io/MeshDataReader.cs b/src/DotRecast.Detour/Io/DtMeshDataReader.cs similarity index 99% rename from src/DotRecast.Detour/Io/MeshDataReader.cs rename to src/DotRecast.Detour/Io/DtMeshDataReader.cs index a327bb6..b43b38a 100644 --- a/src/DotRecast.Detour/Io/MeshDataReader.cs +++ b/src/DotRecast.Detour/Io/DtMeshDataReader.cs @@ -21,7 +21,7 @@ using DotRecast.Core; namespace DotRecast.Detour.Io { - public class MeshDataReader + public class DtMeshDataReader { public const int DT_POLY_DETAIL_SIZE = 10; diff --git a/src/DotRecast.Detour/Io/MeshDataWriter.cs b/src/DotRecast.Detour/Io/DtMeshDataWriter.cs similarity index 98% rename from src/DotRecast.Detour/Io/MeshDataWriter.cs rename to src/DotRecast.Detour/Io/DtMeshDataWriter.cs index 4734283..cc4ae92 100644 --- a/src/DotRecast.Detour/Io/MeshDataWriter.cs +++ b/src/DotRecast.Detour/Io/DtMeshDataWriter.cs @@ -21,7 +21,7 @@ using DotRecast.Core; namespace DotRecast.Detour.Io { - public class MeshDataWriter : DetourWriter + public class DtMeshDataWriter : DtWriter { public void Write(BinaryWriter stream, DtMeshData data, RcByteOrder order, bool cCompatibility) { @@ -55,7 +55,7 @@ namespace DotRecast.Detour.Io WritePolys(stream, data, order, cCompatibility); if (cCompatibility) { - byte[] linkPlaceholder = new byte[header.maxLinkCount * MeshDataReader.GetSizeofLink(false)]; + byte[] linkPlaceholder = new byte[header.maxLinkCount * DtMeshDataReader.GetSizeofLink(false)]; stream.Write(linkPlaceholder); } diff --git a/src/DotRecast.Detour/Io/MeshSetReader.cs b/src/DotRecast.Detour/Io/DtMeshSetReader.cs similarity index 96% rename from src/DotRecast.Detour/Io/MeshSetReader.cs rename to src/DotRecast.Detour/Io/DtMeshSetReader.cs index 5486085..107bb4b 100644 --- a/src/DotRecast.Detour/Io/MeshSetReader.cs +++ b/src/DotRecast.Detour/Io/DtMeshSetReader.cs @@ -22,13 +22,10 @@ using DotRecast.Core; namespace DotRecast.Detour.Io { - using static DotRecast.Core.RcMath; - - - public class MeshSetReader + public class DtMeshSetReader { - private readonly MeshDataReader meshReader = new MeshDataReader(); - private readonly NavMeshParamReader paramReader = new NavMeshParamReader(); + private readonly DtMeshDataReader meshReader = new DtMeshDataReader(); + private readonly DtNavMeshParamsReader paramReader = new DtNavMeshParamsReader(); public DtNavMesh Read(BinaryReader @is, int maxVertPerPoly) { diff --git a/src/DotRecast.Detour/Io/MeshSetWriter.cs b/src/DotRecast.Detour/Io/DtMeshSetWriter.cs similarity index 94% rename from src/DotRecast.Detour/Io/MeshSetWriter.cs rename to src/DotRecast.Detour/Io/DtMeshSetWriter.cs index 5acef03..eff10c5 100644 --- a/src/DotRecast.Detour/Io/MeshSetWriter.cs +++ b/src/DotRecast.Detour/Io/DtMeshSetWriter.cs @@ -21,10 +21,10 @@ using DotRecast.Core; namespace DotRecast.Detour.Io { - public class MeshSetWriter : DetourWriter + public class DtMeshSetWriter : DtWriter { - private readonly MeshDataWriter writer = new MeshDataWriter(); - private readonly NavMeshParamWriter paramWriter = new NavMeshParamWriter(); + private readonly DtMeshDataWriter writer = new DtMeshDataWriter(); + private readonly DtNavMeshParamWriter paramWriter = new DtNavMeshParamWriter(); public void Write(BinaryWriter stream, DtNavMesh mesh, RcByteOrder order, bool cCompatibility) { diff --git a/src/DotRecast.Detour/Io/NavMeshParamWriter.cs b/src/DotRecast.Detour/Io/DtNavMeshParamWriter.cs similarity index 91% rename from src/DotRecast.Detour/Io/NavMeshParamWriter.cs rename to src/DotRecast.Detour/Io/DtNavMeshParamWriter.cs index 2cdd412..2ef13a8 100644 --- a/src/DotRecast.Detour/Io/NavMeshParamWriter.cs +++ b/src/DotRecast.Detour/Io/DtNavMeshParamWriter.cs @@ -3,7 +3,7 @@ using DotRecast.Core; namespace DotRecast.Detour.Io { - public class NavMeshParamWriter : DetourWriter + public class DtNavMeshParamWriter : DtWriter { public void Write(BinaryWriter stream, DtNavMeshParams option, RcByteOrder order) { diff --git a/src/DotRecast.Detour/Io/NavMeshParamReader.cs b/src/DotRecast.Detour/Io/DtNavMeshParamsReader.cs similarity index 93% rename from src/DotRecast.Detour/Io/NavMeshParamReader.cs rename to src/DotRecast.Detour/Io/DtNavMeshParamsReader.cs index 72d823a..933f8b7 100644 --- a/src/DotRecast.Detour/Io/NavMeshParamReader.cs +++ b/src/DotRecast.Detour/Io/DtNavMeshParamsReader.cs @@ -2,7 +2,7 @@ using DotRecast.Core; namespace DotRecast.Detour.Io { - public class NavMeshParamReader + public class DtNavMeshParamsReader { public DtNavMeshParams Read(RcByteBuffer bb) { diff --git a/src/DotRecast.Detour/Io/DetourWriter.cs b/src/DotRecast.Detour/Io/DtWriter.cs similarity index 98% rename from src/DotRecast.Detour/Io/DetourWriter.cs rename to src/DotRecast.Detour/Io/DtWriter.cs index 5ff55cc..30eb56a 100644 --- a/src/DotRecast.Detour/Io/DetourWriter.cs +++ b/src/DotRecast.Detour/Io/DtWriter.cs @@ -22,7 +22,7 @@ using DotRecast.Core; namespace DotRecast.Detour.Io { - public abstract class DetourWriter + public abstract class DtWriter { protected void Write(BinaryWriter stream, float value, RcByteOrder order) { diff --git a/src/DotRecast.Recast.Demo/RecastDemo.cs b/src/DotRecast.Recast.Demo/RecastDemo.cs index 78cd2c6..7b9490b 100644 --- a/src/DotRecast.Recast.Demo/RecastDemo.cs +++ b/src/DotRecast.Recast.Demo/RecastDemo.cs @@ -315,7 +315,7 @@ public class RecastDemo } else if (filename.EndsWith(".bin") || filename.EndsWith(".navmesh")) { - MeshSetReader reader = new MeshSetReader(); + DtMeshSetReader reader = new DtMeshSetReader(); using (var fis = new BinaryReader(file)) { mesh = reader.Read(fis, 6); diff --git a/src/DotRecast.Recast.DemoTool/Geom/DemoInputGeomProvider.cs b/src/DotRecast.Recast.DemoTool/Geom/DemoInputGeomProvider.cs index e89a961..ec7a3c4 100644 --- a/src/DotRecast.Recast.DemoTool/Geom/DemoInputGeomProvider.cs +++ b/src/DotRecast.Recast.DemoTool/Geom/DemoInputGeomProvider.cs @@ -35,7 +35,7 @@ namespace DotRecast.Recast.DemoTool.Geom private readonly RcVec3f bmax; private readonly List _convexVolumes = new List(); private readonly List offMeshConnections = new List(); - private readonly TriMesh _mesh; + private readonly RcTriMesh _mesh; public DemoInputGeomProvider(List vertexPositions, List meshFaces) : this(MapVertices(vertexPositions), MapFaces(meshFaces)) @@ -80,7 +80,7 @@ namespace DotRecast.Recast.DemoTool.Geom bmax.Max(vertices, i * 3); } - _mesh = new TriMesh(vertices, faces); + _mesh = new RcTriMesh(vertices, faces); } public RcVec3f GetMeshBoundsMin() @@ -127,7 +127,7 @@ namespace DotRecast.Recast.DemoTool.Geom return _convexVolumes; } - public IEnumerable Meshes() + public IEnumerable Meshes() { return ImmutableArray.Create(_mesh); } @@ -163,7 +163,7 @@ namespace DotRecast.Recast.DemoTool.Geom q[0] = src.x + (dst.x - src.x) * btmax; q[1] = src.z + (dst.z - src.z) * btmax; - List chunks = _mesh.chunkyTriMesh.GetChunksOverlappingSegment(p, q); + List chunks = _mesh.chunkyTriMesh.GetChunksOverlappingSegment(p, q); if (0 == chunks.Count) { return null; @@ -171,7 +171,7 @@ namespace DotRecast.Recast.DemoTool.Geom float? tmin = 1.0f; bool hit = false; - foreach (ChunkyTriMeshNode chunk in chunks) + foreach (RcChunkyTriMeshNode chunk in chunks) { int[] tris = chunk.tris; for (int j = 0; j < chunk.tris.Length; j += 3) diff --git a/src/DotRecast.Recast/Geom/IInputGeomProvider.cs b/src/DotRecast.Recast/Geom/IInputGeomProvider.cs index cf2d1ee..bc503ec 100644 --- a/src/DotRecast.Recast/Geom/IInputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/IInputGeomProvider.cs @@ -29,6 +29,6 @@ namespace DotRecast.Recast.Geom RcVec3f GetMeshBoundsMax(); - IEnumerable Meshes(); + IEnumerable Meshes(); } } \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs b/src/DotRecast.Recast/Geom/RcChunkyTriMesh.cs similarity index 90% rename from src/DotRecast.Recast/Geom/ChunkyTriMesh.cs rename to src/DotRecast.Recast/Geom/RcChunkyTriMesh.cs index 74c01d8..6fcffca 100644 --- a/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs +++ b/src/DotRecast.Recast/Geom/RcChunkyTriMesh.cs @@ -24,9 +24,9 @@ using DotRecast.Core; namespace DotRecast.Recast.Geom { - public class ChunkyTriMesh + public class RcChunkyTriMesh { - List nodes; + List nodes; int ntris; int maxTrisPerChunk; @@ -68,11 +68,11 @@ namespace DotRecast.Recast.Geom return y > x ? 1 : 0; } - private void Subdivide(BoundsItem[] items, int imin, int imax, int trisPerChunk, List nodes, int[] inTris) + private void Subdivide(BoundsItem[] items, int imin, int imax, int trisPerChunk, List nodes, int[] inTris) { int inum = imax - imin; - ChunkyTriMeshNode node = new ChunkyTriMeshNode(); + RcChunkyTriMeshNode node = new RcChunkyTriMeshNode(); nodes.Add(node); if (inum <= trisPerChunk) @@ -123,11 +123,11 @@ namespace DotRecast.Recast.Geom } } - public ChunkyTriMesh(float[] verts, int[] tris, int ntris, int trisPerChunk) + public RcChunkyTriMesh(float[] verts, int[] tris, int ntris, int trisPerChunk) { int nchunks = (ntris + trisPerChunk - 1) / trisPerChunk; - nodes = new List(nchunks); + nodes = new List(nchunks); this.ntris = ntris; // Build tree @@ -170,7 +170,7 @@ namespace DotRecast.Recast.Geom // Calc max tris per node. maxTrisPerChunk = 0; - foreach (ChunkyTriMeshNode node in nodes) + foreach (RcChunkyTriMeshNode node in nodes) { bool isLeaf = node.i >= 0; if (!isLeaf) @@ -193,14 +193,14 @@ namespace DotRecast.Recast.Geom return overlap; } - public List GetChunksOverlappingRect(float[] bmin, float[] bmax) + public List GetChunksOverlappingRect(float[] bmin, float[] bmax) { // Traverse tree - List ids = new List(); + List ids = new List(); int i = 0; while (i < nodes.Count) { - ChunkyTriMeshNode node = nodes[i]; + RcChunkyTriMeshNode node = nodes[i]; bool overlap = CheckOverlapRect(bmin, bmax, node.bmin, node.bmax); bool isLeafNode = node.i >= 0; @@ -222,14 +222,14 @@ namespace DotRecast.Recast.Geom return ids; } - public List GetChunksOverlappingSegment(float[] p, float[] q) + public List GetChunksOverlappingSegment(float[] p, float[] q) { // Traverse tree - List ids = new List(); + List ids = new List(); int i = 0; while (i < nodes.Count) { - ChunkyTriMeshNode node = nodes[i]; + RcChunkyTriMeshNode node = nodes[i]; bool overlap = CheckOverlapSegment(p, q, node.bmin, node.bmax); bool isLeafNode = node.i >= 0; diff --git a/src/DotRecast.Recast/Geom/ChunkyTriMeshNode.cs b/src/DotRecast.Recast/Geom/RcChunkyTriMeshNode.cs similarity index 82% rename from src/DotRecast.Recast/Geom/ChunkyTriMeshNode.cs rename to src/DotRecast.Recast/Geom/RcChunkyTriMeshNode.cs index babba6a..d884d61 100644 --- a/src/DotRecast.Recast/Geom/ChunkyTriMeshNode.cs +++ b/src/DotRecast.Recast/Geom/RcChunkyTriMeshNode.cs @@ -2,7 +2,7 @@ namespace DotRecast.Recast.Geom { - public class ChunkyTriMeshNode + public class RcChunkyTriMeshNode { public RcVec2f bmin; public RcVec2f bmax; diff --git a/src/DotRecast.Recast/Geom/TriMesh.cs b/src/DotRecast.Recast/Geom/RcTriMesh.cs similarity index 82% rename from src/DotRecast.Recast/Geom/TriMesh.cs rename to src/DotRecast.Recast/Geom/RcTriMesh.cs index e2631a8..c858260 100644 --- a/src/DotRecast.Recast/Geom/TriMesh.cs +++ b/src/DotRecast.Recast/Geom/RcTriMesh.cs @@ -22,17 +22,17 @@ using System.Collections.Generic; namespace DotRecast.Recast.Geom { - public class TriMesh + public class RcTriMesh { private readonly float[] vertices; private readonly int[] faces; - public readonly ChunkyTriMesh chunkyTriMesh; + public readonly RcChunkyTriMesh chunkyTriMesh; - public TriMesh(float[] vertices, int[] faces) + public RcTriMesh(float[] vertices, int[] faces) { this.vertices = vertices; this.faces = faces; - chunkyTriMesh = new ChunkyTriMesh(vertices, faces, faces.Length / 3, 32); + chunkyTriMesh = new RcChunkyTriMesh(vertices, faces, faces.Length / 3, 32); } public int[] GetTris() @@ -45,7 +45,7 @@ namespace DotRecast.Recast.Geom return vertices; } - public List GetChunksOverlappingRect(float[] bmin, float[] bmax) + public List GetChunksOverlappingRect(float[] bmin, float[] bmax) { return chunkyTriMesh.GetChunksOverlappingRect(bmin, bmax); } diff --git a/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs b/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs index a14f036..ee6927a 100644 --- a/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs @@ -33,7 +33,7 @@ namespace DotRecast.Recast.Geom private RcVec3f bmin; private RcVec3f bmax; private readonly List volumes = new List(); - private readonly TriMesh _mesh; + private readonly RcTriMesh _mesh; public SimpleInputGeomProvider(List vertexPositions, List meshFaces) : this(MapVertices(vertexPositions), MapFaces(meshFaces)) @@ -78,7 +78,7 @@ namespace DotRecast.Recast.Geom bmax.Max(vertices, i * 3); } - _mesh = new TriMesh(vertices, faces); + _mesh = new RcTriMesh(vertices, faces); } public RcVec3f GetMeshBoundsMin() @@ -106,7 +106,7 @@ namespace DotRecast.Recast.Geom volumes.Add(vol); } - public IEnumerable Meshes() + public IEnumerable Meshes() { return ImmutableArray.Create(_mesh); } diff --git a/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs b/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs index b076805..5df75c4 100644 --- a/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs @@ -27,7 +27,7 @@ namespace DotRecast.Recast.Geom { private readonly RcVec3f bmin; private readonly RcVec3f bmax; - private readonly TriMesh _mesh; + private readonly RcTriMesh _mesh; public SingleTrimeshInputGeomProvider(float[] vertices, int[] faces) { @@ -41,7 +41,7 @@ namespace DotRecast.Recast.Geom bmax.Max(vertices, i * 3); } - _mesh = new TriMesh(vertices, faces); + _mesh = new RcTriMesh(vertices, faces); } public RcVec3f GetMeshBoundsMin() @@ -54,7 +54,7 @@ namespace DotRecast.Recast.Geom return bmax; } - public IEnumerable Meshes() + public IEnumerable Meshes() { return ImmutableArray.Create(_mesh); } diff --git a/src/DotRecast.Recast/RecastVoxelization.cs b/src/DotRecast.Recast/RecastVoxelization.cs index 7fdc45c..3f2ecac 100644 --- a/src/DotRecast.Recast/RecastVoxelization.cs +++ b/src/DotRecast.Recast/RecastVoxelization.cs @@ -23,8 +23,7 @@ namespace DotRecast.Recast { public static class RecastVoxelization { - public static RcHeightfield BuildSolidHeightfield(IInputGeomProvider geomProvider, RecastBuilderConfig builderCfg, - Telemetry ctx) + public static RcHeightfield BuildSolidHeightfield(IInputGeomProvider geomProvider, RecastBuilderConfig builderCfg, Telemetry ctx) { RcConfig cfg = builderCfg.cfg; @@ -41,7 +40,7 @@ namespace DotRecast.Recast // If your input data is multiple meshes, you can transform them here, // calculate // the are type for each of the meshes and rasterize them. - foreach (TriMesh geom in geomProvider.Meshes()) + foreach (RcTriMesh geom in geomProvider.Meshes()) { float[] verts = geom.GetVerts(); if (cfg.useTiles) @@ -52,8 +51,8 @@ namespace DotRecast.Recast tbmin[1] = builderCfg.bmin.z; tbmax[0] = builderCfg.bmax.x; tbmax[1] = builderCfg.bmax.z; - List nodes = geom.GetChunksOverlappingRect(tbmin, tbmax); - foreach (ChunkyTriMeshNode node in nodes) + List nodes = geom.GetChunksOverlappingRect(tbmin, tbmax); + foreach (RcChunkyTriMeshNode node in nodes) { int[] tris = node.tris; int ntris = tris.Length / 3; diff --git a/test/DotRecast.Detour.Extras.Test/Unity/Astar/UnityAStarPathfindingImporterTest.cs b/test/DotRecast.Detour.Extras.Test/Unity/Astar/UnityAStarPathfindingImporterTest.cs index b708719..c38cd2d 100644 --- a/test/DotRecast.Detour.Extras.Test/Unity/Astar/UnityAStarPathfindingImporterTest.cs +++ b/test/DotRecast.Detour.Extras.Test/Unity/Astar/UnityAStarPathfindingImporterTest.cs @@ -130,7 +130,7 @@ public class UnityAStarPathfindingImporterTest } // Save the mesh as recast file, - MeshSetWriter writer = new MeshSetWriter(); + DtMeshSetWriter writer = new DtMeshSetWriter(); string filename = $"all_tiles_navmesh_{filePostfix}.bin"; string filepath = Path.Combine("test-output", filename); using var fs = new FileStream(filename, FileMode.Create); diff --git a/test/DotRecast.Detour.Test/Io/MeshDataReaderWriterTest.cs b/test/DotRecast.Detour.Test/Io/MeshDataReaderWriterTest.cs index c1cc48e..419787e 100644 --- a/test/DotRecast.Detour.Test/Io/MeshDataReaderWriterTest.cs +++ b/test/DotRecast.Detour.Test/Io/MeshDataReaderWriterTest.cs @@ -65,12 +65,12 @@ public class MeshDataReaderWriterTest using var ms = new MemoryStream(); using var bwos = new BinaryWriter(ms); - MeshDataWriter writer = new MeshDataWriter(); + DtMeshDataWriter writer = new DtMeshDataWriter(); writer.Write(bwos, meshData, order, cCompatibility); ms.Seek(0, SeekOrigin.Begin); using var bris = new BinaryReader(ms); - MeshDataReader reader = new MeshDataReader(); + DtMeshDataReader reader = new DtMeshDataReader(); DtMeshData readData = reader.Read(bris, VERTS_PER_POLYGON); Assert.That(readData.header.vertCount, Is.EqualTo(meshData.header.vertCount)); diff --git a/test/DotRecast.Detour.Test/Io/MeshSetReaderTest.cs b/test/DotRecast.Detour.Test/Io/MeshSetReaderTest.cs index f70b7e3..73d7178 100644 --- a/test/DotRecast.Detour.Test/Io/MeshSetReaderTest.cs +++ b/test/DotRecast.Detour.Test/Io/MeshSetReaderTest.cs @@ -27,7 +27,7 @@ namespace DotRecast.Detour.Test.Io; [Parallelizable] public class MeshSetReaderTest { - private readonly MeshSetReader reader = new MeshSetReader(); + private readonly DtMeshSetReader reader = new DtMeshSetReader(); [Test] public void TestNavmesh() diff --git a/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs b/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs index 2fe2692..fae54eb 100644 --- a/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs +++ b/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs @@ -30,8 +30,8 @@ namespace DotRecast.Detour.Test.Io; [Parallelizable] public class MeshSetReaderWriterTest { - private readonly MeshSetWriter writer = new MeshSetWriter(); - private readonly MeshSetReader reader = new MeshSetReader(); + private readonly DtMeshSetWriter writer = new DtMeshSetWriter(); + private readonly DtMeshSetReader reader = new DtMeshSetReader(); private const float m_cellSize = 0.3f; private const float m_cellHeight = 0.2f; private const float m_agentHeight = 2.0f; diff --git a/test/DotRecast.Detour.TileCache.Test/AbstractTileCacheTest.cs b/test/DotRecast.Detour.TileCache.Test/AbstractTileCacheTest.cs index 291a63b..7b60708 100644 --- a/test/DotRecast.Detour.TileCache.Test/AbstractTileCacheTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/AbstractTileCacheTest.cs @@ -39,7 +39,7 @@ public class AbstractTileCacheTest private readonly float m_edgeMaxError = 1.3f; private readonly int m_tileSize = 48; - protected class TestTileCacheMeshProcess : ITileCacheMeshProcess + protected class TestTileCacheMeshProcess : IDtTileCacheMeshProcess { public void Process(DtNavMeshCreateParams option) { @@ -50,9 +50,9 @@ public class AbstractTileCacheTest } } - public TileCache GetTileCache(IInputGeomProvider geom, RcByteOrder order, bool cCompatibility) + public DtTileCache GetTileCache(IInputGeomProvider geom, RcByteOrder order, bool cCompatibility) { - TileCacheParams option = new TileCacheParams(); + DtTileCacheParams option = new DtTileCacheParams(); Recast.Recast.CalcTileCount(geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), m_cellSize, m_tileSize, m_tileSize, out var tw, out var th); option.ch = m_cellHeight; option.cs = m_cellSize; @@ -72,8 +72,8 @@ public class AbstractTileCacheTest navMeshParams.maxTiles = 256; navMeshParams.maxPolys = 16384; DtNavMesh navMesh = new DtNavMesh(navMeshParams, 6); - TileCache tc = new TileCache(option, new TileCacheStorageParams(order, cCompatibility), navMesh, - TileCacheCompressorFactory.Get(cCompatibility), new TestTileCacheMeshProcess()); + DtTileCache tc = new DtTileCache(option, new TileCacheStorageParams(order, cCompatibility), navMesh, + DtTileCacheCompressorFactory.Get(cCompatibility), new TestTileCacheMeshProcess()); return tc; } } \ No newline at end of file diff --git a/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderTest.cs b/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderTest.cs index 453919c..88b3ca4 100644 --- a/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderTest.cs @@ -29,14 +29,14 @@ namespace DotRecast.Detour.TileCache.Test.Io; [Parallelizable] public class TileCacheReaderTest { - private readonly TileCacheReader reader = new TileCacheReader(); + private readonly DtTileCacheReader reader = new DtTileCacheReader(); [Test] public void TestNavmesh() { using var ms = new MemoryStream(Loader.ToBytes("all_tiles_tilecache.bin")); using var @is = new BinaryReader(ms); - TileCache tc = reader.Read(@is, 6, null); + DtTileCache tc = reader.Read(@is, 6, null); Assert.That(tc.GetNavMesh().GetMaxTiles(), Is.EqualTo(256)); Assert.That(tc.GetNavMesh().GetParams().maxPolys, Is.EqualTo(16384)); Assert.That(tc.GetNavMesh().GetParams().tileWidth, Is.EqualTo(14.4f).Within(0.001f)); @@ -134,7 +134,7 @@ public class TileCacheReaderTest { using var ms = new MemoryStream(Loader.ToBytes("dungeon_all_tiles_tilecache.bin")); using var @is = new BinaryReader(ms); - TileCache tc = reader.Read(@is, 6, null); + DtTileCache tc = reader.Read(@is, 6, null); Assert.That(tc.GetNavMesh().GetMaxTiles(), Is.EqualTo(256)); Assert.That(tc.GetNavMesh().GetParams().maxPolys, Is.EqualTo(16384)); Assert.That(tc.GetNavMesh().GetParams().tileWidth, Is.EqualTo(14.4f).Within(0.001f)); diff --git a/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderWriterTest.cs b/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderWriterTest.cs index 9bac03a..d611f4f 100644 --- a/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderWriterTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderWriterTest.cs @@ -31,8 +31,8 @@ namespace DotRecast.Detour.TileCache.Test.Io; [Parallelizable] public class TileCacheReaderWriterTest : AbstractTileCacheTest { - private readonly TileCacheReader reader = new TileCacheReader(); - private readonly TileCacheWriter writer = new TileCacheWriter(); + private readonly DtTileCacheReader reader = new DtTileCacheReader(); + private readonly DtTileCacheWriter writer = new DtTileCacheWriter(); [Test] public void TestFastLz() @@ -53,7 +53,7 @@ public class TileCacheReaderWriterTest : AbstractTileCacheTest IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(RcByteOrder.LITTLE_ENDIAN, cCompatibility, 1); - TileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility); + DtTileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility); foreach (byte[] layer in layers) { long refs = tc.AddTile(layer, 0); diff --git a/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs b/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs index 11876ce..a70a61d 100644 --- a/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs @@ -36,7 +36,7 @@ public class TempObstaclesTest : AbstractTileCacheTest IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(RcByteOrder.LITTLE_ENDIAN, cCompatibility, 1); - TileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility); + DtTileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility); foreach (byte[] data in layers) { long refs = tc.AddTile(data, 0); @@ -70,7 +70,7 @@ public class TempObstaclesTest : AbstractTileCacheTest IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(RcByteOrder.LITTLE_ENDIAN, cCompatibility, 1); - TileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility); + DtTileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility); foreach (byte[] data in layers) { long refs = tc.AddTile(data, 0); diff --git a/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs b/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs index 7dccc64..a5508ac 100644 --- a/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs +++ b/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs @@ -81,15 +81,15 @@ public class TestTileLayerBuilder : AbstractTileLayersBuilder List result = new(); if (lset != null) { - TileCacheBuilder builder = new TileCacheBuilder(); + DtTileCacheBuilder builder = new DtTileCacheBuilder(); for (int i = 0; i < lset.layers.Length; ++i) { RcHeightfieldLayer layer = lset.layers[i]; // Store header - TileCacheLayerHeader header = new TileCacheLayerHeader(); - header.magic = TileCacheLayerHeader.DT_TILECACHE_MAGIC; - header.version = TileCacheLayerHeader.DT_TILECACHE_VERSION; + DtTileCacheLayerHeader header = new DtTileCacheLayerHeader(); + header.magic = DtTileCacheLayerHeader.DT_TILECACHE_MAGIC; + header.version = DtTileCacheLayerHeader.DT_TILECACHE_VERSION; // Tile layer location in the navmesh. header.tx = tx; diff --git a/test/DotRecast.Detour.TileCache.Test/TileCacheFindPathTest.cs b/test/DotRecast.Detour.TileCache.Test/TileCacheFindPathTest.cs index 125969b..f3c224e 100644 --- a/test/DotRecast.Detour.TileCache.Test/TileCacheFindPathTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TileCacheFindPathTest.cs @@ -39,7 +39,7 @@ public class TileCacheFindPathTest : AbstractTileCacheTest { using var msis = new MemoryStream(Loader.ToBytes("dungeon_all_tiles_tilecache.bin")); using var @is = new BinaryReader(msis); - TileCache tcC = new TileCacheReader().Read(@is, 6, new TestTileCacheMeshProcess()); + DtTileCache tcC = new DtTileCacheReader().Read(@is, 6, new TestTileCacheMeshProcess()); navmesh = tcC.GetNavMesh(); query = new DtNavMeshQuery(navmesh); } diff --git a/test/DotRecast.Detour.TileCache.Test/TileCacheNavigationTest.cs b/test/DotRecast.Detour.TileCache.Test/TileCacheNavigationTest.cs index aea1990..6e6c86d 100644 --- a/test/DotRecast.Detour.TileCache.Test/TileCacheNavigationTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TileCacheNavigationTest.cs @@ -59,7 +59,7 @@ public class TileCacheNavigationTest : AbstractTileCacheTest IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(RcByteOrder.LITTLE_ENDIAN, cCompatibility, 1); - TileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility); + DtTileCache tc = GetTileCache(geom, RcByteOrder.LITTLE_ENDIAN, cCompatibility); foreach (byte[] data in layers) { tc.AddTile(data, 0); diff --git a/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs b/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs index 043a910..0714646 100644 --- a/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs @@ -60,7 +60,7 @@ public class TileCacheTest : AbstractTileCacheTest private void TestDungeon(RcByteOrder order, bool cCompatibility) { IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); - TileCache tc = GetTileCache(geom, order, cCompatibility); + DtTileCache tc = GetTileCache(geom, order, cCompatibility); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(order, cCompatibility, 1); int cacheLayerCount = 0; @@ -156,7 +156,7 @@ public class TileCacheTest : AbstractTileCacheTest private void Test(RcByteOrder order, bool cCompatibility) { IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("nav_test.obj")); - TileCache tc = GetTileCache(geom, order, cCompatibility); + DtTileCache tc = GetTileCache(geom, order, cCompatibility); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(order, cCompatibility, 1); int cacheLayerCount = 0; @@ -205,7 +205,7 @@ public class TileCacheTest : AbstractTileCacheTest long t3 = RcFrequency.Ticks; Console.WriteLine(" Time ST : " + (t2 - t1) / TimeSpan.TicksPerMillisecond); Console.WriteLine(" Time MT : " + (t3 - t2) / TimeSpan.TicksPerMillisecond); - TileCache tc = GetTileCache(geom, order, cCompatibility); + DtTileCache tc = GetTileCache(geom, order, cCompatibility); foreach (byte[] layer in layers) { long refs = tc.AddTile(layer, 0); diff --git a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs index e0a6f96..a697da5 100644 --- a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs @@ -117,7 +117,7 @@ public class RecastSoloMeshTest // Allocate voxel heightfield where we rasterize our input data to. RcHeightfield m_solid = new RcHeightfield(bcfg.width, bcfg.height, bcfg.bmin, bcfg.bmax, cfg.cs, cfg.ch, cfg.borderSize); - foreach (TriMesh geom in geomProvider.Meshes()) + foreach (RcTriMesh geom in geomProvider.Meshes()) { float[] verts = geom.GetVerts(); int[] tris = geom.GetTris();