forked from mirror/DotRecast
move class type
This commit is contained in:
parent
0f9e61f51e
commit
d066523e9e
|
@ -0,0 +1,9 @@
|
|||
namespace DotRecast.Core
|
||||
{
|
||||
public class Edge
|
||||
{
|
||||
public int[] vert = new int[2];
|
||||
public int[] polyEdge = new int[2];
|
||||
public int[] poly = new int[2];
|
||||
}
|
||||
}
|
|
@ -31,14 +31,6 @@ namespace DotRecast.Detour.Crowd
|
|||
{
|
||||
public const int MAX_LOCAL_SEGS = 8;
|
||||
|
||||
private class Segment
|
||||
{
|
||||
/** Segment start/end */
|
||||
public Vector3f[] s = new Vector3f[2];
|
||||
|
||||
/** Distance for pruning. */
|
||||
public float d;
|
||||
}
|
||||
|
||||
Vector3f m_center = new Vector3f();
|
||||
List<Segment> m_segs = new List<Segment>();
|
||||
|
@ -172,4 +164,4 @@ namespace DotRecast.Detour.Crowd
|
|||
return m_segs.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour.Crowd
|
||||
{
|
||||
public class Segment
|
||||
{
|
||||
/** Segment start/end */
|
||||
public Vector3f[] s = new Vector3f[2];
|
||||
|
||||
/** Distance for pruning. */
|
||||
public float d;
|
||||
}
|
||||
}
|
|
@ -33,10 +33,10 @@ namespace DotRecast.Detour.Extras
|
|||
|
||||
private static int CreateBVTree(MeshData data, BVNode[] nodes, float quantFactor)
|
||||
{
|
||||
NavMeshBuilder.BVItem[] items = new NavMeshBuilder.BVItem[data.header.polyCount];
|
||||
BVItem[] items = new BVItem[data.header.polyCount];
|
||||
for (int i = 0; i < data.header.polyCount; i++)
|
||||
{
|
||||
NavMeshBuilder.BVItem it = new NavMeshBuilder.BVItem();
|
||||
BVItem it = new BVItem();
|
||||
items[i] = it;
|
||||
it.i = i;
|
||||
Vector3f bmin = new Vector3f();
|
||||
|
|
|
@ -8,9 +8,9 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
public class EdgeExtractor
|
||||
{
|
||||
public Edge[] ExtractEdges(PolyMesh mesh)
|
||||
public JumpEdge[] ExtractEdges(PolyMesh mesh)
|
||||
{
|
||||
List<Edge> edges = new List<Edge>();
|
||||
List<JumpEdge> edges = new List<JumpEdge>();
|
||||
if (mesh != null)
|
||||
{
|
||||
Vector3f orig = mesh.bmin;
|
||||
|
@ -57,7 +57,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
|
||||
int va = mesh.polys[p + j] * 3;
|
||||
int vb = mesh.polys[p + nj] * 3;
|
||||
Edge e = new Edge();
|
||||
JumpEdge e = new JumpEdge();
|
||||
e.sp.x = orig.x + mesh.verts[vb] * cs;
|
||||
e.sp.y = orig.y + mesh.verts[vb + 1] * ch;
|
||||
e.sp.z = orig.z + mesh.verts[vb + 2] * cs;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
public readonly Vector3f ay = new Vector3f();
|
||||
public readonly Vector3f az = new Vector3f();
|
||||
|
||||
public EdgeSampler(Edge edge, Trajectory trajectory)
|
||||
public EdgeSampler(JumpEdge edge, Trajectory trajectory)
|
||||
{
|
||||
this.trajectory = trajectory;
|
||||
ax = VSub(edge.sq, edge.sp);
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
class EdgeSamplerFactory
|
||||
{
|
||||
public EdgeSampler Get(JumpLinkBuilderConfig acfg, JumpLinkType type, Edge edge)
|
||||
public EdgeSampler Get(JumpLinkBuilderConfig acfg, JumpLinkType type, JumpEdge edge)
|
||||
{
|
||||
EdgeSampler es = null;
|
||||
switch (type.Bit)
|
||||
|
@ -25,7 +25,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
}
|
||||
|
||||
|
||||
private EdgeSampler InitEdgeJumpSampler(JumpLinkBuilderConfig acfg, Edge edge)
|
||||
private EdgeSampler InitEdgeJumpSampler(JumpLinkBuilderConfig acfg, JumpEdge edge)
|
||||
{
|
||||
EdgeSampler es = new EdgeSampler(edge, new JumpTrajectory(acfg.jumpHeight));
|
||||
es.start.height = acfg.agentClimb * 2;
|
||||
|
@ -53,7 +53,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
return es;
|
||||
}
|
||||
|
||||
private EdgeSampler InitClimbDownSampler(JumpLinkBuilderConfig acfg, Edge edge)
|
||||
private EdgeSampler InitClimbDownSampler(JumpLinkBuilderConfig acfg, JumpEdge edge)
|
||||
{
|
||||
EdgeSampler es = new EdgeSampler(edge, new ClimbTrajectory());
|
||||
es.start.height = acfg.agentClimb * 2;
|
||||
|
|
|
@ -2,7 +2,7 @@ using DotRecast.Core;
|
|||
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
public class Edge
|
||||
public class JumpEdge
|
||||
{
|
||||
public Vector3f sp = new Vector3f();
|
||||
public Vector3f sq = new Vector3f();
|
|
@ -15,7 +15,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
private readonly TrajectorySampler trajectorySampler = new TrajectorySampler();
|
||||
private readonly JumpSegmentBuilder jumpSegmentBuilder = new JumpSegmentBuilder();
|
||||
|
||||
private readonly List<Edge[]> edges;
|
||||
private readonly List<JumpEdge[]> edges;
|
||||
private readonly IList<RecastBuilderResult> results;
|
||||
|
||||
public JumpLinkBuilder(IList<RecastBuilderResult> results)
|
||||
|
@ -29,8 +29,8 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
List<JumpLink> links = new List<JumpLink>();
|
||||
for (int tile = 0; tile < results.Count; tile++)
|
||||
{
|
||||
Edge[] edges = this.edges[tile];
|
||||
foreach (Edge edge in edges)
|
||||
JumpEdge[] edges = this.edges[tile];
|
||||
foreach (JumpEdge edge in edges)
|
||||
{
|
||||
links.AddRange(ProcessEdge(acfg, results[tile], type, edge));
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
return links;
|
||||
}
|
||||
|
||||
private List<JumpLink> ProcessEdge(JumpLinkBuilderConfig acfg, RecastBuilderResult result, JumpLinkType type, Edge edge)
|
||||
private List<JumpLink> ProcessEdge(JumpLinkBuilderConfig acfg, RecastBuilderResult result, JumpLinkType type, JumpEdge edge)
|
||||
{
|
||||
EdgeSampler es = edgeSamplerFactory.Get(acfg, type, edge);
|
||||
groundSampler.Sample(acfg, result, es);
|
||||
|
@ -88,7 +88,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
return links;
|
||||
}
|
||||
|
||||
public List<Edge[]> GetEdges()
|
||||
public List<JumpEdge[]> GetEdges()
|
||||
{
|
||||
return edges;
|
||||
}
|
||||
|
|
|
@ -73,14 +73,7 @@ namespace DotRecast.Detour.TileCache
|
|||
verts.Clear();
|
||||
}
|
||||
};
|
||||
|
||||
public class Edge
|
||||
{
|
||||
public int[] vert = new int[2];
|
||||
public int[] polyEdge = new int[2];
|
||||
public int[] poly = new int[2];
|
||||
};
|
||||
|
||||
|
||||
private readonly TileCacheLayerHeaderReader reader = new TileCacheLayerHeaderReader();
|
||||
|
||||
public void BuildTileCacheRegions(TileCacheLayer layer, int walkableClimb)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
namespace DotRecast.Detour
|
||||
{
|
||||
public class BVItem
|
||||
{
|
||||
public readonly int[] bmin = new int[3];
|
||||
public readonly int[] bmax = new int[3];
|
||||
public int i;
|
||||
};
|
||||
}
|
|
@ -30,13 +30,6 @@ namespace DotRecast.Detour
|
|||
{
|
||||
const int MESH_NULL_IDX = 0xffff;
|
||||
|
||||
public class BVItem
|
||||
{
|
||||
public readonly int[] bmin = new int[3];
|
||||
public readonly int[] bmax = new int[3];
|
||||
public int i;
|
||||
};
|
||||
|
||||
private class CompareItemX : IComparer<BVItem>
|
||||
{
|
||||
public int Compare(BVItem a, BVItem b)
|
||||
|
@ -674,4 +667,4 @@ namespace DotRecast.Detour
|
|||
return nmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
namespace DotRecast.Recast.Demo.Tools;
|
||||
|
||||
public class AgentTrail
|
||||
{
|
||||
public float[] trail = new float[CrowdTool.AGENT_MAX_TRAIL * 3];
|
||||
public int htrail;
|
||||
};
|
|
@ -71,14 +71,7 @@ public class CrowdTool : Tool
|
|||
private readonly CrowdProfilingTool profilingTool;
|
||||
private readonly CrowdAgentDebugInfo m_agentDebug = new CrowdAgentDebugInfo();
|
||||
|
||||
private static readonly int AGENT_MAX_TRAIL = 64;
|
||||
|
||||
private class AgentTrail
|
||||
{
|
||||
public float[] trail = new float[AGENT_MAX_TRAIL * 3];
|
||||
public int htrail;
|
||||
};
|
||||
|
||||
public static readonly int AGENT_MAX_TRAIL = 64;
|
||||
private readonly Dictionary<long, AgentTrail> m_trails = new();
|
||||
private Vector3f m_targetPos;
|
||||
private long m_targetRef;
|
||||
|
|
|
@ -60,7 +60,7 @@ public class JumpLinkBuilderTool : Tool
|
|||
{
|
||||
if (annotationBuilder != null)
|
||||
{
|
||||
foreach (Edge[] edges in annotationBuilder.GetEdges())
|
||||
foreach (JumpEdge[] edges in annotationBuilder.GetEdges())
|
||||
{
|
||||
dd.Begin(LINES, 3.0f);
|
||||
for (int i = 0; i < edges.Length; ++i)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
namespace DotRecast.Recast
|
||||
{
|
||||
public class HeightPatch
|
||||
{
|
||||
public int xmin;
|
||||
public int ymin;
|
||||
public int width;
|
||||
public int height;
|
||||
public int[] data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
public class LayerRegion
|
||||
{
|
||||
public int id;
|
||||
public int layerId;
|
||||
public bool @base;
|
||||
public int ymin, ymax;
|
||||
public List<int> layers;
|
||||
public List<int> neis;
|
||||
|
||||
public LayerRegion(int i)
|
||||
{
|
||||
id = i;
|
||||
ymin = 0xFFFF;
|
||||
layerId = 0xff;
|
||||
layers = new List<int>();
|
||||
neis = new List<int>();
|
||||
}
|
||||
};
|
||||
}
|
|
@ -34,24 +34,6 @@ namespace DotRecast.Recast
|
|||
const int RC_MAX_LAYERS = RecastConstants.RC_NOT_CONNECTED;
|
||||
const int RC_MAX_NEIS = 16;
|
||||
|
||||
private class LayerRegion
|
||||
{
|
||||
public int id;
|
||||
public int layerId;
|
||||
public bool @base;
|
||||
public int ymin, ymax;
|
||||
public List<int> layers;
|
||||
public List<int> neis;
|
||||
|
||||
public LayerRegion(int i)
|
||||
{
|
||||
id = i;
|
||||
ymin = 0xFFFF;
|
||||
layerId = 0xff;
|
||||
layers = new List<int>();
|
||||
neis = new List<int>();
|
||||
}
|
||||
};
|
||||
|
||||
private static void AddUnique(List<int> a, int v)
|
||||
{
|
||||
|
@ -564,4 +546,4 @@ namespace DotRecast.Recast
|
|||
return lset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ freely, subject to the following restrictions:
|
|||
*/
|
||||
|
||||
using System;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
@ -29,12 +30,6 @@ namespace DotRecast.Recast
|
|||
public const int MAX_MESH_VERTS_POLY = 0xffff;
|
||||
public const int VERTEX_BUCKET_COUNT = (1 << 12);
|
||||
|
||||
private class Edge
|
||||
{
|
||||
public int[] vert = new int[2];
|
||||
public int[] polyEdge = new int[2];
|
||||
public int[] poly = new int[2];
|
||||
}
|
||||
|
||||
private static void BuildMeshAdjacency(int[] polys, int npolys, int nverts, int vertsPerPoly)
|
||||
{
|
||||
|
@ -1381,4 +1376,4 @@ namespace DotRecast.Recast
|
|||
return dst;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,14 +37,6 @@ namespace DotRecast.Recast
|
|||
public const int EV_UNDEF = -1;
|
||||
public const int EV_HULL = -2;
|
||||
|
||||
private class HeightPatch
|
||||
{
|
||||
public int xmin;
|
||||
public int ymin;
|
||||
public int width;
|
||||
public int height;
|
||||
public int[] data;
|
||||
}
|
||||
|
||||
private static float Vdot2(float[] a, float[] b)
|
||||
{
|
||||
|
@ -1692,4 +1684,4 @@ namespace DotRecast.Recast
|
|||
return mesh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,13 +30,6 @@ namespace DotRecast.Recast
|
|||
{
|
||||
const int RC_NULL_NEI = 0xffff;
|
||||
|
||||
public class SweepSpan
|
||||
{
|
||||
public int rid; // row id
|
||||
public int id; // region id
|
||||
public int ns; // number samples
|
||||
public int nei; // neighbour id
|
||||
}
|
||||
|
||||
public static int CalculateDistanceField(CompactHeightfield chf, int[] src)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
namespace DotRecast.Recast
|
||||
{
|
||||
public class SweepSpan
|
||||
{
|
||||
public int rid; // row id
|
||||
public int id; // region id
|
||||
public int ns; // number samples
|
||||
public int nei; // neighbour id
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue