move private class -> public class

This commit is contained in:
ikpil 2023-05-07 17:55:13 +09:00
parent d066523e9e
commit 7d5f37f415
29 changed files with 287 additions and 218 deletions

View File

@ -9,20 +9,6 @@ namespace DotRecast.Detour.Extras.Jumplink
{ {
private readonly IQueryFilter filter = new NoOpFilter(); 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) public override void Sample(JumpLinkBuilderConfig acfg, RecastBuilderResult result, EdgeSampler es)
{ {
NavMeshQuery navMeshQuery = CreateNavMesh(result, acfg.agentRadius, acfg.agentHeight, acfg.agentClimb); 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)); return new NavMeshQuery(new NavMesh(NavMeshBuilder.CreateNavMeshData(option), option.nvp, 0));
} }
public class PolyQueryInvoker : IPolyQuery
{
public readonly Action<MeshTile, Poly, long> _callback;
public PolyQueryInvoker(Action<MeshTile, Poly, long> callback)
{
_callback = callback;
}
public void Process(MeshTile tile, Poly poly, long refs)
{
_callback?.Invoke(tile, poly, refs);
}
}
private Tuple<bool, float> GetNavMeshHeight(NavMeshQuery navMeshQuery, Vector3f pt, float cs, float heightRange) private Tuple<bool, float> GetNavMeshHeight(NavMeshQuery navMeshQuery, Vector3f pt, float cs, float heightRange)
{ {

View File

@ -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;
}
}
}

View File

@ -0,0 +1,19 @@
using System;
namespace DotRecast.Detour.Extras.Jumplink
{
public class PolyQueryInvoker : IPolyQuery
{
public readonly Action<MeshTile, Poly, long> _callback;
public PolyQueryInvoker(Action<MeshTile, Poly, long> callback)
{
_callback = callback;
}
public void Process(MeshTile tile, Poly poly, long refs)
{
_callback?.Invoke(tile, poly, refs);
}
}
}

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace DotRecast.Detour.TileCache
{
public class LayerMonotoneRegion
{
public int area;
public List<int> neis = new List<int>(16);
public int regId;
public int areaId;
};
}

View File

@ -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
};
}

View File

@ -0,0 +1,29 @@
using System.Collections.Generic;
namespace DotRecast.Detour.TileCache
{
public class TempContour
{
public List<int> verts;
public int nverts;
public List<int> poly;
public TempContour()
{
verts = new List<int>();
nverts = 0;
poly = new List<int>();
}
public int Npoly()
{
return poly.Count;
}
public void Clear()
{
nverts = 0;
verts.Clear();
}
};
}

View File

@ -361,7 +361,7 @@ namespace DotRecast.Detour.TileCache
public long AddObstacle(Vector3f pos, float radius, float height) public long AddObstacle(Vector3f pos, float radius, float height)
{ {
TileCacheObstacle ob = AllocObstacle(); TileCacheObstacle ob = AllocObstacle();
ob.type = TileCacheObstacle.TileCacheObstacleType.CYLINDER; ob.type = TileCacheObstacleType.CYLINDER;
ob.pos = pos; ob.pos = pos;
ob.radius = radius; ob.radius = radius;
@ -374,7 +374,7 @@ namespace DotRecast.Detour.TileCache
public long AddBoxObstacle(Vector3f bmin, Vector3f bmax) public long AddBoxObstacle(Vector3f bmin, Vector3f bmax)
{ {
TileCacheObstacle ob = AllocObstacle(); TileCacheObstacle ob = AllocObstacle();
ob.type = TileCacheObstacle.TileCacheObstacleType.BOX; ob.type = TileCacheObstacleType.BOX;
ob.bmin = bmin; ob.bmin = bmin;
ob.bmax = bmax; ob.bmax = bmax;
@ -386,7 +386,7 @@ namespace DotRecast.Detour.TileCache
public long AddBoxObstacle(Vector3f center, Vector3f extents, float yRadians) public long AddBoxObstacle(Vector3f center, Vector3f extents, float yRadians)
{ {
TileCacheObstacle ob = AllocObstacle(); TileCacheObstacle ob = AllocObstacle();
ob.type = TileCacheObstacle.TileCacheObstacleType.ORIENTED_BOX; ob.type = TileCacheObstacleType.ORIENTED_BOX;
ob.center = center; ob.center = center;
ob.extents = extents; ob.extents = extents;
float coshalf = (float)Math.Cos(0.5f * yRadians); float coshalf = (float)Math.Cos(0.5f * yRadians);
@ -614,15 +614,15 @@ namespace DotRecast.Detour.TileCache
if (Contains(ob.touched, refs)) 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); 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); 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); 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) 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.x = ob.pos.x - ob.radius;
bmin.y = ob.pos.y; bmin.y = ob.pos.y;
@ -704,12 +704,12 @@ namespace DotRecast.Detour.TileCache
bmax.y = ob.pos.y + ob.height; bmax.y = ob.pos.y + ob.height;
bmax.z = ob.pos.z + ob.radius; bmax.z = ob.pos.z + ob.radius;
} }
else if (ob.type == TileCacheObstacle.TileCacheObstacleType.BOX) else if (ob.type == TileCacheObstacleType.BOX)
{ {
bmin = ob.bmin; bmin = ob.bmin;
bmax = ob.bmax; 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); float maxr = 1.41f * Math.Max(ob.extents.x, ob.extents.z);
bmin.x = ob.center.x - maxr; bmin.x = ob.center.x - maxr;

View File

@ -34,45 +34,11 @@ namespace DotRecast.Detour.TileCache
const int DT_TILECACHE_WALKABLE_AREA = 63; const int DT_TILECACHE_WALKABLE_AREA = 63;
const int DT_TILECACHE_NULL_IDX = 0xffff; 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<int> neis = new List<int>(16);
public int regId;
public int areaId;
};
public class TempContour
{
public List<int> verts;
public int nverts;
public List<int> poly;
public TempContour()
{
verts = new List<int>();
nverts = 0;
poly = new List<int>();
}
public int Npoly()
{
return poly.Count;
}
public void Clear()
{
nverts = 0;
verts.Clear();
}
};
private readonly TileCacheLayerHeaderReader reader = new TileCacheLayerHeaderReader(); private readonly TileCacheLayerHeaderReader reader = new TileCacheLayerHeaderReader();

View File

@ -25,13 +25,6 @@ namespace DotRecast.Detour.TileCache
{ {
public class TileCacheObstacle public class TileCacheObstacle
{ {
public enum TileCacheObstacleType
{
CYLINDER,
BOX,
ORIENTED_BOX
};
public readonly int index; public readonly int index;
public TileCacheObstacleType type; public TileCacheObstacleType type;
public Vector3f pos = new Vector3f(); public Vector3f pos = new Vector3f();

View File

@ -0,0 +1,9 @@
namespace DotRecast.Detour.TileCache
{
public enum TileCacheObstacleType
{
CYLINDER,
BOX,
ORIENTED_BOX
};
}

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace DotRecast.Detour
{
public class CompareItemX : IComparer<BVItem>
{
public int Compare(BVItem a, BVItem b)
{
return a.bmin[0].CompareTo(b.bmin[0]);
}
}
}

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace DotRecast.Detour
{
public class CompareItemY : IComparer<BVItem>
{
public int Compare(BVItem a, BVItem b)
{
return a.bmin[1].CompareTo(b.bmin[1]);
}
}
}

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace DotRecast.Detour
{
public class CompareItemZ : IComparer<BVItem>
{
public int Compare(BVItem a, BVItem b)
{
return a.bmin[2].CompareTo(b.bmin[2]);
}
}
}

View File

@ -30,20 +30,6 @@ namespace DotRecast.Detour
{ {
private static readonly float EPSILON = 0.0001f; 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) public static float[] Intersect(float[] p, float[] q)
{ {
int n = p.Length / 3; int n = p.Length / 3;
@ -210,7 +196,7 @@ namespace DotRecast.Detour
inters[ii + 2] = p[2]; inters[ii + 2] = p[2];
return ii + 3; return ii + 3;
} }
private static int AddVertex(float[] inters, int ii, Vector3f p) private static int AddVertex(float[] inters, int ii, Vector3f p)
{ {
if (ii > 0) if (ii > 0)
@ -325,4 +311,4 @@ namespace DotRecast.Detour
} }
} }
} }
} }

View File

@ -0,0 +1,9 @@
namespace DotRecast.Detour
{
public enum InFlag
{
Pin,
Qin,
Unknown,
}
}

View File

@ -0,0 +1,9 @@
namespace DotRecast.Detour
{
public enum Intersection
{
None,
Single,
Overlap,
}
}

View File

@ -19,7 +19,6 @@ freely, subject to the following restrictions:
*/ */
using System; using System;
using System.Collections.Generic;
using DotRecast.Core; using DotRecast.Core;
namespace DotRecast.Detour namespace DotRecast.Detour
@ -30,29 +29,6 @@ namespace DotRecast.Detour
{ {
const int MESH_NULL_IDX = 0xffff; const int MESH_NULL_IDX = 0xffff;
private class CompareItemX : IComparer<BVItem>
{
public int Compare(BVItem a, BVItem b)
{
return a.bmin[0].CompareTo(b.bmin[0]);
}
}
private class CompareItemY : IComparer<BVItem>
{
public int Compare(BVItem a, BVItem b)
{
return a.bmin[1].CompareTo(b.bmin[1]);
}
}
private class CompareItemZ : IComparer<BVItem>
{
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) private static int[][] CalcExtends(BVItem[] items, int nitems, int imin, int imax)
{ {

View File

@ -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;
}
}

View File

@ -0,0 +1,8 @@
namespace DotRecast.Recast.Demo.Tools;
public enum AgentType
{
VILLAGER,
TRAVELLER,
MOB,
}

View File

@ -411,25 +411,6 @@ public class CrowdProfilingTool
return crowd.AddAgent(p, ap); 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) public void UpdateAgentParams(int updateFlags, int obstacleAvoidanceType, float separationWeight)
{ {
if (crowd != null) if (crowd != null)
@ -452,4 +433,4 @@ public class CrowdProfilingTool
} }
} }
} }
} }

View File

@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace DotRecast.Recast
{
public class CompareDiagDist : IComparer<PotentialDiagonal>
{
public int Compare(PotentialDiagonal va, PotentialDiagonal vb)
{
PotentialDiagonal a = va;
PotentialDiagonal b = vb;
return a.dist.CompareTo(b.dist);
}
}
}

View File

@ -0,0 +1,19 @@
using System.Collections.Generic;
namespace DotRecast.Recast
{
public class CompareHoles : IComparer<ContourHole>
{
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);
}
}
}
}

View File

@ -0,0 +1,10 @@
namespace DotRecast.Recast
{
public class ContourHole
{
public int leftmost;
public int minx;
public int minz;
public Contour contour;
}
}

View File

@ -0,0 +1,9 @@
namespace DotRecast.Recast
{
public class ContourRegion
{
public Contour outline;
public ContourHole[] holes;
public int nholes;
}
}

View File

@ -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;
}
}
}

View File

@ -0,0 +1,8 @@
namespace DotRecast.Recast
{
public class PotentialDiagonal
{
public int dist;
public int vert;
}
}

View File

@ -25,41 +25,8 @@ namespace DotRecast.Recast
{ {
using static RecastConstants; 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) private static CornerHeight GetCornerHeight(int x, int y, int i, int dir, CompactHeightfield chf)
{ {
bool isBorderVertex = false; bool isBorderVertex = false;
@ -640,31 +607,6 @@ namespace DotRecast.Recast
return new int[] { minx, minz, leftmost }; return new int[] { minx, minz, leftmost };
} }
private class CompareHoles : IComparer<ContourHole>
{
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<PotentialDiagonal>
{
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) private static void MergeRegionHoles(Telemetry ctx, ContourRegion region)
{ {
// Sort holes from left to right. // Sort holes from left to right.
@ -1017,4 +959,4 @@ namespace DotRecast.Recast
return cset; return cset;
} }
} }
} }

View File

@ -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<int> connections;
public List<int> floors;
public Region(int i)
{
id = i;
ymin = 0xFFFF;
connections = new List<int>();
floors = new List<int>();
}
}
private static void RemoveAdjacentNeighbours(Region reg) private static void RemoveAdjacentNeighbours(Region reg)
{ {

View File

@ -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<int> connections;
public List<int> floors;
public Region(int i)
{
id = i;
ymin = 0xFFFF;
connections = new List<int>();
floors = new List<int>();
}
}
}