diff --git a/src/DotRecast.Detour.Dynamic/Io/ByteUtils.cs b/src/DotRecast.Core/RcByteUtils.cs similarity index 89% rename from src/DotRecast.Detour.Dynamic/Io/ByteUtils.cs rename to src/DotRecast.Core/RcByteUtils.cs index f5aaa58..ec525f0 100644 --- a/src/DotRecast.Detour.Dynamic/Io/ByteUtils.cs +++ b/src/DotRecast.Core/RcByteUtils.cs @@ -17,11 +17,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -using DotRecast.Core; - -namespace DotRecast.Detour.Dynamic.Io +namespace DotRecast.Core { - public static class ByteUtils + public static class RcByteUtils { public static int GetInt(byte[] data, int position, RcByteOrder order) { @@ -30,13 +28,17 @@ namespace DotRecast.Detour.Dynamic.Io public static int GetIntBE(byte[] data, int position) { - return ((data[position] & 0xff) << 24) | ((data[position + 1] & 0xff) << 16) | ((data[position + 2] & 0xff) << 8) + return ((data[position] & 0xff) << 24) + | ((data[position + 1] & 0xff) << 16) + | ((data[position + 2] & 0xff) << 8) | (data[position + 3] & 0xff); } public static int GetIntLE(byte[] data, int position) { - return ((data[position + 3] & 0xff) << 24) | ((data[position + 2] & 0xff) << 16) | ((data[position + 1] & 0xff) << 8) + return ((data[position + 3] & 0xff) << 24) + | ((data[position + 2] & 0xff) << 16) + | ((data[position + 1] & 0xff) << 8) | (data[position] & 0xff); } diff --git a/src/DotRecast.Detour.Crowd/DtCrowd.cs b/src/DotRecast.Detour.Crowd/DtCrowd.cs index 94a2b7b..b2f5e62 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowd.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowd.cs @@ -21,7 +21,7 @@ freely, subject to the following restrictions: using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Collections.ObjectModel; + using System.Linq; using DotRecast.Core; using DotRecast.Detour.Crowd.Tracking; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/BoxCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/DtBoxCollider.cs similarity index 96% rename from src/DotRecast.Detour.Dynamic/Colliders/BoxCollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/DtBoxCollider.cs index 9a52a00..fd7b7c3 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/BoxCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/DtBoxCollider.cs @@ -23,12 +23,12 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public class BoxCollider : AbstractCollider + public class DtBoxCollider : DtCollider { private readonly RcVec3f center; private readonly RcVec3f[] halfEdges; - public BoxCollider(RcVec3f center, RcVec3f[] halfEdges, int area, float flagMergeThreshold) : + public DtBoxCollider(RcVec3f center, RcVec3f[] halfEdges, int area, float flagMergeThreshold) : base(area, flagMergeThreshold, Bounds(center, halfEdges)) { this.center = center; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/CapsuleCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/DtCapsuleCollider.cs similarity index 92% rename from src/DotRecast.Detour.Dynamic/Colliders/CapsuleCollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/DtCapsuleCollider.cs index a342a89..739e7ab 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/CapsuleCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/DtCapsuleCollider.cs @@ -23,13 +23,13 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public class CapsuleCollider : AbstractCollider + public class DtCapsuleCollider : DtCollider { private readonly RcVec3f start; private readonly RcVec3f end; private readonly float radius; - public CapsuleCollider(RcVec3f start, RcVec3f end, float radius, int area, float flagMergeThreshold) + public DtCapsuleCollider(RcVec3f start, RcVec3f end, float radius, int area, float flagMergeThreshold) : base(area, flagMergeThreshold, Bounds(start, end, radius)) { this.start = start; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/DtCollider.cs similarity index 91% rename from src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/DtCollider.cs index c034e19..efe16a0 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/DtCollider.cs @@ -22,13 +22,13 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public abstract class AbstractCollider : ICollider + public abstract class DtCollider : IDtCollider { protected readonly int area; protected readonly float flagMergeThreshold; protected readonly float[] _bounds; - public AbstractCollider(int area, float flagMergeThreshold, float[] bounds) + public DtCollider(int area, float flagMergeThreshold, float[] bounds) { this.area = area; this.flagMergeThreshold = flagMergeThreshold; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/DtCompositeCollider.cs similarity index 86% rename from src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/DtCompositeCollider.cs index b980cc6..6acb515 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/DtCompositeCollider.cs @@ -25,18 +25,18 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public class CompositeCollider : ICollider + public class DtCompositeCollider : IDtCollider { - private readonly List colliders; + private readonly List colliders; private readonly float[] _bounds; - public CompositeCollider(List colliders) + public DtCompositeCollider(List colliders) { this.colliders = colliders; _bounds = Bounds(colliders); } - public CompositeCollider(params ICollider[] colliders) + public DtCompositeCollider(params IDtCollider[] colliders) { this.colliders = colliders.ToList(); _bounds = Bounds(this.colliders); @@ -47,14 +47,14 @@ namespace DotRecast.Detour.Dynamic.Colliders return _bounds; } - private static float[] Bounds(List colliders) + private static float[] Bounds(List colliders) { float[] bounds = new float[] { float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity, float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity }; - foreach (ICollider collider in colliders) + foreach (IDtCollider collider in colliders) { float[] b = collider.Bounds(); bounds[0] = Math.Min(bounds[0], b[0]); diff --git a/src/DotRecast.Detour.Dynamic/Colliders/ConvexTrimeshCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/DtConvexTrimeshCollider.cs similarity index 81% rename from src/DotRecast.Detour.Dynamic/Colliders/ConvexTrimeshCollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/DtConvexTrimeshCollider.cs index 708f3b5..44f8645 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/ConvexTrimeshCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/DtConvexTrimeshCollider.cs @@ -23,19 +23,19 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public class ConvexTrimeshCollider : AbstractCollider + public class DtConvexTrimeshCollider : DtCollider { private readonly float[] vertices; private readonly int[] triangles; - public ConvexTrimeshCollider(float[] vertices, int[] triangles, int area, float flagMergeThreshold) - : base(area, flagMergeThreshold, TrimeshCollider.ComputeBounds(vertices)) + public DtConvexTrimeshCollider(float[] vertices, int[] triangles, int area, float flagMergeThreshold) + : base(area, flagMergeThreshold, DtTrimeshCollider.ComputeBounds(vertices)) { this.vertices = vertices; this.triangles = triangles; } - public ConvexTrimeshCollider(float[] vertices, int[] triangles, float[] bounds, int area, float flagMergeThreshold) + public DtConvexTrimeshCollider(float[] vertices, int[] triangles, float[] bounds, int area, float flagMergeThreshold) : base(area, flagMergeThreshold, bounds) { this.vertices = vertices; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/CylinderCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/DtCylinderCollider.cs similarity index 92% rename from src/DotRecast.Detour.Dynamic/Colliders/CylinderCollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/DtCylinderCollider.cs index 00f6497..9cdbaf1 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/CylinderCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/DtCylinderCollider.cs @@ -23,13 +23,13 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public class CylinderCollider : AbstractCollider + public class DtCylinderCollider : DtCollider { private readonly RcVec3f start; private readonly RcVec3f end; private readonly float radius; - public CylinderCollider(RcVec3f start, RcVec3f end, float radius, int area, float flagMergeThreshold) : + public DtCylinderCollider(RcVec3f start, RcVec3f end, float radius, int area, float flagMergeThreshold) : base(area, flagMergeThreshold, Bounds(start, end, radius)) { this.start = start; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/SphereCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/DtSphereCollider.cs similarity index 92% rename from src/DotRecast.Detour.Dynamic/Colliders/SphereCollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/DtSphereCollider.cs index ed8a225..17ff831 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/SphereCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/DtSphereCollider.cs @@ -23,12 +23,12 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public class SphereCollider : AbstractCollider + public class DtSphereCollider : DtCollider { private readonly RcVec3f center; private readonly float radius; - public SphereCollider(RcVec3f center, float radius, int area, float flagMergeThreshold) + public DtSphereCollider(RcVec3f center, float radius, int area, float flagMergeThreshold) : base(area, flagMergeThreshold, Bounds(center, radius)) { this.center = center; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/TrimeshCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/DtTrimeshCollider.cs similarity index 90% rename from src/DotRecast.Detour.Dynamic/Colliders/TrimeshCollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/DtTrimeshCollider.cs index d54e708..ea07032 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/TrimeshCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/DtTrimeshCollider.cs @@ -23,19 +23,19 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public class TrimeshCollider : AbstractCollider + public class DtTrimeshCollider : DtCollider { private readonly float[] vertices; private readonly int[] triangles; - public TrimeshCollider(float[] vertices, int[] triangles, int area, float flagMergeThreshold) + public DtTrimeshCollider(float[] vertices, int[] triangles, int area, float flagMergeThreshold) : base(area, flagMergeThreshold, ComputeBounds(vertices)) { this.vertices = vertices; this.triangles = triangles; } - public TrimeshCollider(float[] vertices, int[] triangles, float[] bounds, int area, float flagMergeThreshold) : + public DtTrimeshCollider(float[] vertices, int[] triangles, float[] bounds, int area, float flagMergeThreshold) : base(area, flagMergeThreshold, bounds) { this.vertices = vertices; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/ICollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/IDtCollider.cs similarity index 97% rename from src/DotRecast.Detour.Dynamic/Colliders/ICollider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/IDtCollider.cs index e4f1408..a0bc77c 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/ICollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/IDtCollider.cs @@ -22,7 +22,7 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public interface ICollider + public interface IDtCollider { float[] Bounds(); void Rasterize(RcHeightfield hf, RcTelemetry telemetry); diff --git a/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs b/src/DotRecast.Detour.Dynamic/DtDynamicNavMesh.cs similarity index 80% rename from src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs rename to src/DotRecast.Detour.Dynamic/DtDynamicNavMesh.cs index 31789f1..7999b2b 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs +++ b/src/DotRecast.Detour.Dynamic/DtDynamicNavMesh.cs @@ -20,7 +20,6 @@ freely, subject to the following restrictions: using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using DotRecast.Core; @@ -30,22 +29,22 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic { - public class DynamicNavMesh + public class DtDynamicNavMesh { public const int MAX_VERTS_PER_POLY = 6; - public readonly DynamicNavMeshConfig config; + public readonly DtDynamicNavMeshConfig config; private readonly RecastBuilder builder; - private readonly Dictionary _tiles = new Dictionary(); + private readonly Dictionary _tiles = new Dictionary(); private readonly RcTelemetry telemetry; private readonly DtNavMeshParams navMeshParams; - private readonly BlockingCollection updateQueue = new BlockingCollection(); + private readonly BlockingCollection updateQueue = new BlockingCollection(); private readonly RcAtomicLong currentColliderId = new RcAtomicLong(0); private DtNavMesh _navMesh; private bool dirty = true; - public DynamicNavMesh(VoxelFile voxelFile) + public DtDynamicNavMesh(DtVoxelFile voxelFile) { - config = new DynamicNavMeshConfig(voxelFile.useTiles, voxelFile.tileSizeX, voxelFile.tileSizeZ, voxelFile.cellSize); + config = new DtDynamicNavMeshConfig(voxelFile.useTiles, voxelFile.tileSizeX, voxelFile.tileSizeZ, voxelFile.cellSize); config.walkableHeight = voxelFile.walkableHeight; config.walkableRadius = voxelFile.walkableRadius; config.walkableClimb = voxelFile.walkableClimb; @@ -69,7 +68,7 @@ namespace DotRecast.Detour.Dynamic navMeshParams.maxPolys = 0x8000; foreach (var t in voxelFile.tiles) { - _tiles.Add(LookupKey(t.tileX, t.tileZ), new DynamicTile(t)); + _tiles.Add(LookupKey(t.tileX, t.tileZ), new DtDynamicTile(t)); } ; @@ -84,9 +83,9 @@ namespace DotRecast.Detour.Dynamic /** * Voxel queries require checkpoints to be enabled in {@link DynamicNavMeshConfig} */ - public VoxelQuery VoxelQuery() + public DtVoxelQuery VoxelQuery() { - return new VoxelQuery(navMeshParams.orig, navMeshParams.tileWidth, navMeshParams.tileHeight, LookupHeightfield); + return new DtVoxelQuery(navMeshParams.orig, navMeshParams.tileWidth, navMeshParams.tileHeight, LookupHeightfield); } private RcHeightfield LookupHeightfield(int x, int z) @@ -94,16 +93,16 @@ namespace DotRecast.Detour.Dynamic return GetTileAt(x, z)?.checkpoint.heightfield; } - public long AddCollider(ICollider collider) + public long AddCollider(IDtCollider collider) { long cid = currentColliderId.IncrementAndGet(); - updateQueue.Add(new AddColliderQueueItem(cid, collider, GetTiles(collider.Bounds()))); + updateQueue.Add(new DtDynamicTileColliderAdditionJob(cid, collider, GetTiles(collider.Bounds()))); return cid; } public void RemoveCollider(long colliderId) { - updateQueue.Add(new RemoveColliderQueueItem(colliderId, GetTilesByCollider(colliderId))); + updateQueue.Add(new DtDynamicTileColliderRemovalJob(colliderId, GetTilesByCollider(colliderId))); } /** @@ -123,14 +122,14 @@ namespace DotRecast.Detour.Dynamic return Rebuild(ProcessQueue()); } - private bool Rebuild(ICollection stream) + private bool Rebuild(ICollection stream) { foreach (var dynamicTile in stream) Rebuild(dynamicTile); return UpdateNavMesh(); } - private HashSet ProcessQueue() + private HashSet ProcessQueue() { var items = ConsumeQueue(); foreach (var item in items) @@ -141,9 +140,9 @@ namespace DotRecast.Detour.Dynamic return items.SelectMany(i => i.AffectedTiles()).ToHashSet(); } - private List ConsumeQueue() + private List ConsumeQueue() { - List items = new List(); + List items = new List(); while (updateQueue.TryTake(out var item)) { items.Add(item); @@ -152,7 +151,7 @@ namespace DotRecast.Detour.Dynamic return items; } - private void Process(IUpdateQueueItem item) + private void Process(IDtDaynmicTileJob item) { foreach (var tile in item.AffectedTiles()) { @@ -177,13 +176,13 @@ namespace DotRecast.Detour.Dynamic return Rebuild(ProcessQueue(), executor); } - private Task Rebuild(ICollection tiles, TaskFactory executor) + private Task Rebuild(ICollection tiles, TaskFactory executor) { var tasks = tiles.Select(tile => executor.StartNew(() => Rebuild(tile))).ToArray(); return Task.WhenAll(tasks).ContinueWith(k => UpdateNavMesh()); } - private ICollection GetTiles(float[] bounds) + private ICollection GetTiles(float[] bounds) { if (bounds == null) { @@ -194,12 +193,12 @@ namespace DotRecast.Detour.Dynamic int minz = (int)Math.Floor((bounds[2] - navMeshParams.orig.z) / navMeshParams.tileHeight); int maxx = (int)Math.Floor((bounds[3] - navMeshParams.orig.x) / navMeshParams.tileWidth); int maxz = (int)Math.Floor((bounds[5] - navMeshParams.orig.z) / navMeshParams.tileHeight); - List tiles = new List(); + List tiles = new List(); for (int z = minz; z <= maxz; ++z) { for (int x = minx; x <= maxx; ++x) { - DynamicTile tile = GetTileAt(x, z); + DtDynamicTile tile = GetTileAt(x, z); if (tile != null) { tiles.Add(tile); @@ -210,12 +209,12 @@ namespace DotRecast.Detour.Dynamic return tiles; } - private List GetTilesByCollider(long cid) + private List GetTilesByCollider(long cid) { return _tiles.Values.Where(t => t.ContainsCollider(cid)).ToList(); } - private void Rebuild(DynamicTile tile) + private void Rebuild(DtDynamicTile tile) { DtNavMeshCreateParams option = new DtNavMeshCreateParams(); option.walkableHeight = config.walkableHeight; @@ -238,7 +237,7 @@ namespace DotRecast.Detour.Dynamic return false; } - private DynamicTile GetTileAt(int x, int z) + private DtDynamicTile GetTileAt(int x, int z) { return _tiles.TryGetValue(LookupKey(x, z), out var tile) ? tile @@ -250,7 +249,7 @@ namespace DotRecast.Detour.Dynamic return (z << 32) | x; } - public List VoxelTiles() + public List VoxelTiles() { return _tiles.Values.Select(t => t.voxelTile).ToList(); } diff --git a/src/DotRecast.Detour.Dynamic/DynamicNavMeshConfig.cs b/src/DotRecast.Detour.Dynamic/DtDynamicNavMeshConfig.cs similarity index 94% rename from src/DotRecast.Detour.Dynamic/DynamicNavMeshConfig.cs rename to src/DotRecast.Detour.Dynamic/DtDynamicNavMeshConfig.cs index 0a59128..8f840f9 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicNavMeshConfig.cs +++ b/src/DotRecast.Detour.Dynamic/DtDynamicNavMeshConfig.cs @@ -21,7 +21,7 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic { - public class DynamicNavMeshConfig + public class DtDynamicNavMeshConfig { public readonly bool useTiles; public readonly int tileSizeX; @@ -47,7 +47,7 @@ namespace DotRecast.Detour.Dynamic public bool enableCheckpoints = true; public bool keepIntermediateResults = false; - public DynamicNavMeshConfig(bool useTiles, int tileSizeX, int tileSizeZ, float cellSize) + public DtDynamicNavMeshConfig(bool useTiles, int tileSizeX, int tileSizeZ, float cellSize) { this.useTiles = useTiles; this.tileSizeX = tileSizeX; diff --git a/src/DotRecast.Detour.Dynamic/DynamicTile.cs b/src/DotRecast.Detour.Dynamic/DtDynamicTile.cs similarity index 88% rename from src/DotRecast.Detour.Dynamic/DynamicTile.cs rename to src/DotRecast.Detour.Dynamic/DtDynamicTile.cs index 3726807..b911bca 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicTile.cs +++ b/src/DotRecast.Detour.Dynamic/DtDynamicTile.cs @@ -20,7 +20,7 @@ freely, subject to the following restrictions: using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Collections.ObjectModel; + using System.Linq; using DotRecast.Core; using DotRecast.Detour.Dynamic.Colliders; @@ -29,22 +29,22 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic { - public class DynamicTile + public class DtDynamicTile { - public readonly VoxelTile voxelTile; - public DynamicTileCheckpoint checkpoint; + public readonly DtVoxelTile voxelTile; + public DtDynamicTileCheckpoint checkpoint; public RecastBuilderResult recastResult; private DtMeshData meshData; - private readonly ConcurrentDictionary colliders = new ConcurrentDictionary(); + private readonly ConcurrentDictionary colliders = new ConcurrentDictionary(); private bool dirty = true; private long id; - public DynamicTile(VoxelTile voxelTile) + public DtDynamicTile(DtVoxelTile voxelTile) { this.voxelTile = voxelTile; } - public bool Build(RecastBuilder builder, DynamicNavMeshConfig config, RcTelemetry telemetry) + public bool Build(RecastBuilder builder, DtDynamicNavMeshConfig config, RcTelemetry telemetry) { if (dirty) { @@ -59,7 +59,7 @@ namespace DotRecast.Detour.Dynamic return false; } - private RcHeightfield BuildHeightfield(DynamicNavMeshConfig config, RcTelemetry telemetry) + private RcHeightfield BuildHeightfield(DtDynamicNavMeshConfig config, RcTelemetry telemetry) { ICollection rasterizedColliders = checkpoint != null ? checkpoint.colliders as ICollection @@ -80,13 +80,13 @@ namespace DotRecast.Detour.Dynamic if (config.enableCheckpoints) { - checkpoint = new DynamicTileCheckpoint(heightfield, colliders.Keys.ToHashSet()); + checkpoint = new DtDynamicTileCheckpoint(heightfield, colliders.Keys.ToHashSet()); } return heightfield; } - private RecastBuilderResult BuildRecast(RecastBuilder builder, DynamicNavMeshConfig config, VoxelTile vt, + private RecastBuilderResult BuildRecast(RecastBuilder builder, DtDynamicNavMeshConfig config, DtVoxelTile vt, RcHeightfield heightfield, RcTelemetry telemetry) { RcConfig rcConfig = new RcConfig( @@ -97,7 +97,7 @@ namespace DotRecast.Detour.Dynamic config.walkableSlopeAngle, config.walkableHeight, config.walkableRadius, config.walkableClimb, config.minRegionArea, config.regionMergeArea, config.maxEdgeLen, config.maxSimplificationError, - Math.Min(DynamicNavMesh.MAX_VERTS_PER_POLY, config.vertsPerPoly), + Math.Min(DtDynamicNavMesh.MAX_VERTS_PER_POLY, config.vertsPerPoly), config.detailSampleDistance, config.detailSampleMaxError, true, true, true, null, true); RecastBuilderResult r = builder.Build(vt.tileX, vt.tileZ, null, rcConfig, heightfield, telemetry); @@ -109,7 +109,7 @@ namespace DotRecast.Detour.Dynamic return r; } - public void AddCollider(long cid, ICollider collider) + public void AddCollider(long cid, IDtCollider collider) { colliders[cid] = collider; dirty = true; @@ -130,7 +130,7 @@ namespace DotRecast.Detour.Dynamic } private DtNavMeshCreateParams NavMeshCreateParams(int tilex, int tileZ, float cellSize, float cellHeight, - DynamicNavMeshConfig config, RecastBuilderResult rcResult) + DtDynamicNavMeshConfig config, RecastBuilderResult rcResult) { RcPolyMesh m_pmesh = rcResult.GetMesh(); RcPolyMeshDetail m_dmesh = rcResult.GetMeshDetail(); diff --git a/src/DotRecast.Detour.Dynamic/DynamicTileCheckpoint.cs b/src/DotRecast.Detour.Dynamic/DtDynamicTileCheckpoint.cs similarity index 94% rename from src/DotRecast.Detour.Dynamic/DynamicTileCheckpoint.cs rename to src/DotRecast.Detour.Dynamic/DtDynamicTileCheckpoint.cs index 79d307d..24a074a 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicTileCheckpoint.cs +++ b/src/DotRecast.Detour.Dynamic/DtDynamicTileCheckpoint.cs @@ -22,12 +22,12 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic { - public class DynamicTileCheckpoint + public class DtDynamicTileCheckpoint { public readonly RcHeightfield heightfield; public readonly ISet colliders; - public DynamicTileCheckpoint(RcHeightfield heightfield, ISet colliders) + public DtDynamicTileCheckpoint(RcHeightfield heightfield, ISet colliders) { this.colliders = colliders; this.heightfield = Clone(heightfield); diff --git a/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs b/src/DotRecast.Detour.Dynamic/DtDynamicTileColliderAdditionJob.cs similarity index 67% rename from src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs rename to src/DotRecast.Detour.Dynamic/DtDynamicTileColliderAdditionJob.cs index 81c59d2..9957099 100644 --- a/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/DtDynamicTileColliderAdditionJob.cs @@ -22,27 +22,27 @@ using DotRecast.Detour.Dynamic.Colliders; namespace DotRecast.Detour.Dynamic { - public class AddColliderQueueItem : IUpdateQueueItem + public class DtDynamicTileColliderAdditionJob : IDtDaynmicTileJob { - private readonly long colliderId; - private readonly ICollider collider; - private readonly ICollection _affectedTiles; + private readonly long _colliderId; + private readonly IDtCollider _collider; + private readonly ICollection _affectedTiles; - public AddColliderQueueItem(long colliderId, ICollider collider, ICollection affectedTiles) + public DtDynamicTileColliderAdditionJob(long colliderId, IDtCollider collider, ICollection affectedTiles) { - this.colliderId = colliderId; - this.collider = collider; + _colliderId = colliderId; + _collider = collider; _affectedTiles = affectedTiles; } - public ICollection AffectedTiles() + public ICollection AffectedTiles() { return _affectedTiles; } - public void Process(DynamicTile tile) + public void Process(DtDynamicTile tile) { - tile.AddCollider(colliderId, collider); + tile.AddCollider(_colliderId, _collider); } } } \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs b/src/DotRecast.Detour.Dynamic/DtDynamicTileColliderRemovalJob.cs similarity index 78% rename from src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs rename to src/DotRecast.Detour.Dynamic/DtDynamicTileColliderRemovalJob.cs index 73df4fc..d72c586 100644 --- a/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/DtDynamicTileColliderRemovalJob.cs @@ -21,23 +21,23 @@ using System.Collections.Generic; namespace DotRecast.Detour.Dynamic { - public class RemoveColliderQueueItem : IUpdateQueueItem + public class DtDynamicTileColliderRemovalJob : IDtDaynmicTileJob { private readonly long colliderId; - private readonly ICollection _affectedTiles; + private readonly ICollection _affectedTiles; - public RemoveColliderQueueItem(long colliderId, ICollection affectedTiles) + public DtDynamicTileColliderRemovalJob(long colliderId, ICollection affectedTiles) { this.colliderId = colliderId; this._affectedTiles = affectedTiles; } - public ICollection AffectedTiles() + public ICollection AffectedTiles() { return _affectedTiles; } - public void Process(DynamicTile tile) + public void Process(DtDynamicTile tile) { tile.RemoveCollider(colliderId); } diff --git a/src/DotRecast.Detour.Dynamic/VoxelQuery.cs b/src/DotRecast.Detour.Dynamic/DtVoxelQuery.cs similarity index 97% rename from src/DotRecast.Detour.Dynamic/VoxelQuery.cs rename to src/DotRecast.Detour.Dynamic/DtVoxelQuery.cs index 74271eb..cebeacd 100644 --- a/src/DotRecast.Detour.Dynamic/VoxelQuery.cs +++ b/src/DotRecast.Detour.Dynamic/DtVoxelQuery.cs @@ -28,14 +28,14 @@ namespace DotRecast.Detour.Dynamic * * "A Fast Voxel Traversal Algorithm for Ray Tracing" by John Amanatides and Andrew Woo */ - public class VoxelQuery + public class DtVoxelQuery { private readonly RcVec3f origin; private readonly float tileWidth; private readonly float tileDepth; private readonly Func heightfieldProvider; - public VoxelQuery(RcVec3f origin, float tileWidth, float tileDepth, Func heightfieldProvider) + public DtVoxelQuery(RcVec3f origin, float tileWidth, float tileDepth, Func heightfieldProvider) { this.origin = origin; this.tileWidth = tileWidth; diff --git a/src/DotRecast.Detour.Dynamic/IUpdateQueueItem.cs b/src/DotRecast.Detour.Dynamic/IDtDaynmicTileJob.cs similarity index 88% rename from src/DotRecast.Detour.Dynamic/IUpdateQueueItem.cs rename to src/DotRecast.Detour.Dynamic/IDtDaynmicTileJob.cs index 96ce836..f7ce42c 100644 --- a/src/DotRecast.Detour.Dynamic/IUpdateQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/IDtDaynmicTileJob.cs @@ -21,10 +21,10 @@ using System.Collections.Generic; namespace DotRecast.Detour.Dynamic { - public interface IUpdateQueueItem + public interface IDtDaynmicTileJob { - ICollection AffectedTiles(); + ICollection AffectedTiles(); - void Process(DynamicTile tile); + void Process(DtDynamicTile tile); } } \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs b/src/DotRecast.Detour.Dynamic/Io/DtVoxelFile.cs similarity index 89% rename from src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs rename to src/DotRecast.Detour.Dynamic/Io/DtVoxelFile.cs index 35b9589..505dc41 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs +++ b/src/DotRecast.Detour.Dynamic/Io/DtVoxelFile.cs @@ -24,7 +24,7 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Io { - public class VoxelFile + public class DtVoxelFile { public static readonly RcByteOrder PREFERRED_BYTE_ORDER = RcByteOrder.BIG_ENDIAN; public const int MAGIC = 'V' << 24 | 'O' << 16 | 'X' << 8 | 'L'; @@ -55,14 +55,14 @@ namespace DotRecast.Detour.Dynamic.Io public int tileSizeZ; public RcVec3f rotation = new RcVec3f(); public float[] bounds = new float[6]; - public readonly List tiles = new List(); + public readonly List tiles = new List(); - public void AddTile(VoxelTile tile) + public void AddTile(DtVoxelTile tile) { tiles.Add(tile); } - public RcConfig GetConfig(VoxelTile tile, RcAreaModification walkbableAreaMod, bool buildMeshDetail) + public RcConfig GetConfig(DtVoxelTile tile, RcAreaModification walkbableAreaMod, bool buildMeshDetail) { return new RcConfig(useTiles, tileSizeX, tileSizeZ, tile.borderSize, @@ -77,9 +77,9 @@ namespace DotRecast.Detour.Dynamic.Io walkbableAreaMod, buildMeshDetail); } - public static VoxelFile From(RcConfig config, List results) + public static DtVoxelFile From(RcConfig config, List results) { - VoxelFile f = new VoxelFile(); + DtVoxelFile f = new DtVoxelFile(); f.version = 1; f.partition = config.Partition; f.filterLowHangingObstacles = config.FilterLowHangingObstacles; @@ -108,7 +108,7 @@ namespace DotRecast.Detour.Dynamic.Io }; foreach (RecastBuilderResult r in results) { - f.tiles.Add(new VoxelTile(r.tileX, r.tileZ, r.GetSolidHeightfield())); + f.tiles.Add(new DtVoxelTile(r.tileX, r.tileZ, r.GetSolidHeightfield())); f.bounds[0] = Math.Min(f.bounds[0], r.GetSolidHeightfield().bmin.x); f.bounds[1] = Math.Min(f.bounds[1], r.GetSolidHeightfield().bmin.y); f.bounds[2] = Math.Min(f.bounds[2], r.GetSolidHeightfield().bmin.z); @@ -120,11 +120,11 @@ namespace DotRecast.Detour.Dynamic.Io return f; } - public static VoxelFile From(DynamicNavMesh mesh) + public static DtVoxelFile From(DtDynamicNavMesh mesh) { - VoxelFile f = new VoxelFile(); + DtVoxelFile f = new DtVoxelFile(); f.version = 1; - DynamicNavMeshConfig config = mesh.config; + DtDynamicNavMeshConfig config = mesh.config; f.partition = config.partition; f.filterLowHangingObstacles = config.filterLowHangingObstacles; f.filterLedgeSpans = config.filterLedgeSpans; @@ -150,10 +150,10 @@ namespace DotRecast.Detour.Dynamic.Io float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity, float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity }; - foreach (VoxelTile vt in mesh.VoxelTiles()) + foreach (DtVoxelTile vt in mesh.VoxelTiles()) { RcHeightfield heightfield = vt.Heightfield(); - f.tiles.Add(new VoxelTile(vt.tileX, vt.tileZ, heightfield)); + f.tiles.Add(new DtVoxelTile(vt.tileX, vt.tileZ, heightfield)); f.bounds[0] = Math.Min(f.bounds[0], vt.boundsMin.x); f.bounds[1] = Math.Min(f.bounds[1], vt.boundsMin.y); f.bounds[2] = Math.Min(f.bounds[2], vt.boundsMin.z); diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelFileReader.cs b/src/DotRecast.Detour.Dynamic/Io/DtVoxelFileReader.cs similarity index 89% rename from src/DotRecast.Detour.Dynamic/Io/VoxelFileReader.cs rename to src/DotRecast.Detour.Dynamic/Io/DtVoxelFileReader.cs index 74fa98c..dccbd74 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelFileReader.cs +++ b/src/DotRecast.Detour.Dynamic/Io/DtVoxelFileReader.cs @@ -23,24 +23,24 @@ using DotRecast.Detour.Io; namespace DotRecast.Detour.Dynamic.Io { - public class VoxelFileReader + public class DtVoxelFileReader { private readonly IRcCompressor _compressor; - public VoxelFileReader(IRcCompressor compressor) + public DtVoxelFileReader(IRcCompressor compressor) { _compressor = compressor; } - public VoxelFile Read(BinaryReader stream) + public DtVoxelFile Read(BinaryReader stream) { RcByteBuffer buf = IOUtils.ToByteBuffer(stream); - VoxelFile file = new VoxelFile(); + DtVoxelFile file = new DtVoxelFile(); int magic = buf.GetInt(); - if (magic != VoxelFile.MAGIC) + if (magic != DtVoxelFile.MAGIC) { magic = IOUtils.SwapEndianness(magic); - if (magic != VoxelFile.MAGIC) + if (magic != DtVoxelFile.MAGIC) { throw new IOException("Invalid magic"); } @@ -49,8 +49,8 @@ namespace DotRecast.Detour.Dynamic.Io } file.version = buf.GetInt(); - bool isExportedFromAstar = (file.version & VoxelFile.VERSION_EXPORTER_MASK) == 0; - bool compression = (file.version & VoxelFile.VERSION_COMPRESSION_MASK) == VoxelFile.VERSION_COMPRESSION_LZ4; + bool isExportedFromAstar = (file.version & DtVoxelFile.VERSION_EXPORTER_MASK) == 0; + bool compression = (file.version & DtVoxelFile.VERSION_COMPRESSION_MASK) == DtVoxelFile.VERSION_COMPRESSION_LZ4; file.walkableRadius = buf.GetFloat(); file.walkableHeight = buf.GetFloat(); file.walkableClimb = buf.GetFloat(); @@ -138,7 +138,7 @@ namespace DotRecast.Detour.Dynamic.Io RcByteBuffer data = new RcByteBuffer(bytes); data.Order(buf.Order()); - file.AddTile(new VoxelTile(tileX, tileZ, width, depth, boundsMin, boundsMax, cellSize, cellHeight, borderSize, data)); + file.AddTile(new DtVoxelTile(tileX, tileZ, width, depth, boundsMin, boundsMax, cellSize, cellHeight, borderSize, data)); buf.Position(position + voxelSize); } diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs b/src/DotRecast.Detour.Dynamic/Io/DtVoxelFileWriter.cs similarity index 83% rename from src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs rename to src/DotRecast.Detour.Dynamic/Io/DtVoxelFileWriter.cs index 177aa63..9efd45c 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs +++ b/src/DotRecast.Detour.Dynamic/Io/DtVoxelFileWriter.cs @@ -23,24 +23,24 @@ using DotRecast.Detour.Io; namespace DotRecast.Detour.Dynamic.Io { - public class VoxelFileWriter : DtWriter + public class DtVoxelFileWriter : DtWriter { private readonly IRcCompressor _compressor; - public VoxelFileWriter(IRcCompressor compressor) + public DtVoxelFileWriter(IRcCompressor compressor) { _compressor = compressor; } - public void Write(BinaryWriter stream, VoxelFile f, bool compression) + public void Write(BinaryWriter stream, DtVoxelFile f, bool compression) { - Write(stream, f, VoxelFile.PREFERRED_BYTE_ORDER, compression); + Write(stream, f, DtVoxelFile.PREFERRED_BYTE_ORDER, compression); } - public void Write(BinaryWriter stream, VoxelFile f, RcByteOrder byteOrder, bool compression) + public void Write(BinaryWriter stream, DtVoxelFile f, RcByteOrder byteOrder, bool compression) { - Write(stream, VoxelFile.MAGIC, byteOrder); - Write(stream, VoxelFile.VERSION_EXPORTER_RECAST4J | (compression ? VoxelFile.VERSION_COMPRESSION_LZ4 : 0), byteOrder); + Write(stream, DtVoxelFile.MAGIC, byteOrder); + Write(stream, DtVoxelFile.VERSION_EXPORTER_RECAST4J | (compression ? DtVoxelFile.VERSION_COMPRESSION_LZ4 : 0), byteOrder); Write(stream, f.walkableRadius, byteOrder); Write(stream, f.walkableHeight, byteOrder); Write(stream, f.walkableClimb, byteOrder); @@ -67,13 +67,13 @@ namespace DotRecast.Detour.Dynamic.Io Write(stream, f.bounds[4], byteOrder); Write(stream, f.bounds[5], byteOrder); Write(stream, f.tiles.Count, byteOrder); - foreach (VoxelTile t in f.tiles) + foreach (DtVoxelTile t in f.tiles) { WriteTile(stream, t, byteOrder, compression); } } - public void WriteTile(BinaryWriter stream, VoxelTile tile, RcByteOrder byteOrder, bool compression) + public void WriteTile(BinaryWriter stream, DtVoxelTile tile, RcByteOrder byteOrder, bool compression) { Write(stream, tile.tileX, byteOrder); Write(stream, tile.tileZ, byteOrder); diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelTile.cs b/src/DotRecast.Detour.Dynamic/Io/DtVoxelTile.cs similarity index 78% rename from src/DotRecast.Detour.Dynamic/Io/VoxelTile.cs rename to src/DotRecast.Detour.Dynamic/Io/DtVoxelTile.cs index f3fe608..2ce4af6 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelTile.cs +++ b/src/DotRecast.Detour.Dynamic/Io/DtVoxelTile.cs @@ -22,7 +22,7 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Io { - public class VoxelTile + public class DtVoxelTile { private const int SERIALIZED_SPAN_COUNT_BYTES = 2; private const int SERIALIZED_SPAN_BYTES = 12; @@ -37,7 +37,7 @@ namespace DotRecast.Detour.Dynamic.Io public float cellHeight; public readonly byte[] spanData; - public VoxelTile(int tileX, int tileZ, int width, int depth, RcVec3f boundsMin, RcVec3f boundsMax, float cellSize, + public DtVoxelTile(int tileX, int tileZ, int width, int depth, RcVec3f boundsMin, RcVec3f boundsMax, float cellSize, float cellHeight, int borderSize, RcByteBuffer buffer) { this.tileX = tileX; @@ -49,10 +49,10 @@ namespace DotRecast.Detour.Dynamic.Io this.cellSize = cellSize; this.cellHeight = cellHeight; this.borderSize = borderSize; - spanData = ToByteArray(buffer, width, depth, VoxelFile.PREFERRED_BYTE_ORDER); + spanData = ToByteArray(buffer, width, depth, DtVoxelFile.PREFERRED_BYTE_ORDER); } - public VoxelTile(int tileX, int tileZ, RcHeightfield heightfield) + public DtVoxelTile(int tileX, int tileZ, RcHeightfield heightfield) { this.tileX = tileX; this.tileZ = tileZ; @@ -63,12 +63,12 @@ namespace DotRecast.Detour.Dynamic.Io cellSize = heightfield.cs; cellHeight = heightfield.ch; borderSize = heightfield.borderSize; - spanData = SerializeSpans(heightfield, VoxelFile.PREFERRED_BYTE_ORDER); + spanData = SerializeSpans(heightfield, DtVoxelFile.PREFERRED_BYTE_ORDER); } public RcHeightfield Heightfield() { - return VoxelFile.PREFERRED_BYTE_ORDER == RcByteOrder.BIG_ENDIAN ? HeightfieldBE() : HeightfieldLE(); + return DtVoxelFile.PREFERRED_BYTE_ORDER == RcByteOrder.BIG_ENDIAN ? HeightfieldBE() : HeightfieldLE(); } private RcHeightfield HeightfieldBE() @@ -80,16 +80,16 @@ namespace DotRecast.Detour.Dynamic.Io for (int x = 0; x < width; x++) { RcSpan prev = null; - int spanCount = ByteUtils.GetShortBE(spanData, position); + int spanCount = RcByteUtils.GetShortBE(spanData, position); position += 2; for (int s = 0; s < spanCount; s++) { RcSpan span = new RcSpan(); - span.smin = ByteUtils.GetIntBE(spanData, position); + span.smin = RcByteUtils.GetIntBE(spanData, position); position += 4; - span.smax = ByteUtils.GetIntBE(spanData, position); + span.smax = RcByteUtils.GetIntBE(spanData, position); position += 4; - span.area = ByteUtils.GetIntBE(spanData, position); + span.area = RcByteUtils.GetIntBE(spanData, position); position += 4; if (prev == null) { @@ -117,16 +117,16 @@ namespace DotRecast.Detour.Dynamic.Io for (int x = 0; x < width; x++) { RcSpan prev = null; - int spanCount = ByteUtils.GetShortLE(spanData, position); + int spanCount = RcByteUtils.GetShortLE(spanData, position); position += 2; for (int s = 0; s < spanCount; s++) { RcSpan span = new RcSpan(); - span.smin = ByteUtils.GetIntLE(spanData, position); + span.smin = RcByteUtils.GetIntLE(spanData, position); position += 4; - span.smax = ByteUtils.GetIntLE(spanData, position); + span.smax = RcByteUtils.GetIntLE(spanData, position); position += 4; - span.area = ByteUtils.GetIntLE(spanData, position); + span.area = RcByteUtils.GetIntLE(spanData, position); position += 4; if (prev == null) { @@ -169,13 +169,13 @@ namespace DotRecast.Detour.Dynamic.Io { for (int x = 0; x < heightfield.width; x++) { - position = ByteUtils.PutShort(counts[pz + x], data, position, order); + position = RcByteUtils.PutShort(counts[pz + x], data, position, order); RcSpan span = heightfield.spans[pz + x]; while (span != null) { - position = ByteUtils.PutInt(span.smin, data, position, order); - position = ByteUtils.PutInt(span.smax, data, position, order); - position = ByteUtils.PutInt(span.area, data, position, order); + position = RcByteUtils.PutInt(span.smin, data, position, order); + position = RcByteUtils.PutInt(span.smax, data, position, order); + position = RcByteUtils.PutInt(span.area, data, position, order); span = span.next; } } @@ -199,15 +199,15 @@ namespace DotRecast.Detour.Dynamic.Io for (int i = 0; i < l; i++) { int count = buf.GetShort(); - ByteUtils.PutShort(count, data, position, order); + RcByteUtils.PutShort(count, data, position, order); position += 2; for (int j = 0; j < count; j++) { - ByteUtils.PutInt(buf.GetInt(), data, position, order); + RcByteUtils.PutInt(buf.GetInt(), data, position, order); position += 4; - ByteUtils.PutInt(buf.GetInt(), data, position, order); + RcByteUtils.PutInt(buf.GetInt(), data, position, order); position += 4; - ByteUtils.PutInt(buf.GetInt(), data, position, order); + RcByteUtils.PutInt(buf.GetInt(), data, position, order); position += 4; } } diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs index df9a54e..f5ca751 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using DotRecast.Core; using DotRecast.Recast; -using static DotRecast.Core.RcMath; namespace DotRecast.Detour.Extras.Jumplink { diff --git a/src/DotRecast.Recast.Demo/DtVoxelTileLZ4DemoCompressor.cs b/src/DotRecast.Recast.Demo/DtVoxelTileLZ4DemoCompressor.cs index c47bb84..b82e720 100644 --- a/src/DotRecast.Recast.Demo/DtVoxelTileLZ4DemoCompressor.cs +++ b/src/DotRecast.Recast.Demo/DtVoxelTileLZ4DemoCompressor.cs @@ -15,7 +15,7 @@ public class DtVoxelTileLZ4DemoCompressor : IRcCompressor public byte[] Decompress(byte[] data) { - int compressedSize = ByteUtils.GetIntBE(data, 0); + int compressedSize = RcByteUtils.GetIntBE(data, 0); return LZ4Pickler.Unpickle(data.AsSpan(4, compressedSize)); } @@ -28,7 +28,7 @@ public class DtVoxelTileLZ4DemoCompressor : IRcCompressor { byte[] compressed = LZ4Pickler.Pickle(data, LZ4Level.L12_MAX); byte[] result = new byte[4 + compressed.Length]; - ByteUtils.PutInt(compressed.Length, result, 0, RcByteOrder.BIG_ENDIAN); + RcByteUtils.PutInt(compressed.Length, result, 0, RcByteOrder.BIG_ENDIAN); Array.Copy(compressed, 0, result, 4, compressed.Length); return result; } diff --git a/src/DotRecast.Recast.Demo/Tools/DynamicUpdateSampleTool.cs b/src/DotRecast.Recast.Demo/Tools/DynamicUpdateSampleTool.cs index c92acb7..df116f1 100644 --- a/src/DotRecast.Recast.Demo/Tools/DynamicUpdateSampleTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/DynamicUpdateSampleTool.cs @@ -461,7 +461,7 @@ public class DynamicUpdateSampleTool : ISampleTool _sample.Update(null, dynaMesh.RecastResults(), dynaMesh.NavMesh()); } - private void UpdateTo(DynamicNavMeshConfig config) + private void UpdateTo(DtDynamicNavMeshConfig config) { config.partition = partitioning; config.walkableHeight = walkableHeight; @@ -481,7 +481,7 @@ public class DynamicUpdateSampleTool : ISampleTool config.detailSampleMaxError = detailSampleMaxError; } - private void UpdateFrom(DynamicNavMeshConfig config) + private void UpdateFrom(DtDynamicNavMeshConfig config) { cellSize = config.cellSize; partitioning = config.partition; diff --git a/src/DotRecast.Recast.Toolset/Gizmos/RcBoxGizmo.cs b/src/DotRecast.Recast.Toolset/Gizmos/RcBoxGizmo.cs index 9cf173f..9fcc563 100644 --- a/src/DotRecast.Recast.Toolset/Gizmos/RcBoxGizmo.cs +++ b/src/DotRecast.Recast.Toolset/Gizmos/RcBoxGizmo.cs @@ -28,7 +28,7 @@ namespace DotRecast.Recast.Toolset.Gizmos public readonly RcVec3f[] halfEdges; public RcBoxGizmo(RcVec3f center, RcVec3f extent, RcVec3f forward, RcVec3f up) : - this(center, BoxCollider.GetHalfEdges(up, forward, extent)) + this(center, DtBoxCollider.GetHalfEdges(up, forward, extent)) { } diff --git a/src/DotRecast.Recast.Toolset/Gizmos/RcGizmo.cs b/src/DotRecast.Recast.Toolset/Gizmos/RcGizmo.cs index 34cd98e..da94d8d 100644 --- a/src/DotRecast.Recast.Toolset/Gizmos/RcGizmo.cs +++ b/src/DotRecast.Recast.Toolset/Gizmos/RcGizmo.cs @@ -6,9 +6,9 @@ namespace DotRecast.Recast.Toolset.Gizmos public class RcGizmo { public readonly IRcGizmoMeshFilter Gizmo; - public readonly ICollider Collider; + public readonly IDtCollider Collider; - public RcGizmo(ICollider collider, IRcGizmoMeshFilter gizmo) + public RcGizmo(IDtCollider collider, IRcGizmoMeshFilter gizmo) { Collider = collider; Gizmo = gizmo; diff --git a/src/DotRecast.Recast.Toolset/Tools/RcDynamicUpdateTool.cs b/src/DotRecast.Recast.Toolset/Tools/RcDynamicUpdateTool.cs index d62b7a5..411067a 100644 --- a/src/DotRecast.Recast.Toolset/Tools/RcDynamicUpdateTool.cs +++ b/src/DotRecast.Recast.Toolset/Tools/RcDynamicUpdateTool.cs @@ -14,7 +14,7 @@ namespace DotRecast.Recast.Toolset.Tools { public class RcDynamicUpdateTool : IRcToolable { - private DynamicNavMesh dynaMesh; + private DtDynamicNavMesh dynaMesh; private readonly Dictionary colliderGizmos; private readonly Random random; @@ -41,7 +41,7 @@ namespace DotRecast.Recast.Toolset.Tools return "Dynamic Updates"; } - public DynamicNavMesh GetDynamicNavMesh() + public DtDynamicNavMesh GetDynamicNavMesh() { return dynaMesh; } @@ -140,14 +140,14 @@ namespace DotRecast.Recast.Toolset.Tools return colliderWithGizmo; } - public DynamicNavMesh Load(string filename, IRcCompressor compressor) + public DtDynamicNavMesh Load(string filename, IRcCompressor compressor) { using var fs = new FileStream(filename, FileMode.Open, FileAccess.Read); using var br = new BinaryReader(fs); - VoxelFileReader reader = new VoxelFileReader(compressor); - VoxelFile voxelFile = reader.Read(br); + DtVoxelFileReader reader = new DtVoxelFileReader(compressor); + DtVoxelFile voxelFile = reader.Read(br); - dynaMesh = new DynamicNavMesh(voxelFile); + dynaMesh = new DtDynamicNavMesh(voxelFile); dynaMesh.config.keepIntermediateResults = true; colliderGizmos.Clear(); @@ -157,10 +157,10 @@ namespace DotRecast.Recast.Toolset.Tools public void Save(string filename, bool compression, IRcCompressor compressor) { - VoxelFile voxelFile = VoxelFile.From(dynaMesh); + DtVoxelFile voxelFile = DtVoxelFile.From(dynaMesh); using var fs = new FileStream(filename, FileMode.CreateNew, FileAccess.Write); using var bw = new BinaryWriter(fs); - VoxelFileWriter writer = new VoxelFileWriter(compressor); + DtVoxelFileWriter writer = new DtVoxelFileWriter(compressor); writer.Write(bw, voxelFile, compression); } @@ -168,7 +168,7 @@ namespace DotRecast.Recast.Toolset.Tools public RcGizmo SphereCollider(RcVec3f p, float walkableClimb) { float radius = 1 + (float)random.NextDouble() * 10; - var collider = new SphereCollider(p, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb); + var collider = new DtSphereCollider(p, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb); var gizmo = GizmoFactory.Sphere(p, radius); return new RcGizmo(collider, gizmo); @@ -189,7 +189,7 @@ namespace DotRecast.Recast.Toolset.Tools a.z *= len; RcVec3f start = RcVec3f.Of(p.x, p.y, p.z); RcVec3f end = RcVec3f.Of(p.x + a.x, p.y + a.y, p.z + a.z); - var collider = new CapsuleCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb); + var collider = new DtCapsuleCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb); var gizmo = GizmoFactory.Capsule(start, end, radius); return new RcGizmo(collider, gizmo); } @@ -203,8 +203,8 @@ namespace DotRecast.Recast.Toolset.Tools ); RcVec3f forward = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble())); RcVec3f up = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0.01f + (float)random.NextDouble(), (1f - 2 * (float)random.NextDouble())); - RcVec3f[] halfEdges = Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(up, forward, extent); - var collider = new BoxCollider(p, halfEdges, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb); + RcVec3f[] halfEdges = Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(up, forward, extent); + var collider = new DtBoxCollider(p, halfEdges, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb); var gizmo = GizmoFactory.Box(p, halfEdges); return new RcGizmo(collider, gizmo); } @@ -220,7 +220,7 @@ namespace DotRecast.Recast.Toolset.Tools a[2] *= len; RcVec3f start = RcVec3f.Of(p.x, p.y, p.z); RcVec3f end = RcVec3f.Of(p.x + a.x, p.y + a.y, p.z + a.z); - var collider = new CylinderCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb); + var collider = new DtCylinderCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb); var gizmo = GizmoFactory.Cylinder(start, end, radius); return new RcGizmo(collider, gizmo); @@ -234,14 +234,14 @@ namespace DotRecast.Recast.Toolset.Tools RcVec3f forward = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble())); forward.Normalize(); RcVec3f side = RcVec3f.Cross(forward, baseUp); - BoxCollider @base = new BoxCollider(baseCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(baseUp, forward, baseExtent), + DtBoxCollider @base = new DtBoxCollider(baseCenter, Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(baseUp, forward, baseExtent), SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb); var roofUp = RcVec3f.Zero; RcVec3f roofExtent = RcVec3f.Of(4.5f, 4.5f, 8f); var rx = RcMatrix4x4f.CreateFromRotate(45, forward.x, forward.y, forward.z); roofUp = MulMatrixVector(ref roofUp, rx, baseUp); RcVec3f roofCenter = RcVec3f.Of(p.x, p.y + 6, p.z); - BoxCollider roof = new BoxCollider(roofCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(roofUp, forward, roofExtent), + DtBoxCollider roof = new DtBoxCollider(roofCenter, Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(roofUp, forward, roofExtent), SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb); RcVec3f trunkStart = RcVec3f.Of( baseCenter.x - forward.x * 15 + side.x * 6, @@ -249,17 +249,17 @@ namespace DotRecast.Recast.Toolset.Tools baseCenter.z - forward.z * 15 + side.z * 6 ); RcVec3f trunkEnd = RcVec3f.Of(trunkStart.x, trunkStart.y + 10, trunkStart.z); - CapsuleCollider trunk = new CapsuleCollider(trunkStart, trunkEnd, 0.5f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, + DtCapsuleCollider trunk = new DtCapsuleCollider(trunkStart, trunkEnd, 0.5f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb); RcVec3f crownCenter = RcVec3f.Of( baseCenter.x - forward.x * 15 + side.x * 6, p.y + 10, baseCenter.z - forward.z * 15 + side.z * 6 ); - SphereCollider crown = new SphereCollider(crownCenter, 4f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GRASS, + DtSphereCollider crown = new DtSphereCollider(crownCenter, 4f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GRASS, walkableClimb); - CompositeCollider collider = new CompositeCollider(@base, roof, trunk, crown); - IRcGizmoMeshFilter baseGizmo = GizmoFactory.Box(baseCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(baseUp, forward, baseExtent)); - IRcGizmoMeshFilter roofGizmo = GizmoFactory.Box(roofCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(roofUp, forward, roofExtent)); + DtCompositeCollider collider = new DtCompositeCollider(@base, roof, trunk, crown); + IRcGizmoMeshFilter baseGizmo = GizmoFactory.Box(baseCenter, Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(baseUp, forward, baseExtent)); + IRcGizmoMeshFilter roofGizmo = GizmoFactory.Box(roofCenter, Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(roofUp, forward, roofExtent)); IRcGizmoMeshFilter trunkGizmo = GizmoFactory.Capsule(trunkStart, trunkEnd, 0.5f); IRcGizmoMeshFilter crownGizmo = GizmoFactory.Sphere(crownCenter, 4f); IRcGizmoMeshFilter gizmo = GizmoFactory.Composite(baseGizmo, roofGizmo, trunkGizmo, crownGizmo); @@ -279,7 +279,7 @@ namespace DotRecast.Recast.Toolset.Tools public RcGizmo ConvexTrimesh(RcVec3f p, float walkableClimb) { float[] verts = TransformVertices(p, convexGeom, 360); - var collider = new ConvexTrimeshCollider(verts, convexGeom.faces, + var collider = new DtConvexTrimeshCollider(verts, convexGeom.faces, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb * 10); var gizmo = GizmoFactory.Trimesh(verts, convexGeom.faces); return new RcGizmo(collider, gizmo); @@ -288,7 +288,7 @@ namespace DotRecast.Recast.Toolset.Tools private RcGizmo TrimeshCollider(RcVec3f p, DemoInputGeomProvider geom, float walkableClimb) { float[] verts = TransformVertices(p, geom, 0); - var collider = new TrimeshCollider(verts, geom.faces, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, + var collider = new DtTrimeshCollider(verts, geom.faces, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb * 10); var gizmo = GizmoFactory.Trimesh(verts, geom.faces); diff --git a/test/DotRecast.Detour.Dynamic.Test/DynamicNavMeshTest.cs b/test/DotRecast.Detour.Dynamic.Test/DynamicNavMeshTest.cs index 6a7f7dd..03dd43f 100644 --- a/test/DotRecast.Detour.Dynamic.Test/DynamicNavMeshTest.cs +++ b/test/DotRecast.Detour.Dynamic.Test/DynamicNavMeshTest.cs @@ -26,10 +26,10 @@ public class DynamicNavMeshTest using var br = new BinaryReader(ms); // load voxels from file - VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); - VoxelFile f = reader.Read(br); + DtVoxelFileReader reader = new DtVoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); + DtVoxelFile f = reader.Read(br); // create dynamic navmesh - DynamicNavMesh mesh = new DynamicNavMesh(f); + DtDynamicNavMesh mesh = new DtDynamicNavMesh(f); // build navmesh asynchronously using multiple threads Task future = mesh.Build(Task.Factory); // wait for build to complete @@ -49,7 +49,7 @@ public class DynamicNavMeshTest Assert.That(path.Count, Is.EqualTo(16)); // place obstacle - ICollider colldier = new SphereCollider(SPHERE_POS, 20, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GROUND, 0.1f); + IDtCollider colldier = new DtSphereCollider(SPHERE_POS, 20, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GROUND, 0.1f); long colliderId = mesh.AddCollider(colldier); // update navmesh asynchronously diff --git a/test/DotRecast.Detour.Dynamic.Test/Io/DtVoxelTileLZ4ForTestCompressor.cs b/test/DotRecast.Detour.Dynamic.Test/Io/DtVoxelTileLZ4ForTestCompressor.cs index f01d00f..62c7960 100644 --- a/test/DotRecast.Detour.Dynamic.Test/Io/DtVoxelTileLZ4ForTestCompressor.cs +++ b/test/DotRecast.Detour.Dynamic.Test/Io/DtVoxelTileLZ4ForTestCompressor.cs @@ -34,7 +34,7 @@ namespace DotRecast.Detour.Dynamic.Test.Io public byte[] Decompress(byte[] data) { - int compressedSize = ByteUtils.GetIntBE(data, 0); + int compressedSize = RcByteUtils.GetIntBE(data, 0); return LZ4Pickler.Unpickle(data.AsSpan(4, compressedSize)); } @@ -47,7 +47,7 @@ namespace DotRecast.Detour.Dynamic.Test.Io { byte[] compressed = LZ4Pickler.Pickle(data, LZ4Level.L12_MAX); byte[] result = new byte[4 + compressed.Length]; - ByteUtils.PutInt(compressed.Length, result, 0, RcByteOrder.BIG_ENDIAN); + RcByteUtils.PutInt(compressed.Length, result, 0, RcByteOrder.BIG_ENDIAN); Array.Copy(compressed, 0, result, 4, compressed.Length); return result; } diff --git a/test/DotRecast.Detour.Dynamic.Test/Io/VoxelFileReaderTest.cs b/test/DotRecast.Detour.Dynamic.Test/Io/VoxelFileReaderTest.cs index 7319650..3aceab6 100644 --- a/test/DotRecast.Detour.Dynamic.Test/Io/VoxelFileReaderTest.cs +++ b/test/DotRecast.Detour.Dynamic.Test/Io/VoxelFileReaderTest.cs @@ -34,8 +34,8 @@ public class VoxelFileReaderTest using var ms = new MemoryStream(bytes); using var br = new BinaryReader(ms); - VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); - VoxelFile f = reader.Read(br); + DtVoxelFileReader reader = new DtVoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); + DtVoxelFile f = reader.Read(br); Assert.That(f.useTiles, Is.False); Assert.That(f.bounds, Is.EqualTo(new float[] { -100.0f, 0f, -100f, 100f, 5f, 100f })); Assert.That(f.cellSize, Is.EqualTo(0.25f)); @@ -60,8 +60,8 @@ public class VoxelFileReaderTest using var ms = new MemoryStream(bytes); using var br = new BinaryReader(ms); - VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); - VoxelFile f = reader.Read(br); + DtVoxelFileReader reader = new DtVoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); + DtVoxelFile f = reader.Read(br); Assert.That(f.useTiles, Is.True); Assert.That(f.bounds, Is.EqualTo(new float[] { -100.0f, 0f, -100f, 100f, 5f, 100f })); diff --git a/test/DotRecast.Detour.Dynamic.Test/Io/VoxelFileReaderWriterTest.cs b/test/DotRecast.Detour.Dynamic.Test/Io/VoxelFileReaderWriterTest.cs index cd3c8b1..1f55223 100644 --- a/test/DotRecast.Detour.Dynamic.Test/Io/VoxelFileReaderWriterTest.cs +++ b/test/DotRecast.Detour.Dynamic.Test/Io/VoxelFileReaderWriterTest.cs @@ -35,7 +35,7 @@ public class VoxelFileReaderWriterTest using var ms = new MemoryStream(bytes); using var br = new BinaryReader(ms); - VoxelFile f = ReadWriteRead(br, compression); + DtVoxelFile f = ReadWriteRead(br, compression); Assert.That(f.useTiles, Is.False); Assert.That(f.bounds, Is.EqualTo(new[] { -100.0f, 0f, -100f, 100f, 5f, 100f })); Assert.That(f.cellSize, Is.EqualTo(0.25f)); @@ -63,7 +63,7 @@ public class VoxelFileReaderWriterTest using var ms = new MemoryStream(bytes); using var br = new BinaryReader(ms); - VoxelFile f = ReadWriteRead(br, compression); + DtVoxelFile f = ReadWriteRead(br, compression); Assert.That(f.useTiles, Is.True); Assert.That(f.bounds, Is.EqualTo(new[] { -100.0f, 0f, -100f, 100f, 5f, 100f })); @@ -86,14 +86,14 @@ public class VoxelFileReaderWriterTest Assert.That(f.tiles[0].boundsMax, Is.EqualTo(RcVec3f.Of(-78.75f, 5.0f, -78.75f))); } - private VoxelFile ReadWriteRead(BinaryReader bis, bool compression) + private DtVoxelFile ReadWriteRead(BinaryReader bis, bool compression) { - VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); - VoxelFile f = reader.Read(bis); + DtVoxelFileReader reader = new DtVoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); + DtVoxelFile f = reader.Read(bis); using var msw = new MemoryStream(); using var bw = new BinaryWriter(msw); - VoxelFileWriter writer = new VoxelFileWriter(DtVoxelTileLZ4ForTestCompressor.Shared); + DtVoxelFileWriter writer = new DtVoxelFileWriter(DtVoxelTileLZ4ForTestCompressor.Shared); writer.Write(bw, f, compression); using var msr = new MemoryStream(msw.ToArray()); diff --git a/test/DotRecast.Detour.Dynamic.Test/VoxelQueryTest.cs b/test/DotRecast.Detour.Dynamic.Test/VoxelQueryTest.cs index f12267a..2bdca20 100644 --- a/test/DotRecast.Detour.Dynamic.Test/VoxelQueryTest.cs +++ b/test/DotRecast.Detour.Dynamic.Test/VoxelQueryTest.cs @@ -56,7 +56,7 @@ public class VoxelQueryTest captorZ.Add(z); }); - VoxelQuery query = new VoxelQuery(ORIGIN, TILE_WIDTH, TILE_DEPTH, hfProvider.Object); + DtVoxelQuery query = new DtVoxelQuery(ORIGIN, TILE_WIDTH, TILE_DEPTH, hfProvider.Object); RcVec3f start = RcVec3f.Of(120, 10, 365); RcVec3f end = RcVec3f.Of(320, 10, 57); @@ -71,8 +71,8 @@ public class VoxelQueryTest [Test] public void ShouldHandleRaycastWithoutObstacles() { - DynamicNavMesh mesh = CreateDynaMesh(); - VoxelQuery query = mesh.VoxelQuery(); + DtDynamicNavMesh mesh = CreateDynaMesh(); + DtVoxelQuery query = mesh.VoxelQuery(); RcVec3f start = RcVec3f.Of(7.4f, 0.5f, -64.8f); RcVec3f end = RcVec3f.Of(31.2f, 0.5f, -75.3f); bool isHit = query.Raycast(start, end, out var hit); @@ -82,8 +82,8 @@ public class VoxelQueryTest [Test] public void ShouldHandleRaycastWithObstacles() { - DynamicNavMesh mesh = CreateDynaMesh(); - VoxelQuery query = mesh.VoxelQuery(); + DtDynamicNavMesh mesh = CreateDynaMesh(); + DtVoxelQuery query = mesh.VoxelQuery(); RcVec3f start = RcVec3f.Of(32.3f, 0.5f, 47.9f); RcVec3f end = RcVec3f.Of(-31.2f, 0.5f, -29.8f); bool isHit = query.Raycast(start, end, out var hit); @@ -91,17 +91,17 @@ public class VoxelQueryTest Assert.That(hit, Is.EqualTo(0.5263836f).Within(1e-7f)); } - private DynamicNavMesh CreateDynaMesh() + private DtDynamicNavMesh CreateDynaMesh() { var bytes = Loader.ToBytes("test_tiles.voxels"); using var ms = new MemoryStream(bytes); using var br = new BinaryReader(ms); // load voxels from file - VoxelFileReader reader = new VoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); - VoxelFile f = reader.Read(br); + DtVoxelFileReader reader = new DtVoxelFileReader(DtVoxelTileLZ4ForTestCompressor.Shared); + DtVoxelFile f = reader.Read(br); // create dynamic navmesh - var mesh = new DynamicNavMesh(f); + var mesh = new DtDynamicNavMesh(f); // build navmesh asynchronously using multiple threads Task future = mesh.Build(Task.Factory); // wait for build to complete