From 5d0c5db2e7f19a98239e6c77df6e5b19e6ef755a Mon Sep 17 00:00:00 2001 From: ikpil Date: Fri, 17 Mar 2023 01:09:10 +0900 Subject: [PATCH] fix netstandard21 --- README.md | 15 ++++++- src/DotRecast.Core/ArrayUtils.cs | 5 ++- src/DotRecast.Core/AtomicBoolean.cs | 5 ++- src/DotRecast.Core/AtomicFloat.cs | 5 ++- src/DotRecast.Core/AtomicInteger.cs | 5 ++- src/DotRecast.Core/AtomicLong.cs | 5 ++- src/DotRecast.Core/ByteBuffer.cs | 15 ++++--- src/DotRecast.Core/ByteOrder.cs | 6 ++- src/DotRecast.Core/CollectionExtensions.cs | 5 ++- src/DotRecast.Core/ConvexUtils.cs | 8 +++- src/DotRecast.Core/DemoMath.cs | 6 ++- src/DotRecast.Core/DotRecast.Core.csproj | 9 ++-- src/DotRecast.Core/Loader.cs | 5 ++- src/DotRecast.Core/NodeQueue.cs | 8 +++- src/DotRecast.Detour.Crowd/Crowd.cs | 20 +++++---- src/DotRecast.Detour.Crowd/CrowdAgent.cs | 9 ++-- .../CrowdAgentAnimation.cs | 6 ++- .../CrowdAgentParams.cs | 5 ++- src/DotRecast.Detour.Crowd/CrowdConfig.cs | 6 ++- src/DotRecast.Detour.Crowd/CrowdTelemetry.cs | 12 +++-- .../DotRecast.Detour.Crowd.csproj | 2 +- src/DotRecast.Detour.Crowd/LocalBoundary.cs | 10 +++-- .../ObstacleAvoidanceQuery.cs | 6 ++- src/DotRecast.Detour.Crowd/PathCorridor.cs | 14 +++--- src/DotRecast.Detour.Crowd/PathQuery.cs | 6 ++- src/DotRecast.Detour.Crowd/PathQueryResult.cs | 8 +++- src/DotRecast.Detour.Crowd/PathQueue.cs | 8 +++- src/DotRecast.Detour.Crowd/ProximityGrid.cs | 12 +++-- .../SweepCircleCircleResult.cs | 6 ++- .../Tracking/CrowdAgentDebugInfo.cs | 6 ++- .../Tracking/ObstacleAvoidanceDebugData.cs | 5 ++- .../AddColliderQueueItem.cs | 6 ++- .../Colliders/AbstractCollider.cs | 6 ++- .../Colliders/BoxCollider.cs | 6 ++- .../Colliders/CapsuleCollider.cs | 6 ++- .../Colliders/Collider.cs | 6 ++- .../Colliders/CompositeCollider.cs | 6 ++- .../Colliders/ConvexTrimeshCollider.cs | 6 ++- .../Colliders/CylinderCollider.cs | 6 ++- .../Colliders/SphereCollider.cs | 6 ++- .../Colliders/TrimeshCollider.cs | 6 ++- .../DotRecast.Detour.Dynamic.csproj | 2 +- .../DynamicNavMesh.cs | 14 +++--- .../DynamicNavMeshConfig.cs | 6 ++- src/DotRecast.Detour.Dynamic/DynamicTile.cs | 11 +++-- .../DynamicTileCheckpoint.cs | 6 ++- src/DotRecast.Detour.Dynamic/Io/ByteUtils.cs | 22 +++++---- .../Io/LZ4VoxelTileCompressor.cs | 6 ++- src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs | 8 +++- .../Io/VoxelFileReader.cs | 6 ++- .../Io/VoxelFileWriter.cs | 6 ++- src/DotRecast.Detour.Dynamic/Io/VoxelTile.cs | 6 ++- .../RemoveColliderQueueItem.cs | 6 ++- .../UpdateQueueItem.cs | 6 ++- src/DotRecast.Detour.Dynamic/VoxelQuery.cs | 6 ++- src/DotRecast.Detour.Extras/BVTreeBuilder.cs | 6 ++- .../DotRecast.Detour.Extras.csproj | 3 +- .../Jumplink/AbstractGroundSampler.cs | 6 ++- .../Jumplink/ClimbTrajectory.cs | 6 ++- src/DotRecast.Detour.Extras/Jumplink/Edge.cs | 6 ++- .../Jumplink/EdgeExtractor.cs | 8 +++- .../Jumplink/EdgeSampler.cs | 8 +++- .../Jumplink/EdgeSamplerFactory.cs | 6 ++- .../Jumplink/GroundSample.cs | 6 ++- .../Jumplink/GroundSampler.cs | 6 ++- .../Jumplink/GroundSegment.cs | 6 ++- .../Jumplink/JumpLink.cs | 6 ++- .../Jumplink/JumpLinkBuilder.cs | 10 +++-- .../Jumplink/JumpLinkBuilderConfig.cs | 6 ++- .../Jumplink/JumpLinkType.cs | 5 ++- .../Jumplink/JumpSegment.cs | 6 ++- .../Jumplink/JumpSegmentBuilder.cs | 6 ++- .../Jumplink/JumpTrajectory.cs | 6 ++- .../Jumplink/NavMeshGroundSampler.cs | 6 ++- .../Jumplink/Trajectory.cs | 6 ++- .../Jumplink/TrajectorySampler.cs | 6 ++- src/DotRecast.Detour.Extras/ObjExporter.cs | 6 ++- src/DotRecast.Detour.Extras/PolyUtils.cs | 6 ++- .../Unity/Astar/BVTreeCreator.cs | 6 ++- .../Unity/Astar/GraphConnectionReader.cs | 8 +++- .../Unity/Astar/GraphData.cs | 6 ++- .../Unity/Astar/GraphMeshData.cs | 6 ++- .../Unity/Astar/GraphMeshDataReader.cs | 18 +++++++- .../Unity/Astar/GraphMeta.cs | 6 ++- .../Unity/Astar/GraphMetaReader.cs | 6 ++- .../Unity/Astar/LinkBuilder.cs | 6 ++- .../Unity/Astar/Meta.cs | 6 ++- .../Unity/Astar/MetaReader.cs | 6 ++- .../Unity/Astar/NodeIndexReader.cs | 6 ++- .../Unity/Astar/NodeLink2.cs | 6 ++- .../Unity/Astar/NodeLink2Reader.cs | 6 ++- .../Unity/Astar/OffMeshLinkCreator.cs | 6 ++- .../Astar/UnityAStarPathfindingImporter.cs | 6 ++- .../Astar/UnityAStarPathfindingReader.cs | 12 +++-- .../Unity/Astar/ZipBinaryReader.cs | 6 ++- src/DotRecast.Detour.Extras/Vector3f.cs | 6 ++- .../AbstractTileLayersBuilder.cs | 10 +++-- .../CompressedTile.cs | 6 ++- .../DotRecast.Detour.TileCache.csproj | 2 +- .../Io/Compress/FastLz.cs | 19 ++++---- .../Io/Compress/FastLzTileCacheCompressor.cs | 6 ++- .../Io/Compress/LZ4TileCacheCompressor.cs | 6 ++- .../Io/Compress/TileCacheCompressorFactory.cs | 14 ++++-- .../Io/TileCacheLayerHeaderReader.cs | 6 ++- .../Io/TileCacheLayerHeaderWriter.cs | 6 ++- .../Io/TileCacheReader.cs | 6 ++- .../Io/TileCacheSetHeader.cs | 6 ++- .../Io/TileCacheWriter.cs | 6 ++- .../ObstacleRequest.cs | 6 ++- .../ObstacleRequestAction.cs | 6 ++- .../ObstacleState.cs | 6 ++- src/DotRecast.Detour.TileCache/TileCache.cs | 16 ++++--- .../TileCacheBuilder.cs | 20 +++++---- .../TileCacheCompressor.cs | 6 ++- .../TileCacheContour.cs | 6 ++- .../TileCacheContourSet.cs | 6 ++- .../TileCacheLayer.cs | 6 ++- .../TileCacheLayerHeader.cs | 6 ++- .../TileCacheMeshProcess.cs | 6 ++- .../TileCacheObstacle.cs | 10 +++-- .../TileCacheParams.cs | 6 ++- .../TileCachePolyMesh.cs | 6 ++- .../TileCacheStorageParams.cs | 6 ++- src/DotRecast.Detour/BVNode.cs | 6 ++- .../ClosestPointOnPolyResult.cs | 6 ++- .../ConvexConvexIntersection.cs | 6 ++- src/DotRecast.Detour/DefaultQueryFilter.cs | 6 ++- src/DotRecast.Detour/DefaultQueryHeuristic.cs | 6 ++- src/DotRecast.Detour/DetourBuilder.cs | 6 ++- src/DotRecast.Detour/DetourCommon.cs | 6 ++- src/DotRecast.Detour/DotRecast.Detour.csproj | 2 +- .../FindDistanceToWallResult.cs | 5 ++- .../FindLocalNeighbourhoodResult.cs | 5 ++- src/DotRecast.Detour/FindNearestPolyQuery.cs | 6 ++- src/DotRecast.Detour/FindNearestPolyResult.cs | 6 ++- src/DotRecast.Detour/FindPolysAroundResult.cs | 5 ++- src/DotRecast.Detour/FindRandomPointResult.cs | 5 ++- .../GetPolyWallSegmentsResult.cs | 6 ++- src/DotRecast.Detour/Io/DetourWriter.cs | 10 +++-- src/DotRecast.Detour/Io/IOUtils.cs | 11 +++-- src/DotRecast.Detour/Io/MeshDataReader.cs | 6 ++- src/DotRecast.Detour/Io/MeshDataWriter.cs | 6 ++- src/DotRecast.Detour/Io/MeshSetReader.cs | 6 ++- src/DotRecast.Detour/Io/MeshSetWriter.cs | 6 ++- src/DotRecast.Detour/Io/NavMeshParamReader.cs | 6 ++- src/DotRecast.Detour/Io/NavMeshParamWriter.cs | 6 ++- src/DotRecast.Detour/Io/NavMeshSetHeader.cs | 6 ++- src/DotRecast.Detour/Io/NavMeshTileHeader.cs | 6 ++- src/DotRecast.Detour/LegacyNavMeshQuery.cs | 12 +++-- src/DotRecast.Detour/Link.cs | 6 ++- src/DotRecast.Detour/MeshData.cs | 5 ++- src/DotRecast.Detour/MeshHeader.cs | 6 ++- src/DotRecast.Detour/MeshTile.cs | 8 +++- .../MoveAlongSurfaceResult.cs | 6 ++- src/DotRecast.Detour/NavMesh.cs | 18 +++++--- src/DotRecast.Detour/NavMeshBuilder.cs | 6 ++- .../NavMeshDataCreateParams.cs | 5 ++- src/DotRecast.Detour/NavMeshParams.cs | 6 ++- src/DotRecast.Detour/NavMeshQuery.cs | 45 ++++++++++--------- src/DotRecast.Detour/Node.cs | 6 ++- src/DotRecast.Detour/NodePool.cs | 14 +++--- src/DotRecast.Detour/NodeQueue.cs | 8 +++- src/DotRecast.Detour/OffMeshConnection.cs | 5 ++- src/DotRecast.Detour/Poly.cs | 6 ++- src/DotRecast.Detour/PolyDetail.cs | 6 ++- src/DotRecast.Detour/PolyQuery.cs | 6 ++- .../PolygonByCircleConstraint.cs | 6 ++- src/DotRecast.Detour/QueryData.cs | 5 ++- src/DotRecast.Detour/QueryFilter.cs | 6 ++- src/DotRecast.Detour/QueryHeuristic.cs | 6 ++- src/DotRecast.Detour/RaycastHit.cs | 8 +++- src/DotRecast.Detour/Result.cs | 6 ++- src/DotRecast.Detour/Status.cs | 16 ++++--- src/DotRecast.Detour/StraightPathItem.cs | 5 ++- src/DotRecast.Detour/VectorPtr.cs | 5 ++- src/DotRecast.Recast/AreaModification.cs | 5 ++- src/DotRecast.Recast/CompactCell.cs | 5 ++- src/DotRecast.Recast/CompactHeightfield.cs | 5 ++- src/DotRecast.Recast/CompactSpan.cs | 5 ++- src/DotRecast.Recast/Contour.cs | 5 ++- src/DotRecast.Recast/ContourSet.cs | 7 ++- src/DotRecast.Recast/ConvexVolume.cs | 5 ++- src/DotRecast.Recast/DotRecast.Recast.csproj | 3 +- src/DotRecast.Recast/Geom/ChunkyTriMesh.cs | 9 ++-- .../Geom/ChunkyTriMeshNode.cs | 6 ++- .../Geom/ConvexVolumeProvider.cs | 5 ++- .../Geom/InputGeomProvider.cs | 5 ++- .../Geom/SimpleInputGeomProvider.cs | 10 +++-- .../Geom/SingleTrimeshInputGeomProvider.cs | 10 +++-- src/DotRecast.Recast/Geom/TriMesh.cs | 5 ++- src/DotRecast.Recast/Heightfield.cs | 5 ++- src/DotRecast.Recast/HeightfieldLayerSet.cs | 5 ++- src/DotRecast.Recast/InputGeomReader.cs | 5 ++- src/DotRecast.Recast/ObjImporter.cs | 9 ++-- src/DotRecast.Recast/PartitionType.cs | 5 ++- src/DotRecast.Recast/PolyMesh.cs | 5 ++- src/DotRecast.Recast/PolyMeshDetail.cs | 5 ++- src/DotRecast.Recast/Recast.cs | 5 ++- src/DotRecast.Recast/RecastArea.cs | 5 ++- src/DotRecast.Recast/RecastBuilder.cs | 9 ++-- src/DotRecast.Recast/RecastBuilderConfig.cs | 5 ++- src/DotRecast.Recast/RecastBuilderResult.cs | 6 ++- src/DotRecast.Recast/RecastCommon.cs | 5 ++- src/DotRecast.Recast/RecastCompact.cs | 5 ++- src/DotRecast.Recast/RecastConfig.cs | 5 ++- src/DotRecast.Recast/RecastConstants.cs | 5 ++- src/DotRecast.Recast/RecastContour.cs | 9 ++-- .../RecastFilledVolumeRasterization.cs | 5 ++- src/DotRecast.Recast/RecastFilter.cs | 5 ++- src/DotRecast.Recast/RecastLayers.cs | 14 +++--- src/DotRecast.Recast/RecastMesh.cs | 6 ++- src/DotRecast.Recast/RecastMeshDetail.cs | 14 +++--- src/DotRecast.Recast/RecastRasterization.cs | 5 ++- src/DotRecast.Recast/RecastRegion.cs | 34 +++++++------- src/DotRecast.Recast/RecastVectors.cs | 5 ++- src/DotRecast.Recast/RecastVoxelization.cs | 6 ++- src/DotRecast.Recast/Span.cs | 6 ++- src/DotRecast.Recast/Telemetry.cs | 9 ++-- .../DotRecast.Detour.Crowd.Test/Crowd4Test.cs | 8 ++-- .../FindNearestPolyTest.cs | 2 +- .../RecastSoloMeshTest.cs | 2 + .../RecastTileMeshTest.cs | 1 + 222 files changed, 1203 insertions(+), 390 deletions(-) diff --git a/README.md b/README.md index 21ad42e..c3de012 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ # DotRecast -- https://github.com/recastnavigation/recastnavigation -- https://github.com/ppiastucki/recast4j +DotRecast is a port of recast4j(https://github.com/ppiastucki/recast4j) to C# and has been built to target netstandard2.1 to work with both Unity and pure C#. + +If you're using Unity 3D, the following projects have been modified to build with netstandard2.1: + +- DotRecast.Core +- DotRecast.Recast +- DotRecast.Detour +- DotRecast.Detour.Crowd +- DotRecast.Detour.Dynamic +- DotRecast.Detour.Extras +- DotRecast.Detour.TileCache + + Please feel free to copy and use these projects in Unity 3D. We plan to continue improving them as time goes on. diff --git a/src/DotRecast.Core/ArrayUtils.cs b/src/DotRecast.Core/ArrayUtils.cs index ac9d224..f2f6c43 100644 --- a/src/DotRecast.Core/ArrayUtils.cs +++ b/src/DotRecast.Core/ArrayUtils.cs @@ -1,6 +1,8 @@ using System; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public static class ArrayUtils { @@ -38,4 +40,5 @@ public static class ArrayUtils return temp; } +} } \ No newline at end of file diff --git a/src/DotRecast.Core/AtomicBoolean.cs b/src/DotRecast.Core/AtomicBoolean.cs index 19724e5..2d7848c 100644 --- a/src/DotRecast.Core/AtomicBoolean.cs +++ b/src/DotRecast.Core/AtomicBoolean.cs @@ -1,6 +1,8 @@ using System.Threading; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public class AtomicBoolean { @@ -15,4 +17,5 @@ public class AtomicBoolean { return 0 != _location; } +} } \ No newline at end of file diff --git a/src/DotRecast.Core/AtomicFloat.cs b/src/DotRecast.Core/AtomicFloat.cs index 101a1bb..a9a1dd5 100644 --- a/src/DotRecast.Core/AtomicFloat.cs +++ b/src/DotRecast.Core/AtomicFloat.cs @@ -1,6 +1,8 @@ using System.Threading; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public class AtomicFloat { @@ -25,4 +27,5 @@ public class AtomicFloat { return Interlocked.CompareExchange(ref _location, value, comparand); } +} } \ No newline at end of file diff --git a/src/DotRecast.Core/AtomicInteger.cs b/src/DotRecast.Core/AtomicInteger.cs index 0f09510..97f02b2 100644 --- a/src/DotRecast.Core/AtomicInteger.cs +++ b/src/DotRecast.Core/AtomicInteger.cs @@ -1,6 +1,8 @@ using System.Threading; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public class AtomicInteger { @@ -63,4 +65,5 @@ public class AtomicInteger return Interlocked.Add(ref _location, value); } +} } \ No newline at end of file diff --git a/src/DotRecast.Core/AtomicLong.cs b/src/DotRecast.Core/AtomicLong.cs index b3103e1..5046bda 100644 --- a/src/DotRecast.Core/AtomicLong.cs +++ b/src/DotRecast.Core/AtomicLong.cs @@ -1,6 +1,8 @@ using System.Threading; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public class AtomicLong { @@ -49,4 +51,5 @@ public class AtomicLong { return Interlocked.Add(ref _location, value); } +} } \ No newline at end of file diff --git a/src/DotRecast.Core/ByteBuffer.cs b/src/DotRecast.Core/ByteBuffer.cs index 96dc709..90c50af 100644 --- a/src/DotRecast.Core/ByteBuffer.cs +++ b/src/DotRecast.Core/ByteBuffer.cs @@ -1,7 +1,9 @@ using System; using System.Buffers.Binary; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public class ByteBuffer { @@ -93,14 +95,16 @@ public class ByteBuffer public float getFloat() { var span = ReadBytes(4); - if (_order == ByteOrder.BIG_ENDIAN) + if (_order == ByteOrder.BIG_ENDIAN && BitConverter.IsLittleEndian) { - return BinaryPrimitives.ReadSingleBigEndian(span); + span.Reverse(); } - else + else if (_order == ByteOrder.LITTLE_ENDIAN && !BitConverter.IsLittleEndian) { - return BinaryPrimitives.ReadSingleLittleEndian(span); + span.Reverse(); } + + return BitConverter.ToSingle(span); } public long getLong() @@ -125,4 +129,5 @@ public class ByteBuffer { // ? } +} } \ No newline at end of file diff --git a/src/DotRecast.Core/ByteOrder.cs b/src/DotRecast.Core/ByteOrder.cs index 4526da6..47ccdc9 100644 --- a/src/DotRecast.Core/ByteOrder.cs +++ b/src/DotRecast.Core/ByteOrder.cs @@ -1,8 +1,12 @@ -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public enum ByteOrder { /// Default on most Windows systems LITTLE_ENDIAN, BIG_ENDIAN, +} + } \ No newline at end of file diff --git a/src/DotRecast.Core/CollectionExtensions.cs b/src/DotRecast.Core/CollectionExtensions.cs index 904c4e9..70052d1 100644 --- a/src/DotRecast.Core/CollectionExtensions.cs +++ b/src/DotRecast.Core/CollectionExtensions.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public static class CollectionExtensions { @@ -26,4 +28,5 @@ public static class CollectionExtensions list[n] = value; } } +} } \ No newline at end of file diff --git a/src/DotRecast.Core/ConvexUtils.cs b/src/DotRecast.Core/ConvexUtils.cs index 7b9f5c3..43b94ee 100644 --- a/src/DotRecast.Core/ConvexUtils.cs +++ b/src/DotRecast.Core/ConvexUtils.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public static class ConvexUtils { @@ -27,7 +29,7 @@ public static class ConvexUtils { // returns number of points on hull. public static List convexhull(List pts) { int npts = pts.Count / 3; - List @out = new(); + List @out = new List(); // Find lower-leftmost point. int hull = 0; for (int i = 1; i < npts; ++i) { @@ -83,3 +85,5 @@ public static class ConvexUtils { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Core/DemoMath.cs b/src/DotRecast.Core/DemoMath.cs index 5c789d5..3479c92 100644 --- a/src/DotRecast.Core/DemoMath.cs +++ b/src/DotRecast.Core/DemoMath.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public class DemoMath { public static float vDistSqr(float[] v1, float[] v2, int i) { @@ -77,3 +79,5 @@ public class DemoMath { return u * g + (1f - u) * f; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Core/DotRecast.Core.csproj b/src/DotRecast.Core/DotRecast.Core.csproj index 57bdec1..c44e729 100644 --- a/src/DotRecast.Core/DotRecast.Core.csproj +++ b/src/DotRecast.Core/DotRecast.Core.csproj @@ -1,9 +1,12 @@ - net7.0 - - + netstandard2.1 + + + + + diff --git a/src/DotRecast.Core/Loader.cs b/src/DotRecast.Core/Loader.cs index 2d40ccd..c9e8da0 100644 --- a/src/DotRecast.Core/Loader.cs +++ b/src/DotRecast.Core/Loader.cs @@ -1,6 +1,8 @@ using System.IO; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + public static class Loader { @@ -29,4 +31,5 @@ public static class Loader return filename; } +} } \ No newline at end of file diff --git a/src/DotRecast.Core/NodeQueue.cs b/src/DotRecast.Core/NodeQueue.cs index caec267..469d461 100644 --- a/src/DotRecast.Core/NodeQueue.cs +++ b/src/DotRecast.Core/NodeQueue.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Core; +namespace DotRecast.Core +{ + using System.Collections.Generic; @@ -32,7 +34,7 @@ public class OrderedQueue public OrderedQueue(Comparison comparison) { - _items = new(); + _items = new List(); _comparison = comparison; } @@ -71,3 +73,5 @@ public class OrderedQueue return 0 == _items.Count; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/Crowd.cs b/src/DotRecast.Detour.Crowd/Crowd.cs index 0b25bb7..c8d8de9 100644 --- a/src/DotRecast.Detour.Crowd/Crowd.cs +++ b/src/DotRecast.Detour.Crowd/Crowd.cs @@ -25,7 +25,9 @@ using System.Collections.ObjectModel; using DotRecast.Core; using DotRecast.Detour.Crowd.Tracking; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + using static DetourCommon; @@ -177,7 +179,7 @@ public class Crowd { // Allocate temp buffer for merging paths. m_pathq = new PathQueue(config); - m_agents = new(); + m_agents = new HashSet(); // The navQuery is mostly used for local searches, no need for large node pool. navMesh = nav; @@ -334,7 +336,7 @@ public class Crowd { * @return List of active agents */ public List getActiveAgents() { - return new(m_agents); + return new List(m_agents); } public float[] getQueryExtents() { @@ -516,7 +518,7 @@ public class Crowd { private void updateMoveRequest(ICollection agents, float dt) { _telemetry.start("updateMoveRequest"); - OrderedQueue queue = new((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime)); + OrderedQueue queue = new OrderedQueue((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime)); // Fire off new requests. foreach (CrowdAgent ag in agents) { @@ -559,7 +561,7 @@ public class Crowd { if (cr.succeeded()) { reqPos = cr.result.getClosest(); } else { - reqPath = new(); + reqPath = new List(); } } else { vCopy(reqPos, ag.targetPos); @@ -568,7 +570,7 @@ public class Crowd { // Could not find path, start the request from current // location. vCopy(reqPos, ag.npos); - reqPath = new(); + reqPath = new List(); reqPath.Add(path[0]); } @@ -717,7 +719,7 @@ public class Crowd { private void updateTopologyOptimization(ICollection agents, float dt) { _telemetry.start("updateTopologyOptimization"); - OrderedQueue queue = new((a1, a2) => a2.topologyOptTime.CompareTo(a1.topologyOptTime)); + OrderedQueue queue = new OrderedQueue((a1, a2) => a2.topologyOptTime.CompareTo(a1.topologyOptTime)); foreach (CrowdAgent ag in agents) { if (ag.state != CrowdAgent.CrowdAgentState.DT_CROWDAGENT_STATE_WALKING) { @@ -779,7 +781,7 @@ public class Crowd { private List getNeighbours(float[] pos, float height, float range, CrowdAgent skip, ProximityGrid grid) { - List result = new(); + List result = new List(); HashSet proxAgents = grid.queryItems(pos[0] - range, pos[2] - range, pos[0] + range, pos[2] + range); foreach (CrowdAgent ag in proxAgents) { @@ -1170,3 +1172,5 @@ public class Crowd { }; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/CrowdAgent.cs b/src/DotRecast.Detour.Crowd/CrowdAgent.cs index 9fe3e0e..88d45d3 100644 --- a/src/DotRecast.Detour.Crowd/CrowdAgent.cs +++ b/src/DotRecast.Detour.Crowd/CrowdAgent.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + using static DetourCommon; @@ -60,7 +62,7 @@ public class CrowdAgent { /// Time since the agent's path corridor was optimized. public float topologyOptTime; /// The known neighbors of the agent. - public List neis = new(); + public List neis = new List(); /// The desired speed. public float desiredSpeed; @@ -78,7 +80,7 @@ public class CrowdAgent { /// The agent's configuration parameters. public CrowdAgentParams option; /// The local path corridor corners for the agent. - public List corners = new(); + public List corners = new List(); public MoveRequestState targetState; /// < State of the movement request. public long targetRef; /// < Target polyref of the movement request. @@ -189,4 +191,5 @@ public class CrowdAgent { } } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/CrowdAgentAnimation.cs b/src/DotRecast.Detour.Crowd/CrowdAgentAnimation.cs index 43757f7..208aa41 100644 --- a/src/DotRecast.Detour.Crowd/CrowdAgentAnimation.cs +++ b/src/DotRecast.Detour.Crowd/CrowdAgentAnimation.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + public class CrowdAgentAnimation { public bool active; @@ -28,3 +30,5 @@ public class CrowdAgentAnimation { public float t, tmax; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/CrowdAgentParams.cs b/src/DotRecast.Detour.Crowd/CrowdAgentParams.cs index 0011714..a495dfa 100644 --- a/src/DotRecast.Detour.Crowd/CrowdAgentParams.cs +++ b/src/DotRecast.Detour.Crowd/CrowdAgentParams.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + /// Configuration parameters for a crowd agent. /// @ingroup crowd @@ -59,4 +61,5 @@ public class CrowdAgentParams { /// User defined data attached to the agent. public object userData; +} } \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/CrowdConfig.cs b/src/DotRecast.Detour.Crowd/CrowdConfig.cs index ba2e715..16c68cb 100644 --- a/src/DotRecast.Detour.Crowd/CrowdConfig.cs +++ b/src/DotRecast.Detour.Crowd/CrowdConfig.cs @@ -16,7 +16,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + public class CrowdConfig { @@ -64,3 +66,5 @@ public class CrowdConfig { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/CrowdTelemetry.cs b/src/DotRecast.Detour.Crowd/CrowdTelemetry.cs index 0d20e5e..22741ad 100644 --- a/src/DotRecast.Detour.Crowd/CrowdTelemetry.cs +++ b/src/DotRecast.Detour.Crowd/CrowdTelemetry.cs @@ -21,7 +21,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + public class CrowdTelemetry { @@ -29,8 +31,8 @@ public class CrowdTelemetry { public const int TIMING_SAMPLES = 10; private float _maxTimeToEnqueueRequest; private float _maxTimeToFindPath; - private readonly Dictionary _executionTimings = new(); - private readonly Dictionary> _executionTimingSamples = new(); + private readonly Dictionary _executionTimings = new Dictionary(); + private readonly Dictionary> _executionTimingSamples = new Dictionary>(); public float maxTimeToEnqueueRequest() { return _maxTimeToEnqueueRequest; @@ -66,7 +68,7 @@ public class CrowdTelemetry { long duration = Stopwatch.GetTimestamp() - _executionTimings[name]; if (!_executionTimingSamples.TryGetValue(name, out var s)) { - s = new(); + s = new List(); _executionTimingSamples.Add(name, s); } @@ -77,3 +79,5 @@ public class CrowdTelemetry { _executionTimings[name] = (long) s.Average(); } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/DotRecast.Detour.Crowd.csproj b/src/DotRecast.Detour.Crowd/DotRecast.Detour.Crowd.csproj index 29df87b..3188170 100644 --- a/src/DotRecast.Detour.Crowd/DotRecast.Detour.Crowd.csproj +++ b/src/DotRecast.Detour.Crowd/DotRecast.Detour.Crowd.csproj @@ -1,7 +1,7 @@ - net7.0 + netstandard2.1 diff --git a/src/DotRecast.Detour.Crowd/LocalBoundary.cs b/src/DotRecast.Detour.Crowd/LocalBoundary.cs index 5e372d4..f2b083b 100644 --- a/src/DotRecast.Detour.Crowd/LocalBoundary.cs +++ b/src/DotRecast.Detour.Crowd/LocalBoundary.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + using static DetourCommon; @@ -37,8 +39,8 @@ public class LocalBoundary { } float[] m_center = new float[3]; - List m_segs = new(); - List m_polys = new(); + List m_segs = new List(); + List m_polys = new List(); public LocalBoundary() { m_center[0] = m_center[1] = m_center[2] = float.MaxValue; @@ -135,3 +137,5 @@ public class LocalBoundary { return m_segs.Count; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/ObstacleAvoidanceQuery.cs b/src/DotRecast.Detour.Crowd/ObstacleAvoidanceQuery.cs index 411693a..956718d 100644 --- a/src/DotRecast.Detour.Crowd/ObstacleAvoidanceQuery.cs +++ b/src/DotRecast.Detour.Crowd/ObstacleAvoidanceQuery.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Detour.Crowd.Tracking; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + using static DetourCommon; @@ -507,3 +509,5 @@ public class ObstacleAvoidanceQuery { return Tuple.Create(ns, nvel); } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/PathCorridor.cs b/src/DotRecast.Detour.Crowd/PathCorridor.cs index 865542e..e01458d 100644 --- a/src/DotRecast.Detour.Crowd/PathCorridor.cs +++ b/src/DotRecast.Detour.Crowd/PathCorridor.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + using static DetourCommon; @@ -95,7 +97,7 @@ public class PathCorridor { // Concatenate paths. // Adjust beginning of the buffer to include the visited. - List result = new(); + List result = new List(); // Store visited for (int i = visited.Count - 1; i > furthestVisited; --i) { result.Add(visited[i]); @@ -171,7 +173,7 @@ public class PathCorridor { * Allocates the corridor's path buffer. */ public PathCorridor() { - m_path = new(); + m_path = new List(); } /** @@ -209,7 +211,7 @@ public class PathCorridor { * @return Corners */ public List findCorners(int maxCorners, NavMeshQuery navquery, QueryFilter filter) { - List path = new(); + List path = new List(); Result> result = navquery.findStraightPath(m_pos, m_target, m_path, maxCorners, 0); if (result.succeeded()) { path = result.result; @@ -441,7 +443,7 @@ public class PathCorridor { public void setCorridor(float[] target, List path) { vCopy(m_target, target); - m_path = new(path); + m_path = new List(path); } public void fixPathStart(long safeRef, float[] safePos) { @@ -560,3 +562,5 @@ public class PathCorridor { return m_path.Count; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/PathQuery.cs b/src/DotRecast.Detour.Crowd/PathQuery.cs index c8b77a6..a1ffa1e 100644 --- a/src/DotRecast.Detour.Crowd/PathQuery.cs +++ b/src/DotRecast.Detour.Crowd/PathQuery.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + public class PathQuery { /// Path find start and end location. @@ -30,3 +32,5 @@ public class PathQuery { public NavMeshQuery navQuery; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/PathQueryResult.cs b/src/DotRecast.Detour.Crowd/PathQueryResult.cs index 6b6efbe..45546be 100644 --- a/src/DotRecast.Detour.Crowd/PathQueryResult.cs +++ b/src/DotRecast.Detour.Crowd/PathQueryResult.cs @@ -18,9 +18,13 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + public class PathQueryResult { public Status status; - public List path = new(); + public List path = new List(); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/PathQueue.cs b/src/DotRecast.Detour.Crowd/PathQueue.cs index 4be599f..4a664fb 100644 --- a/src/DotRecast.Detour.Crowd/PathQueue.cs +++ b/src/DotRecast.Detour.Crowd/PathQueue.cs @@ -20,14 +20,16 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + using static DetourCommon; public class PathQueue { private readonly CrowdConfig config; - private readonly LinkedList queue = new(); + private readonly LinkedList queue = new LinkedList(); public PathQueue(CrowdConfig config) { this.config = config; @@ -81,3 +83,5 @@ public class PathQueue { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/ProximityGrid.cs b/src/DotRecast.Detour.Crowd/ProximityGrid.cs index 68c71b9..e11f954 100644 --- a/src/DotRecast.Detour.Crowd/ProximityGrid.cs +++ b/src/DotRecast.Detour.Crowd/ProximityGrid.cs @@ -22,7 +22,9 @@ using System; using System.Collections.Generic; using System.Linq; -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + public class ProximityGrid { @@ -33,7 +35,7 @@ public class ProximityGrid { public ProximityGrid(float m_cellSize) { this.m_cellSize = m_cellSize; m_invCellSize = 1.0f / m_cellSize; - items = new(); + items = new Dictionary>(); } void clear() { @@ -50,7 +52,7 @@ public class ProximityGrid { for (int x = iminx; x <= imaxx; ++x) { ItemKey key = new ItemKey(x, y); if (!items.TryGetValue(key, out var ids)) { - ids = new(); + ids = new List(); items.Add(key, ids); } ids.Add(agent); @@ -64,7 +66,7 @@ public class ProximityGrid { int imaxx = (int) Math.Floor(maxx * m_invCellSize); int imaxy = (int) Math.Floor(maxy * m_invCellSize); - HashSet result = new(); + HashSet result = new HashSet(); for (int y = iminy; y <= imaxy; ++y) { for (int x = iminx; x <= imaxx; ++x) { ItemKey key = new ItemKey(x, y); @@ -128,3 +130,5 @@ public class ProximityGrid { }; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/SweepCircleCircleResult.cs b/src/DotRecast.Detour.Crowd/SweepCircleCircleResult.cs index 84536ff..409f12d 100644 --- a/src/DotRecast.Detour.Crowd/SweepCircleCircleResult.cs +++ b/src/DotRecast.Detour.Crowd/SweepCircleCircleResult.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Crowd; +namespace DotRecast.Detour.Crowd +{ + public class SweepCircleCircleResult { @@ -32,3 +34,5 @@ public class SweepCircleCircleResult { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/Tracking/CrowdAgentDebugInfo.cs b/src/DotRecast.Detour.Crowd/Tracking/CrowdAgentDebugInfo.cs index 49f6e3a..fa4d54e 100644 --- a/src/DotRecast.Detour.Crowd/Tracking/CrowdAgentDebugInfo.cs +++ b/src/DotRecast.Detour.Crowd/Tracking/CrowdAgentDebugInfo.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Crowd.Tracking; +namespace DotRecast.Detour.Crowd.Tracking +{ + public class CrowdAgentDebugInfo { @@ -27,3 +29,5 @@ public class CrowdAgentDebugInfo { public ObstacleAvoidanceDebugData vod; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Crowd/Tracking/ObstacleAvoidanceDebugData.cs b/src/DotRecast.Detour.Crowd/Tracking/ObstacleAvoidanceDebugData.cs index ebd4519..d75974e 100644 --- a/src/DotRecast.Detour.Crowd/Tracking/ObstacleAvoidanceDebugData.cs +++ b/src/DotRecast.Detour.Crowd/Tracking/ObstacleAvoidanceDebugData.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Detour.Crowd.Tracking; +namespace DotRecast.Detour.Crowd.Tracking +{ + using static DetourCommon; @@ -122,4 +124,5 @@ public class ObstacleAvoidanceDebugData { public float getSampleCollisionTimePenalty(int i) { return m_tpen[i]; } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs b/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs index 4afa6e3..99c1946 100644 --- a/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/AddColliderQueueItem.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; using DotRecast.Detour.Dynamic.Colliders; -namespace DotRecast.Detour.Dynamic; +namespace DotRecast.Detour.Dynamic +{ + public class AddColliderQueueItem : UpdateQueueItem { @@ -42,3 +44,5 @@ public class AddColliderQueueItem : UpdateQueueItem { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs index 2773f61..ad4ccb4 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/AbstractCollider.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public abstract class AbstractCollider : Collider { @@ -42,3 +44,5 @@ public abstract class AbstractCollider : Collider { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/BoxCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/BoxCollider.cs index 9ec35ad..c3308e5 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/BoxCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/BoxCollider.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public class BoxCollider : AbstractCollider { @@ -77,3 +79,5 @@ public class BoxCollider : AbstractCollider { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/CapsuleCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/CapsuleCollider.cs index 311af6f..14ccdf0 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/CapsuleCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/CapsuleCollider.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public class CapsuleCollider : AbstractCollider { @@ -47,3 +49,5 @@ public class CapsuleCollider : AbstractCollider { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/Collider.cs b/src/DotRecast.Detour.Dynamic/Colliders/Collider.cs index 292ff34..b14e58e 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/Collider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/Collider.cs @@ -18,10 +18,14 @@ freely, subject to the following restrictions: using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public interface Collider { float[] bounds(); void rasterize(Heightfield hf, Telemetry telemetry); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs index 1234b94..b422865 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/CompositeCollider.cs @@ -21,7 +21,9 @@ using System.Collections.Generic; using System.Linq; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public class CompositeCollider : Collider { @@ -63,3 +65,5 @@ public class CompositeCollider : Collider { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/ConvexTrimeshCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/ConvexTrimeshCollider.cs index 4766960..641dbae 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/ConvexTrimeshCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/ConvexTrimeshCollider.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public class ConvexTrimeshCollider : AbstractCollider { @@ -44,3 +46,5 @@ public class ConvexTrimeshCollider : AbstractCollider { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/CylinderCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/CylinderCollider.cs index 04e529a..15550eb 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/CylinderCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/CylinderCollider.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public class CylinderCollider : AbstractCollider { @@ -46,3 +48,5 @@ public class CylinderCollider : AbstractCollider { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/SphereCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/SphereCollider.cs index 7b8f58f..795f957 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/SphereCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/SphereCollider.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public class SphereCollider : AbstractCollider { @@ -43,3 +45,5 @@ public class SphereCollider : AbstractCollider { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Colliders/TrimeshCollider.cs b/src/DotRecast.Detour.Dynamic/Colliders/TrimeshCollider.cs index 4e4a485..c3e3fa0 100644 --- a/src/DotRecast.Detour.Dynamic/Colliders/TrimeshCollider.cs +++ b/src/DotRecast.Detour.Dynamic/Colliders/TrimeshCollider.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Colliders; +namespace DotRecast.Detour.Dynamic.Colliders +{ + public class TrimeshCollider : AbstractCollider { @@ -59,3 +61,5 @@ public class TrimeshCollider : AbstractCollider { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/DotRecast.Detour.Dynamic.csproj b/src/DotRecast.Detour.Dynamic/DotRecast.Detour.Dynamic.csproj index d9f14b1..fd2bf2d 100644 --- a/src/DotRecast.Detour.Dynamic/DotRecast.Detour.Dynamic.csproj +++ b/src/DotRecast.Detour.Dynamic/DotRecast.Detour.Dynamic.csproj @@ -1,7 +1,7 @@ - net7.0 + netstandard2.1 diff --git a/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs b/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs index 4c34119..872c3ab 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs +++ b/src/DotRecast.Detour.Dynamic/DynamicNavMesh.cs @@ -27,17 +27,19 @@ using DotRecast.Detour.Dynamic.Colliders; using DotRecast.Detour.Dynamic.Io; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic; +namespace DotRecast.Detour.Dynamic +{ + public class DynamicNavMesh { public const int MAX_VERTS_PER_POLY = 6; public readonly DynamicNavMeshConfig config; private readonly RecastBuilder builder; - private readonly Dictionary _tiles = new(); + private readonly Dictionary _tiles = new Dictionary(); private readonly Telemetry telemetry; private readonly NavMeshParams navMeshParams; - private readonly BlockingCollection updateQueue = new(); + private readonly BlockingCollection updateQueue = new BlockingCollection(); private readonly AtomicLong currentColliderId = new AtomicLong(0); private NavMesh _navMesh; private bool dirty = true; @@ -127,7 +129,7 @@ public class DynamicNavMesh { } private List consumeQueue() { - List items = new(); + List items = new List(); while (updateQueue.TryTake(out var item)) { items.Add(item); } @@ -170,7 +172,7 @@ public class DynamicNavMesh { int minz = (int) Math.Floor((bounds[2] - navMeshParams.orig[2]) / navMeshParams.tileHeight); int maxx = (int) Math.Floor((bounds[3] - navMeshParams.orig[0]) / navMeshParams.tileWidth); int maxz = (int) Math.Floor((bounds[5] - navMeshParams.orig[2]) / navMeshParams.tileHeight); - List tiles = new(); + List tiles = new List(); for (int z = minz; z <= maxz; ++z) { for (int x = minx; x <= maxx; ++x) { DynamicTile tile = getTileAt(x, z); @@ -224,3 +226,5 @@ public class DynamicNavMesh { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/DynamicNavMeshConfig.cs b/src/DotRecast.Detour.Dynamic/DynamicNavMeshConfig.cs index 86804ef..ab4deb1 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicNavMeshConfig.cs +++ b/src/DotRecast.Detour.Dynamic/DynamicNavMeshConfig.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic; +namespace DotRecast.Detour.Dynamic +{ + public class DynamicNavMeshConfig { @@ -54,3 +56,5 @@ public class DynamicNavMeshConfig { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/DynamicTile.cs b/src/DotRecast.Detour.Dynamic/DynamicTile.cs index 09bb2aa..8dad26d 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicTile.cs +++ b/src/DotRecast.Detour.Dynamic/DynamicTile.cs @@ -20,13 +20,14 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; -using System.Collections.ObjectModel; using System.Linq; using DotRecast.Detour.Dynamic.Colliders; using DotRecast.Detour.Dynamic.Io; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic; +namespace DotRecast.Detour.Dynamic +{ + public class DynamicTile { @@ -34,7 +35,7 @@ public class DynamicTile { public DynamicTileCheckpoint checkpoint; public RecastBuilderResult recastResult; MeshData meshData; - private readonly ConcurrentDictionary colliders = new(); + private readonly ConcurrentDictionary colliders = new ConcurrentDictionary(); private bool dirty = true; private long id; @@ -55,7 +56,7 @@ public class DynamicTile { } private Heightfield buildHeightfield(DynamicNavMeshConfig config, Telemetry telemetry) { - ICollection rasterizedColliders = checkpoint != null ? checkpoint.colliders : ImmutableArray.Empty; + ICollection rasterizedColliders = checkpoint != null ? checkpoint.colliders : ImmutableHashSet.Empty; Heightfield heightfield = checkpoint != null ? checkpoint.heightfield : voxelTile.heightfield(); foreach (var (cid, c) in colliders) { if (!rasterizedColliders.Contains(cid)) { @@ -152,3 +153,5 @@ public class DynamicTile { } } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/DynamicTileCheckpoint.cs b/src/DotRecast.Detour.Dynamic/DynamicTileCheckpoint.cs index d6fb09e..70e79f5 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicTileCheckpoint.cs +++ b/src/DotRecast.Detour.Dynamic/DynamicTileCheckpoint.cs @@ -21,7 +21,9 @@ using DotRecast.Recast; using static DotRecast.Detour.DetourCommon; -namespace DotRecast.Detour.Dynamic; +namespace DotRecast.Detour.Dynamic +{ + public class DynamicTileCheckpoint { @@ -59,3 +61,5 @@ public class DynamicTileCheckpoint { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Io/ByteUtils.cs b/src/DotRecast.Detour.Dynamic/Io/ByteUtils.cs index 1bc77ac..b052a85 100644 --- a/src/DotRecast.Detour.Dynamic/Io/ByteUtils.cs +++ b/src/DotRecast.Detour.Dynamic/Io/ByteUtils.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using DotRecast.Core; -namespace DotRecast.Detour.Dynamic.Io; +namespace DotRecast.Detour.Dynamic.Io +{ + public static class ByteUtils { @@ -50,28 +52,30 @@ public static class ByteUtils { public static int putInt(int value, byte[] data, int position, ByteOrder order) { if (order == ByteOrder.BIG_ENDIAN) { - data[position] = (byte) (value >>> 24); - data[position + 1] = (byte) (value >>> 16); - data[position + 2] = (byte) (value >>> 8); + data[position] = (byte) ((uint)value >> 24); + data[position + 1] = (byte) ((uint)value >> 16); + data[position + 2] = (byte) ((uint)value >> 8); data[position + 3] = (byte) (value & 0xFF); } else { data[position] = (byte) (value & 0xFF); - data[position + 1] = (byte) (value >>> 8); - data[position + 2] = (byte) (value >>> 16); - data[position + 3] = (byte) (value >>> 24); + data[position + 1] = (byte) ((uint)value >> 8); + data[position + 2] = (byte) ((uint)value >> 16); + data[position + 3] = (byte) ((uint)value >> 24); } return position + 4; } public static int putShort(int value, byte[] data, int position, ByteOrder order) { if (order == ByteOrder.BIG_ENDIAN) { - data[position] = (byte) (value >>> 8); + data[position] = (byte) ((uint)value >> 8); data[position + 1] = (byte) (value & 0xFF); } else { data[position] = (byte) (value & 0xFF); - data[position + 1] = (byte) (value >>> 8); + data[position + 1] = (byte) ((uint)value >> 8); } return position + 2; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Io/LZ4VoxelTileCompressor.cs b/src/DotRecast.Detour.Dynamic/Io/LZ4VoxelTileCompressor.cs index 7f10288..fe59c35 100644 --- a/src/DotRecast.Detour.Dynamic/Io/LZ4VoxelTileCompressor.cs +++ b/src/DotRecast.Detour.Dynamic/Io/LZ4VoxelTileCompressor.cs @@ -20,7 +20,9 @@ using System; using DotRecast.Core; using K4os.Compression.LZ4; -namespace DotRecast.Detour.Dynamic.Io; +namespace DotRecast.Detour.Dynamic.Io +{ + public class LZ4VoxelTileCompressor { @@ -38,3 +40,5 @@ public class LZ4VoxelTileCompressor { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs b/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs index 2a7f8eb..9adec74 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs +++ b/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs @@ -21,7 +21,9 @@ using System.Collections.Generic; using DotRecast.Core; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Io; +namespace DotRecast.Detour.Dynamic.Io +{ + public class VoxelFile { @@ -54,7 +56,7 @@ public class VoxelFile { public int tileSizeZ; public float[] rotation = new float[3]; public float[] bounds = new float[6]; - public readonly List tiles = new(); + public readonly List tiles = new List(); public void addTile(VoxelTile tile) { tiles.Add(tile); @@ -146,3 +148,5 @@ public class VoxelFile { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelFileReader.cs b/src/DotRecast.Detour.Dynamic/Io/VoxelFileReader.cs index 2d54b6a..e444d2c 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelFileReader.cs +++ b/src/DotRecast.Detour.Dynamic/Io/VoxelFileReader.cs @@ -20,7 +20,9 @@ using System.IO; using DotRecast.Core; using DotRecast.Detour.Io; -namespace DotRecast.Detour.Dynamic.Io; +namespace DotRecast.Detour.Dynamic.Io +{ + public class VoxelFileReader { @@ -123,3 +125,5 @@ public class VoxelFileReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs b/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs index 768e69d..d10f233 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs +++ b/src/DotRecast.Detour.Dynamic/Io/VoxelFileWriter.cs @@ -20,7 +20,9 @@ using System.IO; using DotRecast.Core; using DotRecast.Detour.Io; -namespace DotRecast.Detour.Dynamic.Io; +namespace DotRecast.Detour.Dynamic.Io +{ + public class VoxelFileWriter : DetourWriter { @@ -87,3 +89,5 @@ public class VoxelFileWriter : DetourWriter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelTile.cs b/src/DotRecast.Detour.Dynamic/Io/VoxelTile.cs index dd4d0c2..a902ae0 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelTile.cs +++ b/src/DotRecast.Detour.Dynamic/Io/VoxelTile.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using DotRecast.Core; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic.Io; +namespace DotRecast.Detour.Dynamic.Io +{ + public class VoxelTile { @@ -179,3 +181,5 @@ public class VoxelTile { return data; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs b/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs index 2053936..999410e 100644 --- a/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/RemoveColliderQueueItem.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour.Dynamic; +namespace DotRecast.Detour.Dynamic +{ + public class RemoveColliderQueueItem : UpdateQueueItem { @@ -39,3 +41,5 @@ public class RemoveColliderQueueItem : UpdateQueueItem { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/UpdateQueueItem.cs b/src/DotRecast.Detour.Dynamic/UpdateQueueItem.cs index 0385d7e..acd0020 100644 --- a/src/DotRecast.Detour.Dynamic/UpdateQueueItem.cs +++ b/src/DotRecast.Detour.Dynamic/UpdateQueueItem.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour.Dynamic; +namespace DotRecast.Detour.Dynamic +{ + public interface UpdateQueueItem { @@ -27,3 +29,5 @@ public interface UpdateQueueItem { void process(DynamicTile tile); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Dynamic/VoxelQuery.cs b/src/DotRecast.Detour.Dynamic/VoxelQuery.cs index 6814f93..e8db3a5 100644 --- a/src/DotRecast.Detour.Dynamic/VoxelQuery.cs +++ b/src/DotRecast.Detour.Dynamic/VoxelQuery.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Recast; -namespace DotRecast.Detour.Dynamic; +namespace DotRecast.Detour.Dynamic +{ + /** @@ -158,3 +160,5 @@ public class VoxelQuery { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/BVTreeBuilder.cs b/src/DotRecast.Detour.Extras/BVTreeBuilder.cs index 3c28eb7..0a41d5d 100644 --- a/src/DotRecast.Detour.Extras/BVTreeBuilder.cs +++ b/src/DotRecast.Detour.Extras/BVTreeBuilder.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using static DotRecast.Detour.DetourCommon; -namespace DotRecast.Detour.Extras; +namespace DotRecast.Detour.Extras +{ + public class BVTreeBuilder { @@ -53,3 +55,5 @@ public class BVTreeBuilder { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/DotRecast.Detour.Extras.csproj b/src/DotRecast.Detour.Extras/DotRecast.Detour.Extras.csproj index 1893aff..0a58b8c 100644 --- a/src/DotRecast.Detour.Extras/DotRecast.Detour.Extras.csproj +++ b/src/DotRecast.Detour.Extras/DotRecast.Detour.Extras.csproj @@ -1,8 +1,7 @@ - net7.0 - + netstandard2.1 diff --git a/src/DotRecast.Detour.Extras/Jumplink/AbstractGroundSampler.cs b/src/DotRecast.Detour.Extras/Jumplink/AbstractGroundSampler.cs index 8f7b136..b209038 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/AbstractGroundSampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/AbstractGroundSampler.cs @@ -3,7 +3,9 @@ using System; using DotRecast.Recast; using static DotRecast.Detour.DetourCommon; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public abstract class AbstractGroundSampler : GroundSampler { @@ -46,3 +48,5 @@ public abstract class AbstractGroundSampler : GroundSampler { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/ClimbTrajectory.cs b/src/DotRecast.Detour.Extras/Jumplink/ClimbTrajectory.cs index 1ea074e..1b993a7 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/ClimbTrajectory.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/ClimbTrajectory.cs @@ -1,6 +1,8 @@ using System; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class ClimbTrajectory : Trajectory { @@ -11,3 +13,5 @@ public class ClimbTrajectory : Trajectory { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/Edge.cs b/src/DotRecast.Detour.Extras/Jumplink/Edge.cs index 31c4eaa..58d1933 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/Edge.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/Edge.cs @@ -1,6 +1,10 @@ -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class Edge { public readonly float[] sp = new float[3]; public readonly float[] sq = new float[3]; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/EdgeExtractor.cs b/src/DotRecast.Detour.Extras/Jumplink/EdgeExtractor.cs index 6f4395e..0827f5a 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/EdgeExtractor.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/EdgeExtractor.cs @@ -3,11 +3,13 @@ using DotRecast.Recast; using static DotRecast.Recast.RecastConstants; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class EdgeExtractor { public Edge[] extractEdges(PolyMesh mesh) { - List edges = new(); + List edges = new List(); if (mesh != null) { float[] orig = mesh.bmin; float cs = mesh.cs; @@ -56,3 +58,5 @@ public class EdgeExtractor { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/EdgeSampler.cs b/src/DotRecast.Detour.Extras/Jumplink/EdgeSampler.cs index 167c946..eaf9259 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/EdgeSampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/EdgeSampler.cs @@ -2,11 +2,13 @@ using System.Collections.Generic; using static DotRecast.Detour.DetourCommon; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class EdgeSampler { public readonly GroundSegment start = new GroundSegment(); - public readonly List end = new(); + public readonly List end = new List(); public readonly Trajectory trajectory; public readonly float[] ax = new float[3]; @@ -23,3 +25,5 @@ public class EdgeSampler { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/EdgeSamplerFactory.cs b/src/DotRecast.Detour.Extras/Jumplink/EdgeSamplerFactory.cs index 60385a2..8db5176 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/EdgeSamplerFactory.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/EdgeSamplerFactory.cs @@ -1,6 +1,8 @@ using System; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + class EdgeSamplerFactory { @@ -77,3 +79,5 @@ class EdgeSamplerFactory { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/GroundSample.cs b/src/DotRecast.Detour.Extras/Jumplink/GroundSample.cs index d8a1244..95c09c8 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/GroundSample.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/GroundSample.cs @@ -1,7 +1,11 @@ -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class GroundSample { public readonly float[] p = new float[3]; public bool validTrajectory; public bool validHeight; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/GroundSampler.cs b/src/DotRecast.Detour.Extras/Jumplink/GroundSampler.cs index 55f495b..fc5a6e3 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/GroundSampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/GroundSampler.cs @@ -1,9 +1,13 @@ using DotRecast.Recast; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public interface GroundSampler { void sample(JumpLinkBuilderConfig acfg, RecastBuilderResult result, EdgeSampler es); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/GroundSegment.cs b/src/DotRecast.Detour.Extras/Jumplink/GroundSegment.cs index 19ef50e..7b64000 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/GroundSegment.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/GroundSegment.cs @@ -1,4 +1,6 @@ -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class GroundSegment { public readonly float[] p = new float[3]; @@ -7,3 +9,5 @@ public class GroundSegment { public float height; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpLink.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpLink.cs index b988844..0eb7f1f 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpLink.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpLink.cs @@ -1,4 +1,6 @@ -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class JumpLink { @@ -13,3 +15,5 @@ public class JumpLink { public Trajectory trajectory; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs index a0f43c8..4c842ee 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilder.cs @@ -5,7 +5,9 @@ using DotRecast.Core; using DotRecast.Recast; using static DotRecast.Detour.DetourCommon; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class JumpLinkBuilder { @@ -24,7 +26,7 @@ public class JumpLinkBuilder { } public List build(JumpLinkBuilderConfig acfg, JumpLinkType type) { - List links = new(); + List links = new List(); for (int tile = 0; tile < results.Count; tile++) { Edge[] edges = this.edges[tile]; foreach (Edge edge in edges) { @@ -44,7 +46,7 @@ public class JumpLinkBuilder { private List buildJumpLinks(JumpLinkBuilderConfig acfg, EdgeSampler es, JumpSegment[] jumpSegments) { - List links = new(); + List links = new List(); foreach (JumpSegment js in jumpSegments) { float[] sp = es.start.gsamples[js.startSample].p; float[] sq = es.start.gsamples[js.startSample + js.samples - 1].p; @@ -82,3 +84,5 @@ public class JumpLinkBuilder { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilderConfig.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilderConfig.cs index 8404d4a..28eb1b2 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilderConfig.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkBuilderConfig.cs @@ -1,4 +1,6 @@ -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class JumpLinkBuilderConfig { @@ -31,3 +33,5 @@ public class JumpLinkBuilderConfig { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkType.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkType.cs index 22af40a..23ecbb8 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpLinkType.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpLinkType.cs @@ -1,5 +1,8 @@ -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public enum JumpLinkType { EDGE_JUMP, EDGE_CLIMB_DOWN, EDGE_JUMP_OVER +} } \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpSegment.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpSegment.cs index c9f29b2..f76588f 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpSegment.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpSegment.cs @@ -1,7 +1,11 @@ -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class JumpSegment { public int groundSegment; public int startSample; public int samples; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpSegmentBuilder.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpSegmentBuilder.cs index 13674d1..6cbece4 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpSegmentBuilder.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpSegmentBuilder.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using DotRecast.Core; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + class JumpSegmentBuilder { @@ -93,3 +95,5 @@ class JumpSegmentBuilder { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/JumpTrajectory.cs b/src/DotRecast.Detour.Extras/Jumplink/JumpTrajectory.cs index 2275747..e7756e2 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/JumpTrajectory.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/JumpTrajectory.cs @@ -1,6 +1,8 @@ using System; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class JumpTrajectory : Trajectory { @@ -39,3 +41,5 @@ public class JumpTrajectory : Trajectory { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs b/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs index 80437f2..65a4318 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs @@ -2,7 +2,9 @@ using System; using DotRecast.Core; using DotRecast.Recast; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + class NavMeshGroundSampler : AbstractGroundSampler { @@ -89,3 +91,5 @@ class NavMeshGroundSampler : AbstractGroundSampler { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/Trajectory.cs b/src/DotRecast.Detour.Extras/Jumplink/Trajectory.cs index 9bfb787..49b2885 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/Trajectory.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/Trajectory.cs @@ -1,6 +1,8 @@ using System; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + public class Trajectory { @@ -14,3 +16,5 @@ public class Trajectory { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/TrajectorySampler.cs b/src/DotRecast.Detour.Extras/Jumplink/TrajectorySampler.cs index 7aacce5..a0f2928 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/TrajectorySampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/TrajectorySampler.cs @@ -2,7 +2,9 @@ using System; using DotRecast.Recast; using static DotRecast.Detour.DetourCommon; -namespace DotRecast.Detour.Extras.Jumplink; +namespace DotRecast.Detour.Extras.Jumplink +{ + class TrajectorySampler { @@ -74,3 +76,5 @@ class TrajectorySampler { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/ObjExporter.cs b/src/DotRecast.Detour.Extras/ObjExporter.cs index 0dadcd7..bd04776 100644 --- a/src/DotRecast.Detour.Extras/ObjExporter.cs +++ b/src/DotRecast.Detour.Extras/ObjExporter.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using System.IO; -namespace DotRecast.Detour.Extras; +namespace DotRecast.Detour.Extras +{ + public class ObjExporter { @@ -62,3 +64,5 @@ public class ObjExporter { */ } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/PolyUtils.cs b/src/DotRecast.Detour.Extras/PolyUtils.cs index a0928f7..c469fdb 100644 --- a/src/DotRecast.Detour.Extras/PolyUtils.cs +++ b/src/DotRecast.Detour.Extras/PolyUtils.cs @@ -15,7 +15,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Extras; +namespace DotRecast.Detour.Extras +{ + public class PolyUtils { @@ -78,3 +80,5 @@ public class PolyUtils { return edge; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/BVTreeCreator.cs b/src/DotRecast.Detour.Extras/Unity/Astar/BVTreeCreator.cs index 0ee68eb..2685c4c 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/BVTreeCreator.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/BVTreeCreator.cs @@ -15,7 +15,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class BVTreeCreator { @@ -28,3 +30,5 @@ public class BVTreeCreator { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/GraphConnectionReader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/GraphConnectionReader.cs index 593a18e..a06ac5d 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/GraphConnectionReader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/GraphConnectionReader.cs @@ -20,12 +20,14 @@ using System.Collections.Generic; using System.IO.Compression; using DotRecast.Core; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + class GraphConnectionReader : ZipBinaryReader { public List read(ZipArchive file, string filename, Meta meta, int[] indexToNode) { - List connections = new(); + List connections = new List(); ByteBuffer buffer = toByteBuffer(file, filename); while (buffer.remaining() > 0) { int count = buffer.getInt(); @@ -45,3 +47,5 @@ class GraphConnectionReader : ZipBinaryReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/GraphData.cs b/src/DotRecast.Detour.Extras/Unity/Astar/GraphData.cs index 6ee941b..320ccbc 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/GraphData.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/GraphData.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + @@ -42,3 +44,5 @@ public class GraphData { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshData.cs b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshData.cs index 70bfbb3..81a648b 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshData.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshData.cs @@ -15,7 +15,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class GraphMeshData { @@ -60,3 +62,5 @@ public class GraphMeshData { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshDataReader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshDataReader.cs index dd5ec1b..0196567 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshDataReader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshDataReader.cs @@ -21,7 +21,9 @@ using System.IO.Compression; using System.Numerics; using DotRecast.Core; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class GraphMeshDataReader : ZipBinaryReader { @@ -137,10 +139,20 @@ public class GraphMeshDataReader : ZipBinaryReader { return new GraphMeshData(tileXCount, tileZCount, tiles); } + public static int highestOneBit(uint i) + { + i |= (i >> 1); + i |= (i >> 2); + i |= (i >> 4); + i |= (i >> 8); + i |= (i >> 16); + return (int)(i - (i >> 1)); + } + // See NavmeshBase.cs: ASTAR_RECAST_LARGER_TILES private int getVertMask(int vertsCount) { - int vertMask = 1 << (BitOperations.Log2((uint)vertsCount) + 1); + int vertMask = 1 << highestOneBit((uint)vertsCount); if (vertMask != vertsCount) { vertMask *= 2; } @@ -149,3 +161,5 @@ public class GraphMeshDataReader : ZipBinaryReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeta.cs b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeta.cs index b146493..d313106 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeta.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeta.cs @@ -15,7 +15,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + @@ -37,3 +39,5 @@ public class GraphMeta { public Vector3f forcedBoundsCenter { get; set; } public Vector3f forcedBoundsSize { get; set; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMetaReader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMetaReader.cs index ced0868..6c180e4 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMetaReader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMetaReader.cs @@ -20,7 +20,9 @@ using System.IO; using System.IO.Compression; using System.Text.Json; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class GraphMetaReader { @@ -36,3 +38,5 @@ public class GraphMetaReader { return JsonSerializer.Deserialize(json, options); } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/LinkBuilder.cs b/src/DotRecast.Detour.Extras/Unity/Astar/LinkBuilder.cs index 3cf4629..92c9bc3 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/LinkBuilder.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/LinkBuilder.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class LinkBuilder { @@ -64,3 +66,5 @@ public class LinkBuilder { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/Meta.cs b/src/DotRecast.Detour.Extras/Unity/Astar/Meta.cs index d02fcbc..7bb0b70 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/Meta.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/Meta.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using System.Text.RegularExpressions; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class Meta { @@ -71,3 +73,5 @@ public class Meta { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/MetaReader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/MetaReader.cs index 0f32ce1..bd94b0b 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/MetaReader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/MetaReader.cs @@ -23,7 +23,9 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.RegularExpressions; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class MetaReader { @@ -52,3 +54,5 @@ public class MetaReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/NodeIndexReader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/NodeIndexReader.cs index 2bddae8..acb9e55 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/NodeIndexReader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/NodeIndexReader.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System.IO.Compression; using DotRecast.Core; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + class NodeIndexReader : ZipBinaryReader { @@ -36,3 +38,5 @@ class NodeIndexReader : ZipBinaryReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/NodeLink2.cs b/src/DotRecast.Detour.Extras/Unity/Astar/NodeLink2.cs index 3db34b0..c5e2b8d 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/NodeLink2.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/NodeLink2.cs @@ -15,7 +15,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class NodeLink2 { public readonly long linkID; @@ -33,3 +35,5 @@ public class NodeLink2 { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/NodeLink2Reader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/NodeLink2Reader.cs index 8e15e84..50fc6fe 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/NodeLink2Reader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/NodeLink2Reader.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System.IO.Compression; using DotRecast.Core; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class NodeLink2Reader : ZipBinaryReader { @@ -47,3 +49,5 @@ public class NodeLink2Reader : ZipBinaryReader { return links; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/OffMeshLinkCreator.cs b/src/DotRecast.Detour.Extras/Unity/Astar/OffMeshLinkCreator.cs index e1e1460..d7fbd07 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/OffMeshLinkCreator.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/OffMeshLinkCreator.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using DotRecast.Core; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class OffMeshLinkCreator { @@ -61,3 +63,5 @@ public class OffMeshLinkCreator { } } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/UnityAStarPathfindingImporter.cs b/src/DotRecast.Detour.Extras/Unity/Astar/UnityAStarPathfindingImporter.cs index d1889b2..c6e36e6 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/UnityAStarPathfindingImporter.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/UnityAStarPathfindingImporter.cs @@ -20,7 +20,9 @@ using System; using System.Collections.Generic; using System.IO; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + /** * Import navmeshes created with A* Pathfinding Project Unity plugin (https://arongranberg.com/astar/). Graph data is @@ -73,3 +75,5 @@ public class UnityAStarPathfindingImporter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/UnityAStarPathfindingReader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/UnityAStarPathfindingReader.cs index 45e59d9..b0e17c1 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/UnityAStarPathfindingReader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/UnityAStarPathfindingReader.cs @@ -20,7 +20,9 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public class UnityAStarPathfindingReader { @@ -47,9 +49,9 @@ public class UnityAStarPathfindingReader { // Read NodeLink2 data (off-mesh links) NodeLink2[] nodeLinks2 = nodeLink2Reader.read(file, NODE_LINK_2_FILE_NAME, indexToNode); // Read graph by graph - List metaList = new(); - List meshDataList = new(); - List> connectionsList = new(); + List metaList = new List(); + List meshDataList = new List(); + List> connectionsList = new List>(); for (int graphIndex = 0; graphIndex < meta.graphs; graphIndex++) { GraphMeta graphMeta = graphMetaReader.read(file, string.Format(GRAPH_META_FILE_NAME_PATTERN, graphIndex)); // First graph mesh data - vertices and polygons @@ -65,3 +67,5 @@ public class UnityAStarPathfindingReader { return new GraphData(meta, indexToNode, nodeLinks2, metaList, meshDataList, connectionsList); } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/ZipBinaryReader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/ZipBinaryReader.cs index 067f747..ff526b0 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/ZipBinaryReader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/ZipBinaryReader.cs @@ -21,7 +21,9 @@ using System.IO.Compression; using DotRecast.Core; using DotRecast.Detour.Io; -namespace DotRecast.Detour.Extras.Unity.Astar; +namespace DotRecast.Detour.Extras.Unity.Astar +{ + public abstract class ZipBinaryReader { @@ -35,3 +37,5 @@ public abstract class ZipBinaryReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Vector3f.cs b/src/DotRecast.Detour.Extras/Vector3f.cs index b2d8299..c9c1411 100644 --- a/src/DotRecast.Detour.Extras/Vector3f.cs +++ b/src/DotRecast.Detour.Extras/Vector3f.cs @@ -15,7 +15,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Extras; +namespace DotRecast.Detour.Extras +{ + public class Vector3f { @@ -33,3 +35,5 @@ public class Vector3f { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/AbstractTileLayersBuilder.cs b/src/DotRecast.Detour.TileCache/AbstractTileLayersBuilder.cs index 5bdc01a..ca23531 100644 --- a/src/DotRecast.Detour.TileCache/AbstractTileLayersBuilder.cs +++ b/src/DotRecast.Detour.TileCache/AbstractTileLayersBuilder.cs @@ -25,7 +25,9 @@ using System.Linq; using System.Threading.Tasks; using DotRecast.Core; -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public abstract class AbstractTileLayersBuilder { @@ -37,7 +39,7 @@ public abstract class AbstractTileLayersBuilder { } private List buildSingleThread(ByteOrder order, bool cCompatibility, int tw, int th) { - List layers = new(); + List layers = new List(); for (int y = 0; y < th; ++y) { for (int x = 0; x < tw; ++x) { layers.AddRange(build(x, y, order, cCompatibility)); @@ -64,7 +66,7 @@ public abstract class AbstractTileLayersBuilder { .Select(x => x.Result) .ToDictionary(x => Tuple.Create(x.Item1, x.Item2), x => x.Item3); - List layers = new(); + List layers = new List(); for (int y = 0; y < th; ++y) { for (int x = 0; x < tw; ++x) { var key = Tuple.Create(x, y); @@ -76,3 +78,5 @@ public abstract class AbstractTileLayersBuilder { protected abstract List build(int tx, int ty, ByteOrder order, bool cCompatibility); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/CompressedTile.cs b/src/DotRecast.Detour.TileCache/CompressedTile.cs index 905ec7d..372d7e0 100644 --- a/src/DotRecast.Detour.TileCache/CompressedTile.cs +++ b/src/DotRecast.Detour.TileCache/CompressedTile.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class CompressedTile { public readonly int index; @@ -33,3 +35,5 @@ public class CompressedTile { salt = 1; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/DotRecast.Detour.TileCache.csproj b/src/DotRecast.Detour.TileCache/DotRecast.Detour.TileCache.csproj index 009c40d..1ca182e 100644 --- a/src/DotRecast.Detour.TileCache/DotRecast.Detour.TileCache.csproj +++ b/src/DotRecast.Detour.TileCache/DotRecast.Detour.TileCache.csproj @@ -1,7 +1,7 @@ - net7.0 + netstandard2.1 diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/FastLz.cs b/src/DotRecast.Detour.TileCache/Io/Compress/FastLz.cs index 5588f5c..ed02d48 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/FastLz.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/FastLz.cs @@ -16,7 +16,9 @@ using System; -namespace DotRecast.Detour.TileCache.Io.Compress; +namespace DotRecast.Detour.TileCache.Io.Compress +{ + /** * Core of FastLZ compression algorithm. @@ -311,10 +313,10 @@ public class FastLz { if (level == LEVEL_2) { if (distance < MAX_DISTANCE) { if (len < 7) { - output[outOffset + op++] = (byte) ((len << 5) + (distance >>> 8)); + output[outOffset + op++] = (byte) ((len << 5) + (int)((ulong)distance >> 8)); output[outOffset + op++] = (byte) (distance & 255); } else { - output[outOffset + op++] = (byte) ((7 << 5) + (distance >>> 8)); + output[outOffset + op++] = (byte) ((7 << 5) + ((ulong)distance >> 8)); for (len -= 7; len >= 255; len -= 255) { output[outOffset + op++] = (byte) 255; } @@ -327,7 +329,7 @@ public class FastLz { distance -= MAX_DISTANCE; output[outOffset + op++] = (byte) ((len << 5) + 31); output[outOffset + op++] = (byte) 255; - output[outOffset + op++] = (byte) (distance >>> 8); + output[outOffset + op++] = (byte) ((ulong)distance >> 8); output[outOffset + op++] = (byte) (distance & 255); } else { distance -= MAX_DISTANCE; @@ -337,14 +339,14 @@ public class FastLz { } output[outOffset + op++] = (byte) len; output[outOffset + op++] = (byte) 255; - output[outOffset + op++] = (byte) (distance >>> 8); + output[outOffset + op++] = (byte) ((ulong)distance >> 8); output[outOffset + op++] = (byte) (distance & 255); } } } else { if (len > MAX_LEN - 2) { while (len > MAX_LEN - 2) { - output[outOffset + op++] = (byte) ((7 << 5) + (distance >>> 8)); + output[outOffset + op++] = (byte) ((7 << 5) + ((ulong)distance >> 8)); output[outOffset + op++] = (byte) (MAX_LEN - 2 - 7 - 2); output[outOffset + op++] = (byte) (distance & 255); len -= MAX_LEN - 2; @@ -352,10 +354,10 @@ public class FastLz { } if (len < 7) { - output[outOffset + op++] = (byte) ((len << 5) + (distance >>> 8)); + output[outOffset + op++] = (byte) ((len << 5) + (int)((ulong)distance >> 8)); output[outOffset + op++] = (byte) (distance & 255); } else { - output[outOffset + op++] = (byte) ((7 << 5) + (distance >>> 8)); + output[outOffset + op++] = (byte) ((7 << 5) + (int)((ulong)distance >> 8)); output[outOffset + op++] = (byte) (len - 7); output[outOffset + op++] = (byte) (distance & 255); } @@ -573,4 +575,5 @@ public class FastLz { } private FastLz() { } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs b/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs index 0c520b4..5250d00 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/FastLzTileCacheCompressor.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using DotRecast.Core; using K4os.Compression.LZ4; -namespace DotRecast.Detour.TileCache.Io.Compress; +namespace DotRecast.Detour.TileCache.Io.Compress +{ + public class FastLzTileCacheCompressor : TileCacheCompressor { @@ -38,3 +40,5 @@ public class FastLzTileCacheCompressor : TileCacheCompressor { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs b/src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs index afca03a..40c1619 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/LZ4TileCacheCompressor.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using K4os.Compression.LZ4; -namespace DotRecast.Detour.TileCache.Io.Compress; +namespace DotRecast.Detour.TileCache.Io.Compress +{ + public class LZ4TileCacheCompressor : TileCacheCompressor { @@ -33,3 +35,5 @@ public class LZ4TileCacheCompressor : TileCacheCompressor { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs b/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs index b411084..e1e8bef 100644 --- a/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs +++ b/src/DotRecast.Detour.TileCache/Io/Compress/TileCacheCompressorFactory.cs @@ -17,13 +17,21 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache.Io.Compress; +namespace DotRecast.Detour.TileCache.Io.Compress +{ + public class TileCacheCompressorFactory { - public static TileCacheCompressor get(bool cCompatibility) { - return cCompatibility ? new FastLzTileCacheCompressor() : new LZ4TileCacheCompressor(); + public static TileCacheCompressor get(bool cCompatibility) + { + if (cCompatibility) + return new FastLzTileCacheCompressor(); + + return new LZ4TileCacheCompressor(); } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs index c745637..68611e6 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System.IO; using DotRecast.Core; -namespace DotRecast.Detour.TileCache.Io; +namespace DotRecast.Detour.TileCache.Io +{ + public class TileCacheLayerHeaderReader { @@ -59,3 +61,5 @@ public class TileCacheLayerHeaderReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs index 64fddd4..b9d7790 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs @@ -22,7 +22,9 @@ using System.IO; using DotRecast.Core; using DotRecast.Detour.Io; -namespace DotRecast.Detour.TileCache.Io; +namespace DotRecast.Detour.TileCache.Io +{ + public class TileCacheLayerHeaderWriter : DetourWriter { @@ -52,3 +54,5 @@ public class TileCacheLayerHeaderWriter : DetourWriter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs index 166ba3b..a24820e 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs @@ -23,7 +23,9 @@ using DotRecast.Core; using DotRecast.Detour.Io; using DotRecast.Detour.TileCache.Io.Compress; -namespace DotRecast.Detour.TileCache.Io; +namespace DotRecast.Detour.TileCache.Io +{ + public class TileCacheReader { @@ -93,3 +95,5 @@ public class TileCacheReader { return option; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheSetHeader.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheSetHeader.cs index 036e762..49f7a78 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheSetHeader.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheSetHeader.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache.Io; +namespace DotRecast.Detour.TileCache.Io +{ + public class TileCacheSetHeader { @@ -32,3 +34,5 @@ public class TileCacheSetHeader { public TileCacheParams cacheParams = new TileCacheParams(); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs index bcae6b6..8b4ce51 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs @@ -22,7 +22,9 @@ using System.IO; using DotRecast.Core; using DotRecast.Detour.Io; -namespace DotRecast.Detour.TileCache.Io; +namespace DotRecast.Detour.TileCache.Io +{ + public class TileCacheWriter : DetourWriter { @@ -73,3 +75,5 @@ public class TileCacheWriter : DetourWriter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/ObstacleRequest.cs b/src/DotRecast.Detour.TileCache/ObstacleRequest.cs index 4162adc..773a28d 100644 --- a/src/DotRecast.Detour.TileCache/ObstacleRequest.cs +++ b/src/DotRecast.Detour.TileCache/ObstacleRequest.cs @@ -17,9 +17,13 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class ObstacleRequest { public ObstacleRequestAction action; public long refs; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/ObstacleRequestAction.cs b/src/DotRecast.Detour.TileCache/ObstacleRequestAction.cs index ef7b850..875fad9 100644 --- a/src/DotRecast.Detour.TileCache/ObstacleRequestAction.cs +++ b/src/DotRecast.Detour.TileCache/ObstacleRequestAction.cs @@ -17,8 +17,12 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public enum ObstacleRequestAction { REQUEST_ADD, REQUEST_REMOVE } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/ObstacleState.cs b/src/DotRecast.Detour.TileCache/ObstacleState.cs index abc5fb3..95722b2 100644 --- a/src/DotRecast.Detour.TileCache/ObstacleState.cs +++ b/src/DotRecast.Detour.TileCache/ObstacleState.cs @@ -17,9 +17,13 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public enum ObstacleState { DT_OBSTACLE_EMPTY, DT_OBSTACLE_PROCESSING, DT_OBSTACLE_PROCESSED, DT_OBSTACLE_REMOVING } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCache.cs b/src/DotRecast.Detour.TileCache/TileCache.cs index 9957083..5ba9184 100644 --- a/src/DotRecast.Detour.TileCache/TileCache.cs +++ b/src/DotRecast.Detour.TileCache/TileCache.cs @@ -25,7 +25,9 @@ using DotRecast.Detour.TileCache.Io; using static DotRecast.Detour.DetourCommon; -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCache { @@ -46,11 +48,11 @@ public class TileCache { private readonly TileCacheCompressor m_tcomp; private readonly TileCacheMeshProcess m_tmproc; - private readonly List m_obstacles = new(); + private readonly List m_obstacles = new List(); private TileCacheObstacle m_nextFreeObstacle; - private readonly List m_reqs = new(); - private readonly List m_update = new(); + private readonly List m_reqs = new List(); + private readonly List m_update = new List(); private readonly TileCacheBuilder builder = new TileCacheBuilder(); private readonly TileCacheLayerHeaderReader tileReader = new TileCacheLayerHeaderReader(); @@ -137,7 +139,7 @@ public class TileCache { } public List getTilesAt(int tx, int ty) { - List tiles = new(); + List tiles = new List(); // Find tile based on hash. int h = NavMesh.computeTileHash(tx, ty, m_tileLutMask); @@ -357,7 +359,7 @@ public class TileCache { } List queryTiles(float[] bmin, float[] bmax) { - List results = new(); + List results = new List(); float tw = m_params.width * m_params.cs; float th = m_params.height * m_params.cs; int tx0 = (int) Math.Floor((bmin[0] - m_params.orig[0]) / tw); @@ -603,3 +605,5 @@ public class TileCache { return m_navmesh; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs b/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs index 294ddba..fae9cc8 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs @@ -26,7 +26,9 @@ using DotRecast.Detour.TileCache.Io; using DotRecast.Detour.TileCache.Io.Compress; using static DotRecast.Detour.DetourCommon; -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCacheBuilder { @@ -42,7 +44,7 @@ public class TileCacheBuilder { public class LayerMonotoneRegion { public int area; - public List neis = new(16); + public List neis = new List(16); public int regId; public int areaId; }; @@ -53,9 +55,9 @@ public class TileCacheBuilder { public List poly; public TempContour() { - verts = new(); + verts = new List(); nverts = 0; - poly = new(); + poly = new List(); } public int npoly() { @@ -1195,7 +1197,7 @@ public class TileCacheBuilder { return false; // Find edges which share the removed vertex. - List edges = new(); + List edges = new List(); int nedges = 0; for (int i = 0; i < mesh.npolys; ++i) { @@ -1262,10 +1264,10 @@ public class TileCacheBuilder { } int nedges = 0; - List edges = new(); + List edges = new List(); int nhole = 0; - List hole = new(); - List harea = new(); + List hole = new List(); + List harea = new List(); for (int i = 0; i < mesh.npolys; ++i) { int p = i * maxVertsPerPoly * 2; @@ -1841,3 +1843,5 @@ public class TileCacheBuilder { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheCompressor.cs b/src/DotRecast.Detour.TileCache/TileCacheCompressor.cs index e662b49..79bb9ae 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheCompressor.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheCompressor.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public interface TileCacheCompressor { @@ -25,3 +27,5 @@ public interface TileCacheCompressor { byte[] compress(byte[] buf); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheContour.cs b/src/DotRecast.Detour.TileCache/TileCacheContour.cs index 976419b..c7b5532 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheContour.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheContour.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCacheContour { public int nverts; @@ -25,3 +27,5 @@ public class TileCacheContour { public int reg; public int area; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheContourSet.cs b/src/DotRecast.Detour.TileCache/TileCacheContourSet.cs index 5ef6a61..426954f 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheContourSet.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheContourSet.cs @@ -17,9 +17,13 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCacheContourSet { public int nconts; public TileCacheContour[] conts; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheLayer.cs b/src/DotRecast.Detour.TileCache/TileCacheLayer.cs index a0c5ac1..6af1bc6 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheLayer.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheLayer.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCacheLayer { public TileCacheLayerHeader header; @@ -27,3 +29,5 @@ public class TileCacheLayer { public short[] cons; // char public short[] regs; // char } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheLayerHeader.cs b/src/DotRecast.Detour.TileCache/TileCacheLayerHeader.cs index 970518f..379a457 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheLayerHeader.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheLayerHeader.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCacheLayerHeader { @@ -34,3 +36,5 @@ public class TileCacheLayerHeader { public int minx, maxx, miny, maxy; /// < Usable sub-region. } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheMeshProcess.cs b/src/DotRecast.Detour.TileCache/TileCacheMeshProcess.cs index eb7310d..d6e2565 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheMeshProcess.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheMeshProcess.cs @@ -17,9 +17,13 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public interface TileCacheMeshProcess { void process(NavMeshDataCreateParams option); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs b/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs index 056ab84..6b619c8 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCacheObstacle { @@ -37,8 +39,8 @@ public class TileCacheObstacle { public readonly float[] center = new float[3]; public readonly float[] extents = new float[3]; public readonly float[] rotAux = new float[2]; // { cos(0.5f*angle)*sin(-0.5f*angle); cos(0.5f*angle)*cos(0.5f*angle) - 0.5 } - public List touched = new(); - public readonly List pending = new(); + public List touched = new List(); + public readonly List pending = new List(); public int salt; public ObstacleState state = ObstacleState.DT_OBSTACLE_EMPTY; public TileCacheObstacle next; @@ -49,3 +51,5 @@ public class TileCacheObstacle { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheParams.cs b/src/DotRecast.Detour.TileCache/TileCacheParams.cs index 58624df..aaa96ff 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheParams.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheParams.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCacheParams { public readonly float[] orig = new float[3]; @@ -31,3 +33,5 @@ public class TileCacheParams { public int maxObstacles; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCachePolyMesh.cs b/src/DotRecast.Detour.TileCache/TileCachePolyMesh.cs index ea6ea6c..b6e98c9 100644 --- a/src/DotRecast.Detour.TileCache/TileCachePolyMesh.cs +++ b/src/DotRecast.Detour.TileCache/TileCachePolyMesh.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCachePolyMesh { public int nvp; @@ -32,3 +34,5 @@ public class TileCachePolyMesh { this.nvp = nvp; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCacheStorageParams.cs b/src/DotRecast.Detour.TileCache/TileCacheStorageParams.cs index 05ca6db..1fc7a7a 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheStorageParams.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheStorageParams.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using DotRecast.Core; -namespace DotRecast.Detour.TileCache; +namespace DotRecast.Detour.TileCache +{ + public class TileCacheStorageParams { @@ -33,3 +35,5 @@ public class TileCacheStorageParams { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/BVNode.cs b/src/DotRecast.Detour/BVNode.cs index da55ab6..a4e2c09 100644 --- a/src/DotRecast.Detour/BVNode.cs +++ b/src/DotRecast.Detour/BVNode.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** * Bounding volume node. @@ -33,3 +35,5 @@ public class BVNode { /** The node's index. (Negative for escape sequence.) */ public int i; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/ClosestPointOnPolyResult.cs b/src/DotRecast.Detour/ClosestPointOnPolyResult.cs index 2281e47..f877d10 100644 --- a/src/DotRecast.Detour/ClosestPointOnPolyResult.cs +++ b/src/DotRecast.Detour/ClosestPointOnPolyResult.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class ClosestPointOnPolyResult { @@ -40,3 +42,5 @@ public class ClosestPointOnPolyResult { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/ConvexConvexIntersection.cs b/src/DotRecast.Detour/ConvexConvexIntersection.cs index fc05351..1e75653 100644 --- a/src/DotRecast.Detour/ConvexConvexIntersection.cs +++ b/src/DotRecast.Detour/ConvexConvexIntersection.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -235,3 +237,5 @@ public static class ConvexConvexIntersection { } } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/DefaultQueryFilter.cs b/src/DotRecast.Detour/DefaultQueryFilter.cs index bd67d45..8710e17 100644 --- a/src/DotRecast.Detour/DefaultQueryFilter.cs +++ b/src/DotRecast.Detour/DefaultQueryFilter.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -100,3 +102,5 @@ public class DefaultQueryFilter : QueryFilter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/DefaultQueryHeuristic.cs b/src/DotRecast.Detour/DefaultQueryHeuristic.cs index ef66e25..eeba753 100644 --- a/src/DotRecast.Detour/DefaultQueryHeuristic.cs +++ b/src/DotRecast.Detour/DefaultQueryHeuristic.cs @@ -16,7 +16,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -37,3 +39,5 @@ public class DefaultQueryHeuristic : QueryHeuristic { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/DetourBuilder.cs b/src/DotRecast.Detour/DetourBuilder.cs index 171bce9..0285366 100644 --- a/src/DotRecast.Detour/DetourBuilder.cs +++ b/src/DotRecast.Detour/DetourBuilder.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class DetourBuilder { @@ -30,3 +32,5 @@ public class DetourBuilder { return data; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/DetourCommon.cs b/src/DotRecast.Detour/DetourCommon.cs index f9ae688..5b33eb8 100644 --- a/src/DotRecast.Detour/DetourCommon.cs +++ b/src/DotRecast.Detour/DetourCommon.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public static class DetourCommon { @@ -635,3 +637,5 @@ public static class DetourCommon { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/DotRecast.Detour.csproj b/src/DotRecast.Detour/DotRecast.Detour.csproj index 561560c..2a0ba3b 100644 --- a/src/DotRecast.Detour/DotRecast.Detour.csproj +++ b/src/DotRecast.Detour/DotRecast.Detour.csproj @@ -1,7 +1,7 @@ - net7.0 + netstandard2.1 diff --git a/src/DotRecast.Detour/FindDistanceToWallResult.cs b/src/DotRecast.Detour/FindDistanceToWallResult.cs index 84f82b4..34be776 100644 --- a/src/DotRecast.Detour/FindDistanceToWallResult.cs +++ b/src/DotRecast.Detour/FindDistanceToWallResult.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + //TODO: (PP) Add comments public class FindDistanceToWallResult { @@ -43,4 +45,5 @@ public class FindDistanceToWallResult { return normal; } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/FindLocalNeighbourhoodResult.cs b/src/DotRecast.Detour/FindLocalNeighbourhoodResult.cs index 235c668..122bdd6 100644 --- a/src/DotRecast.Detour/FindLocalNeighbourhoodResult.cs +++ b/src/DotRecast.Detour/FindLocalNeighbourhoodResult.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + //TODO: (PP) Add comments public class FindLocalNeighbourhoodResult { @@ -40,4 +42,5 @@ public class FindLocalNeighbourhoodResult { return parentRefs; } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/FindNearestPolyQuery.cs b/src/DotRecast.Detour/FindNearestPolyQuery.cs index c47f75a..ccbd922 100644 --- a/src/DotRecast.Detour/FindNearestPolyQuery.cs +++ b/src/DotRecast.Detour/FindNearestPolyQuery.cs @@ -1,6 +1,8 @@ using System; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -51,3 +53,5 @@ public class FindNearestPolyQuery : PolyQuery { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/FindNearestPolyResult.cs b/src/DotRecast.Detour/FindNearestPolyResult.cs index dd45c3b..c2949af 100644 --- a/src/DotRecast.Detour/FindNearestPolyResult.cs +++ b/src/DotRecast.Detour/FindNearestPolyResult.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class FindNearestPolyResult { private readonly long nearestRef; @@ -45,3 +47,5 @@ public class FindNearestPolyResult { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/FindPolysAroundResult.cs b/src/DotRecast.Detour/FindPolysAroundResult.cs index d848d81..75196ce 100644 --- a/src/DotRecast.Detour/FindPolysAroundResult.cs +++ b/src/DotRecast.Detour/FindPolysAroundResult.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + // TODO: (PP) Add comments @@ -47,4 +49,5 @@ public class FindPolysAroundResult { return costs; } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/FindRandomPointResult.cs b/src/DotRecast.Detour/FindRandomPointResult.cs index 5c2cbc9..db295e3 100644 --- a/src/DotRecast.Detour/FindRandomPointResult.cs +++ b/src/DotRecast.Detour/FindRandomPointResult.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + //TODO: (PP) Add comments public class FindRandomPointResult { @@ -39,4 +41,5 @@ public class FindRandomPointResult { return randomPt; } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/GetPolyWallSegmentsResult.cs b/src/DotRecast.Detour/GetPolyWallSegmentsResult.cs index e466417..7f7bef2 100644 --- a/src/DotRecast.Detour/GetPolyWallSegmentsResult.cs +++ b/src/DotRecast.Detour/GetPolyWallSegmentsResult.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class GetPolyWallSegmentsResult { @@ -42,3 +44,5 @@ public class GetPolyWallSegmentsResult { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/DetourWriter.cs b/src/DotRecast.Detour/Io/DetourWriter.cs index 6fb490b..da411c8 100644 --- a/src/DotRecast.Detour/Io/DetourWriter.cs +++ b/src/DotRecast.Detour/Io/DetourWriter.cs @@ -20,7 +20,9 @@ using System; using System.IO; using DotRecast.Core; -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public abstract class DetourWriter { @@ -42,11 +44,11 @@ public abstract class DetourWriter { protected void write(BinaryWriter stream, long value, ByteOrder order) { if (order == ByteOrder.BIG_ENDIAN) { - write(stream, (int) (value >>> 32), order); + write(stream, (int) ((ulong)value >> 32), order); write(stream, (int) (value & 0xFFFFFFFF), order); } else { write(stream, (int) (value & 0xFFFFFFFF), order); - write(stream, (int) (value >>> 32), order); + write(stream, (int) ((ulong)value >> 32), order); } } @@ -80,3 +82,5 @@ public abstract class DetourWriter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/IOUtils.cs b/src/DotRecast.Detour/Io/IOUtils.cs index 76a65ad..85986a6 100644 --- a/src/DotRecast.Detour/Io/IOUtils.cs +++ b/src/DotRecast.Detour/Io/IOUtils.cs @@ -20,7 +20,9 @@ using System; using System.IO; using DotRecast.Core; -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public static class IOUtils { @@ -51,8 +53,11 @@ public static class IOUtils { return new ByteBuffer(bytes); } - public static int swapEndianness(int i) { - var s = ((i >>> 24) & 0xFF) | ((i>>8) & 0xFF00) | ((i<<8) & 0xFF0000) | ((i << 24) & 0xFF000000); + public static int swapEndianness(int i) + { + var s = (((uint)i >> 24) & 0xFF) | (((uint)i>>8) & 0xFF00) | (((uint)i<<8) & 0xFF0000) | ((i << 24) & 0xFF000000); return (int)s; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/MeshDataReader.cs b/src/DotRecast.Detour/Io/MeshDataReader.cs index 75654a3..5f297e0 100644 --- a/src/DotRecast.Detour/Io/MeshDataReader.cs +++ b/src/DotRecast.Detour/Io/MeshDataReader.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System.IO; using DotRecast.Core; -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public class MeshDataReader { @@ -199,3 +201,5 @@ public class MeshDataReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/MeshDataWriter.cs b/src/DotRecast.Detour/Io/MeshDataWriter.cs index 0416eee..69f58b4 100644 --- a/src/DotRecast.Detour/Io/MeshDataWriter.cs +++ b/src/DotRecast.Detour/Io/MeshDataWriter.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System.IO; using DotRecast.Core; -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public class MeshDataWriter : DetourWriter { @@ -140,3 +142,5 @@ public class MeshDataWriter : DetourWriter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/MeshSetReader.cs b/src/DotRecast.Detour/Io/MeshSetReader.cs index 1dc92d0..b1b8a80 100644 --- a/src/DotRecast.Detour/Io/MeshSetReader.cs +++ b/src/DotRecast.Detour/Io/MeshSetReader.cs @@ -20,7 +20,9 @@ using System; using System.IO; using DotRecast.Core; -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + using static DetourCommon; @@ -125,3 +127,5 @@ public class MeshSetReader { return NavMesh.encodePolyId(salt, it, ip); } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/MeshSetWriter.cs b/src/DotRecast.Detour/Io/MeshSetWriter.cs index d0135d0..b3dacbc 100644 --- a/src/DotRecast.Detour/Io/MeshSetWriter.cs +++ b/src/DotRecast.Detour/Io/MeshSetWriter.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System.IO; using DotRecast.Core; -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public class MeshSetWriter : DetourWriter { @@ -76,3 +78,5 @@ public class MeshSetWriter : DetourWriter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/NavMeshParamReader.cs b/src/DotRecast.Detour/Io/NavMeshParamReader.cs index 54e39a9..a28f0b0 100644 --- a/src/DotRecast.Detour/Io/NavMeshParamReader.cs +++ b/src/DotRecast.Detour/Io/NavMeshParamReader.cs @@ -1,6 +1,8 @@ using DotRecast.Core; -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public class NavMeshParamReader { @@ -17,3 +19,5 @@ public class NavMeshParamReader { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/NavMeshParamWriter.cs b/src/DotRecast.Detour/Io/NavMeshParamWriter.cs index 8fac183..8f0fc65 100644 --- a/src/DotRecast.Detour/Io/NavMeshParamWriter.cs +++ b/src/DotRecast.Detour/Io/NavMeshParamWriter.cs @@ -1,7 +1,9 @@ using System.IO; using DotRecast.Core; -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public class NavMeshParamWriter : DetourWriter { @@ -16,3 +18,5 @@ public class NavMeshParamWriter : DetourWriter { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/NavMeshSetHeader.cs b/src/DotRecast.Detour/Io/NavMeshSetHeader.cs index ab2fc44..e2480e7 100644 --- a/src/DotRecast.Detour/Io/NavMeshSetHeader.cs +++ b/src/DotRecast.Detour/Io/NavMeshSetHeader.cs @@ -15,7 +15,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public class NavMeshSetHeader { @@ -31,3 +33,5 @@ public class NavMeshSetHeader { public int maxVertsPerPoly; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Io/NavMeshTileHeader.cs b/src/DotRecast.Detour/Io/NavMeshTileHeader.cs index 3613c3f..69f70cd 100644 --- a/src/DotRecast.Detour/Io/NavMeshTileHeader.cs +++ b/src/DotRecast.Detour/Io/NavMeshTileHeader.cs @@ -1,6 +1,10 @@ -namespace DotRecast.Detour.Io; +namespace DotRecast.Detour.Io +{ + public class NavMeshTileHeader { public long tileRef; public int dataSize; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/LegacyNavMeshQuery.cs b/src/DotRecast.Detour/LegacyNavMeshQuery.cs index e11bc0a..0ab6cc1 100644 --- a/src/DotRecast.Detour/LegacyNavMeshQuery.cs +++ b/src/DotRecast.Detour/LegacyNavMeshQuery.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -45,7 +47,7 @@ public class LegacyNavMeshQuery : NavMeshQuery { } if (startRef == endRef) { - List singlePath = new(1); + List singlePath = new List(1); singlePath.Add(startRef); return Results.success(singlePath); } @@ -412,7 +414,7 @@ public class LegacyNavMeshQuery : NavMeshQuery { /// @returns The status flags for the query. public override Result> finalizeSlicedFindPath() { - List path = new(64); + List path = new List(64); if (m_query.status.isFailed()) { // Reset query. m_query = new QueryData(); @@ -480,7 +482,7 @@ public class LegacyNavMeshQuery : NavMeshQuery { /// @returns The status flags for the query. public override Result> finalizeSlicedFindPathPartial(List existing) { - List path = new(64); + List path = new List(64); if (null == existing || existing.Count <= 0) { return Results.failure(path); } @@ -728,3 +730,5 @@ public class LegacyNavMeshQuery : NavMeshQuery { return Results.success(new FindDistanceToWallResult((float) Math.Sqrt(radiusSqr), hitPos, hitNormal)); } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Link.cs b/src/DotRecast.Detour/Link.cs index bf6fc85..7d3a400 100644 --- a/src/DotRecast.Detour/Link.cs +++ b/src/DotRecast.Detour/Link.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** * Defines a link between polygons. @@ -40,3 +42,5 @@ public class Link { public int bmax; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/MeshData.cs b/src/DotRecast.Detour/MeshData.cs index 1e96e1e..8282fe4 100644 --- a/src/DotRecast.Detour/MeshData.cs +++ b/src/DotRecast.Detour/MeshData.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class MeshData { @@ -43,4 +45,5 @@ public class MeshData { /** The tile off-mesh connections. [Size: MeshHeader::offMeshConCount] */ public OffMeshConnection[] offMeshCons; +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/MeshHeader.cs b/src/DotRecast.Detour/MeshHeader.cs index 1c36c14..df9911b 100644 --- a/src/DotRecast.Detour/MeshHeader.cs +++ b/src/DotRecast.Detour/MeshHeader.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** Provides high level information related to a dtMeshTile object. */ public class MeshHeader { @@ -77,3 +79,5 @@ public class MeshHeader { /** The bounding volume quantization factor. */ public float bvQuantFactor; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/MeshTile.cs b/src/DotRecast.Detour/MeshTile.cs index 2c63ed9..e34d49e 100644 --- a/src/DotRecast.Detour/MeshTile.cs +++ b/src/DotRecast.Detour/MeshTile.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** * Defines a navigation mesh tile. @@ -33,7 +35,7 @@ public class MeshTile { public MeshData data; public int[] polyLinks; /** The tile links. */ - public readonly List links = new(); + public readonly List links = new List(); /** Index to the next free link. */ public int linksFreeList = NavMesh.DT_NULL_LINK; // FIXME: Remove /** Tile flags. (See: #dtTileFlags) */ @@ -44,3 +46,5 @@ public class MeshTile { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/MoveAlongSurfaceResult.cs b/src/DotRecast.Detour/MoveAlongSurfaceResult.cs index bff157d..5526fe0 100644 --- a/src/DotRecast.Detour/MoveAlongSurfaceResult.cs +++ b/src/DotRecast.Detour/MoveAlongSurfaceResult.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class MoveAlongSurfaceResult { @@ -44,3 +46,5 @@ public class MoveAlongSurfaceResult { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/NavMesh.cs b/src/DotRecast.Detour/NavMesh.cs index 27e7985..26e3562 100644 --- a/src/DotRecast.Detour/NavMesh.cs +++ b/src/DotRecast.Detour/NavMesh.cs @@ -23,7 +23,9 @@ using System.Collections.Generic; using System.Collections.Immutable; using DotRecast.Core; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -58,8 +60,8 @@ public class NavMesh { float m_tileWidth, m_tileHeight; /// < Dimensions of each tile. int m_maxTiles; /// < Max number of tiles. private readonly int m_tileLutMask; /// < Tile hash lookup mask. - private readonly Dictionary> posLookup = new(); - private readonly LinkedList availableTiles = new(); + private readonly Dictionary> posLookup = new Dictionary>(); + private readonly LinkedList availableTiles = new LinkedList(); private readonly MeshTile[] m_tiles; /// < List of tiles. /** The maximum number of vertices per navigation polygon. */ private readonly int m_maxVertPerPoly; @@ -285,7 +287,7 @@ public class NavMesh { // for off-mesh connection finding. List queryPolygonsInTile(MeshTile tile, float[] qmin, float[] qmax) { - List polys = new(); + List polys = new List(); if (tile.data.bvTree != null) { int nodeIndex = 0; float[] tbmin = tile.data.header.bmin; @@ -756,7 +758,7 @@ public class NavMesh { if (tile == null) { return ImmutableArray>.Empty; } - List> result = new(); + List> result = new List>(); float[] amin = new float[2]; float[] amax = new float[2]; calcSlabEndPoints(verts, va, vb, amin, amax, side); @@ -1195,7 +1197,7 @@ public class NavMesh { } public List getTilesAt(int x, int y) { - List tiles = new(); + List tiles = new List(); foreach (MeshTile tile in getTileListByPos(x, y)) { if (tile.data.header != null && tile.data.header.x == x && tile.data.header.y == y) { tiles.Add(tile); @@ -1418,10 +1420,12 @@ public class NavMesh { var tileHash = computeTileHash(x, z, m_tileLutMask); if (!posLookup.TryGetValue(tileHash, out var tiles)) { - tiles = new(); + tiles = new List(); posLookup.Add(tileHash, tiles); } return tiles; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/NavMeshBuilder.cs b/src/DotRecast.Detour/NavMeshBuilder.cs index 2212787..c9bfdc6 100644 --- a/src/DotRecast.Detour/NavMeshBuilder.cs +++ b/src/DotRecast.Detour/NavMeshBuilder.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -600,3 +602,5 @@ public class NavMeshBuilder { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/NavMeshDataCreateParams.cs b/src/DotRecast.Detour/NavMeshDataCreateParams.cs index 285dd02..e285ce0 100644 --- a/src/DotRecast.Detour/NavMeshDataCreateParams.cs +++ b/src/DotRecast.Detour/NavMeshDataCreateParams.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /// Represents the source data used to build an navigation mesh tile. public class NavMeshDataCreateParams { @@ -99,4 +101,5 @@ public class NavMeshDataCreateParams { /// @} +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/NavMeshParams.cs b/src/DotRecast.Detour/NavMeshParams.cs index 79ac3b3..50daa72 100644 --- a/src/DotRecast.Detour/NavMeshParams.cs +++ b/src/DotRecast.Detour/NavMeshParams.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** * Configuration parameters used to define multi-tile navigation meshes. The values are used to allocate space during @@ -37,3 +39,5 @@ public class NavMeshParams { /** The maximum number of polygons each tile can contain. */ public int maxPolys; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/NavMeshQuery.cs b/src/DotRecast.Detour/NavMeshQuery.cs index 06e7cc9..b3d53e6 100644 --- a/src/DotRecast.Detour/NavMeshQuery.cs +++ b/src/DotRecast.Detour/NavMeshQuery.cs @@ -22,7 +22,9 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; using static Node; @@ -636,7 +638,7 @@ public class NavMeshQuery { int[] maxxy = m_nav.calcTileLoc(bmax); int maxx = maxxy[0]; int maxy = maxxy[1]; - List tiles = new(); + List tiles = new List(); for (int y = miny; y <= maxy; ++y) { for (int x = minx; x <= maxx; ++x) { tiles.AddRange(m_nav.getTilesAt(x, y)); @@ -694,7 +696,7 @@ public class NavMeshQuery { } if (startRef == endRef) { - List singlePath = new(1); + List singlePath = new List(1); singlePath.Add(startRef); return Results.success(singlePath); } @@ -1181,7 +1183,7 @@ public class NavMeshQuery { /// @returns The status flags for the query. public virtual Result> finalizeSlicedFindPath() { - List path = new(64); + List path = new List(64); if (m_query.status.isFailed()) { // Reset query. m_query = new QueryData(); @@ -1215,7 +1217,7 @@ public class NavMeshQuery { /// @returns The status flags for the query. public virtual Result> finalizeSlicedFindPathPartial(List existing) { - List path = new(64); + List path = new List(64); if (null == existing || existing.Count <= 0) { return Results.failure(path); } @@ -1350,7 +1352,7 @@ public class NavMeshQuery { public virtual Result> findStraightPath(float[] startPos, float[] endPos, List path, int maxStraightPath, int options) { - List straightPath = new(); + List straightPath = new List(); if (null == startPos || !vIsFinite(startPos) || null == endPos || !vIsFinite(endPos) || null == path || 0 == path.Count || path[0] == 0 || maxStraightPath <= 0) { return Results.invalidParam>(); @@ -1578,7 +1580,7 @@ public class NavMeshQuery { startNode.total = 0; startNode.id = startRef; startNode.flags = Node.DT_NODE_CLOSED; - LinkedList stack = new(); + LinkedList stack = new LinkedList(); stack.AddLast(startNode); float[] bestPos = new float[3]; @@ -1690,7 +1692,7 @@ public class NavMeshQuery { } } - List visited = new(); + List visited = new List(); if (bestNode != null) { // Reverse the path. Node prev = null; @@ -2157,9 +2159,9 @@ public class NavMeshQuery { return Results.invalidParam(); } - List resultRef = new(); - List resultParent = new(); - List resultCost = new(); + List resultRef = new List(); + List resultParent = new List(); + List resultCost = new List(); m_nodePool.clear(); m_openList.clear(); @@ -2316,9 +2318,9 @@ public class NavMeshQuery { return Results.invalidParam(); } - List resultRef = new(); - List resultParent = new(); - List resultCost = new(); + List resultRef = new List(); + List resultParent = new List(); + List resultCost = new List(); m_nodePool.clear(); m_openList.clear(); @@ -2488,8 +2490,8 @@ public class NavMeshQuery { return Results.invalidParam(); } - List resultRef = new(); - List resultParent = new(); + List resultRef = new List(); + List resultParent = new List(); NodePool tinyNodePool = new NodePool(); @@ -2497,7 +2499,7 @@ public class NavMeshQuery { startNode.pidx = 0; startNode.id = startRef; startNode.flags = Node.DT_NODE_CLOSED; - LinkedList stack = new(); + LinkedList stack = new LinkedList(); stack.AddLast(startNode); resultRef.Add(startNode.id); @@ -2679,9 +2681,9 @@ public class NavMeshQuery { MeshTile tile = tileAndPoly.result.Item1; Poly poly = tileAndPoly.result.Item2; - List segmentRefs = new(); - List segmentVerts = new(); - List ints = new(16); + List segmentRefs = new List(); + List segmentVerts = new List(); + List ints = new List(16); for (int i = 0, j = poly.vertCount - 1; i < poly.vertCount; j = i++) { // Skip non-solid edges. @@ -3012,7 +3014,7 @@ public class NavMeshQuery { * Gets the path leading to the specified end node. */ protected List getPathToNode(Node endNode) { - List path = new(); + List path = new List(); // Reverse the path. Node curNode = endNode; do { @@ -3053,4 +3055,5 @@ public class NavMeshQuery { return m_nodePool; } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/Node.cs b/src/DotRecast.Detour/Node.cs index c641c45..456e454 100644 --- a/src/DotRecast.Detour/Node.cs +++ b/src/DotRecast.Detour/Node.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class Node { @@ -60,3 +62,5 @@ public class Node { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/NodePool.cs b/src/DotRecast.Detour/NodePool.cs index abbd166..93c5a8a 100644 --- a/src/DotRecast.Detour/NodePool.cs +++ b/src/DotRecast.Detour/NodePool.cs @@ -20,14 +20,16 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class NodePool { - private readonly Dictionary> m_map = new(); - private readonly List m_nodes = new(); + private readonly Dictionary> m_map = new Dictionary>(); + private readonly List m_nodes = new List(); public NodePool() { @@ -41,7 +43,7 @@ public class NodePool public List findNodes(long id) { var hasNode = m_map.TryGetValue(id, out var nodes);; if (nodes == null) { - nodes = new(); + nodes = new List(); } return nodes; } @@ -73,7 +75,7 @@ public class NodePool m_nodes.Add(node); var hasNode = m_map.TryGetValue(id, out var nodes);; if (nodes == null) { - nodes = new(); + nodes = new List(); m_map.Add(id, nodes); } nodes.Add(node); @@ -97,3 +99,5 @@ public class NodePool } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/NodeQueue.cs b/src/DotRecast.Detour/NodeQueue.cs index 8609b22..799cc21 100644 --- a/src/DotRecast.Detour/NodeQueue.cs +++ b/src/DotRecast.Detour/NodeQueue.cs @@ -17,13 +17,15 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using System.Collections.Generic; public class NodeQueue { - private readonly List m_heap = new(); + private readonly List m_heap = new List(); public int count() { @@ -61,3 +63,5 @@ public class NodeQueue { return 0 == m_heap.Count; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/OffMeshConnection.cs b/src/DotRecast.Detour/OffMeshConnection.cs index b925822..4280a21 100644 --- a/src/DotRecast.Detour/OffMeshConnection.cs +++ b/src/DotRecast.Detour/OffMeshConnection.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** * Defines an navigation mesh off-mesh connection within a dtMeshTile object. An off-mesh connection is a user defined @@ -41,4 +43,5 @@ public class OffMeshConnection { public int side; /** The id of the offmesh connection. (User assigned when the navigation mesh is built.) */ public int userId; +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/Poly.cs b/src/DotRecast.Detour/Poly.cs index 3f22728..bab8682 100644 --- a/src/DotRecast.Detour/Poly.cs +++ b/src/DotRecast.Detour/Poly.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** Defines a polygon within a MeshTile object. */ public class Poly { @@ -69,3 +71,5 @@ public class Poly { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/PolyDetail.cs b/src/DotRecast.Detour/PolyDetail.cs index 95bc0a9..71fb2a5 100644 --- a/src/DotRecast.Detour/PolyDetail.cs +++ b/src/DotRecast.Detour/PolyDetail.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** Defines the location of detail sub-mesh data within a dtMeshTile. */ public class PolyDetail { @@ -30,3 +32,5 @@ public class PolyDetail { /** The number of triangles in the sub-mesh. */ public int triCount; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/PolyQuery.cs b/src/DotRecast.Detour/PolyQuery.cs index c99a430..6f8bbd3 100644 --- a/src/DotRecast.Detour/PolyQuery.cs +++ b/src/DotRecast.Detour/PolyQuery.cs @@ -1,6 +1,10 @@ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public interface PolyQuery { void process(MeshTile tile, Poly poly, long refs); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/PolygonByCircleConstraint.cs b/src/DotRecast.Detour/PolygonByCircleConstraint.cs index 6ae4420..e212b9a 100644 --- a/src/DotRecast.Detour/PolygonByCircleConstraint.cs +++ b/src/DotRecast.Detour/PolygonByCircleConstraint.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -92,3 +94,5 @@ public interface PolygonByCircleConstraint { } } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/QueryData.cs b/src/DotRecast.Detour/QueryData.cs index 5be4a74..25081af 100644 --- a/src/DotRecast.Detour/QueryData.cs +++ b/src/DotRecast.Detour/QueryData.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class QueryData { public Status status; @@ -30,4 +32,5 @@ public class QueryData { public int options; public float raycastLimitSqr; public QueryHeuristic heuristic; +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/QueryFilter.cs b/src/DotRecast.Detour/QueryFilter.cs index 9b44c13..4021cec 100644 --- a/src/DotRecast.Detour/QueryFilter.cs +++ b/src/DotRecast.Detour/QueryFilter.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public interface QueryFilter { @@ -27,3 +29,5 @@ public interface QueryFilter { Poly curPoly, long nextRef, MeshTile nextTile, Poly nextPoly); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/QueryHeuristic.cs b/src/DotRecast.Detour/QueryHeuristic.cs index 5106d88..5b359f2 100644 --- a/src/DotRecast.Detour/QueryHeuristic.cs +++ b/src/DotRecast.Detour/QueryHeuristic.cs @@ -16,10 +16,14 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public interface QueryHeuristic { float getCost(float[] neighbourPos, float[] endPos); } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/RaycastHit.cs b/src/DotRecast.Detour/RaycastHit.cs index 5748440..4768bf9 100644 --- a/src/DotRecast.Detour/RaycastHit.cs +++ b/src/DotRecast.Detour/RaycastHit.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** @@ -32,9 +34,11 @@ public class RaycastHit { /** hitNormal The normal of the nearest wall hit. [(x, y, z)] */ public readonly float[] hitNormal = new float[3]; /** Visited polygons. */ - public readonly List path = new(); + public readonly List path = new List(); /** The cost of the path until hit. */ public float pathCost; /** The index of the edge on the readonly polygon where the wall was hit. */ public int hitEdgeIndex; } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Result.cs b/src/DotRecast.Detour/Result.cs index 83a2e90..3e5f649 100644 --- a/src/DotRecast.Detour/Result.cs +++ b/src/DotRecast.Detour/Result.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public static class Results { @@ -81,3 +83,5 @@ public class Result { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Status.cs b/src/DotRecast.Detour/Status.cs index f15b318..f5e218f 100644 --- a/src/DotRecast.Detour/Status.cs +++ b/src/DotRecast.Detour/Status.cs @@ -17,14 +17,16 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + public class Status { - public static Status FAILURE = new(0); - public static Status SUCCSESS = new(1); - public static Status IN_PROGRESS = new(2); - public static Status PARTIAL_RESULT = new(3); - public static Status FAILURE_INVALID_PARAM = new(4); + public static Status FAILURE = new Status(0); + public static Status SUCCSESS = new Status(1); + public static Status IN_PROGRESS = new Status(2); + public static Status PARTIAL_RESULT = new Status(3); + public static Status FAILURE_INVALID_PARAM = new Status(4); public int Value { get; } @@ -53,3 +55,5 @@ public static class StatusEx } } + +} \ No newline at end of file diff --git a/src/DotRecast.Detour/StraightPathItem.cs b/src/DotRecast.Detour/StraightPathItem.cs index 249c526..786d8e7 100644 --- a/src/DotRecast.Detour/StraightPathItem.cs +++ b/src/DotRecast.Detour/StraightPathItem.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + using static DetourCommon; @@ -45,4 +47,5 @@ public class StraightPathItem { return refs; } +} } \ No newline at end of file diff --git a/src/DotRecast.Detour/VectorPtr.cs b/src/DotRecast.Detour/VectorPtr.cs index 21ec0ce..796b405 100644 --- a/src/DotRecast.Detour/VectorPtr.cs +++ b/src/DotRecast.Detour/VectorPtr.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Detour; +namespace DotRecast.Detour +{ + /** * Wrapper for 3-element pieces (3D vectors) of a bigger float array. @@ -44,4 +46,5 @@ public class VectorPtr { return array[index + offset]; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/AreaModification.cs b/src/DotRecast.Recast/AreaModification.cs index d5f9a81..1750e86 100644 --- a/src/DotRecast.Recast/AreaModification.cs +++ b/src/DotRecast.Recast/AreaModification.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public class AreaModification { @@ -67,4 +69,5 @@ public class AreaModification { return ((value & mask) | (area & ~mask)); } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/CompactCell.cs b/src/DotRecast.Recast/CompactCell.cs index ed33792..dd51608 100644 --- a/src/DotRecast.Recast/CompactCell.cs +++ b/src/DotRecast.Recast/CompactCell.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** Provides information on the content of a cell column in a compact heightfield. */ public class CompactCell @@ -28,4 +30,5 @@ public class CompactCell /** Number of spans in the column. */ public int count; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/CompactHeightfield.cs b/src/DotRecast.Recast/CompactHeightfield.cs index 11db1e0..6189a1c 100644 --- a/src/DotRecast.Recast/CompactHeightfield.cs +++ b/src/DotRecast.Recast/CompactHeightfield.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** A compact, static heightfield representing unobstructed space. */ public class CompactHeightfield @@ -70,4 +72,5 @@ public class CompactHeightfield /** Array containing area id data. [Size: #spanCount] */ public int[] areas; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/CompactSpan.cs b/src/DotRecast.Recast/CompactSpan.cs index ae158c2..09a1386 100644 --- a/src/DotRecast.Recast/CompactSpan.cs +++ b/src/DotRecast.Recast/CompactSpan.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** Represents a span of unobstructed space within a compact heightfield. */ public class CompactSpan @@ -34,4 +36,5 @@ public class CompactSpan /** The height of the span. (Measured from #y.) */ public int h; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/Contour.cs b/src/DotRecast.Recast/Contour.cs index a1b88c6..96f7b38 100644 --- a/src/DotRecast.Recast/Contour.cs +++ b/src/DotRecast.Recast/Contour.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** Represents a simple, non-overlapping contour in field space. */ public class Contour @@ -40,4 +42,5 @@ public class Contour /** The area id of the contour. */ public int reg; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/ContourSet.cs b/src/DotRecast.Recast/ContourSet.cs index 407393a..60bd349 100644 --- a/src/DotRecast.Recast/ContourSet.cs +++ b/src/DotRecast.Recast/ContourSet.cs @@ -20,13 +20,15 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** Represents a group of related contours. */ public class ContourSet { /** A list of the contours in the set. */ - public List conts = new(); + public List conts = new List(); /** The minimum bounds in world space. [(x, y, z)] */ public float[] bmin = new float[3]; @@ -51,4 +53,5 @@ public class ContourSet /** The max edge error that this contour set was simplified with. */ public float maxError; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/ConvexVolume.cs b/src/DotRecast.Recast/ConvexVolume.cs index ba44fa3..4ba6c92 100644 --- a/src/DotRecast.Recast/ConvexVolume.cs +++ b/src/DotRecast.Recast/ConvexVolume.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public class ConvexVolume { @@ -26,4 +28,5 @@ public class ConvexVolume public float hmin; public float hmax; public AreaModification areaMod; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/DotRecast.Recast.csproj b/src/DotRecast.Recast/DotRecast.Recast.csproj index 561560c..67202b4 100644 --- a/src/DotRecast.Recast/DotRecast.Recast.csproj +++ b/src/DotRecast.Recast/DotRecast.Recast.csproj @@ -1,8 +1,7 @@ - net7.0 - + netstandard2.1 diff --git a/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs b/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs index b04f8c8..7c6ba1e 100644 --- a/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs +++ b/src/DotRecast.Recast/Geom/ChunkyTriMesh.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Recast.Geom; +namespace DotRecast.Recast.Geom +{ + public class ChunkyTriMesh { @@ -150,7 +152,7 @@ public class ChunkyTriMesh { int nchunks = (ntris + trisPerChunk - 1) / trisPerChunk; - nodes = new(nchunks); + nodes = new List(nchunks); this.ntris = ntris; // Build tree @@ -219,7 +221,7 @@ public class ChunkyTriMesh public List getChunksOverlappingRect(float[] bmin, float[] bmax) { // Traverse tree - List ids = new(); + List ids = new List(); int i = 0; while (i < nodes.Count) { @@ -244,4 +246,5 @@ public class ChunkyTriMesh return ids; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/ChunkyTriMeshNode.cs b/src/DotRecast.Recast/Geom/ChunkyTriMeshNode.cs index c822707..c7ac1b1 100644 --- a/src/DotRecast.Recast/Geom/ChunkyTriMeshNode.cs +++ b/src/DotRecast.Recast/Geom/ChunkyTriMeshNode.cs @@ -1,4 +1,6 @@ -namespace DotRecast.Recast.Geom; +namespace DotRecast.Recast.Geom +{ + public class ChunkyTriMeshNode { @@ -7,3 +9,5 @@ public class ChunkyTriMeshNode public int i; public int[] tris; } + +} \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/ConvexVolumeProvider.cs b/src/DotRecast.Recast/Geom/ConvexVolumeProvider.cs index 70140c9..e82ae1b 100644 --- a/src/DotRecast.Recast/Geom/ConvexVolumeProvider.cs +++ b/src/DotRecast.Recast/Geom/ConvexVolumeProvider.cs @@ -18,9 +18,12 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Recast.Geom; +namespace DotRecast.Recast.Geom +{ + public interface ConvexVolumeProvider { IList convexVolumes(); +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/InputGeomProvider.cs b/src/DotRecast.Recast/Geom/InputGeomProvider.cs index b40b680..e286cb3 100644 --- a/src/DotRecast.Recast/Geom/InputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/InputGeomProvider.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Recast.Geom; +namespace DotRecast.Recast.Geom +{ + public interface InputGeomProvider : ConvexVolumeProvider { @@ -29,4 +31,5 @@ public interface InputGeomProvider : ConvexVolumeProvider float[] getMeshBoundsMax(); IEnumerable meshes(); +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs b/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs index 119f94c..f17032f 100644 --- a/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/SimpleInputGeomProvider.cs @@ -22,7 +22,9 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -namespace DotRecast.Recast.Geom; +namespace DotRecast.Recast.Geom +{ + public class SimpleInputGeomProvider : InputGeomProvider { @@ -31,7 +33,7 @@ public class SimpleInputGeomProvider : InputGeomProvider public readonly float[] normals; readonly float[] bmin; readonly float[] bmax; - readonly List volumes = new(); + readonly List volumes = new List(); public SimpleInputGeomProvider(List vertexPositions, List meshFaces) : this(mapVertices(vertexPositions), mapFaces(meshFaces)) @@ -102,8 +104,7 @@ public class SimpleInputGeomProvider : InputGeomProvider volumes.Add(vol); } - public IEnumerable meshes() - { + public IEnumerable meshes() { return ImmutableArray.Create(new TriMesh(vertices, faces)); } @@ -134,4 +135,5 @@ public class SimpleInputGeomProvider : InputGeomProvider } } } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs b/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs index e060cec..dbbc7c9 100644 --- a/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/SingleTrimeshInputGeomProvider.cs @@ -16,16 +16,19 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +using System; using System.Collections.Generic; using System.Collections.Immutable; -namespace DotRecast.Recast.Geom; +namespace DotRecast.Recast.Geom +{ + public class SingleTrimeshInputGeomProvider : InputGeomProvider { private readonly float[] bmin; private readonly float[] bmax; - private readonly ImmutableArray _meshes; + private readonly TriMesh[] _meshes; public SingleTrimeshInputGeomProvider(float[] vertices, int[] faces) { @@ -39,7 +42,7 @@ public class SingleTrimeshInputGeomProvider : InputGeomProvider RecastVectors.max(bmax, vertices, i * 3); } - _meshes = ImmutableArray.Create(new TriMesh(vertices, faces)); + _meshes = new[] { new TriMesh(vertices, faces) }; } public float[] getMeshBoundsMin() @@ -61,4 +64,5 @@ public class SingleTrimeshInputGeomProvider : InputGeomProvider { return ImmutableArray.Empty; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/TriMesh.cs b/src/DotRecast.Recast/Geom/TriMesh.cs index c476766..328b3d2 100644 --- a/src/DotRecast.Recast/Geom/TriMesh.cs +++ b/src/DotRecast.Recast/Geom/TriMesh.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; -namespace DotRecast.Recast.Geom; +namespace DotRecast.Recast.Geom +{ + public class TriMesh { @@ -49,4 +51,5 @@ public class TriMesh { return chunkyTriMesh.getChunksOverlappingRect(bmin, bmax); } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/Heightfield.cs b/src/DotRecast.Recast/Heightfield.cs index b260aff..b0ae0c7 100644 --- a/src/DotRecast.Recast/Heightfield.cs +++ b/src/DotRecast.Recast/Heightfield.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** Represents a heightfield layer within a layer set. */ public class Heightfield @@ -58,4 +60,5 @@ public class Heightfield this.borderSize = borderSize; spans = new Span[width * height]; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/HeightfieldLayerSet.cs b/src/DotRecast.Recast/HeightfieldLayerSet.cs index 38560b4..87e3837 100644 --- a/src/DotRecast.Recast/HeightfieldLayerSet.cs +++ b/src/DotRecast.Recast/HeightfieldLayerSet.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /// Represents a set of heightfield layers. /// @ingroup recast @@ -75,4 +77,5 @@ public class HeightfieldLayerSet } public HeightfieldLayer[] layers; /// < The layers in the set. [Size: #nlayers] +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/InputGeomReader.cs b/src/DotRecast.Recast/InputGeomReader.cs index b77afae..720fc3b 100644 --- a/src/DotRecast.Recast/InputGeomReader.cs +++ b/src/DotRecast.Recast/InputGeomReader.cs @@ -1,5 +1,8 @@ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public class InputGeomReader { +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/ObjImporter.cs b/src/DotRecast.Recast/ObjImporter.cs index cfe552d..f4254b6 100644 --- a/src/DotRecast.Recast/ObjImporter.cs +++ b/src/DotRecast.Recast/ObjImporter.cs @@ -21,14 +21,16 @@ using System.Collections.Generic; using System.IO; using DotRecast.Recast.Geom; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public static class ObjImporter { public class ObjImporterContext { - public List vertexPositions = new(); - public List meshFaces = new(); + public List vertexPositions = new List(); + public List meshFaces = new List(); } public static InputGeomProvider load(byte[] chunck) @@ -135,4 +137,5 @@ public static class ObjImporter return posi; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/PartitionType.cs b/src/DotRecast.Recast/PartitionType.cs index 9b944b7..ab2c94a 100644 --- a/src/DotRecast.Recast/PartitionType.cs +++ b/src/DotRecast.Recast/PartitionType.cs @@ -1,4 +1,6 @@ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /// < Tessellate edges between areas during contour /// simplification. @@ -7,4 +9,5 @@ public enum PartitionType WATERSHED, MONOTONE, LAYERS +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/PolyMesh.cs b/src/DotRecast.Recast/PolyMesh.cs index c7fa513..6fc2e23 100644 --- a/src/DotRecast.Recast/PolyMesh.cs +++ b/src/DotRecast.Recast/PolyMesh.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** Represents a polygon mesh suitable for use in building a navigation mesh. */ public class PolyMesh @@ -66,4 +68,5 @@ public class PolyMesh /** The max error of the polygon edges in the mesh. */ public float maxEdgeError; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/PolyMeshDetail.cs b/src/DotRecast.Recast/PolyMeshDetail.cs index ffb082e..c24a8e8 100644 --- a/src/DotRecast.Recast/PolyMeshDetail.cs +++ b/src/DotRecast.Recast/PolyMeshDetail.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** * Contains triangle meshes that represent detailed height data associated with the polygons in its associated polygon @@ -43,4 +45,5 @@ public class PolyMeshDetail /** The number of triangles in #tris. */ public int ntris; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/Recast.cs b/src/DotRecast.Recast/Recast.cs index fdd7fa9..becae24 100644 --- a/src/DotRecast.Recast/Recast.cs +++ b/src/DotRecast.Recast/Recast.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; @@ -119,4 +121,5 @@ public class Recast areas[i] = RC_NULL_AREA; } } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastArea.cs b/src/DotRecast.Recast/RecastArea.cs index 04025f6..f6d4976 100644 --- a/src/DotRecast.Recast/RecastArea.cs +++ b/src/DotRecast.Recast/RecastArea.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; @@ -582,4 +584,5 @@ public class RecastArea ctx.stopTimer("MARK_CYLINDER_AREA"); } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastBuilder.cs b/src/DotRecast.Recast/RecastBuilder.cs index 2ed979f..bfdb55c 100644 --- a/src/DotRecast.Recast/RecastBuilder.cs +++ b/src/DotRecast.Recast/RecastBuilder.cs @@ -25,7 +25,9 @@ using System.Threading.Tasks; using DotRecast.Core; using DotRecast.Recast.Geom; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public class RecastBuilder { @@ -52,7 +54,7 @@ public class RecastBuilder int[] twh = Recast.calcTileCount(bmin, bmax, cfg.cs, cfg.tileSizeX, cfg.tileSizeZ); int tw = twh[0]; int th = twh[1]; - List results = new(); + List results = new List(); if (null != taskFactory) { buildMultiThreadAsync(geom, cfg, bmin, bmax, tw, th, results, taskFactory, default); @@ -104,7 +106,7 @@ public class RecastBuilder { AtomicInteger counter = new AtomicInteger(0); CountdownEvent latch = new CountdownEvent(tw * th); - List tasks = new(); + List tasks = new List(); for (int x = 0; x < tw; ++x) { @@ -317,4 +319,5 @@ public class RecastBuilder CompactHeightfield chf = buildCompactHeightfield(geom, builderCfg.cfg, ctx, solid); return RecastLayers.buildHeightfieldLayers(ctx, chf, builderCfg.cfg.walkableHeight); } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastBuilderConfig.cs b/src/DotRecast.Recast/RecastBuilderConfig.cs index bbf7130..6ee8e13 100644 --- a/src/DotRecast.Recast/RecastBuilderConfig.cs +++ b/src/DotRecast.Recast/RecastBuilderConfig.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastVectors; @@ -97,4 +99,5 @@ public class RecastBuilderConfig height = wh[1]; } } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastBuilderResult.cs b/src/DotRecast.Recast/RecastBuilderResult.cs index deb7c18..f856417 100644 --- a/src/DotRecast.Recast/RecastBuilderResult.cs +++ b/src/DotRecast.Recast/RecastBuilderResult.cs @@ -1,4 +1,6 @@ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public class RecastBuilderResult { @@ -54,3 +56,5 @@ public class RecastBuilderResult return telemetry; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastCommon.cs b/src/DotRecast.Recast/RecastCommon.cs index 41b4edf..a76d9fa 100644 --- a/src/DotRecast.Recast/RecastCommon.cs +++ b/src/DotRecast.Recast/RecastCommon.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public class RecastCommon { @@ -82,4 +84,5 @@ public class RecastCommon } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastCompact.cs b/src/DotRecast.Recast/RecastCompact.cs index 5871ffd..f75e8d7 100644 --- a/src/DotRecast.Recast/RecastCompact.cs +++ b/src/DotRecast.Recast/RecastCompact.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; using static RecastVectors; @@ -183,4 +185,5 @@ public class RecastCompact return spanCount; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastConfig.cs b/src/DotRecast.Recast/RecastConfig.cs index 7558510..8d2b3de 100644 --- a/src/DotRecast.Recast/RecastConfig.cs +++ b/src/DotRecast.Recast/RecastConfig.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; @@ -183,4 +185,5 @@ public class RecastConfig { return 3 + (int)Math.Ceiling(agentRadius / cs); } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastConstants.cs b/src/DotRecast.Recast/RecastConstants.cs index 38d25c9..984ddb6 100644 --- a/src/DotRecast.Recast/RecastConstants.cs +++ b/src/DotRecast.Recast/RecastConstants.cs @@ -18,7 +18,9 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public static class RecastConstants { @@ -82,4 +84,5 @@ public static class RecastConstants public const int RC_LOG_WARNING = 1; +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastContour.cs b/src/DotRecast.Recast/RecastContour.cs index b6676f8..99d0bea 100644 --- a/src/DotRecast.Recast/RecastContour.cs +++ b/src/DotRecast.Recast/RecastContour.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; @@ -842,8 +844,8 @@ public class RecastContour ctx.stopTimer("CONTOURS_TRACE"); - List verts = new(256); - List simplified = new(64); + List verts = new List(256); + List simplified = new List(64); for (int y = 0; y < h; ++y) { @@ -1017,4 +1019,5 @@ public class RecastContour ctx.stopTimer("CONTOURS"); return cset; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastFilledVolumeRasterization.cs b/src/DotRecast.Recast/RecastFilledVolumeRasterization.cs index 89fd202..f5f22fa 100644 --- a/src/DotRecast.Recast/RecastFilledVolumeRasterization.cs +++ b/src/DotRecast.Recast/RecastFilledVolumeRasterization.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System; using DotRecast.Core; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; using static RecastVectors; @@ -799,4 +801,5 @@ public class RecastFilledVolumeRasterization overlap = (amin[2] > bounds[5] || amax[2] < bounds[2]) ? false : overlap; return overlap; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastFilter.cs b/src/DotRecast.Recast/RecastFilter.cs index 4ee4403..1ddcc18 100644 --- a/src/DotRecast.Recast/RecastFilter.cs +++ b/src/DotRecast.Recast/RecastFilter.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; @@ -202,4 +204,5 @@ public class RecastFilter ctx.stopTimer("FILTER_WALKABLE"); } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastLayers.cs b/src/DotRecast.Recast/RecastLayers.cs index 9b55170..9146b60 100644 --- a/src/DotRecast.Recast/RecastLayers.cs +++ b/src/DotRecast.Recast/RecastLayers.cs @@ -21,7 +21,9 @@ freely, subject to the following restrictions: using System; using System.Collections.Generic; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastCommon; using static RecastConstants; @@ -45,8 +47,8 @@ public class RecastLayers { id = i; ymin = 0xFFFF; layerId = 0xff; - layers = new(); - neis = new(); + layers = new List(); + neis = new List(); } }; @@ -174,7 +176,7 @@ public class RecastLayers { } // Find region neighbours and overlapping regions. - List lregs = new(); + List lregs = new List(); for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { CompactCell c = chf.cells[x + y * w]; @@ -225,7 +227,7 @@ public class RecastLayers { // Create 2D layers from regions. int layerId = 0; - List stack = new(); + List stack = new List(); for (int i = 0; i < nregs; ++i) { LayerRegion root = regs[i]; @@ -505,3 +507,5 @@ public class RecastLayers { return lset; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastMesh.cs b/src/DotRecast.Recast/RecastMesh.cs index 17c7cd6..9666b6f 100644 --- a/src/DotRecast.Recast/RecastMesh.cs +++ b/src/DotRecast.Recast/RecastMesh.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; @@ -1212,3 +1214,5 @@ public class RecastMesh { return dst; } } + +} \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastMeshDetail.cs b/src/DotRecast.Recast/RecastMeshDetail.cs index 8528fe3..bdd65ad 100644 --- a/src/DotRecast.Recast/RecastMeshDetail.cs +++ b/src/DotRecast.Recast/RecastMeshDetail.cs @@ -22,7 +22,9 @@ using System; using System.Collections.Generic; using DotRecast.Core; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastCommon; using static RecastConstants; @@ -454,7 +456,7 @@ public class RecastMeshDetail { private static void delaunayHull(Telemetry ctx, int npts, float[] pts, int nhull, int[] hull, List tris) { int nfaces = 0; int maxEdges = npts * 10; - List edges = new(64); + List edges = new List(64); for (int i = 0, j = nhull - 1; i < nhull; j = i++) { addEdge(ctx, edges, maxEdges, hull[j], hull[i], EV_HULL, EV_UNDEF); } @@ -618,7 +620,7 @@ public class RecastMeshDetail { static int buildPolyDetail(Telemetry ctx, float[] @in, int nin, float sampleDist, float sampleMaxError, int heightSearchRadius, CompactHeightfield chf, HeightPatch hp, float[] verts, List tris) { - List samples = new(512); + List samples = new List(512); int nverts = 0; float[] edge = new float[(MAX_VERTS_PER_EDGE + 1) * 3]; @@ -988,7 +990,7 @@ public class RecastMeshDetail { // Note: Reads to the compact heightfield are offset by border size (bs) // since border size offset is already removed from the polymesh vertices. - List queue = new(512); + List queue = new List(512); Array.Fill(hp.data, RC_UNSET_HEIGHT, 0, (hp.width * hp.height) - (0)); bool empty = true; @@ -1127,7 +1129,7 @@ public class RecastMeshDetail { int borderSize = mesh.borderSize; int heightSearchRadius = (int) Math.Max(1, Math.Ceiling(mesh.maxEdgeError)); - List tris = new(512); + List tris = new List(512); float[] verts = new float[256 * 3]; HeightPatch hp = new HeightPatch(); int nPolyVerts = 0; @@ -1333,3 +1335,5 @@ public class RecastMeshDetail { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastRasterization.cs b/src/DotRecast.Recast/RecastRasterization.cs index 6a2096a..0244df5 100644 --- a/src/DotRecast.Recast/RecastRasterization.cs +++ b/src/DotRecast.Recast/RecastRasterization.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; @@ -481,4 +483,5 @@ public class RecastRasterization ctx.stopTimer("RASTERIZE_TRIANGLES"); } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastRegion.cs b/src/DotRecast.Recast/RecastRegion.cs index b825400..410a4a4 100644 --- a/src/DotRecast.Recast/RecastRegion.cs +++ b/src/DotRecast.Recast/RecastRegion.cs @@ -22,7 +22,9 @@ using System; using System.Collections.Generic; using System.Linq; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + using static RecastConstants; @@ -360,7 +362,7 @@ public class RecastRegion { } } - List dirtyEntries = new(); + List dirtyEntries = new List(); int iter = 0; while (stack.Count > 0) { int failed = 0; @@ -493,8 +495,8 @@ public class RecastRegion { public Region(int i) { id = i; ymin = 0xFFFF; - connections = new(); - floors = new(); + connections = new List(); + floors = new List(); } } @@ -563,7 +565,7 @@ public class RecastRegion { int bid = regb.id; // Duplicate current neighbourhood. - List acon = new(rega.connections); + List acon = new List(rega.connections); List bcon = regb.connections; // Find insertion point on A. @@ -770,8 +772,8 @@ public class RecastRegion { } // Remove too small regions. - List stack = new(32); - List trace = new(32); + List stack = new List(32); + List trace = new List(32); for (int i = 0; i < nreg; ++i) { Region reg = regions[i]; if (reg.id == 0 || (reg.id & RC_BORDER_REG) != 0) { @@ -966,7 +968,7 @@ public class RecastRegion { } // Find region neighbours and overlapping regions. - List lregs = new(32); + List lregs = new List(32); for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { CompactCell c = chf.cells[x + y * w]; @@ -1029,7 +1031,7 @@ public class RecastRegion { } // Merge montone regions to create non-overlapping areas. - List stack = new(32); + List stack = new List(32); for (int i = 1; i < nreg; ++i) { Region root = regions[i]; // Skip already visited. @@ -1333,7 +1335,7 @@ public class RecastRegion { ctx.startTimer("REGIONS_FILTER"); // Merge regions and filter out small regions. - List overlaps = new(); + List overlaps = new List(); chf.maxRegions = mergeAndFilterRegions(ctx, minRegionArea, mergeRegionArea, id, chf, srcReg, overlaps); // Monotone partitioning does not generate overlapping regions. @@ -1380,12 +1382,12 @@ public class RecastRegion { int LOG_NB_STACKS = 3; int NB_STACKS = 1 << LOG_NB_STACKS; - List> lvlStacks = new(); + List> lvlStacks = new List>(); for (int i = 0; i < NB_STACKS; ++i) { - lvlStacks.Add(new (1024)); + lvlStacks.Add(new List(1024)); } - List stack = new(1024); + List stack = new List(1024); int[] srcReg = new int[chf.spanCount]; int[] srcDist = new int[chf.spanCount]; @@ -1464,7 +1466,7 @@ public class RecastRegion { ctx.startTimer("REGIONS_FILTER"); // Merge regions and filter out smalle regions. - List overlaps = new(); + List overlaps = new List(); chf.maxRegions = mergeAndFilterRegions(ctx, minRegionArea, mergeRegionArea, regionId, chf, srcReg, overlaps); // If overlapping regions were found during merging, split those regions. @@ -1603,7 +1605,7 @@ public class RecastRegion { ctx.startTimer("REGIONS_FILTER"); // Merge monotone regions to layers and remove small regions. - List overlaps = new(); + List overlaps = new List(); chf.maxRegions = mergeAndFilterLayerRegions(ctx, minRegionArea, id, chf, srcReg, overlaps); ctx.stopTimer("REGIONS_FILTER"); @@ -1617,3 +1619,5 @@ public class RecastRegion { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastVectors.cs b/src/DotRecast.Recast/RecastVectors.cs index a609add..2b575d2 100644 --- a/src/DotRecast.Recast/RecastVectors.cs +++ b/src/DotRecast.Recast/RecastVectors.cs @@ -20,7 +20,9 @@ freely, subject to the following restrictions: using System; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public static class RecastVectors { @@ -95,4 +97,5 @@ public static class RecastVectors { return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } +} } \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastVoxelization.cs b/src/DotRecast.Recast/RecastVoxelization.cs index 2f12ecf..33b7d82 100644 --- a/src/DotRecast.Recast/RecastVoxelization.cs +++ b/src/DotRecast.Recast/RecastVoxelization.cs @@ -19,7 +19,9 @@ freely, subject to the following restrictions: using System.Collections.Generic; using DotRecast.Recast.Geom; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public class RecastVoxelization { @@ -71,3 +73,5 @@ public class RecastVoxelization { } } + +} \ No newline at end of file diff --git a/src/DotRecast.Recast/Span.cs b/src/DotRecast.Recast/Span.cs index aa40770..29696f5 100644 --- a/src/DotRecast.Recast/Span.cs +++ b/src/DotRecast.Recast/Span.cs @@ -17,7 +17,9 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + /** Represents a span in a heightfield. */ public class Span { @@ -32,3 +34,5 @@ public class Span { public Span next; } + +} \ No newline at end of file diff --git a/src/DotRecast.Recast/Telemetry.cs b/src/DotRecast.Recast/Telemetry.cs index ee82460..6088ac4 100644 --- a/src/DotRecast.Recast/Telemetry.cs +++ b/src/DotRecast.Recast/Telemetry.cs @@ -23,12 +23,14 @@ using System.Diagnostics; using System.Threading; using DotRecast.Core; -namespace DotRecast.Recast; +namespace DotRecast.Recast +{ + public class Telemetry { - private readonly ThreadLocal> timerStart = new(() => new Dictionary()); - private readonly ConcurrentDictionary timerAccum = new(); + private readonly ThreadLocal> timerStart = new ThreadLocal>(() => new Dictionary()); + private readonly ConcurrentDictionary timerAccum = new ConcurrentDictionary(); public void startTimer(string name) { @@ -54,4 +56,5 @@ public class Telemetry Console.WriteLine(n + ": " + v.Read() / 1000000); } } +} } \ No newline at end of file diff --git a/test/DotRecast.Detour.Crowd.Test/Crowd4Test.cs b/test/DotRecast.Detour.Crowd.Test/Crowd4Test.cs index 6a6b948..f4e48fb 100644 --- a/test/DotRecast.Detour.Crowd.Test/Crowd4Test.cs +++ b/test/DotRecast.Detour.Crowd.Test/Crowd4Test.cs @@ -345,10 +345,10 @@ public class Crowd4Test : AbstractCrowdTest { setMoveTarget(endPoss[0], false); for (int i = 0; i < EXPECTED_A1Q2T.Length; i++) { - if (i == 37) - { - int a = 3; - } + // if (i == 37) + // { + // int a = 3; + // } crowd.update(1 / 5f, null); CrowdAgent ag = agents[2]; diff --git a/test/DotRecast.Detour.Test/FindNearestPolyTest.cs b/test/DotRecast.Detour.Test/FindNearestPolyTest.cs index 54d7395..6642407 100644 --- a/test/DotRecast.Detour.Test/FindNearestPolyTest.cs +++ b/test/DotRecast.Detour.Test/FindNearestPolyTest.cs @@ -67,7 +67,7 @@ public class FindNearestPolyTest : AbstractDetourTest { float[] startPos = startPoss[i]; Result poly = query.findNearestPoly(startPos, extents, filter); Assert.That(poly.succeeded(), Is.True); - Assert.That(0L, Is.EqualTo(poly.result.getNearestRef())); + Assert.That(poly.result.getNearestRef(), Is.EqualTo(0L)); for (int v = 0; v < POLY_POS[i].Length; v++) { Assert.That(poly.result.getNearestPos()[v], Is.EqualTo(startPos[v]).Within(0.001f)); } diff --git a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs index 1c96106..b9b0573 100644 --- a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs @@ -300,6 +300,7 @@ public class RecastSoloMeshTest } catch (Exception e) { + Console.WriteLine(e); } } @@ -332,6 +333,7 @@ public class RecastSoloMeshTest } catch (Exception e) { + Console.WriteLine(e); } } } \ No newline at end of file diff --git a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs index ddb8012..99abb73 100644 --- a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs @@ -157,6 +157,7 @@ public class RecastTileMeshTest } catch (Exception e) { + Console.WriteLine(e); } }