From 7d5f37f4157fc5a53db480eb4cb1369ec28f42d5 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sun, 7 May 2023 17:55:13 +0900 Subject: [PATCH] move private class -> public class --- .../Jumplink/NavMeshGroundSampler.cs | 28 --------- .../Jumplink/NoOpFilter.cs | 18 ++++++ .../Jumplink/PolyQueryInvoker.cs | 19 ++++++ .../LayerMonotoneRegion.cs | 12 ++++ .../LayerSweepSpan.cs | 9 +++ src/DotRecast.Detour.TileCache/TempContour.cs | 29 +++++++++ src/DotRecast.Detour.TileCache/TileCache.cs | 18 +++--- .../TileCacheBuilder.cs | 34 ---------- .../TileCacheObstacle.cs | 7 --- .../TileCacheObstacleType.cs | 9 +++ src/DotRecast.Detour/CompareItemX.cs | 12 ++++ src/DotRecast.Detour/CompareItemY.cs | 12 ++++ src/DotRecast.Detour/CompareItemZ.cs | 12 ++++ .../ConvexConvexIntersection.cs | 18 +----- src/DotRecast.Detour/InFlag.cs | 9 +++ src/DotRecast.Detour/Intersection.cs | 9 +++ src/DotRecast.Detour/NavMeshBuilder.cs | 24 ------- src/DotRecast.Recast.Demo/Tools/AgentData.cs | 15 +++++ src/DotRecast.Recast.Demo/Tools/AgentType.cs | 8 +++ .../Tools/CrowdProfilingTool.cs | 21 +------ src/DotRecast.Recast/CompareDiagDist.cs | 14 +++++ src/DotRecast.Recast/CompareHoles.cs | 19 ++++++ src/DotRecast.Recast/ContourHole.cs | 10 +++ src/DotRecast.Recast/ContourRegion.cs | 9 +++ src/DotRecast.Recast/CornerHeight.cs | 14 +++++ src/DotRecast.Recast/PotentialDiagonal.cs | 8 +++ src/DotRecast.Recast/RecastContour.cs | 62 +------------------ src/DotRecast.Recast/RecastRegion.cs | 20 ------ src/DotRecast.Recast/Region.cs | 26 ++++++++ 29 files changed, 287 insertions(+), 218 deletions(-) create mode 100644 src/DotRecast.Detour.Extras/Jumplink/NoOpFilter.cs create mode 100644 src/DotRecast.Detour.Extras/Jumplink/PolyQueryInvoker.cs create mode 100644 src/DotRecast.Detour.TileCache/LayerMonotoneRegion.cs create mode 100644 src/DotRecast.Detour.TileCache/LayerSweepSpan.cs create mode 100644 src/DotRecast.Detour.TileCache/TempContour.cs create mode 100644 src/DotRecast.Detour.TileCache/TileCacheObstacleType.cs create mode 100644 src/DotRecast.Detour/CompareItemX.cs create mode 100644 src/DotRecast.Detour/CompareItemY.cs create mode 100644 src/DotRecast.Detour/CompareItemZ.cs create mode 100644 src/DotRecast.Detour/InFlag.cs create mode 100644 src/DotRecast.Detour/Intersection.cs create mode 100644 src/DotRecast.Recast.Demo/Tools/AgentData.cs create mode 100644 src/DotRecast.Recast.Demo/Tools/AgentType.cs create mode 100644 src/DotRecast.Recast/CompareDiagDist.cs create mode 100644 src/DotRecast.Recast/CompareHoles.cs create mode 100644 src/DotRecast.Recast/ContourHole.cs create mode 100644 src/DotRecast.Recast/ContourRegion.cs create mode 100644 src/DotRecast.Recast/CornerHeight.cs create mode 100644 src/DotRecast.Recast/PotentialDiagonal.cs create mode 100644 src/DotRecast.Recast/Region.cs diff --git a/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs b/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs index df7035f..a295f61 100644 --- a/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs +++ b/src/DotRecast.Detour.Extras/Jumplink/NavMeshGroundSampler.cs @@ -9,20 +9,6 @@ namespace DotRecast.Detour.Extras.Jumplink { private readonly IQueryFilter filter = new NoOpFilter(); - private class NoOpFilter : IQueryFilter - { - public bool PassFilter(long refs, MeshTile tile, Poly poly) - { - return true; - } - - public float GetCost(Vector3f pa, Vector3f pb, long prevRef, MeshTile prevTile, Poly prevPoly, long curRef, - MeshTile curTile, Poly curPoly, long nextRef, MeshTile nextTile, Poly nextPoly) - { - return 0; - } - } - public override void Sample(JumpLinkBuilderConfig acfg, RecastBuilderResult result, EdgeSampler es) { NavMeshQuery navMeshQuery = CreateNavMesh(result, acfg.agentRadius, acfg.agentHeight, acfg.agentClimb); @@ -55,20 +41,6 @@ namespace DotRecast.Detour.Extras.Jumplink return new NavMeshQuery(new NavMesh(NavMeshBuilder.CreateNavMeshData(option), option.nvp, 0)); } - public class PolyQueryInvoker : IPolyQuery - { - public readonly Action _callback; - - public PolyQueryInvoker(Action callback) - { - _callback = callback; - } - - public void Process(MeshTile tile, Poly poly, long refs) - { - _callback?.Invoke(tile, poly, refs); - } - } private Tuple GetNavMeshHeight(NavMeshQuery navMeshQuery, Vector3f pt, float cs, float heightRange) { diff --git a/src/DotRecast.Detour.Extras/Jumplink/NoOpFilter.cs b/src/DotRecast.Detour.Extras/Jumplink/NoOpFilter.cs new file mode 100644 index 0000000..2c2b9aa --- /dev/null +++ b/src/DotRecast.Detour.Extras/Jumplink/NoOpFilter.cs @@ -0,0 +1,18 @@ +using DotRecast.Core; + +namespace DotRecast.Detour.Extras.Jumplink +{ + public class NoOpFilter : IQueryFilter + { + public bool PassFilter(long refs, MeshTile tile, Poly poly) + { + return true; + } + + public float GetCost(Vector3f pa, Vector3f pb, long prevRef, MeshTile prevTile, Poly prevPoly, long curRef, + MeshTile curTile, Poly curPoly, long nextRef, MeshTile nextTile, Poly nextPoly) + { + return 0; + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Detour.Extras/Jumplink/PolyQueryInvoker.cs b/src/DotRecast.Detour.Extras/Jumplink/PolyQueryInvoker.cs new file mode 100644 index 0000000..9f3da23 --- /dev/null +++ b/src/DotRecast.Detour.Extras/Jumplink/PolyQueryInvoker.cs @@ -0,0 +1,19 @@ +using System; + +namespace DotRecast.Detour.Extras.Jumplink +{ + public class PolyQueryInvoker : IPolyQuery + { + public readonly Action _callback; + + public PolyQueryInvoker(Action callback) + { + _callback = callback; + } + + public void Process(MeshTile tile, Poly poly, long refs) + { + _callback?.Invoke(tile, poly, refs); + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/LayerMonotoneRegion.cs b/src/DotRecast.Detour.TileCache/LayerMonotoneRegion.cs new file mode 100644 index 0000000..7973884 --- /dev/null +++ b/src/DotRecast.Detour.TileCache/LayerMonotoneRegion.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace DotRecast.Detour.TileCache +{ + public class LayerMonotoneRegion + { + public int area; + public List neis = new List(16); + public int regId; + public int areaId; + }; +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/LayerSweepSpan.cs b/src/DotRecast.Detour.TileCache/LayerSweepSpan.cs new file mode 100644 index 0000000..909abcf --- /dev/null +++ b/src/DotRecast.Detour.TileCache/LayerSweepSpan.cs @@ -0,0 +1,9 @@ +namespace DotRecast.Detour.TileCache +{ + public class LayerSweepSpan + { + public int ns; // number samples + public int id; // region id + public int nei; // neighbour id + }; +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TempContour.cs b/src/DotRecast.Detour.TileCache/TempContour.cs new file mode 100644 index 0000000..797afcd --- /dev/null +++ b/src/DotRecast.Detour.TileCache/TempContour.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace DotRecast.Detour.TileCache +{ + public class TempContour + { + public List verts; + public int nverts; + public List poly; + + public TempContour() + { + verts = new List(); + nverts = 0; + poly = new List(); + } + + public int Npoly() + { + return poly.Count; + } + + public void Clear() + { + nverts = 0; + verts.Clear(); + } + }; +} \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/TileCache.cs b/src/DotRecast.Detour.TileCache/TileCache.cs index 4f64a9d..2bfe8fc 100644 --- a/src/DotRecast.Detour.TileCache/TileCache.cs +++ b/src/DotRecast.Detour.TileCache/TileCache.cs @@ -361,7 +361,7 @@ namespace DotRecast.Detour.TileCache public long AddObstacle(Vector3f pos, float radius, float height) { TileCacheObstacle ob = AllocObstacle(); - ob.type = TileCacheObstacle.TileCacheObstacleType.CYLINDER; + ob.type = TileCacheObstacleType.CYLINDER; ob.pos = pos; ob.radius = radius; @@ -374,7 +374,7 @@ namespace DotRecast.Detour.TileCache public long AddBoxObstacle(Vector3f bmin, Vector3f bmax) { TileCacheObstacle ob = AllocObstacle(); - ob.type = TileCacheObstacle.TileCacheObstacleType.BOX; + ob.type = TileCacheObstacleType.BOX; ob.bmin = bmin; ob.bmax = bmax; @@ -386,7 +386,7 @@ namespace DotRecast.Detour.TileCache public long AddBoxObstacle(Vector3f center, Vector3f extents, float yRadians) { TileCacheObstacle ob = AllocObstacle(); - ob.type = TileCacheObstacle.TileCacheObstacleType.ORIENTED_BOX; + ob.type = TileCacheObstacleType.ORIENTED_BOX; ob.center = center; ob.extents = extents; float coshalf = (float)Math.Cos(0.5f * yRadians); @@ -614,15 +614,15 @@ namespace DotRecast.Detour.TileCache if (Contains(ob.touched, refs)) { - if (ob.type == TileCacheObstacle.TileCacheObstacleType.CYLINDER) + if (ob.type == TileCacheObstacleType.CYLINDER) { builder.MarkCylinderArea(layer, tile.header.bmin, m_params.cs, m_params.ch, ob.pos, ob.radius, ob.height, 0); } - else if (ob.type == TileCacheObstacle.TileCacheObstacleType.BOX) + else if (ob.type == TileCacheObstacleType.BOX) { builder.MarkBoxArea(layer, tile.header.bmin, m_params.cs, m_params.ch, ob.bmin, ob.bmax, 0); } - else if (ob.type == TileCacheObstacle.TileCacheObstacleType.ORIENTED_BOX) + else if (ob.type == TileCacheObstacleType.ORIENTED_BOX) { builder.MarkBoxArea(layer, tile.header.bmin, m_params.cs, m_params.ch, ob.center, ob.extents, ob.rotAux, 0); } @@ -695,7 +695,7 @@ namespace DotRecast.Detour.TileCache void GetObstacleBounds(TileCacheObstacle ob, ref Vector3f bmin, ref Vector3f bmax) { - if (ob.type == TileCacheObstacle.TileCacheObstacleType.CYLINDER) + if (ob.type == TileCacheObstacleType.CYLINDER) { bmin.x = ob.pos.x - ob.radius; bmin.y = ob.pos.y; @@ -704,12 +704,12 @@ namespace DotRecast.Detour.TileCache bmax.y = ob.pos.y + ob.height; bmax.z = ob.pos.z + ob.radius; } - else if (ob.type == TileCacheObstacle.TileCacheObstacleType.BOX) + else if (ob.type == TileCacheObstacleType.BOX) { bmin = ob.bmin; bmax = ob.bmax; } - else if (ob.type == TileCacheObstacle.TileCacheObstacleType.ORIENTED_BOX) + else if (ob.type == TileCacheObstacleType.ORIENTED_BOX) { float maxr = 1.41f * Math.Max(ob.extents.x, ob.extents.z); bmin.x = ob.center.x - maxr; diff --git a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs b/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs index 28e9c90..68219cd 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs @@ -34,45 +34,11 @@ namespace DotRecast.Detour.TileCache const int DT_TILECACHE_WALKABLE_AREA = 63; const int DT_TILECACHE_NULL_IDX = 0xffff; - public class LayerSweepSpan - { - public int ns; // number samples - public int id; // region id - public int nei; // neighbour id - }; - public class LayerMonotoneRegion - { - public int area; - public List neis = new List(16); - public int regId; - public int areaId; - }; - public class TempContour - { - public List verts; - public int nverts; - public List poly; - public TempContour() - { - verts = new List(); - nverts = 0; - poly = new List(); - } - public int Npoly() - { - return poly.Count; - } - public void Clear() - { - nverts = 0; - verts.Clear(); - } - }; private readonly TileCacheLayerHeaderReader reader = new TileCacheLayerHeaderReader(); diff --git a/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs b/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs index 34bea62..0575535 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheObstacle.cs @@ -25,13 +25,6 @@ namespace DotRecast.Detour.TileCache { public class TileCacheObstacle { - public enum TileCacheObstacleType - { - CYLINDER, - BOX, - ORIENTED_BOX - }; - public readonly int index; public TileCacheObstacleType type; public Vector3f pos = new Vector3f(); diff --git a/src/DotRecast.Detour.TileCache/TileCacheObstacleType.cs b/src/DotRecast.Detour.TileCache/TileCacheObstacleType.cs new file mode 100644 index 0000000..a203655 --- /dev/null +++ b/src/DotRecast.Detour.TileCache/TileCacheObstacleType.cs @@ -0,0 +1,9 @@ +namespace DotRecast.Detour.TileCache +{ + public enum TileCacheObstacleType + { + CYLINDER, + BOX, + ORIENTED_BOX + }; +} \ No newline at end of file diff --git a/src/DotRecast.Detour/CompareItemX.cs b/src/DotRecast.Detour/CompareItemX.cs new file mode 100644 index 0000000..4118686 --- /dev/null +++ b/src/DotRecast.Detour/CompareItemX.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace DotRecast.Detour +{ + public class CompareItemX : IComparer + { + public int Compare(BVItem a, BVItem b) + { + return a.bmin[0].CompareTo(b.bmin[0]); + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Detour/CompareItemY.cs b/src/DotRecast.Detour/CompareItemY.cs new file mode 100644 index 0000000..97986f4 --- /dev/null +++ b/src/DotRecast.Detour/CompareItemY.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace DotRecast.Detour +{ + public class CompareItemY : IComparer + { + public int Compare(BVItem a, BVItem b) + { + return a.bmin[1].CompareTo(b.bmin[1]); + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Detour/CompareItemZ.cs b/src/DotRecast.Detour/CompareItemZ.cs new file mode 100644 index 0000000..8225705 --- /dev/null +++ b/src/DotRecast.Detour/CompareItemZ.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace DotRecast.Detour +{ + public class CompareItemZ : IComparer + { + public int Compare(BVItem a, BVItem b) + { + return a.bmin[2].CompareTo(b.bmin[2]); + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Detour/ConvexConvexIntersection.cs b/src/DotRecast.Detour/ConvexConvexIntersection.cs index 46266df..2a766d9 100644 --- a/src/DotRecast.Detour/ConvexConvexIntersection.cs +++ b/src/DotRecast.Detour/ConvexConvexIntersection.cs @@ -30,20 +30,6 @@ namespace DotRecast.Detour { private static readonly float EPSILON = 0.0001f; - private enum InFlag - { - Pin, - Qin, - Unknown, - } - - private enum Intersection - { - None, - Single, - Overlap, - } - public static float[] Intersect(float[] p, float[] q) { int n = p.Length / 3; @@ -210,7 +196,7 @@ namespace DotRecast.Detour inters[ii + 2] = p[2]; return ii + 3; } - + private static int AddVertex(float[] inters, int ii, Vector3f p) { if (ii > 0) @@ -325,4 +311,4 @@ namespace DotRecast.Detour } } } -} +} \ No newline at end of file diff --git a/src/DotRecast.Detour/InFlag.cs b/src/DotRecast.Detour/InFlag.cs new file mode 100644 index 0000000..bdf29d3 --- /dev/null +++ b/src/DotRecast.Detour/InFlag.cs @@ -0,0 +1,9 @@ +namespace DotRecast.Detour +{ + public enum InFlag + { + Pin, + Qin, + Unknown, + } +} \ No newline at end of file diff --git a/src/DotRecast.Detour/Intersection.cs b/src/DotRecast.Detour/Intersection.cs new file mode 100644 index 0000000..319288e --- /dev/null +++ b/src/DotRecast.Detour/Intersection.cs @@ -0,0 +1,9 @@ +namespace DotRecast.Detour +{ + public enum Intersection + { + None, + Single, + Overlap, + } +} \ No newline at end of file diff --git a/src/DotRecast.Detour/NavMeshBuilder.cs b/src/DotRecast.Detour/NavMeshBuilder.cs index e632526..8cb1357 100644 --- a/src/DotRecast.Detour/NavMeshBuilder.cs +++ b/src/DotRecast.Detour/NavMeshBuilder.cs @@ -19,7 +19,6 @@ freely, subject to the following restrictions: */ using System; -using System.Collections.Generic; using DotRecast.Core; namespace DotRecast.Detour @@ -30,29 +29,6 @@ namespace DotRecast.Detour { const int MESH_NULL_IDX = 0xffff; - private class CompareItemX : IComparer - { - public int Compare(BVItem a, BVItem b) - { - return a.bmin[0].CompareTo(b.bmin[0]); - } - } - - private class CompareItemY : IComparer - { - public int Compare(BVItem a, BVItem b) - { - return a.bmin[1].CompareTo(b.bmin[1]); - } - } - - private class CompareItemZ : IComparer - { - public int Compare(BVItem a, BVItem b) - { - return a.bmin[2].CompareTo(b.bmin[2]); - } - } private static int[][] CalcExtends(BVItem[] items, int nitems, int imin, int imax) { diff --git a/src/DotRecast.Recast.Demo/Tools/AgentData.cs b/src/DotRecast.Recast.Demo/Tools/AgentData.cs new file mode 100644 index 0000000..8f27b71 --- /dev/null +++ b/src/DotRecast.Recast.Demo/Tools/AgentData.cs @@ -0,0 +1,15 @@ +using DotRecast.Core; + +namespace DotRecast.Recast.Demo.Tools; + +public class AgentData +{ + public readonly AgentType type; + public readonly Vector3f home = new Vector3f(); + + public AgentData(AgentType type, Vector3f home) + { + this.type = type; + this.home = home; + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast.Demo/Tools/AgentType.cs b/src/DotRecast.Recast.Demo/Tools/AgentType.cs new file mode 100644 index 0000000..b97dec8 --- /dev/null +++ b/src/DotRecast.Recast.Demo/Tools/AgentType.cs @@ -0,0 +1,8 @@ +namespace DotRecast.Recast.Demo.Tools; + +public enum AgentType +{ + VILLAGER, + TRAVELLER, + MOB, +} \ No newline at end of file diff --git a/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs b/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs index 59df8fd..a326289 100644 --- a/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs @@ -411,25 +411,6 @@ public class CrowdProfilingTool return crowd.AddAgent(p, ap); } - public enum AgentType - { - VILLAGER, - TRAVELLER, - MOB, - } - - private class AgentData - { - public readonly AgentType type; - public readonly Vector3f home = new Vector3f(); - - public AgentData(AgentType type, Vector3f home) - { - this.type = type; - this.home = home; - } - } - public void UpdateAgentParams(int updateFlags, int obstacleAvoidanceType, float separationWeight) { if (crowd != null) @@ -452,4 +433,4 @@ public class CrowdProfilingTool } } } -} +} \ No newline at end of file diff --git a/src/DotRecast.Recast/CompareDiagDist.cs b/src/DotRecast.Recast/CompareDiagDist.cs new file mode 100644 index 0000000..d694755 --- /dev/null +++ b/src/DotRecast.Recast/CompareDiagDist.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace DotRecast.Recast +{ + public class CompareDiagDist : IComparer + { + public int Compare(PotentialDiagonal va, PotentialDiagonal vb) + { + PotentialDiagonal a = va; + PotentialDiagonal b = vb; + return a.dist.CompareTo(b.dist); + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast/CompareHoles.cs b/src/DotRecast.Recast/CompareHoles.cs new file mode 100644 index 0000000..07c33e9 --- /dev/null +++ b/src/DotRecast.Recast/CompareHoles.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace DotRecast.Recast +{ + public class CompareHoles : IComparer + { + public int Compare(ContourHole a, ContourHole b) + { + if (a.minx == b.minx) + { + return a.minz.CompareTo(b.minz); + } + else + { + return a.minx.CompareTo(b.minx); + } + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast/ContourHole.cs b/src/DotRecast.Recast/ContourHole.cs new file mode 100644 index 0000000..cbb9ea7 --- /dev/null +++ b/src/DotRecast.Recast/ContourHole.cs @@ -0,0 +1,10 @@ +namespace DotRecast.Recast +{ + public class ContourHole + { + public int leftmost; + public int minx; + public int minz; + public Contour contour; + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast/ContourRegion.cs b/src/DotRecast.Recast/ContourRegion.cs new file mode 100644 index 0000000..ab0c5ea --- /dev/null +++ b/src/DotRecast.Recast/ContourRegion.cs @@ -0,0 +1,9 @@ +namespace DotRecast.Recast +{ + public class ContourRegion + { + public Contour outline; + public ContourHole[] holes; + public int nholes; + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast/CornerHeight.cs b/src/DotRecast.Recast/CornerHeight.cs new file mode 100644 index 0000000..6e57718 --- /dev/null +++ b/src/DotRecast.Recast/CornerHeight.cs @@ -0,0 +1,14 @@ +namespace DotRecast.Recast +{ + public class CornerHeight + { + public readonly int height; + public readonly bool borderVertex; + + public CornerHeight(int height, bool borderVertex) + { + this.height = height; + this.borderVertex = borderVertex; + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast/PotentialDiagonal.cs b/src/DotRecast.Recast/PotentialDiagonal.cs new file mode 100644 index 0000000..1195b73 --- /dev/null +++ b/src/DotRecast.Recast/PotentialDiagonal.cs @@ -0,0 +1,8 @@ +namespace DotRecast.Recast +{ + public class PotentialDiagonal + { + public int dist; + public int vert; + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastContour.cs b/src/DotRecast.Recast/RecastContour.cs index 1ca6c92..a189700 100644 --- a/src/DotRecast.Recast/RecastContour.cs +++ b/src/DotRecast.Recast/RecastContour.cs @@ -25,41 +25,8 @@ namespace DotRecast.Recast { using static RecastConstants; - public class RecastContour + public static class RecastContour { - private class ContourRegion - { - public Contour outline; - public ContourHole[] holes; - public int nholes; - } - - private class ContourHole - { - public int leftmost; - public int minx; - public int minz; - public Contour contour; - } - - private class PotentialDiagonal - { - public int dist; - public int vert; - } - - private class CornerHeight - { - public readonly int height; - public readonly bool borderVertex; - - public CornerHeight(int height, bool borderVertex) - { - this.height = height; - this.borderVertex = borderVertex; - } - } - private static CornerHeight GetCornerHeight(int x, int y, int i, int dir, CompactHeightfield chf) { bool isBorderVertex = false; @@ -640,31 +607,6 @@ namespace DotRecast.Recast return new int[] { minx, minz, leftmost }; } - private class CompareHoles : IComparer - { - public int Compare(ContourHole a, ContourHole b) - { - if (a.minx == b.minx) - { - return a.minz.CompareTo(b.minz); - } - else - { - return a.minx.CompareTo(b.minx); - } - } - } - - private class CompareDiagDist : IComparer - { - public int Compare(PotentialDiagonal va, PotentialDiagonal vb) - { - PotentialDiagonal a = va; - PotentialDiagonal b = vb; - return a.dist.CompareTo(b.dist); - } - } - private static void MergeRegionHoles(Telemetry ctx, ContourRegion region) { // Sort holes from left to right. @@ -1017,4 +959,4 @@ namespace DotRecast.Recast return cset; } } -} +} \ No newline at end of file diff --git a/src/DotRecast.Recast/RecastRegion.cs b/src/DotRecast.Recast/RecastRegion.cs index 2e6adbc..e430078 100644 --- a/src/DotRecast.Recast/RecastRegion.cs +++ b/src/DotRecast.Recast/RecastRegion.cs @@ -578,27 +578,7 @@ namespace DotRecast.Recast } } - private class Region - { - public int spanCount; // Number of spans belonging to this region - public int id; // ID of the region - public int areaType; // Are type. - public bool remap; - public bool visited; - public bool overlap; - public bool connectsToBorder; - public int ymin, ymax; - public List connections; - public List floors; - public Region(int i) - { - id = i; - ymin = 0xFFFF; - connections = new List(); - floors = new List(); - } - } private static void RemoveAdjacentNeighbours(Region reg) { diff --git a/src/DotRecast.Recast/Region.cs b/src/DotRecast.Recast/Region.cs new file mode 100644 index 0000000..c7c7c13 --- /dev/null +++ b/src/DotRecast.Recast/Region.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace DotRecast.Recast +{ + public class Region + { + public int spanCount; // Number of spans belonging to this region + public int id; // ID of the region + public int areaType; // Are type. + public bool remap; + public bool visited; + public bool overlap; + public bool connectsToBorder; + public int ymin, ymax; + public List connections; + public List floors; + + public Region(int i) + { + id = i; + ymin = 0xFFFF; + connections = new List(); + floors = new List(); + } + } +} \ No newline at end of file