diff --git a/src/DotRecast.Detour.Crowd/Crowd.cs b/src/DotRecast.Detour.Crowd/Crowd.cs index 2b2e742..88e63b5 100644 --- a/src/DotRecast.Detour.Crowd/Crowd.cs +++ b/src/DotRecast.Detour.Crowd/Crowd.cs @@ -149,7 +149,7 @@ namespace DotRecast.Detour.Crowd private readonly ObstacleAvoidanceQuery _obstacleQuery; private ProximityGrid _grid; private readonly Vector3f _ext = new Vector3f(); - private readonly QueryFilter[] _filters = new QueryFilter[DT_CROWD_MAX_QUERY_FILTER_TYPE]; + private readonly IQueryFilter[] _filters = new IQueryFilter[DT_CROWD_MAX_QUERY_FILTER_TYPE]; private NavMeshQuery _navQuery; private NavMesh _navMesh; private readonly CrowdConfig _config; @@ -161,7 +161,7 @@ namespace DotRecast.Detour.Crowd { } - public Crowd(CrowdConfig config, NavMesh nav, Func queryFilterFactory) + public Crowd(CrowdConfig config, NavMesh nav, Func queryFilterFactory) { _config = config; VSet(ref _ext, config.maxAgentRadius * 2.0f, config.maxAgentRadius * 1.5f, config.maxAgentRadius * 2.0f); @@ -364,7 +364,7 @@ namespace DotRecast.Detour.Crowd return _ext; } - public QueryFilter GetFilter(int i) + public IQueryFilter GetFilter(int i) { return i >= 0 && i < DT_CROWD_MAX_QUERY_FILTER_TYPE ? _filters[i] : null; } diff --git a/src/DotRecast.Detour.Crowd/LocalBoundary.cs b/src/DotRecast.Detour.Crowd/LocalBoundary.cs index f698c77..89eb6e9 100644 --- a/src/DotRecast.Detour.Crowd/LocalBoundary.cs +++ b/src/DotRecast.Detour.Crowd/LocalBoundary.cs @@ -98,7 +98,7 @@ namespace DotRecast.Detour.Crowd } } - public void Update(long refs, Vector3f pos, float collisionQueryRange, NavMeshQuery navquery, QueryFilter filter) + public void Update(long refs, Vector3f pos, float collisionQueryRange, NavMeshQuery navquery, IQueryFilter filter) { if (refs == 0) { @@ -138,7 +138,7 @@ namespace DotRecast.Detour.Crowd } } - public bool IsValid(NavMeshQuery navquery, QueryFilter filter) + public bool IsValid(NavMeshQuery navquery, IQueryFilter filter) { if (m_polys.Count == 0) { diff --git a/src/DotRecast.Detour.Crowd/PathCorridor.cs b/src/DotRecast.Detour.Crowd/PathCorridor.cs index b52cbc0..3bafc07 100644 --- a/src/DotRecast.Detour.Crowd/PathCorridor.cs +++ b/src/DotRecast.Detour.Crowd/PathCorridor.cs @@ -234,7 +234,7 @@ namespace DotRecast.Detour.Crowd * @param[in] navquery The query object used to build the corridor. * @return Corners */ - public List FindCorners(int maxCorners, NavMeshQuery navquery, QueryFilter filter) + public List FindCorners(int maxCorners, NavMeshQuery navquery, IQueryFilter filter) { List path = new List(); Result> result = navquery.FindStraightPath(m_pos, m_target, m_path, maxCorners, 0); @@ -299,7 +299,7 @@ namespace DotRecast.Detour.Crowd * @param filter * The filter to apply to the operation. */ - public void OptimizePathVisibility(Vector3f next, float pathOptimizationRange, NavMeshQuery navquery, QueryFilter filter) + public void OptimizePathVisibility(Vector3f next, float pathOptimizationRange, NavMeshQuery navquery, IQueryFilter filter) { // Clamp the ray to max distance. float dist = VDist2D(m_pos, next); @@ -344,7 +344,7 @@ namespace DotRecast.Detour.Crowd * The filter to apply to the operation. * */ - public bool OptimizePathTopology(NavMeshQuery navquery, QueryFilter filter, int maxIterations) + public bool OptimizePathTopology(NavMeshQuery navquery, IQueryFilter filter, int maxIterations) { if (m_path.Count < 3) { @@ -423,7 +423,7 @@ namespace DotRecast.Detour.Crowd * @param filter * The filter to apply to the operation. */ - public bool MovePosition(Vector3f npos, NavMeshQuery navquery, QueryFilter filter) + public bool MovePosition(Vector3f npos, NavMeshQuery navquery, IQueryFilter filter) { // Move along navmesh and update new position. Result masResult = navquery.MoveAlongSurface(m_path[0], m_pos, npos, filter); @@ -461,7 +461,7 @@ namespace DotRecast.Detour.Crowd * @param filter * The filter to apply to the operation. */ - public bool MoveTargetPosition(Vector3f npos, NavMeshQuery navquery, QueryFilter filter) + public bool MoveTargetPosition(Vector3f npos, NavMeshQuery navquery, IQueryFilter filter) { // Move along navmesh and update new position. Result masResult = navquery.MoveAlongSurface(m_path[m_path.Count - 1], m_target, npos, filter); @@ -516,7 +516,7 @@ namespace DotRecast.Detour.Crowd } } - public void TrimInvalidPath(long safeRef, float[] safePos, NavMeshQuery navquery, QueryFilter filter) + public void TrimInvalidPath(long safeRef, float[] safePos, NavMeshQuery navquery, IQueryFilter filter) { // Keep valid path as far as possible. int n = 0; @@ -559,7 +559,7 @@ namespace DotRecast.Detour.Crowd * The filter to apply to the operation. * @return */ - public bool IsValid(int maxLookAhead, NavMeshQuery navquery, QueryFilter filter) + public bool IsValid(int maxLookAhead, NavMeshQuery navquery, IQueryFilter filter) { // Check that all polygons still pass query filter. int n = Math.Min(m_path.Count, maxLookAhead); diff --git a/src/DotRecast.Detour.Crowd/PathQuery.cs b/src/DotRecast.Detour.Crowd/PathQuery.cs index 077cbb7..dde8665 100644 --- a/src/DotRecast.Detour.Crowd/PathQuery.cs +++ b/src/DotRecast.Detour.Crowd/PathQuery.cs @@ -30,7 +30,7 @@ namespace DotRecast.Detour.Crowd public Vector3f endPos = new Vector3f(); public long startRef; public long endRef; - public QueryFilter filter; + public IQueryFilter filter; /// < TODO: This is potentially dangerous! public readonly PathQueryResult result = new PathQueryResult(); diff --git a/src/DotRecast.Detour.Crowd/PathQueue.cs b/src/DotRecast.Detour.Crowd/PathQueue.cs index b87f578..5bb2f6c 100644 --- a/src/DotRecast.Detour.Crowd/PathQueue.cs +++ b/src/DotRecast.Detour.Crowd/PathQueue.cs @@ -79,7 +79,7 @@ namespace DotRecast.Detour.Crowd } } - public PathQueryResult Request(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter) + public PathQueryResult Request(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter) { if (queue.Count >= config.pathQueueSize) { diff --git a/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs b/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs index 6388b3b..9b45b89 100644 --- a/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs @@ -21,13 +21,13 @@ using DotRecast.Detour.Dynamic.Colliders; namespace DotRecast.Detour.Dynamic { - public class AddColliderQueueItem : UpdateQueueItem + public class AddColliderQueueItem : IUpdateQueueItem { private readonly long colliderId; - private readonly Collider collider; + private readonly ICollider collider; private readonly ICollection _affectedTiles; - public AddColliderQueueItem(long colliderId, Collider collider, ICollection affectedTiles) + public AddColliderQueueItem(long colliderId, ICollider collider, ICollection affectedTiles) { this.colliderId = colliderId; this.collider = collider; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs index 34892ee..eae13f5 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs @@ -20,7 +20,7 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public abstract class AbstractCollider : Collider + public abstract class AbstractCollider : ICollider { protected readonly int area; protected readonly float flagMergeThreshold; diff --git a/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs index 2349ee2..8637300 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs @@ -23,18 +23,18 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public class CompositeCollider : Collider + public class CompositeCollider : ICollider { - private readonly List colliders; + private readonly List colliders; private readonly float[] _bounds; - public CompositeCollider(List colliders) + public CompositeCollider(List colliders) { this.colliders = colliders; _bounds = Bounds(colliders); } - public CompositeCollider(params Collider[] colliders) + public CompositeCollider(params ICollider[] colliders) { this.colliders = colliders.ToList(); _bounds = Bounds(this.colliders); @@ -45,14 +45,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 (Collider collider in colliders) + foreach (ICollider collider in colliders) { float[] b = collider.Bounds(); bounds[0] = Math.Min(bounds[0], b[0]); diff --git a/src/DotRecast.Detour.Dynamic/Colliders/Collider.cs b/src/DotRecast.Detour.Dynamic/Colliders/ICollider.cs similarity index 97% rename from src/DotRecast.Detour.Dynamic/Colliders/Collider.cs rename to src/DotRecast.Detour.Dynamic/Colliders/ICollider.cs index 6f1c856..847d998 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/Collider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/ICollider.cs @@ -20,7 +20,7 @@ using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { - public interface Collider + public interface ICollider { float[] Bounds(); void Rasterize(Heightfield hf, Telemetry telemetry); diff --git a/src/DotRecast.Detour.Dynamic/DotRecast.Detour.Dynamic.csproj b/src/DotRecast.Detour.Dynamic/DotRecast.Detour.Dynamic.csproj index 152dba6..0919237 100644 --- a/src/DotRecast.Detour.Dynamic/DotRecast.Detour.Dynamic.csproj +++ b/src/DotRecast.Detour.Dynamic/DotRecast.Detour.Dynamic.csproj @@ -6,12 +6,12 @@ - + - - + + diff --git a/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs b/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs index 1b97239..91b2d10 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs +++ b/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs @@ -37,7 +37,7 @@ namespace DotRecast.Detour.Dynamic private readonly Dictionary _tiles = new Dictionary(); private readonly Telemetry telemetry; private readonly NavMeshParams navMeshParams; - private readonly BlockingCollection updateQueue = new BlockingCollection(); + private readonly BlockingCollection updateQueue = new BlockingCollection(); private readonly AtomicLong currentColliderId = new AtomicLong(0); private NavMesh _navMesh; private bool dirty = true; @@ -93,7 +93,7 @@ namespace DotRecast.Detour.Dynamic return GetTileAt(x, z)?.checkpoint.heightfield; } - public long AddCollider(Collider collider) + public long AddCollider(ICollider collider) { long cid = currentColliderId.IncrementAndGet(); updateQueue.Add(new AddColliderQueueItem(cid, collider, GetTiles(collider.Bounds()))); @@ -140,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); @@ -151,7 +151,7 @@ namespace DotRecast.Detour.Dynamic return items; } - private void Process(UpdateQueueItem item) + private void Process(IUpdateQueueItem item) { foreach (var tile in item.AffectedTiles()) { diff --git a/src/DotRecast.Detour.Dynamic/DynamicTile.cs b/src/DotRecast.Detour.Dynamic/DynamicTile.cs index 772f608..756d71b 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicTile.cs +++ b/src/DotRecast.Detour.Dynamic/DynamicTile.cs @@ -33,7 +33,7 @@ namespace DotRecast.Detour.Dynamic public DynamicTileCheckpoint checkpoint; public RecastBuilderResult recastResult; MeshData meshData; - private readonly ConcurrentDictionary colliders = new ConcurrentDictionary(); + private readonly ConcurrentDictionary colliders = new ConcurrentDictionary(); private bool dirty = true; private long id; @@ -96,7 +96,7 @@ namespace DotRecast.Detour.Dynamic return r; } - public void AddCollider(long cid, Collider collider) + public void AddCollider(long cid, ICollider collider) { colliders[cid] = collider; dirty = true; diff --git a/src/DotRecast.Detour.Dynamic/UpdateQueueItem.cs b/src/DotRecast.Detour.Dynamic/IUpdateQueueItem.cs similarity index 96% rename from src/DotRecast.Detour.Dynamic/UpdateQueueItem.cs rename to src/DotRecast.Detour.Dynamic/IUpdateQueueItem.cs index 63def02..bbd5532 100644 --- a/src/DotRecast.Detour.Dynamic/UpdateQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/IUpdateQueueItem.cs @@ -20,7 +20,7 @@ using System.Collections.Generic; namespace DotRecast.Detour.Dynamic { - public interface UpdateQueueItem + public interface IUpdateQueueItem { ICollection AffectedTiles(); diff --git a/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs b/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs index a839674..c2628b2 100644 --- a/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs @@ -20,7 +20,7 @@ using System.Collections.Generic; namespace DotRecast.Detour.Dynamic { - public class RemoveColliderQueueItem : UpdateQueueItem + public class RemoveColliderQueueItem : IUpdateQueueItem { private readonly long colliderId; private readonly ICollection _affectedTiles; diff --git a/src/DotRecast.Detour.Extras/Jumplink/AbstractGroundSampler.cs b/src/DotRecast.Detour.Extras/Jumplink/AbstractGroundSampler.cs index 3ee77d6..ab358ac 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/AbstractGroundSampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/AbstractGroundSampler.cs @@ -5,7 +5,7 @@ using static DotRecast.Core.RecastMath; namespace DotRecast.Detour.Extras.Jumplink { - public abstract class AbstractGroundSampler : GroundSampler + public abstract class AbstractGroundSampler : IGroundSampler { protected void SampleGround(JumpLinkBuilderConfig acfg, EdgeSampler es, Func> heightFunc) diff --git a/src/DotRecast.Detour.Extras/Jumplink/GroundSampler.cs b/src/DotRecast.Detour.Extras/Jumplink/IGroundSampler.cs similarity index 82% rename from src/DotRecast.Detour.Extras/Jumplink/GroundSampler.cs rename to src/DotRecast.Detour.Extras/Jumplink/IGroundSampler.cs index 7926bb5..d82c206 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/GroundSampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/IGroundSampler.cs @@ -2,7 +2,7 @@ using DotRecast.Recast; namespace DotRecast.Detour.Extras.Jumplink { - public interface GroundSampler + public interface IGroundSampler { void Sample(JumpLinkBuilderConfig acfg, RecastBuilderResult result, EdgeSampler es); } diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs index 73e9918..0912529 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs @@ -11,7 +11,7 @@ namespace DotRecast.Detour.Extras.Jumplink { private readonly EdgeExtractor edgeExtractor = new EdgeExtractor(); private readonly EdgeSamplerFactory edgeSamplerFactory = new EdgeSamplerFactory(); - private readonly GroundSampler groundSampler = new NavMeshGroundSampler(); + private readonly IGroundSampler groundSampler = new NavMeshGroundSampler(); private readonly TrajectorySampler trajectorySampler = new TrajectorySampler(); private readonly JumpSegmentBuilder jumpSegmentBuilder = new JumpSegmentBuilder(); diff --git a/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs b/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs index 4f5f5b6..e3f667c 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs @@ -7,9 +7,9 @@ namespace DotRecast.Detour.Extras.Jumplink { class NavMeshGroundSampler : AbstractGroundSampler { - private readonly QueryFilter filter = new NoOpFilter(); + private readonly IQueryFilter filter = new NoOpFilter(); - private class NoOpFilter : QueryFilter + private class NoOpFilter : IQueryFilter { public bool PassFilter(long refs, MeshTile tile, Poly poly) { @@ -55,7 +55,7 @@ namespace DotRecast.Detour.Extras.Jumplink return new NavMeshQuery(new NavMesh(NavMeshBuilder.CreateNavMeshData(option), option.nvp, 0)); } - public class PolyQueryInvoker : PolyQuery + public class PolyQueryInvoker : IPolyQuery { public readonly Action _callback; diff --git a/src/DotRecast.Detour.TileCache/DotRecast.Detour.TileCache.csproj b/src/DotRecast.Detour.TileCache/DotRecast.Detour.TileCache.csproj index dfb71a5..3dccb7f 100644 --- a/src/DotRecast.Detour.TileCache/DotRecast.Detour.TileCache.csproj +++ b/src/DotRecast.Detour.TileCache/DotRecast.Detour.TileCache.csproj @@ -6,11 +6,11 @@ - + - + diff --git a/src/DotRecast.Detour.TileCache/TileCacheCompressor.cs b/src/DotRecast.Detour.TileCache/ITileCacheCompressor.cs similarity index 96% rename from src/DotRecast.Detour.TileCache/TileCacheCompressor.cs rename to src/DotRecast.Detour.TileCache/ITileCacheCompressor.cs index ad86bd1..ce42f4b 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/ITileCacheCompressor.cs @@ -20,7 +20,7 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public interface TileCacheCompressor + public interface ITileCacheCompressor { byte[] Decompress(byte[] buf, int offset, int len, int outputlen); diff --git a/src/DotRecast.Detour.TileCache/TileCacheMeshProcess.cs b/src/DotRecast.Detour.TileCache/ITileCacheMeshProcess.cs similarity index 96% rename from src/DotRecast.Detour.TileCache/TileCacheMeshProcess.cs rename to src/DotRecast.Detour.TileCache/ITileCacheMeshProcess.cs index fce67e5..a649fcb 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheMeshProcess.cs +++ b/src/DotRecast.Detour.TileCache/ITileCacheMeshProcess.cs @@ -20,7 +20,7 @@ freely, subject to the following restrictions: namespace DotRecast.Detour.TileCache { - public interface TileCacheMeshProcess + public interface ITileCacheMeshProcess { void Process(NavMeshDataCreateParams option); } diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs b/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs index 48de513..8192226 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs @@ -22,7 +22,7 @@ using DotRecast.Core; namespace DotRecast.Detour.TileCache.Io.Compress { - public class FastLzTileCacheCompressor : TileCacheCompressor + public class FastLzTileCacheCompressor : ITileCacheCompressor { 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/LZ4TileCacheCompressor.cs index 8a14f6c..e117dae 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs @@ -22,7 +22,7 @@ using K4os.Compression.LZ4; namespace DotRecast.Detour.TileCache.Io.Compress { - public class LZ4TileCacheCompressor : TileCacheCompressor + public class LZ4TileCacheCompressor : ITileCacheCompressor { public byte[] Decompress(byte[] buf, int offset, int len, int outputlen) { diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs b/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs index d71fd83..5dbdd5e 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs @@ -22,7 +22,7 @@ namespace DotRecast.Detour.TileCache.Io.Compress { public static class TileCacheCompressorFactory { - public static TileCacheCompressor Get(bool cCompatibility) + public static ITileCacheCompressor Get(bool cCompatibility) { if (cCompatibility) return new FastLzTileCacheCompressor(); diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs index df73fab..eec4c80 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs @@ -29,13 +29,13 @@ namespace DotRecast.Detour.TileCache.Io { private readonly NavMeshParamReader paramReader = new NavMeshParamReader(); - public TileCache Read(BinaryReader @is, int maxVertPerPoly, TileCacheMeshProcess meshProcessor) + public TileCache Read(BinaryReader @is, int maxVertPerPoly, ITileCacheMeshProcess meshProcessor) { ByteBuffer bb = IOUtils.ToByteBuffer(@is); return Read(bb, maxVertPerPoly, meshProcessor); } - public TileCache Read(ByteBuffer bb, int maxVertPerPoly, TileCacheMeshProcess meshProcessor) + public TileCache Read(ByteBuffer bb, int maxVertPerPoly, ITileCacheMeshProcess meshProcessor) { TileCacheSetHeader header = new TileCacheSetHeader(); header.magic = bb.GetInt(); @@ -64,7 +64,7 @@ namespace DotRecast.Detour.TileCache.Io header.meshParams = paramReader.Read(bb); header.cacheParams = ReadCacheParams(bb, cCompatibility); NavMesh mesh = new NavMesh(header.meshParams, maxVertPerPoly); - TileCacheCompressor compressor = TileCacheCompressorFactory.Get(cCompatibility); + ITileCacheCompressor compressor = TileCacheCompressorFactory.Get(cCompatibility); TileCache tc = new TileCache(header.cacheParams, new TileCacheStorageParams(bb.Order(), cCompatibility), mesh, compressor, meshProcessor); // Read tiles. diff --git a/src/DotRecast.Detour.TileCache/TileCache.cs b/src/DotRecast.Detour.TileCache/TileCache.cs index a07cb3d..4f64a9d 100644 --- a/src/DotRecast.Detour.TileCache/TileCache.cs +++ b/src/DotRecast.Detour.TileCache/TileCache.cs @@ -54,8 +54,8 @@ namespace DotRecast.Detour.TileCache private readonly TileCacheParams m_params; private readonly TileCacheStorageParams m_storageParams; - private readonly TileCacheCompressor m_tcomp; - private readonly TileCacheMeshProcess m_tmproc; + private readonly ITileCacheCompressor m_tcomp; + private readonly ITileCacheMeshProcess m_tmproc; private readonly List m_obstacles = new List(); private TileCacheObstacle m_nextFreeObstacle; @@ -112,7 +112,7 @@ namespace DotRecast.Detour.TileCache } public TileCache(TileCacheParams option, TileCacheStorageParams storageParams, NavMesh navmesh, - TileCacheCompressor tcomp, TileCacheMeshProcess tmprocs) + ITileCacheCompressor tcomp, ITileCacheMeshProcess tmprocs) { m_params = option; m_storageParams = storageParams; @@ -726,7 +726,7 @@ namespace DotRecast.Detour.TileCache return m_params; } - public TileCacheCompressor GetCompressor() + public ITileCacheCompressor GetCompressor() { return m_tcomp; } diff --git a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs b/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs index 6bdcd04..16f07cb 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs @@ -2014,7 +2014,7 @@ namespace DotRecast.Detour.TileCache } } - public TileCacheLayer DecompressTileCacheLayer(TileCacheCompressor comp, byte[] compressed, ByteOrder order, + public TileCacheLayer DecompressTileCacheLayer(ITileCacheCompressor comp, byte[] compressed, ByteOrder order, bool cCompatibility) { ByteBuffer buf = new ByteBuffer(compressed); diff --git a/src/DotRecast.Detour/DefaultQueryFilter.cs b/src/DotRecast.Detour/DefaultQueryFilter.cs index 69d840b..079e93e 100644 --- a/src/DotRecast.Detour/DefaultQueryFilter.cs +++ b/src/DotRecast.Detour/DefaultQueryFilter.cs @@ -50,7 +50,7 @@ namespace DotRecast.Detour * * @see NavMeshQuery */ - public class DefaultQueryFilter : QueryFilter + public class DefaultQueryFilter : IQueryFilter { private int m_excludeFlags; private int m_includeFlags; diff --git a/src/DotRecast.Detour/DefaultQueryHeuristic.cs b/src/DotRecast.Detour/DefaultQueryHeuristic.cs index 0193d2d..8f80a82 100644 --- a/src/DotRecast.Detour/DefaultQueryHeuristic.cs +++ b/src/DotRecast.Detour/DefaultQueryHeuristic.cs @@ -22,7 +22,7 @@ using static DotRecast.Core.RecastMath; namespace DotRecast.Detour { - public class DefaultQueryHeuristic : QueryHeuristic + public class DefaultQueryHeuristic : IQueryHeuristic { private readonly float scale; diff --git a/src/DotRecast.Detour/FindNearestPolyQuery.cs b/src/DotRecast.Detour/FindNearestPolyQuery.cs index 75e5754..380155b 100644 --- a/src/DotRecast.Detour/FindNearestPolyQuery.cs +++ b/src/DotRecast.Detour/FindNearestPolyQuery.cs @@ -6,7 +6,7 @@ namespace DotRecast.Detour { using static DotRecast.Core.RecastMath; - public class FindNearestPolyQuery : PolyQuery + public class FindNearestPolyQuery : IPolyQuery { private readonly NavMeshQuery query; private readonly Vector3f center; diff --git a/src/DotRecast.Detour/PolyQuery.cs b/src/DotRecast.Detour/IPolyQuery.cs similarity index 75% rename from src/DotRecast.Detour/PolyQuery.cs rename to src/DotRecast.Detour/IPolyQuery.cs index 63d2f38..c9860b5 100644 --- a/src/DotRecast.Detour/PolyQuery.cs +++ b/src/DotRecast.Detour/IPolyQuery.cs @@ -1,6 +1,6 @@ namespace DotRecast.Detour { - public interface PolyQuery + public interface IPolyQuery { void Process(MeshTile tile, Poly poly, long refs); } diff --git a/src/DotRecast.Detour/PolygonByCircleConstraint.cs b/src/DotRecast.Detour/IPolygonByCircleConstraint.cs similarity index 91% rename from src/DotRecast.Detour/PolygonByCircleConstraint.cs rename to src/DotRecast.Detour/IPolygonByCircleConstraint.cs index 021fab5..1e79d9f 100644 --- a/src/DotRecast.Detour/PolygonByCircleConstraint.cs +++ b/src/DotRecast.Detour/IPolygonByCircleConstraint.cs @@ -23,21 +23,21 @@ namespace DotRecast.Detour { using static DotRecast.Core.RecastMath; - public interface PolygonByCircleConstraint + public interface IPolygonByCircleConstraint { float[] Aply(float[] polyVerts, Vector3f circleCenter, float radius); - public static PolygonByCircleConstraint Noop() + public static IPolygonByCircleConstraint Noop() { return new NoOpPolygonByCircleConstraint(); } - public static PolygonByCircleConstraint Strict() + public static IPolygonByCircleConstraint Strict() { return new StrictPolygonByCircleConstraint(); } - public class NoOpPolygonByCircleConstraint : PolygonByCircleConstraint + public class NoOpPolygonByCircleConstraint : IPolygonByCircleConstraint { public float[] Aply(float[] polyVerts, Vector3f circleCenter, float radius) { @@ -48,7 +48,7 @@ namespace DotRecast.Detour /** * Calculate the intersection between a polygon and a circle. A dodecagon is used as an approximation of the circle. */ - public class StrictPolygonByCircleConstraint : PolygonByCircleConstraint + public class StrictPolygonByCircleConstraint : IPolygonByCircleConstraint { private const int CIRCLE_SEGMENTS = 12; private static float[] unitCircle; diff --git a/src/DotRecast.Detour/QueryFilter.cs b/src/DotRecast.Detour/IQueryFilter.cs similarity index 97% rename from src/DotRecast.Detour/QueryFilter.cs rename to src/DotRecast.Detour/IQueryFilter.cs index 308df27..b5d3d4a 100644 --- a/src/DotRecast.Detour/QueryFilter.cs +++ b/src/DotRecast.Detour/IQueryFilter.cs @@ -22,7 +22,7 @@ using DotRecast.Core; namespace DotRecast.Detour { - public interface QueryFilter + public interface IQueryFilter { bool PassFilter(long refs, MeshTile tile, Poly poly); diff --git a/src/DotRecast.Detour/QueryHeuristic.cs b/src/DotRecast.Detour/IQueryHeuristic.cs similarity index 96% rename from src/DotRecast.Detour/QueryHeuristic.cs rename to src/DotRecast.Detour/IQueryHeuristic.cs index f3cc7d2..c059c62 100644 --- a/src/DotRecast.Detour/QueryHeuristic.cs +++ b/src/DotRecast.Detour/IQueryHeuristic.cs @@ -20,7 +20,7 @@ using DotRecast.Core; namespace DotRecast.Detour { - public interface QueryHeuristic + public interface IQueryHeuristic { float GetCost(Vector3f neighbourPos, Vector3f endPos); } diff --git a/src/DotRecast.Detour/LegacyNavMeshQuery.cs b/src/DotRecast.Detour/LegacyNavMeshQuery.cs index dd55474..41bb5de 100644 --- a/src/DotRecast.Detour/LegacyNavMeshQuery.cs +++ b/src/DotRecast.Detour/LegacyNavMeshQuery.cs @@ -34,13 +34,13 @@ namespace DotRecast.Detour { } - public override Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter, + public override Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter, int options, float raycastLimit) { return FindPath(startRef, endRef, startPos, endPos, filter); } - public override Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter) + public override Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter) { // Validate input if (!m_nav.IsValidPolyRef(startRef) || !m_nav.IsValidPolyRef(endRef) || !VIsFinite(startPos) || !VIsFinite(endPos) || null == filter) @@ -645,7 +645,7 @@ namespace DotRecast.Detour return Results.Of(status, path); } - public override Result FindDistanceToWall(long startRef, Vector3f centerPos, float maxRadius, QueryFilter filter) + public override Result FindDistanceToWall(long startRef, Vector3f centerPos, float maxRadius, IQueryFilter filter) { // Validate input if (!m_nav.IsValidPolyRef(startRef) || !VIsFinite(centerPos) || maxRadius < 0 diff --git a/src/DotRecast.Detour/NavMeshQuery.cs b/src/DotRecast.Detour/NavMeshQuery.cs index c84a9e7..8a8e556 100644 --- a/src/DotRecast.Detour/NavMeshQuery.cs +++ b/src/DotRecast.Detour/NavMeshQuery.cs @@ -83,7 +83,7 @@ namespace DotRecast.Detour * Function returning a random number [0..1). * @return Random location */ - public Result FindRandomPoint(QueryFilter filter, FRand frand) + public Result FindRandomPoint(IQueryFilter filter, FRand frand) { // Randomly pick one tile. Assume that all tiles cover roughly the same area. if (null == filter || null == frand) @@ -197,9 +197,9 @@ namespace DotRecast.Detour * @return Random location */ public Result FindRandomPointAroundCircle(long startRef, Vector3f centerPos, float maxRadius, - QueryFilter filter, FRand frand) + IQueryFilter filter, FRand frand) { - return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, PolygonByCircleConstraint.Noop()); + return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, IPolygonByCircleConstraint.Noop()); } /** @@ -218,13 +218,13 @@ namespace DotRecast.Detour * @return Random location */ public Result FindRandomPointWithinCircle(long startRef, Vector3f centerPos, float maxRadius, - QueryFilter filter, FRand frand) + IQueryFilter filter, FRand frand) { - return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, PolygonByCircleConstraint.Strict()); + return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, IPolygonByCircleConstraint.Strict()); } public Result FindRandomPointAroundCircle(long startRef, Vector3f centerPos, float maxRadius, - QueryFilter filter, FRand frand, PolygonByCircleConstraint constraint) + IQueryFilter filter, FRand frand, IPolygonByCircleConstraint constraint) { // Validate input if (!m_nav.IsValidPolyRef(startRef) || !VIsFinite(centerPos) || maxRadius < 0 @@ -561,7 +561,7 @@ namespace DotRecast.Detour * The polygon filter to apply to the query. * @return FindNearestPolyResult containing nearestRef, nearestPt and overPoly */ - public Result FindNearestPoly(Vector3f center, Vector3f halfExtents, QueryFilter filter) + public Result FindNearestPoly(Vector3f center, Vector3f halfExtents, IQueryFilter filter) { // Get nearby polygons from proximity grid. FindNearestPolyQuery query = new FindNearestPolyQuery(this, center); @@ -575,7 +575,7 @@ namespace DotRecast.Detour } // FIXME: (PP) duplicate? - protected void QueryPolygonsInTile(MeshTile tile, Vector3f qmin, Vector3f qmax, QueryFilter filter, PolyQuery query) + protected void QueryPolygonsInTile(MeshTile tile, Vector3f qmin, Vector3f qmax, IQueryFilter filter, IPolyQuery query) { if (tile.data.bvTree != null) { @@ -682,7 +682,7 @@ namespace DotRecast.Detour * The polygon filter to apply to the query. * @return The reference ids of the polygons that overlap the query box. */ - public Status QueryPolygons(Vector3f center, Vector3f halfExtents, QueryFilter filter, PolyQuery query) + public Status QueryPolygons(Vector3f center, Vector3f halfExtents, IQueryFilter filter, IPolyQuery query) { if (!VIsFinite(center) || !VIsFinite(halfExtents) || null == filter) { @@ -750,19 +750,19 @@ namespace DotRecast.Detour * The polygon filter to apply to the query. * @return Found path */ - public virtual Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter) + public virtual Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter) { return FindPath(startRef, endRef, startPos, endPos, filter, new DefaultQueryHeuristic(), 0, 0); } - public virtual Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter, + public virtual Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter, int options, float raycastLimit) { return FindPath(startRef, endRef, startPos, endPos, filter, new DefaultQueryHeuristic(), options, raycastLimit); } - public Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter, - QueryHeuristic heuristic, int options, float raycastLimit) + public Result> FindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter, + IQueryHeuristic heuristic, int options, float raycastLimit) { // Validate input if (!m_nav.IsValidPolyRef(startRef) || !m_nav.IsValidPolyRef(endRef) || !VIsFinite(startPos) || !VIsFinite(endPos) || null == filter) @@ -1022,20 +1022,20 @@ namespace DotRecast.Detour * query options (see: #FindPathOptions) * @return */ - public Status InitSlicedFindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter, + public Status InitSlicedFindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter, int options) { return InitSlicedFindPath(startRef, endRef, startPos, endPos, filter, options, new DefaultQueryHeuristic(), -1.0f); } - public Status InitSlicedFindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter, + public Status InitSlicedFindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter, int options, float raycastLimit) { return InitSlicedFindPath(startRef, endRef, startPos, endPos, filter, options, new DefaultQueryHeuristic(), raycastLimit); } - public Status InitSlicedFindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, QueryFilter filter, - int options, QueryHeuristic heuristic, float raycastLimit) + public Status InitSlicedFindPath(long startRef, long endRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter, + int options, IQueryHeuristic heuristic, float raycastLimit) { // Init path state. m_query = new QueryData(); @@ -1800,7 +1800,7 @@ namespace DotRecast.Detour /// @param[in] endPos The desired end position of the mover. [(x, y, z)] /// @param[in] filter The polygon filter to apply to the query. /// @returns Path - public Result MoveAlongSurface(long startRef, Vector3f startPos, Vector3f endPos, QueryFilter filter) + public Result MoveAlongSurface(long startRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter) { // Validate input if (!m_nav.IsValidPolyRef(startRef) || !VIsFinite(startPos) @@ -2192,7 +2192,7 @@ namespace DotRecast.Detour /// @param[out] pathCount The number of visited polygons. [opt] /// @param[in] maxPath The maximum number of polygons the @p path array can hold. /// @returns The status flags for the query. - public Result Raycast(long startRef, Vector3f startPos, Vector3f endPos, QueryFilter filter, int options, + public Result Raycast(long startRef, Vector3f startPos, Vector3f endPos, IQueryFilter filter, int options, long prevRef) { // Validate input @@ -2460,7 +2460,7 @@ namespace DotRecast.Detour /// @param[out] resultCount The number of polygons found. [opt] /// @param[in] maxResult The maximum number of polygons the result arrays can hold. /// @returns The status flags for the query. - public Result FindPolysAroundCircle(long startRef, Vector3f centerPos, float radius, QueryFilter filter) + public Result FindPolysAroundCircle(long startRef, Vector3f centerPos, float radius, IQueryFilter filter) { // Validate input @@ -2638,7 +2638,7 @@ namespace DotRecast.Detour /// @param[out] resultCount The number of polygons found. /// @param[in] maxResult The maximum number of polygons the result arrays can hold. /// @returns The status flags for the query. - public Result FindPolysAroundShape(long startRef, float[] verts, QueryFilter filter) + public Result FindPolysAroundShape(long startRef, float[] verts, IQueryFilter filter) { // Validate input int nverts = verts.Length / 3; @@ -2830,7 +2830,7 @@ namespace DotRecast.Detour /// @param[in] maxResult The maximum number of polygons the result arrays can hold. /// @returns The status flags for the query. public Result FindLocalNeighbourhood(long startRef, Vector3f centerPos, float radius, - QueryFilter filter) + IQueryFilter filter) { // Validate input if (!m_nav.IsValidPolyRef(startRef) || !VIsFinite(centerPos) || radius < 0 @@ -3044,7 +3044,7 @@ namespace DotRecast.Detour /// @param[out] segmentCount The number of segments returned. /// @param[in] maxSegments The maximum number of segments the result arrays can hold. /// @returns The status flags for the query. - public Result GetPolyWallSegments(long refs, bool storePortals, QueryFilter filter) + public Result GetPolyWallSegments(long refs, bool storePortals, IQueryFilter filter) { Result> tileAndPoly = m_nav.GetTileAndPolyByRef(refs); if (tileAndPoly.Failed()) @@ -3182,7 +3182,7 @@ namespace DotRecast.Detour /// source point. [(x, y, z)] /// @returns The status flags for the query. public virtual Result FindDistanceToWall(long startRef, Vector3f centerPos, float maxRadius, - QueryFilter filter) + IQueryFilter filter) { // Validate input if (!m_nav.IsValidPolyRef(startRef) || !VIsFinite(centerPos) || maxRadius < 0 @@ -3393,7 +3393,7 @@ namespace DotRecast.Detour /// Returns true if the polygon reference is valid and passes the filter restrictions. /// @param[in] ref The polygon reference to check. /// @param[in] filter The filter to apply. - public bool IsValidPolyRef(long refs, QueryFilter filter) + public bool IsValidPolyRef(long refs, IQueryFilter filter) { Result> tileAndPolyResult = m_nav.GetTileAndPolyByRef(refs); if (tileAndPolyResult.Failed()) diff --git a/src/DotRecast.Detour/QueryData.cs b/src/DotRecast.Detour/QueryData.cs index ae6b05e..b1d2ef0 100644 --- a/src/DotRecast.Detour/QueryData.cs +++ b/src/DotRecast.Detour/QueryData.cs @@ -30,9 +30,9 @@ namespace DotRecast.Detour public long startRef, endRef; public Vector3f startPos = new Vector3f(); public Vector3f endPos = new Vector3f(); - public QueryFilter filter; + public IQueryFilter filter; public int options; public float raycastLimitSqr; - public QueryHeuristic heuristic; + public IQueryHeuristic heuristic; } } \ No newline at end of file diff --git a/src/DotRecast.Recast.Demo/Draw/DebugDraw.cs b/src/DotRecast.Recast.Demo/Draw/DebugDraw.cs index 9d5ff97..a88c391 100644 --- a/src/DotRecast.Recast.Demo/Draw/DebugDraw.cs +++ b/src/DotRecast.Recast.Demo/Draw/DebugDraw.cs @@ -28,7 +28,7 @@ namespace DotRecast.Recast.Demo.Draw; public class DebugDraw { private readonly GLCheckerTexture g_tex; - private readonly OpenGLDraw openGlDraw; + private readonly IOpenGLDraw openGlDraw; private readonly int[] boxIndices = { 7, 6, 5, 4, 0, 1, 2, 3, 1, 5, 6, 2, 3, 7, 4, 0, 2, 6, 7, 3, 0, 4, 5, 1, }; private readonly float[][] frustumPlanes = ArrayUtils.Of(6, 4); @@ -604,7 +604,7 @@ public class DebugDraw return _viewMatrix; } - private OpenGLDraw GetOpenGlDraw() + private IOpenGLDraw GetOpenGlDraw() { return openGlDraw; } diff --git a/src/DotRecast.Recast.Demo/Draw/OpenGLDraw.cs b/src/DotRecast.Recast.Demo/Draw/IOpenGLDraw.cs similarity index 95% rename from src/DotRecast.Recast.Demo/Draw/OpenGLDraw.cs rename to src/DotRecast.Recast.Demo/Draw/IOpenGLDraw.cs index c65ab19..fe74c81 100644 --- a/src/DotRecast.Recast.Demo/Draw/OpenGLDraw.cs +++ b/src/DotRecast.Recast.Demo/Draw/IOpenGLDraw.cs @@ -3,7 +3,7 @@ using Silk.NET.OpenGL; namespace DotRecast.Recast.Demo.Draw; -public interface OpenGLDraw +public interface IOpenGLDraw { void Init(); diff --git a/src/DotRecast.Recast.Demo/Draw/ModernOpenGLDraw.cs b/src/DotRecast.Recast.Demo/Draw/ModernOpenGLDraw.cs index 9c440ad..5151a0d 100644 --- a/src/DotRecast.Recast.Demo/Draw/ModernOpenGLDraw.cs +++ b/src/DotRecast.Recast.Demo/Draw/ModernOpenGLDraw.cs @@ -6,7 +6,7 @@ using Silk.NET.OpenGL; namespace DotRecast.Recast.Demo.Draw; -public class ModernOpenGLDraw : OpenGLDraw +public class ModernOpenGLDraw : IOpenGLDraw { private GL _gl; private uint program; diff --git a/src/DotRecast.Recast.Demo/Geom/DemoInputGeomProvider.cs b/src/DotRecast.Recast.Demo/Geom/DemoInputGeomProvider.cs index 30b6309..fca6294 100644 --- a/src/DotRecast.Recast.Demo/Geom/DemoInputGeomProvider.cs +++ b/src/DotRecast.Recast.Demo/Geom/DemoInputGeomProvider.cs @@ -27,7 +27,7 @@ using DotRecast.Recast.Geom; namespace DotRecast.Recast.Demo.Geom; -public class DemoInputGeomProvider : InputGeomProvider +public class DemoInputGeomProvider : IInputGeomProvider { public readonly float[] vertices; public readonly int[] faces; diff --git a/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs b/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs index 04ec7e6..520ea28 100644 --- a/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs @@ -83,7 +83,7 @@ public class CrowdProfilingTool CreateCrowd(); CreateZones(); NavMeshQuery navquery = new NavMeshQuery(navMesh); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < agents; i++) { float tr = rnd.Frand(); @@ -146,7 +146,7 @@ public class CrowdProfilingTool } } - private Vector3f? GetMobPosition(NavMeshQuery navquery, QueryFilter filter) + private Vector3f? GetMobPosition(NavMeshQuery navquery, IQueryFilter filter) { Result result = navquery.FindRandomPoint(filter, rnd); if (result.Succeeded()) @@ -157,7 +157,7 @@ public class CrowdProfilingTool return null; } - private Vector3f? GetVillagerPosition(NavMeshQuery navquery, QueryFilter filter) + private Vector3f? GetVillagerPosition(NavMeshQuery navquery, IQueryFilter filter) { if (0 < zones.Count) { @@ -176,7 +176,7 @@ public class CrowdProfilingTool private void CreateZones() { zones.Clear(); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); NavMeshQuery navquery = new NavMeshQuery(navMesh); for (int i = 0; i < numberOfZones; i++) { @@ -252,7 +252,7 @@ public class CrowdProfilingTool if (crowd != null) { NavMeshQuery navquery = new NavMeshQuery(navMesh); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); foreach (CrowdAgent ag in crowd.GetActiveAgents()) { if (NeedsNewTarget(ag)) @@ -277,7 +277,7 @@ public class CrowdProfilingTool crowdUpdateTime = (endTime - startTime) / TimeSpan.TicksPerMillisecond; } - private void MoveMob(NavMeshQuery navquery, QueryFilter filter, CrowdAgent ag, AgentData agentData) + private void MoveMob(NavMeshQuery navquery, IQueryFilter filter, CrowdAgent ag, AgentData agentData) { // Move somewhere Result nearestPoly = navquery.FindNearestPoly(ag.npos, crowd.GetQueryExtents(), filter); @@ -292,7 +292,7 @@ public class CrowdProfilingTool } } - private void MoveVillager(NavMeshQuery navquery, QueryFilter filter, CrowdAgent ag, AgentData agentData) + private void MoveVillager(NavMeshQuery navquery, IQueryFilter filter, CrowdAgent ag, AgentData agentData) { // Move somewhere close Result nearestPoly = navquery.FindNearestPoly(ag.npos, crowd.GetQueryExtents(), filter); @@ -307,7 +307,7 @@ public class CrowdProfilingTool } } - private void MoveTraveller(NavMeshQuery navquery, QueryFilter filter, CrowdAgent ag, AgentData agentData) + private void MoveTraveller(NavMeshQuery navquery, IQueryFilter filter, CrowdAgent ag, AgentData agentData) { // Move to another zone List potentialTargets = new(); diff --git a/src/DotRecast.Recast.Demo/Tools/CrowdTool.cs b/src/DotRecast.Recast.Demo/Tools/CrowdTool.cs index 2e4b858..9dfd0f8 100644 --- a/src/DotRecast.Recast.Demo/Tools/CrowdTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/CrowdTool.cs @@ -192,7 +192,7 @@ public class CrowdTool : Tool NavMeshQuery navquery = sample.GetNavMeshQuery(); if (nav != null && navquery != null) { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); Vector3f halfExtents = crowd.GetQueryExtents(); Result result = navquery.FindNearestPoly(p, halfExtents, filter); long refs = result.result.GetNearestRef(); @@ -304,7 +304,7 @@ public class CrowdTool : Tool // Find nearest point on navmesh and set move request to that location. NavMeshQuery navquery = sample.GetNavMeshQuery(); - QueryFilter filter = crowd.GetFilter(0); + IQueryFilter filter = crowd.GetFilter(0); Vector3f halfExtents = crowd.GetQueryExtents(); if (adjust) diff --git a/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs b/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs index 8f3b2ac..0510956 100644 --- a/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs @@ -110,8 +110,8 @@ public class DynamicUpdateTool : Tool private DynamicNavMesh dynaMesh; private readonly TaskFactory executor; - private readonly Dictionary colliders = new(); - private readonly Dictionary colliderGizmos = new(); + private readonly Dictionary colliders = new(); + private readonly Dictionary colliderGizmos = new(); private readonly Random random = Random.Shared; private readonly DemoInputGeomProvider bridgeGeom; private readonly DemoInputGeomProvider houseGeom; @@ -142,7 +142,7 @@ public class DynamicUpdateTool : Tool { if (!shift) { - Tuple colliderWithGizmo = null; + Tuple colliderWithGizmo = null; if (dynaMesh != null) { if (colliderShape == ColliderShape.SPHERE) @@ -217,15 +217,15 @@ public class DynamicUpdateTool : Tool } } - private Tuple SphereCollider(Vector3f p) + private Tuple SphereCollider(Vector3f p) { float radius = 1 + (float)random.NextDouble() * 10; - return Tuple.Create( + return Tuple.Create( new SphereCollider(p, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, dynaMesh.config.walkableClimb), GizmoFactory.Sphere(p, radius)); } - private Tuple CapsuleCollider(Vector3f p) + private Tuple CapsuleCollider(Vector3f p) { float radius = 0.4f + (float)random.NextDouble() * 4f; Vector3f a = Vector3f.Of( @@ -240,11 +240,11 @@ public class DynamicUpdateTool : Tool a.z *= len; Vector3f start = Vector3f.Of(p.x, p.y, p.z); Vector3f end = Vector3f.Of(p.x + a.x, p.y + a.y, p.z + a.z); - return Tuple.Create(new CapsuleCollider( + return Tuple.Create(new CapsuleCollider( start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, dynaMesh.config.walkableClimb), GizmoFactory.Capsule(start, end, radius)); } - private Tuple BoxCollider(Vector3f p) + private Tuple BoxCollider(Vector3f p) { Vector3f extent = Vector3f.Of( 0.5f + (float)random.NextDouble() * 6f, @@ -254,11 +254,11 @@ public class DynamicUpdateTool : Tool Vector3f forward = Vector3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble())); Vector3f up = Vector3f.Of((1f - 2 * (float)random.NextDouble()), 0.01f + (float)random.NextDouble(), (1f - 2 * (float)random.NextDouble())); Vector3f[] halfEdges = Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(up, forward, extent); - return Tuple.Create( + return Tuple.Create( new BoxCollider(p, halfEdges, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, dynaMesh.config.walkableClimb), GizmoFactory.Box(p, halfEdges)); } - private Tuple CylinderCollider(Vector3f p) + private Tuple CylinderCollider(Vector3f p) { float radius = 0.7f + (float)random.NextDouble() * 4f; float[] a = new float[] { (1f - 2 * (float)random.NextDouble()), 0.01f + (float)random.NextDouble(), (1f - 2 * (float)random.NextDouble()) }; @@ -269,11 +269,11 @@ public class DynamicUpdateTool : Tool a[2] *= len; Vector3f start = Vector3f.Of(p.x, p.y, p.z); Vector3f end = Vector3f.Of(p.x + a[0], p.y + a[1], p.z + a[2]); - return Tuple.Create(new CylinderCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, + return Tuple.Create(new CylinderCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, dynaMesh.config.walkableClimb), GizmoFactory.Cylinder(start, end, radius)); } - private Tuple CompositeCollider(Vector3f p) + private Tuple CompositeCollider(Vector3f p) { Vector3f baseExtent = Vector3f.Of(5, 3, 8); Vector3f baseCenter = Vector3f.Of(p.x, p.y + 3, p.z); @@ -305,38 +305,38 @@ public class DynamicUpdateTool : Tool SphereCollider crown = new SphereCollider(crownCenter, 4f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GRASS, dynaMesh.config.walkableClimb); CompositeCollider collider = new CompositeCollider(@base, roof, trunk, crown); - ColliderGizmo baseGizmo = GizmoFactory.Box(baseCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(baseUp, forward, baseExtent)); - ColliderGizmo roofGizmo = GizmoFactory.Box(roofCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(roofUp, forward, roofExtent)); - ColliderGizmo trunkGizmo = GizmoFactory.Capsule(trunkStart, trunkEnd, 0.5f); - ColliderGizmo crownGizmo = GizmoFactory.Sphere(crownCenter, 4f); - ColliderGizmo gizmo = GizmoFactory.Composite(baseGizmo, roofGizmo, trunkGizmo, crownGizmo); - return Tuple.Create(collider, gizmo); + IColliderGizmo baseGizmo = GizmoFactory.Box(baseCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(baseUp, forward, baseExtent)); + IColliderGizmo roofGizmo = GizmoFactory.Box(roofCenter, Detour.Dynamic.Colliders.BoxCollider.GetHalfEdges(roofUp, forward, roofExtent)); + IColliderGizmo trunkGizmo = GizmoFactory.Capsule(trunkStart, trunkEnd, 0.5f); + IColliderGizmo crownGizmo = GizmoFactory.Sphere(crownCenter, 4f); + IColliderGizmo gizmo = GizmoFactory.Composite(baseGizmo, roofGizmo, trunkGizmo, crownGizmo); + return Tuple.Create(collider, gizmo); } - private Tuple TrimeshBridge(Vector3f p) + private Tuple TrimeshBridge(Vector3f p) { return TrimeshCollider(p, bridgeGeom); } - private Tuple TrimeshHouse(Vector3f p) + private Tuple TrimeshHouse(Vector3f p) { return TrimeshCollider(p, houseGeom); } - private Tuple ConvexTrimesh(Vector3f p) + private Tuple ConvexTrimesh(Vector3f p) { float[] verts = TransformVertices(p, convexGeom, 360); ConvexTrimeshCollider collider = new ConvexTrimeshCollider(verts, convexGeom.faces, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, dynaMesh.config.walkableClimb * 10); - return Tuple.Create(collider, GizmoFactory.Trimesh(verts, convexGeom.faces)); + return Tuple.Create(collider, GizmoFactory.Trimesh(verts, convexGeom.faces)); } - private Tuple TrimeshCollider(Vector3f p, DemoInputGeomProvider geom) + private Tuple TrimeshCollider(Vector3f p, DemoInputGeomProvider geom) { float[] verts = TransformVertices(p, geom, 0); TrimeshCollider collider = new TrimeshCollider(verts, geom.faces, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, dynaMesh.config.walkableClimb * 10); - return Tuple.Create(collider, GizmoFactory.Trimesh(verts, geom.faces)); + return Tuple.Create(collider, GizmoFactory.Trimesh(verts, geom.faces)); } private float[] TransformVertices(Vector3f p, DemoInputGeomProvider geom, float ax) diff --git a/src/DotRecast.Recast.Demo/Tools/Gizmos/BoxGizmo.cs b/src/DotRecast.Recast.Demo/Tools/Gizmos/BoxGizmo.cs index 965e2a9..76f2180 100644 --- a/src/DotRecast.Recast.Demo/Tools/Gizmos/BoxGizmo.cs +++ b/src/DotRecast.Recast.Demo/Tools/Gizmos/BoxGizmo.cs @@ -4,7 +4,7 @@ using DotRecast.Recast.Demo.Draw; namespace DotRecast.Recast.Demo.Tools.Gizmos; -public class BoxGizmo : ColliderGizmo +public class BoxGizmo : IColliderGizmo { private static readonly int[] TRIANLGES = { diff --git a/src/DotRecast.Recast.Demo/Tools/Gizmos/CapsuleGizmo.cs b/src/DotRecast.Recast.Demo/Tools/Gizmos/CapsuleGizmo.cs index d0ddb28..316852f 100644 --- a/src/DotRecast.Recast.Demo/Tools/Gizmos/CapsuleGizmo.cs +++ b/src/DotRecast.Recast.Demo/Tools/Gizmos/CapsuleGizmo.cs @@ -6,7 +6,7 @@ using static DotRecast.Recast.Demo.Tools.Gizmos.GizmoHelper; namespace DotRecast.Recast.Demo.Tools.Gizmos; -public class CapsuleGizmo : ColliderGizmo +public class CapsuleGizmo : IColliderGizmo { private readonly float[] vertices; private readonly int[] triangles; diff --git a/src/DotRecast.Recast.Demo/Tools/Gizmos/CompositeGizmo.cs b/src/DotRecast.Recast.Demo/Tools/Gizmos/CompositeGizmo.cs index 266d5b4..84b6d23 100644 --- a/src/DotRecast.Recast.Demo/Tools/Gizmos/CompositeGizmo.cs +++ b/src/DotRecast.Recast.Demo/Tools/Gizmos/CompositeGizmo.cs @@ -4,11 +4,11 @@ using DotRecast.Recast.Demo.Draw; namespace DotRecast.Recast.Demo.Tools.Gizmos; -public class CompositeGizmo : ColliderGizmo +public class CompositeGizmo : IColliderGizmo { - private readonly ColliderGizmo[] gizmos; + private readonly IColliderGizmo[] gizmos; - public CompositeGizmo(params ColliderGizmo[] gizmos) + public CompositeGizmo(params IColliderGizmo[] gizmos) { this.gizmos = gizmos; } diff --git a/src/DotRecast.Recast.Demo/Tools/Gizmos/CylinderGizmo.cs b/src/DotRecast.Recast.Demo/Tools/Gizmos/CylinderGizmo.cs index 6228efc..1b8780b 100644 --- a/src/DotRecast.Recast.Demo/Tools/Gizmos/CylinderGizmo.cs +++ b/src/DotRecast.Recast.Demo/Tools/Gizmos/CylinderGizmo.cs @@ -7,7 +7,7 @@ using static DotRecast.Recast.Demo.Tools.Gizmos.GizmoHelper; namespace DotRecast.Recast.Demo.Tools.Gizmos; -public class CylinderGizmo : ColliderGizmo +public class CylinderGizmo : IColliderGizmo { private readonly float[] vertices; private readonly int[] triangles; diff --git a/src/DotRecast.Recast.Demo/Tools/Gizmos/GizmoFactory.cs b/src/DotRecast.Recast.Demo/Tools/Gizmos/GizmoFactory.cs index 25a4238..838c44a 100644 --- a/src/DotRecast.Recast.Demo/Tools/Gizmos/GizmoFactory.cs +++ b/src/DotRecast.Recast.Demo/Tools/Gizmos/GizmoFactory.cs @@ -4,32 +4,32 @@ namespace DotRecast.Recast.Demo.Tools.Gizmos; public static class GizmoFactory { - public static ColliderGizmo Box(Vector3f center, Vector3f[] halfEdges) + public static IColliderGizmo Box(Vector3f center, Vector3f[] halfEdges) { return new BoxGizmo(center, halfEdges); } - public static ColliderGizmo Sphere(Vector3f center, float radius) + public static IColliderGizmo Sphere(Vector3f center, float radius) { return new SphereGizmo(center, radius); } - public static ColliderGizmo Capsule(Vector3f start, Vector3f end, float radius) + public static IColliderGizmo Capsule(Vector3f start, Vector3f end, float radius) { return new CapsuleGizmo(start, end, radius); } - public static ColliderGizmo Cylinder(Vector3f start, Vector3f end, float radius) + public static IColliderGizmo Cylinder(Vector3f start, Vector3f end, float radius) { return new CylinderGizmo(start, end, radius); } - public static ColliderGizmo Trimesh(float[] verts, int[] faces) + public static IColliderGizmo Trimesh(float[] verts, int[] faces) { return new TrimeshGizmo(verts, faces); } - public static ColliderGizmo Composite(params ColliderGizmo[] gizmos) + public static IColliderGizmo Composite(params IColliderGizmo[] gizmos) { return new CompositeGizmo(gizmos); } diff --git a/src/DotRecast.Recast.Demo/Tools/Gizmos/ColliderGizmo.cs b/src/DotRecast.Recast.Demo/Tools/Gizmos/IColliderGizmo.cs similarity index 79% rename from src/DotRecast.Recast.Demo/Tools/Gizmos/ColliderGizmo.cs rename to src/DotRecast.Recast.Demo/Tools/Gizmos/IColliderGizmo.cs index a442db0..dbcf621 100644 --- a/src/DotRecast.Recast.Demo/Tools/Gizmos/ColliderGizmo.cs +++ b/src/DotRecast.Recast.Demo/Tools/Gizmos/IColliderGizmo.cs @@ -2,7 +2,7 @@ using DotRecast.Recast.Demo.Draw; namespace DotRecast.Recast.Demo.Tools.Gizmos; -public interface ColliderGizmo +public interface IColliderGizmo { void Render(RecastDebugDraw debugDraw); } \ No newline at end of file diff --git a/src/DotRecast.Recast.Demo/Tools/Gizmos/SphereGizmo.cs b/src/DotRecast.Recast.Demo/Tools/Gizmos/SphereGizmo.cs index fdb8625..fc6faac 100644 --- a/src/DotRecast.Recast.Demo/Tools/Gizmos/SphereGizmo.cs +++ b/src/DotRecast.Recast.Demo/Tools/Gizmos/SphereGizmo.cs @@ -6,7 +6,7 @@ using static DotRecast.Recast.Demo.Tools.Gizmos.GizmoHelper; namespace DotRecast.Recast.Demo.Tools.Gizmos; -public class SphereGizmo : ColliderGizmo +public class SphereGizmo : IColliderGizmo { private readonly float[] vertices; private readonly int[] triangles; diff --git a/src/DotRecast.Recast.Demo/Tools/Gizmos/TrimeshGizmo.cs b/src/DotRecast.Recast.Demo/Tools/Gizmos/TrimeshGizmo.cs index 4e56a6d..bed1efe 100644 --- a/src/DotRecast.Recast.Demo/Tools/Gizmos/TrimeshGizmo.cs +++ b/src/DotRecast.Recast.Demo/Tools/Gizmos/TrimeshGizmo.cs @@ -2,7 +2,7 @@ namespace DotRecast.Recast.Demo.Tools.Gizmos; -public class TrimeshGizmo : ColliderGizmo +public class TrimeshGizmo : IColliderGizmo { private readonly float[] vertices; private readonly int[] triangles; diff --git a/src/DotRecast.Recast.Demo/Tools/TestNavmeshTool.cs b/src/DotRecast.Recast.Demo/Tools/TestNavmeshTool.cs index 2cbc79a..c832cea 100644 --- a/src/DotRecast.Recast.Demo/Tools/TestNavmeshTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/TestNavmeshTool.cs @@ -489,9 +489,9 @@ public class TestNavmeshTool : Tool float dx = m_epos.x - m_spos.x; float dz = m_epos.z - m_spos.z; float dist = (float)Math.Sqrt(dx * dx + dz * dz); - PolygonByCircleConstraint constraint = constrainByCircle - ? PolygonByCircleConstraint.Strict() - : PolygonByCircleConstraint.Noop(); + IPolygonByCircleConstraint constraint = constrainByCircle + ? IPolygonByCircleConstraint.Strict() + : IPolygonByCircleConstraint.Noop(); for (int i = 0; i < 200; i++) { Result result = m_navQuery.FindRandomPointAroundCircle(m_startRef, m_spos, dist, diff --git a/src/DotRecast.Recast.Demo/Tools/ToolUIModule.cs b/src/DotRecast.Recast.Demo/Tools/ToolUIModule.cs deleted file mode 100644 index e085ea2..0000000 --- a/src/DotRecast.Recast.Demo/Tools/ToolUIModule.cs +++ /dev/null @@ -1,26 +0,0 @@ -/* -recast4j copyright (c) 2021 Piotr Piastucki piotr@jtilia.org - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -using Silk.NET.Windowing; - -namespace DotRecast.Recast.Demo.Tools; - -public interface ToolUIModule -{ - void Layout(IWindow ctx); -} \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/ConvexVolumeProvider.cs b/src/DotRecast.Recast/Geom/IConvexVolumeProvider.cs similarity index 95% rename from src/DotRecast.Recast/Geom/ConvexVolumeProvider.cs rename to src/DotRecast.Recast/Geom/IConvexVolumeProvider.cs index b8ebc74..2134cf7 100644 --- a/src/DotRecast.Recast/Geom/ConvexVolumeProvider.cs +++ b/src/DotRecast.Recast/Geom/IConvexVolumeProvider.cs @@ -20,7 +20,7 @@ using System.Collections.Generic; namespace DotRecast.Recast.Geom { - public interface ConvexVolumeProvider + public interface IConvexVolumeProvider { IList ConvexVolumes(); } diff --git a/src/DotRecast.Recast/Geom/InputGeomProvider.cs b/src/DotRecast.Recast/Geom/IInputGeomProvider.cs similarity index 94% rename from src/DotRecast.Recast/Geom/InputGeomProvider.cs rename to src/DotRecast.Recast/Geom/IInputGeomProvider.cs index 84ae5e0..1976c7d 100644 --- a/src/DotRecast.Recast/Geom/InputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/IInputGeomProvider.cs @@ -23,7 +23,7 @@ using DotRecast.Core; namespace DotRecast.Recast.Geom { - public interface InputGeomProvider : ConvexVolumeProvider + public interface IInputGeomProvider : IConvexVolumeProvider { Vector3f GetMeshBoundsMin(); diff --git a/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs b/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs index f858eb6..d9b7a4a 100644 --- a/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs @@ -25,7 +25,7 @@ using DotRecast.Core; namespace DotRecast.Recast.Geom { - public class SimpleInputGeomProvider : InputGeomProvider + public class SimpleInputGeomProvider : IInputGeomProvider { public readonly float[] vertices; public readonly int[] faces; diff --git a/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs b/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs index cb17eba..c8bf091 100644 --- a/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs @@ -23,7 +23,7 @@ using DotRecast.Core; namespace DotRecast.Recast.Geom { - public class SingleTrimeshInputGeomProvider : InputGeomProvider + public class SingleTrimeshInputGeomProvider : IInputGeomProvider { private readonly Vector3f bmin; private readonly Vector3f bmax; diff --git a/src/DotRecast.Recast/ObjImporter.cs b/src/DotRecast.Recast/ObjImporter.cs index 7e20ac0..958cebe 100644 --- a/src/DotRecast.Recast/ObjImporter.cs +++ b/src/DotRecast.Recast/ObjImporter.cs @@ -31,7 +31,7 @@ namespace DotRecast.Recast public List meshFaces = new List(); } - public static InputGeomProvider Load(byte[] chunck) + public static IInputGeomProvider Load(byte[] chunck) { var context = LoadContext(chunck); return new SimpleInputGeomProvider(context.vertexPositions, context.meshFaces); diff --git a/src/DotRecast.Recast/RecastBuilder.cs b/src/DotRecast.Recast/RecastBuilder.cs index 6519e38..7382ac0 100644 --- a/src/DotRecast.Recast/RecastBuilder.cs +++ b/src/DotRecast.Recast/RecastBuilder.cs @@ -29,24 +29,24 @@ namespace DotRecast.Recast { public class RecastBuilder { - public interface RecastBuilderProgressListener + public interface IRecastBuilderProgressListener { void OnProgress(int completed, int total); } - private readonly RecastBuilderProgressListener progressListener; + private readonly IRecastBuilderProgressListener progressListener; public RecastBuilder() { progressListener = null; } - public RecastBuilder(RecastBuilderProgressListener progressListener) + public RecastBuilder(IRecastBuilderProgressListener progressListener) { this.progressListener = progressListener; } - public List BuildTiles(InputGeomProvider geom, RecastConfig cfg, TaskFactory taskFactory) + public List BuildTiles(IInputGeomProvider geom, RecastConfig cfg, TaskFactory taskFactory) { Vector3f bmin = geom.GetMeshBoundsMin(); Vector3f bmax = geom.GetMeshBoundsMax(); @@ -67,7 +67,7 @@ namespace DotRecast.Recast } - public Task BuildTilesAsync(InputGeomProvider geom, RecastConfig cfg, int threads, List results, TaskFactory taskFactory, CancellationToken cancellationToken) + public Task BuildTilesAsync(IInputGeomProvider geom, RecastConfig cfg, int threads, List results, TaskFactory taskFactory, CancellationToken cancellationToken) { Vector3f bmin = geom.GetMeshBoundsMin(); Vector3f bmax = geom.GetMeshBoundsMax(); @@ -87,7 +87,7 @@ namespace DotRecast.Recast return task; } - private Task BuildSingleThreadAsync(InputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, + private Task BuildSingleThreadAsync(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, int tw, int th, List results) { AtomicInteger counter = new AtomicInteger(0); @@ -102,7 +102,7 @@ namespace DotRecast.Recast return Task.CompletedTask; } - private Task BuildMultiThreadAsync(InputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, + private Task BuildMultiThreadAsync(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, int tw, int th, List results, TaskFactory taskFactory, CancellationToken cancellationToken) { AtomicInteger counter = new AtomicInteger(0); @@ -152,7 +152,7 @@ namespace DotRecast.Recast return Task.WhenAll(tasks.ToArray()); } - private RecastBuilderResult BuildTile(InputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, int tx, + private RecastBuilderResult BuildTile(IInputGeomProvider geom, RecastConfig cfg, Vector3f bmin, Vector3f bmax, int tx, int ty, AtomicInteger counter, int total) { RecastBuilderResult result = Build(geom, new RecastBuilderConfig(cfg, bmin, bmax, tx, ty)); @@ -164,7 +164,7 @@ namespace DotRecast.Recast return result; } - public RecastBuilderResult Build(InputGeomProvider geom, RecastBuilderConfig builderCfg) + public RecastBuilderResult Build(IInputGeomProvider geom, RecastBuilderConfig builderCfg) { RecastConfig cfg = builderCfg.cfg; Telemetry ctx = new Telemetry(); @@ -175,7 +175,7 @@ namespace DotRecast.Recast return Build(builderCfg.tileX, builderCfg.tileZ, geom, cfg, solid, ctx); } - public RecastBuilderResult Build(int tileX, int tileZ, ConvexVolumeProvider geom, RecastConfig cfg, Heightfield solid, + public RecastBuilderResult Build(int tileX, int tileZ, IConvexVolumeProvider geom, RecastConfig cfg, Heightfield solid, Telemetry ctx) { FilterHeightfield(solid, cfg, ctx); @@ -290,7 +290,7 @@ namespace DotRecast.Recast /* * Step 3. Partition walkable surface to simple regions. */ - private CompactHeightfield BuildCompactHeightfield(ConvexVolumeProvider volumeProvider, RecastConfig cfg, Telemetry ctx, + private CompactHeightfield BuildCompactHeightfield(IConvexVolumeProvider volumeProvider, RecastConfig cfg, Telemetry ctx, Heightfield solid) { // Compact the heightfield so that it is faster to handle from now on. @@ -312,7 +312,7 @@ namespace DotRecast.Recast return chf; } - public HeightfieldLayerSet BuildLayers(InputGeomProvider geom, RecastBuilderConfig builderCfg) + public HeightfieldLayerSet BuildLayers(IInputGeomProvider geom, RecastBuilderConfig builderCfg) { Telemetry ctx = new Telemetry(); Heightfield solid = RecastVoxelization.BuildSolidHeightfield(geom, builderCfg, ctx); diff --git a/src/DotRecast.Recast/RecastVoxelization.cs b/src/DotRecast.Recast/RecastVoxelization.cs index 7d85922..f491620 100644 --- a/src/DotRecast.Recast/RecastVoxelization.cs +++ b/src/DotRecast.Recast/RecastVoxelization.cs @@ -23,7 +23,7 @@ namespace DotRecast.Recast { public class RecastVoxelization { - public static Heightfield BuildSolidHeightfield(InputGeomProvider geomProvider, RecastBuilderConfig builderCfg, + public static Heightfield BuildSolidHeightfield(IInputGeomProvider geomProvider, RecastBuilderConfig builderCfg, Telemetry ctx) { RecastConfig cfg = builderCfg.cfg; diff --git a/test/DotRecast.Detour.Crowd.Test/AbstractCrowdTest.cs b/test/DotRecast.Detour.Crowd.Test/AbstractCrowdTest.cs index 0e2f8ad..5e5a6eb 100644 --- a/test/DotRecast.Detour.Crowd.Test/AbstractCrowdTest.cs +++ b/test/DotRecast.Detour.Crowd.Test/AbstractCrowdTest.cs @@ -132,7 +132,7 @@ public class AbstractCrowdTest protected void SetMoveTarget(Vector3f pos, bool adjust) { Vector3f ext = crowd.GetQueryExtents(); - QueryFilter filter = crowd.GetFilter(0); + IQueryFilter filter = crowd.GetFilter(0); if (adjust) { foreach (CrowdAgent ag in crowd.GetActiveAgents()) diff --git a/test/DotRecast.Detour.Crowd.Test/PathCorridorTest.cs b/test/DotRecast.Detour.Crowd.Test/PathCorridorTest.cs index f0d5ccc..6f9ed53 100644 --- a/test/DotRecast.Detour.Crowd.Test/PathCorridorTest.cs +++ b/test/DotRecast.Detour.Crowd.Test/PathCorridorTest.cs @@ -28,7 +28,7 @@ namespace DotRecast.Detour.Crowd.Test; public class PathCorridorTest { private readonly PathCorridor corridor = new PathCorridor(); - private readonly QueryFilter filter = new DefaultQueryFilter(); + private readonly IQueryFilter filter = new DefaultQueryFilter(); [SetUp] public void SetUp() diff --git a/test/DotRecast.Detour.Crowd.Test/RecastTestMeshBuilder.cs b/test/DotRecast.Detour.Crowd.Test/RecastTestMeshBuilder.cs index cba6a3f..61f1f88 100644 --- a/test/DotRecast.Detour.Crowd.Test/RecastTestMeshBuilder.cs +++ b/test/DotRecast.Detour.Crowd.Test/RecastTestMeshBuilder.cs @@ -46,7 +46,7 @@ public class RecastTestMeshBuilder { } - public RecastTestMeshBuilder(InputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize, + public RecastTestMeshBuilder(IInputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize, float m_cellHeight, float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope, int m_regionMinSize, int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly, float m_detailSampleDist, float m_detailSampleMaxError) diff --git a/test/DotRecast.Detour.Dynamic.Test/DynamicNavMeshTest.cs b/test/DotRecast.Detour.Dynamic.Test/DynamicNavMeshTest.cs index b227cb0..e811068 100644 --- a/test/DotRecast.Detour.Dynamic.Test/DynamicNavMeshTest.cs +++ b/test/DotRecast.Detour.Dynamic.Test/DynamicNavMeshTest.cs @@ -36,7 +36,7 @@ public class DynamicNavMeshTest bool _ = future.Result; // create new query NavMeshQuery query = new NavMeshQuery(mesh.NavMesh()); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); // find path FindNearestPolyResult start = query.FindNearestPoly(START_POS, EXTENT, filter).result; FindNearestPolyResult end = query.FindNearestPoly(END_POS, EXTENT, filter).result; @@ -45,7 +45,7 @@ public class DynamicNavMeshTest // check path length without any obstacles Assert.That(path.Count, Is.EqualTo(16)); // place obstacle - Collider colldier = new SphereCollider(SPHERE_POS, 20, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GROUND, 0.1f); + ICollider colldier = new SphereCollider(SPHERE_POS, 20, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GROUND, 0.1f); long colliderId = mesh.AddCollider(colldier); // update navmesh asynchronously future = mesh.Update(Task.Factory); diff --git a/test/DotRecast.Detour.Extras.Test/Unity/Astar/UnityAStarPathfindingImporterTest.cs b/test/DotRecast.Detour.Extras.Test/Unity/Astar/UnityAStarPathfindingImporterTest.cs index 9171d08..b8d06db 100644 --- a/test/DotRecast.Detour.Extras.Test/Unity/Astar/UnityAStarPathfindingImporterTest.cs +++ b/test/DotRecast.Detour.Extras.Test/Unity/Astar/UnityAStarPathfindingImporterTest.cs @@ -93,7 +93,7 @@ public class UnityAStarPathfindingImporterTest { // Perform a simple pathfinding NavMeshQuery query = new NavMeshQuery(mesh); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); FindNearestPolyResult[] polys = GetNearestPolys(mesh, startPos, endPos); return query.FindPath(polys[0].GetNearestRef(), polys[1].GetNearestRef(), startPos, endPos, filter); @@ -102,7 +102,7 @@ public class UnityAStarPathfindingImporterTest private FindNearestPolyResult[] GetNearestPolys(NavMesh mesh, params Vector3f[] positions) { NavMeshQuery query = new NavMeshQuery(mesh); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); Vector3f extents = Vector3f.Of(0.1f, 0.1f, 0.1f); FindNearestPolyResult[] results = new FindNearestPolyResult[positions.Length]; diff --git a/test/DotRecast.Detour.Test/FindDistanceToWallTest.cs b/test/DotRecast.Detour.Test/FindDistanceToWallTest.cs index eb954bf..8715bd6 100644 --- a/test/DotRecast.Detour.Test/FindDistanceToWallTest.cs +++ b/test/DotRecast.Detour.Test/FindDistanceToWallTest.cs @@ -48,7 +48,7 @@ public class FindDistanceToWallTest : AbstractDetourTest [Test] public void TestFindDistanceToWall() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { Vector3f startPos = startPoss[i]; diff --git a/test/DotRecast.Detour.Test/FindLocalNeighbourhoodTest.cs b/test/DotRecast.Detour.Test/FindLocalNeighbourhoodTest.cs index 12d12cb..6d17b29 100644 --- a/test/DotRecast.Detour.Test/FindLocalNeighbourhoodTest.cs +++ b/test/DotRecast.Detour.Test/FindLocalNeighbourhoodTest.cs @@ -54,7 +54,7 @@ public class FindLocalNeighbourhoodTest : AbstractDetourTest [Test] public void TestFindNearestPoly() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { Vector3f startPos = startPoss[i]; diff --git a/test/DotRecast.Detour.Test/FindNearestPolyTest.cs b/test/DotRecast.Detour.Test/FindNearestPolyTest.cs index f4171ce..fefedd5 100644 --- a/test/DotRecast.Detour.Test/FindNearestPolyTest.cs +++ b/test/DotRecast.Detour.Test/FindNearestPolyTest.cs @@ -37,7 +37,7 @@ public class FindNearestPolyTest : AbstractDetourTest [Test] public void TestFindNearestPoly() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); Vector3f extents = Vector3f.Of(2, 4, 2); for (int i = 0; i < startRefs.Length; i++) { @@ -52,7 +52,7 @@ public class FindNearestPolyTest : AbstractDetourTest } } - public class EmptyQueryFilter : QueryFilter + public class EmptyQueryFilter : IQueryFilter { public bool PassFilter(long refs, MeshTile tile, Poly poly) { diff --git a/test/DotRecast.Detour.Test/FindPathTest.cs b/test/DotRecast.Detour.Test/FindPathTest.cs index 56ffdc1..d9dcada 100644 --- a/test/DotRecast.Detour.Test/FindPathTest.cs +++ b/test/DotRecast.Detour.Test/FindPathTest.cs @@ -131,7 +131,7 @@ public class FindPathTest : AbstractDetourTest [Test] public void TestFindPath() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { long startRef = startRefs[i]; @@ -151,7 +151,7 @@ public class FindPathTest : AbstractDetourTest [Test] public void TestFindPathSliced() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { long startRef = startRefs[i]; @@ -179,7 +179,7 @@ public class FindPathTest : AbstractDetourTest [Test] public void TestFindPathStraight() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < STRAIGHT_PATHS.Length; i++) { // startRefs.Length; i++) { diff --git a/test/DotRecast.Detour.Test/FindPolysAroundCircleTest.cs b/test/DotRecast.Detour.Test/FindPolysAroundCircleTest.cs index 857e06c..5118892 100644 --- a/test/DotRecast.Detour.Test/FindPolysAroundCircleTest.cs +++ b/test/DotRecast.Detour.Test/FindPolysAroundCircleTest.cs @@ -101,7 +101,7 @@ public class FindPolysAroundCircleTest : AbstractDetourTest [Test] public void TestFindPolysAroundCircle() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { long startRef = startRefs[i]; diff --git a/test/DotRecast.Detour.Test/FindPolysAroundShapeTest.cs b/test/DotRecast.Detour.Test/FindPolysAroundShapeTest.cs index bad1861..214bad6 100644 --- a/test/DotRecast.Detour.Test/FindPolysAroundShapeTest.cs +++ b/test/DotRecast.Detour.Test/FindPolysAroundShapeTest.cs @@ -128,7 +128,7 @@ public class FindPolysAroundShapeTest : AbstractDetourTest [Test] public void TestFindPolysAroundShape() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { long startRef = startRefs[i]; diff --git a/test/DotRecast.Detour.Test/GetPolyWallSegmentsTest.cs b/test/DotRecast.Detour.Test/GetPolyWallSegmentsTest.cs index 8c97913..05db0b5 100644 --- a/test/DotRecast.Detour.Test/GetPolyWallSegmentsTest.cs +++ b/test/DotRecast.Detour.Test/GetPolyWallSegmentsTest.cs @@ -77,7 +77,7 @@ public class GetPolyWallSegmentsTest : AbstractDetourTest [Test] public void TestFindDistanceToWall() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { Result result = query.GetPolyWallSegments(startRefs[i], true, filter); diff --git a/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs b/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs index 6308531..ac89403 100644 --- a/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs +++ b/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs @@ -54,7 +54,7 @@ public class MeshSetReaderWriterTest [Test] public void Test() { - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); NavMeshSetHeader header = new NavMeshSetHeader(); header.magic = NavMeshSetHeader.NAVMESHSET_MAGIC; diff --git a/test/DotRecast.Detour.Test/MoveAlongSurfaceTest.cs b/test/DotRecast.Detour.Test/MoveAlongSurfaceTest.cs index 743fb25..711d2be 100644 --- a/test/DotRecast.Detour.Test/MoveAlongSurfaceTest.cs +++ b/test/DotRecast.Detour.Test/MoveAlongSurfaceTest.cs @@ -68,7 +68,7 @@ public class MoveAlongSurfaceTest : AbstractDetourTest [Test] public void TestMoveAlongSurface() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { long startRef = startRefs[i]; diff --git a/test/DotRecast.Detour.Test/PolygonByCircleConstraintTest.cs b/test/DotRecast.Detour.Test/PolygonByCircleConstraintTest.cs index ce03acb..8e1d8e4 100644 --- a/test/DotRecast.Detour.Test/PolygonByCircleConstraintTest.cs +++ b/test/DotRecast.Detour.Test/PolygonByCircleConstraintTest.cs @@ -24,7 +24,7 @@ namespace DotRecast.Detour.Test; [Parallelizable] public class PolygonByCircleConstraintTest { - private readonly PolygonByCircleConstraint constraint = new PolygonByCircleConstraint.StrictPolygonByCircleConstraint(); + private readonly IPolygonByCircleConstraint constraint = new IPolygonByCircleConstraint.StrictPolygonByCircleConstraint(); [Test] public void ShouldHandlePolygonFullyInsideCircle() diff --git a/test/DotRecast.Detour.Test/RandomPointTest.cs b/test/DotRecast.Detour.Test/RandomPointTest.cs index 11f3bdc..989d417 100644 --- a/test/DotRecast.Detour.Test/RandomPointTest.cs +++ b/test/DotRecast.Detour.Test/RandomPointTest.cs @@ -32,7 +32,7 @@ public class RandomPointTest : AbstractDetourTest public void TestRandom() { FRand f = new FRand(1); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < 1000; i++) { Result point = query.FindRandomPoint(filter, f); @@ -60,7 +60,7 @@ public class RandomPointTest : AbstractDetourTest public void TestRandomAroundCircle() { FRand f = new FRand(1); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); FindRandomPointResult point = query.FindRandomPoint(filter, f).result; for (int i = 0; i < 1000; i++) { @@ -91,7 +91,7 @@ public class RandomPointTest : AbstractDetourTest public void TestRandomWithinCircle() { FRand f = new FRand(1); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); FindRandomPointResult point = query.FindRandomPoint(filter, f).result; float radius = 5f; for (int i = 0; i < 1000; i++) @@ -109,7 +109,7 @@ public class RandomPointTest : AbstractDetourTest public void TestPerformance() { FRand f = new FRand(1); - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); FindRandomPointResult point = query.FindRandomPoint(filter, f).result; float radius = 5f; // jvm warmup diff --git a/test/DotRecast.Detour.Test/RecastTestMeshBuilder.cs b/test/DotRecast.Detour.Test/RecastTestMeshBuilder.cs index dd0b018..8e3d4d5 100644 --- a/test/DotRecast.Detour.Test/RecastTestMeshBuilder.cs +++ b/test/DotRecast.Detour.Test/RecastTestMeshBuilder.cs @@ -47,7 +47,7 @@ public class RecastTestMeshBuilder { } - public RecastTestMeshBuilder(InputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize, + public RecastTestMeshBuilder(IInputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize, float m_cellHeight, float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope, int m_regionMinSize, int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly, float m_detailSampleDist, float m_detailSampleMaxError) diff --git a/test/DotRecast.Detour.Test/TestDetourBuilder.cs b/test/DotRecast.Detour.Test/TestDetourBuilder.cs index 3d4928b..c16b925 100644 --- a/test/DotRecast.Detour.Test/TestDetourBuilder.cs +++ b/test/DotRecast.Detour.Test/TestDetourBuilder.cs @@ -23,7 +23,7 @@ namespace DotRecast.Detour.Test; public class TestDetourBuilder : DetourBuilder { - public MeshData Build(InputGeomProvider geom, RecastBuilderConfig rcConfig, float agentHeight, float agentRadius, + public MeshData Build(IInputGeomProvider geom, RecastBuilderConfig rcConfig, float agentHeight, float agentRadius, float agentMaxClimb, int x, int y, bool applyRecastDemoFlags) { RecastBuilder rcBuilder = new RecastBuilder(); diff --git a/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs b/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs index 0557615..dae3bf4 100644 --- a/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs +++ b/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs @@ -52,7 +52,7 @@ public class TestTiledNavMeshBuilder { } - public TestTiledNavMeshBuilder(InputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize, float m_cellHeight, + public TestTiledNavMeshBuilder(IInputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize, float m_cellHeight, float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope, int m_regionMinSize, int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly, float m_detailSampleDist, float m_detailSampleMaxError, int m_tileSize) diff --git a/test/DotRecast.Detour.Test/TiledFindPathTest.cs b/test/DotRecast.Detour.Test/TiledFindPathTest.cs index e741986..066f165 100644 --- a/test/DotRecast.Detour.Test/TiledFindPathTest.cs +++ b/test/DotRecast.Detour.Test/TiledFindPathTest.cs @@ -64,7 +64,7 @@ public class TiledFindPathTest [Test] public void TestFindPath() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < START_REFS.Length; i++) { long startRef = START_REFS[i]; diff --git a/test/DotRecast.Detour.TileCache.Test/AbstractTileCacheTest.cs b/test/DotRecast.Detour.TileCache.Test/AbstractTileCacheTest.cs index fa65ae0..b337942 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 : TileCacheMeshProcess + protected class TestTileCacheMeshProcess : ITileCacheMeshProcess { public void Process(NavMeshDataCreateParams option) { @@ -50,7 +50,7 @@ public class AbstractTileCacheTest } } - public TileCache GetTileCache(InputGeomProvider geom, ByteOrder order, bool cCompatibility) + public TileCache GetTileCache(IInputGeomProvider geom, ByteOrder order, bool cCompatibility) { TileCacheParams option = new TileCacheParams(); int[] twh = Recast.Recast.CalcTileCount(geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), m_cellSize, m_tileSize, m_tileSize); diff --git a/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderWriterTest.cs b/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderWriterTest.cs index 452b9c9..82b5f87 100644 --- a/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderWriterTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/Io/TileCacheReaderWriterTest.cs @@ -50,7 +50,7 @@ public class TileCacheReaderWriterTest : AbstractTileCacheTest private void TestDungeon(bool cCompatibility) { - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(ByteOrder.LITTLE_ENDIAN, cCompatibility, 1); TileCache tc = GetTileCache(geom, ByteOrder.LITTLE_ENDIAN, cCompatibility); diff --git a/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs b/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs index 61f2ecc..a598dd8 100644 --- a/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs @@ -33,7 +33,7 @@ public class TempObstaclesTest : AbstractTileCacheTest public void TestDungeon() { bool cCompatibility = true; - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(ByteOrder.LITTLE_ENDIAN, cCompatibility, 1); TileCache tc = GetTileCache(geom, ByteOrder.LITTLE_ENDIAN, cCompatibility); @@ -67,7 +67,7 @@ public class TempObstaclesTest : AbstractTileCacheTest public void TestDungeonBox() { bool cCompatibility = true; - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(ByteOrder.LITTLE_ENDIAN, cCompatibility, 1); TileCache tc = GetTileCache(geom, ByteOrder.LITTLE_ENDIAN, cCompatibility); diff --git a/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs b/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs index a2f0fe8..19b3be0 100644 --- a/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs +++ b/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs @@ -45,11 +45,11 @@ public class TestTileLayerBuilder : AbstractTileLayersBuilder private const float m_detailSampleMaxError = 1.0f; private readonly RecastConfig rcConfig; private const int m_tileSize = 48; - protected readonly InputGeomProvider geom; + protected readonly IInputGeomProvider geom; private readonly int tw; private readonly int th; - public TestTileLayerBuilder(InputGeomProvider geom) + public TestTileLayerBuilder(IInputGeomProvider geom) { this.geom = geom; rcConfig = new RecastConfig(true, m_tileSize, m_tileSize, RecastConfig.CalcBorder(m_agentRadius, m_cellSize), diff --git a/test/DotRecast.Detour.TileCache.Test/TileCacheFindPathTest.cs b/test/DotRecast.Detour.TileCache.Test/TileCacheFindPathTest.cs index 05f6fbb..818398e 100644 --- a/test/DotRecast.Detour.TileCache.Test/TileCacheFindPathTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TileCacheFindPathTest.cs @@ -47,7 +47,7 @@ public class TileCacheFindPathTest : AbstractTileCacheTest [Test] public void TestFindPath() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); Vector3f extents = Vector3f.Of(2f, 4f, 2f); Result findPolyStart = query.FindNearestPoly(start, extents, filter); Result findPolyEnd = query.FindNearestPoly(end, extents, filter); diff --git a/test/DotRecast.Detour.TileCache.Test/TileCacheNavigationTest.cs b/test/DotRecast.Detour.TileCache.Test/TileCacheNavigationTest.cs index 924befc..329d778 100644 --- a/test/DotRecast.Detour.TileCache.Test/TileCacheNavigationTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TileCacheNavigationTest.cs @@ -56,7 +56,7 @@ public class TileCacheNavigationTest : AbstractTileCacheTest public void SetUp() { bool cCompatibility = true; - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(ByteOrder.LITTLE_ENDIAN, cCompatibility, 1); TileCache tc = GetTileCache(geom, ByteOrder.LITTLE_ENDIAN, cCompatibility); @@ -83,7 +83,7 @@ public class TileCacheNavigationTest : AbstractTileCacheTest [Test] public void TestFindPathWithDefaultHeuristic() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { long startRef = startRefs[i]; @@ -103,7 +103,7 @@ public class TileCacheNavigationTest : AbstractTileCacheTest [Test] public void TestFindPathWithNoHeuristic() { - QueryFilter filter = new DefaultQueryFilter(); + IQueryFilter filter = new DefaultQueryFilter(); for (int i = 0; i < startRefs.Length; i++) { long startRef = startRefs[i]; diff --git a/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs b/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs index 943411e..b6e6aa3 100644 --- a/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs @@ -59,7 +59,7 @@ public class TileCacheTest : AbstractTileCacheTest private void TestDungeon(ByteOrder order, bool cCompatibility) { - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TileCache tc = GetTileCache(geom, order, cCompatibility); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(order, cCompatibility, 1); @@ -155,7 +155,7 @@ public class TileCacheTest : AbstractTileCacheTest private void Test(ByteOrder order, bool cCompatibility) { - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("nav_test.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("nav_test.obj")); TileCache tc = GetTileCache(geom, order, cCompatibility); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); List layers = layerBuilder.Build(order, cCompatibility, 1); @@ -181,7 +181,7 @@ public class TileCacheTest : AbstractTileCacheTest int threads = 4; ByteOrder order = ByteOrder.LITTLE_ENDIAN; bool cCompatibility = false; - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); TestTileLayerBuilder layerBuilder = new TestTileLayerBuilder(geom); for (int i = 0; i < 4; i++) { diff --git a/test/DotRecast.Recast.Test/RecastLayersTest.cs b/test/DotRecast.Recast.Test/RecastLayersTest.cs index 92504c2..7527442 100644 --- a/test/DotRecast.Recast.Test/RecastLayersTest.cs +++ b/test/DotRecast.Recast.Test/RecastLayersTest.cs @@ -145,7 +145,7 @@ public class RecastLayersTest private HeightfieldLayerSet Build(string filename, int x, int y) { - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename)); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename)); RecastBuilder builder = new RecastBuilder(); RecastConfig cfg = new RecastConfig(true, m_tileSize, m_tileSize, RecastConfig.CalcBorder(m_agentRadius, m_cellSize), m_partitionType, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, diff --git a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs index 0ba379b..574b75e 100644 --- a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs @@ -96,7 +96,7 @@ public class RecastSoloMeshTest int expContours, int expVerts, int expPolys, int expDetMeshes, int expDetVerts, int expDetTris) { m_partitionType = partitionType; - InputGeomProvider geomProvider = ObjImporter.Load(Loader.ToBytes(filename)); + IInputGeomProvider geomProvider = ObjImporter.Load(Loader.ToBytes(filename)); long time = FrequencyWatch.Ticks; Vector3f bmin = geomProvider.GetMeshBoundsMin(); Vector3f bmax = geomProvider.GetMeshBoundsMax(); diff --git a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs index a8dd791..f0a5703 100644 --- a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs @@ -60,7 +60,7 @@ public class RecastTileMeshTest public void TestBuild(string filename) { - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename)); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename)); RecastBuilder builder = new RecastBuilder(); RecastConfig cfg = new RecastConfig(true, m_tileSize, m_tileSize, RecastConfig.CalcBorder(m_agentRadius, m_cellSize), m_partitionType, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, @@ -95,7 +95,7 @@ public class RecastTileMeshTest [Test] public void TestPerformance() { - InputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); + IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); RecastBuilder builder = new RecastBuilder(); RecastConfig cfg = new RecastConfig(true, m_tileSize, m_tileSize, RecastConfig.CalcBorder(m_agentRadius, m_cellSize), m_partitionType, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, @@ -124,7 +124,7 @@ public class RecastTileMeshTest Console.WriteLine(" Time MT : " + (t3 - t2) / TimeSpan.TicksPerMillisecond); } - private void Build(InputGeomProvider geom, RecastBuilder builder, RecastConfig cfg, int threads, bool validate) + private void Build(IInputGeomProvider geom, RecastBuilder builder, RecastConfig cfg, int threads, bool validate) { CancellationTokenSource cts = new CancellationTokenSource(); List tiles = new();