forked from mirror/DotRecast
Renamed RcBuilderResult class to C# style naming
This commit is contained in:
parent
82027dffd7
commit
7874b4403c
|
@ -132,8 +132,8 @@ namespace DotRecast.Detour.Dynamic
|
||||||
private DtNavMeshCreateParams NavMeshCreateParams(int tilex, int tileZ, float cellSize, float cellHeight,
|
private DtNavMeshCreateParams NavMeshCreateParams(int tilex, int tileZ, float cellSize, float cellHeight,
|
||||||
DtDynamicNavMeshConfig config, RcBuilderResult rcResult)
|
DtDynamicNavMeshConfig config, RcBuilderResult rcResult)
|
||||||
{
|
{
|
||||||
RcPolyMesh m_pmesh = rcResult.GetMesh();
|
RcPolyMesh m_pmesh = rcResult.Mesh;
|
||||||
RcPolyMeshDetail m_dmesh = rcResult.GetMeshDetail();
|
RcPolyMeshDetail m_dmesh = rcResult.MeshDetail;
|
||||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||||
for (int i = 0; i < m_pmesh.npolys; ++i)
|
for (int i = 0; i < m_pmesh.npolys; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,13 +109,13 @@ namespace DotRecast.Detour.Dynamic.Io
|
||||||
};
|
};
|
||||||
foreach (RcBuilderResult r in results)
|
foreach (RcBuilderResult r in results)
|
||||||
{
|
{
|
||||||
f.tiles.Add(new DtVoxelTile(r.tileX, r.tileZ, r.GetSolidHeightfield()));
|
f.tiles.Add(new DtVoxelTile(r.TileX, r.TileZ, r.SolidHeightfiled));
|
||||||
f.bounds[0] = Math.Min(f.bounds[0], r.GetSolidHeightfield().bmin.X);
|
f.bounds[0] = Math.Min(f.bounds[0], r.SolidHeightfiled.bmin.X);
|
||||||
f.bounds[1] = Math.Min(f.bounds[1], r.GetSolidHeightfield().bmin.Y);
|
f.bounds[1] = Math.Min(f.bounds[1], r.SolidHeightfiled.bmin.Y);
|
||||||
f.bounds[2] = Math.Min(f.bounds[2], r.GetSolidHeightfield().bmin.Z);
|
f.bounds[2] = Math.Min(f.bounds[2], r.SolidHeightfiled.bmin.Z);
|
||||||
f.bounds[3] = Math.Max(f.bounds[3], r.GetSolidHeightfield().bmax.X);
|
f.bounds[3] = Math.Max(f.bounds[3], r.SolidHeightfiled.bmax.X);
|
||||||
f.bounds[4] = Math.Max(f.bounds[4], r.GetSolidHeightfield().bmax.Y);
|
f.bounds[4] = Math.Max(f.bounds[4], r.SolidHeightfiled.bmax.Y);
|
||||||
f.bounds[5] = Math.Max(f.bounds[5], r.GetSolidHeightfield().bmax.Z);
|
f.bounds[5] = Math.Max(f.bounds[5], r.SolidHeightfiled.bmax.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
public JumpLinkBuilder(IList<RcBuilderResult> results)
|
public JumpLinkBuilder(IList<RcBuilderResult> results)
|
||||||
{
|
{
|
||||||
this.results = results;
|
this.results = results;
|
||||||
edges = results.Select(r => edgeExtractor.ExtractEdges(r.GetMesh())).ToList();
|
edges = results.Select(r => edgeExtractor.ExtractEdges(r.Mesh)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JumpLink> Build(JumpLinkBuilderConfig acfg, JumpLinkType type)
|
public List<JumpLink> Build(JumpLinkBuilderConfig acfg, JumpLinkType type)
|
||||||
|
@ -43,7 +43,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
EdgeSampler es = edgeSamplerFactory.Get(acfg, type, edge);
|
EdgeSampler es = edgeSamplerFactory.Get(acfg, type, edge);
|
||||||
groundSampler.Sample(acfg, result, es);
|
groundSampler.Sample(acfg, result, es);
|
||||||
trajectorySampler.Sample(acfg, result.GetSolidHeightfield(), es);
|
trajectorySampler.Sample(acfg, result.SolidHeightfiled, es);
|
||||||
JumpSegment[] jumpSegments = jumpSegmentBuilder.Build(acfg, es);
|
JumpSegment[] jumpSegments = jumpSegmentBuilder.Build(acfg, es);
|
||||||
return BuildJumpLinks(acfg, es, jumpSegments);
|
return BuildJumpLinks(acfg, es, jumpSegments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,25 +16,25 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
private DtNavMeshQuery CreateNavMesh(RcBuilderResult r, float agentRadius, float agentHeight, float agentClimb)
|
private DtNavMeshQuery CreateNavMesh(RcBuilderResult r, float agentRadius, float agentHeight, float agentClimb)
|
||||||
{
|
{
|
||||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||||
option.verts = r.GetMesh().verts;
|
option.verts = r.Mesh.verts;
|
||||||
option.vertCount = r.GetMesh().nverts;
|
option.vertCount = r.Mesh.nverts;
|
||||||
option.polys = r.GetMesh().polys;
|
option.polys = r.Mesh.polys;
|
||||||
option.polyAreas = r.GetMesh().areas;
|
option.polyAreas = r.Mesh.areas;
|
||||||
option.polyFlags = r.GetMesh().flags;
|
option.polyFlags = r.Mesh.flags;
|
||||||
option.polyCount = r.GetMesh().npolys;
|
option.polyCount = r.Mesh.npolys;
|
||||||
option.nvp = r.GetMesh().nvp;
|
option.nvp = r.Mesh.nvp;
|
||||||
option.detailMeshes = r.GetMeshDetail().meshes;
|
option.detailMeshes = r.MeshDetail.meshes;
|
||||||
option.detailVerts = r.GetMeshDetail().verts;
|
option.detailVerts = r.MeshDetail.verts;
|
||||||
option.detailVertsCount = r.GetMeshDetail().nverts;
|
option.detailVertsCount = r.MeshDetail.nverts;
|
||||||
option.detailTris = r.GetMeshDetail().tris;
|
option.detailTris = r.MeshDetail.tris;
|
||||||
option.detailTriCount = r.GetMeshDetail().ntris;
|
option.detailTriCount = r.MeshDetail.ntris;
|
||||||
option.walkableRadius = agentRadius;
|
option.walkableRadius = agentRadius;
|
||||||
option.walkableHeight = agentHeight;
|
option.walkableHeight = agentHeight;
|
||||||
option.walkableClimb = agentClimb;
|
option.walkableClimb = agentClimb;
|
||||||
option.bmin = r.GetMesh().bmin;
|
option.bmin = r.Mesh.bmin;
|
||||||
option.bmax = r.GetMesh().bmax;
|
option.bmax = r.Mesh.bmax;
|
||||||
option.cs = r.GetMesh().cs;
|
option.cs = r.Mesh.cs;
|
||||||
option.ch = r.GetMesh().ch;
|
option.ch = r.Mesh.ch;
|
||||||
option.buildBvTree = true;
|
option.buildBvTree = true;
|
||||||
return new DtNavMeshQuery(new DtNavMesh(DtNavMeshBuilder.CreateNavMeshData(option), option.nvp, 0));
|
return new DtNavMeshQuery(new DtNavMesh(DtNavMeshBuilder.CreateNavMeshData(option), option.nvp, 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,80 +123,80 @@ public class NavMeshRenderer
|
||||||
|
|
||||||
foreach (RcBuilderResult rcBuilderResult in rcBuilderResults)
|
foreach (RcBuilderResult rcBuilderResult in rcBuilderResults)
|
||||||
{
|
{
|
||||||
if (rcBuilderResult.GetCompactHeightfield() != null && drawMode == DrawMode.DRAWMODE_COMPACT)
|
if (rcBuilderResult.CompactHeightfield != null && drawMode == DrawMode.DRAWMODE_COMPACT)
|
||||||
{
|
{
|
||||||
_debugDraw.DebugDrawCompactHeightfieldSolid(rcBuilderResult.GetCompactHeightfield());
|
_debugDraw.DebugDrawCompactHeightfieldSolid(rcBuilderResult.CompactHeightfield);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetCompactHeightfield() != null && drawMode == DrawMode.DRAWMODE_COMPACT_DISTANCE)
|
if (rcBuilderResult.CompactHeightfield != null && drawMode == DrawMode.DRAWMODE_COMPACT_DISTANCE)
|
||||||
{
|
{
|
||||||
_debugDraw.DebugDrawCompactHeightfieldDistance(rcBuilderResult.GetCompactHeightfield());
|
_debugDraw.DebugDrawCompactHeightfieldDistance(rcBuilderResult.CompactHeightfield);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetCompactHeightfield() != null && drawMode == DrawMode.DRAWMODE_COMPACT_REGIONS)
|
if (rcBuilderResult.CompactHeightfield != null && drawMode == DrawMode.DRAWMODE_COMPACT_REGIONS)
|
||||||
{
|
{
|
||||||
_debugDraw.DebugDrawCompactHeightfieldRegions(rcBuilderResult.GetCompactHeightfield());
|
_debugDraw.DebugDrawCompactHeightfieldRegions(rcBuilderResult.CompactHeightfield);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetSolidHeightfield() != null && drawMode == DrawMode.DRAWMODE_VOXELS)
|
if (rcBuilderResult.SolidHeightfiled != null && drawMode == DrawMode.DRAWMODE_VOXELS)
|
||||||
{
|
{
|
||||||
_debugDraw.Fog(true);
|
_debugDraw.Fog(true);
|
||||||
_debugDraw.DebugDrawHeightfieldSolid(rcBuilderResult.GetSolidHeightfield());
|
_debugDraw.DebugDrawHeightfieldSolid(rcBuilderResult.SolidHeightfiled);
|
||||||
_debugDraw.Fog(false);
|
_debugDraw.Fog(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetSolidHeightfield() != null && drawMode == DrawMode.DRAWMODE_VOXELS_WALKABLE)
|
if (rcBuilderResult.SolidHeightfiled != null && drawMode == DrawMode.DRAWMODE_VOXELS_WALKABLE)
|
||||||
{
|
{
|
||||||
_debugDraw.Fog(true);
|
_debugDraw.Fog(true);
|
||||||
_debugDraw.DebugDrawHeightfieldWalkable(rcBuilderResult.GetSolidHeightfield());
|
_debugDraw.DebugDrawHeightfieldWalkable(rcBuilderResult.SolidHeightfiled);
|
||||||
_debugDraw.Fog(false);
|
_debugDraw.Fog(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetContourSet() != null && drawMode == DrawMode.DRAWMODE_RAW_CONTOURS)
|
if (rcBuilderResult.ContourSet != null && drawMode == DrawMode.DRAWMODE_RAW_CONTOURS)
|
||||||
{
|
{
|
||||||
_debugDraw.DepthMask(false);
|
_debugDraw.DepthMask(false);
|
||||||
_debugDraw.DebugDrawRawContours(rcBuilderResult.GetContourSet(), 1f);
|
_debugDraw.DebugDrawRawContours(rcBuilderResult.ContourSet, 1f);
|
||||||
_debugDraw.DepthMask(true);
|
_debugDraw.DepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetContourSet() != null && drawMode == DrawMode.DRAWMODE_BOTH_CONTOURS)
|
if (rcBuilderResult.ContourSet != null && drawMode == DrawMode.DRAWMODE_BOTH_CONTOURS)
|
||||||
{
|
{
|
||||||
_debugDraw.DepthMask(false);
|
_debugDraw.DepthMask(false);
|
||||||
_debugDraw.DebugDrawRawContours(rcBuilderResult.GetContourSet(), 0.5f);
|
_debugDraw.DebugDrawRawContours(rcBuilderResult.ContourSet, 0.5f);
|
||||||
_debugDraw.DebugDrawContours(rcBuilderResult.GetContourSet());
|
_debugDraw.DebugDrawContours(rcBuilderResult.ContourSet);
|
||||||
_debugDraw.DepthMask(true);
|
_debugDraw.DepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetContourSet() != null && drawMode == DrawMode.DRAWMODE_CONTOURS)
|
if (rcBuilderResult.ContourSet != null && drawMode == DrawMode.DRAWMODE_CONTOURS)
|
||||||
{
|
{
|
||||||
_debugDraw.DepthMask(false);
|
_debugDraw.DepthMask(false);
|
||||||
_debugDraw.DebugDrawContours(rcBuilderResult.GetContourSet());
|
_debugDraw.DebugDrawContours(rcBuilderResult.ContourSet);
|
||||||
_debugDraw.DepthMask(true);
|
_debugDraw.DepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetCompactHeightfield() != null && drawMode == DrawMode.DRAWMODE_REGION_CONNECTIONS)
|
if (rcBuilderResult.CompactHeightfield != null && drawMode == DrawMode.DRAWMODE_REGION_CONNECTIONS)
|
||||||
{
|
{
|
||||||
_debugDraw.DebugDrawCompactHeightfieldRegions(rcBuilderResult.GetCompactHeightfield());
|
_debugDraw.DebugDrawCompactHeightfieldRegions(rcBuilderResult.CompactHeightfield);
|
||||||
_debugDraw.DepthMask(false);
|
_debugDraw.DepthMask(false);
|
||||||
if (rcBuilderResult.GetContourSet() != null)
|
if (rcBuilderResult.ContourSet != null)
|
||||||
{
|
{
|
||||||
_debugDraw.DebugDrawRegionConnections(rcBuilderResult.GetContourSet());
|
_debugDraw.DebugDrawRegionConnections(rcBuilderResult.ContourSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
_debugDraw.DepthMask(true);
|
_debugDraw.DepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetMesh() != null && drawMode == DrawMode.DRAWMODE_POLYMESH)
|
if (rcBuilderResult.Mesh != null && drawMode == DrawMode.DRAWMODE_POLYMESH)
|
||||||
{
|
{
|
||||||
_debugDraw.DepthMask(false);
|
_debugDraw.DepthMask(false);
|
||||||
_debugDraw.DebugDrawPolyMesh(rcBuilderResult.GetMesh());
|
_debugDraw.DebugDrawPolyMesh(rcBuilderResult.Mesh);
|
||||||
_debugDraw.DepthMask(true);
|
_debugDraw.DepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcBuilderResult.GetMeshDetail() != null && drawMode == DrawMode.DRAWMODE_POLYMESH_DETAIL)
|
if (rcBuilderResult.MeshDetail != null && drawMode == DrawMode.DRAWMODE_POLYMESH_DETAIL)
|
||||||
{
|
{
|
||||||
_debugDraw.DepthMask(false);
|
_debugDraw.DepthMask(false);
|
||||||
_debugDraw.DebugDrawPolyMeshDetail(rcBuilderResult.GetMeshDetail());
|
_debugDraw.DebugDrawPolyMeshDetail(rcBuilderResult.MeshDetail);
|
||||||
_debugDraw.DepthMask(true);
|
_debugDraw.DepthMask(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,7 +552,7 @@ public class RecastDemo : IRecastDemoChannel
|
||||||
{
|
{
|
||||||
foreach (RcBuilderResult result in _sample.GetRecastResults())
|
foreach (RcBuilderResult result in _sample.GetRecastResults())
|
||||||
{
|
{
|
||||||
if (result.GetSolidHeightfield() != null)
|
if (result.SolidHeightfiled != null)
|
||||||
{
|
{
|
||||||
if (!hasBound)
|
if (!hasBound)
|
||||||
{
|
{
|
||||||
|
@ -561,15 +561,15 @@ public class RecastDemo : IRecastDemoChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
bminN = new RcVec3f(
|
bminN = new RcVec3f(
|
||||||
Math.Min(bminN.X, result.GetSolidHeightfield().bmin.X),
|
Math.Min(bminN.X, result.SolidHeightfiled.bmin.X),
|
||||||
Math.Min(bminN.Y, result.GetSolidHeightfield().bmin.Y),
|
Math.Min(bminN.Y, result.SolidHeightfiled.bmin.Y),
|
||||||
Math.Min(bminN.Z, result.GetSolidHeightfield().bmin.Z)
|
Math.Min(bminN.Z, result.SolidHeightfiled.bmin.Z)
|
||||||
);
|
);
|
||||||
|
|
||||||
bmaxN = new RcVec3f(
|
bmaxN = new RcVec3f(
|
||||||
Math.Max(bmaxN.X, result.GetSolidHeightfield().bmax.X),
|
Math.Max(bmaxN.X, result.SolidHeightfiled.bmax.X),
|
||||||
Math.Max(bmaxN.Y, result.GetSolidHeightfield().bmax.Y),
|
Math.Max(bmaxN.Y, result.SolidHeightfiled.bmax.Y),
|
||||||
Math.Max(bmaxN.Z, result.GetSolidHeightfield().bmax.Z)
|
Math.Max(bmaxN.Z, result.SolidHeightfiled.bmax.Z)
|
||||||
);
|
);
|
||||||
|
|
||||||
hasBound = true;
|
hasBound = true;
|
||||||
|
@ -713,7 +713,7 @@ public class RecastDemo : IRecastDemoChannel
|
||||||
Logger.Information($"build times");
|
Logger.Information($"build times");
|
||||||
Logger.Information($"-----------------------------------------");
|
Logger.Information($"-----------------------------------------");
|
||||||
var telemetries = buildResult.RecastBuilderResults
|
var telemetries = buildResult.RecastBuilderResults
|
||||||
.Select(x => x.GetTelemetry())
|
.Select(x => x.Context)
|
||||||
.SelectMany(x => x.ToList())
|
.SelectMany(x => x.ToList())
|
||||||
.GroupBy(x => x.Key)
|
.GroupBy(x => x.Key)
|
||||||
.ToImmutableSortedDictionary(x => x.Key, x => x.Sum(y => y.Millis));
|
.ToImmutableSortedDictionary(x => x.Key, x => x.Sum(y => y.Millis));
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace DotRecast.Recast.Toolset.Builder
|
||||||
float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb,
|
float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb,
|
||||||
RcBuilderResult rcResult)
|
RcBuilderResult rcResult)
|
||||||
{
|
{
|
||||||
RcPolyMesh pmesh = rcResult.GetMesh();
|
RcPolyMesh pmesh = rcResult.Mesh;
|
||||||
RcPolyMeshDetail dmesh = rcResult.GetMeshDetail();
|
RcPolyMeshDetail dmesh = rcResult.MeshDetail;
|
||||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||||
for (int i = 0; i < pmesh.npolys; ++i)
|
for (int i = 0; i < pmesh.npolys; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,8 +124,8 @@ namespace DotRecast.Recast.Toolset.Builder
|
||||||
List<DtMeshData> meshData = new List<DtMeshData>();
|
List<DtMeshData> meshData = new List<DtMeshData>();
|
||||||
foreach (RcBuilderResult result in results)
|
foreach (RcBuilderResult result in results)
|
||||||
{
|
{
|
||||||
int x = result.tileX;
|
int x = result.TileX;
|
||||||
int z = result.tileZ;
|
int z = result.TileZ;
|
||||||
DtNavMeshCreateParams option = DemoNavMeshBuilder
|
DtNavMeshCreateParams option = DemoNavMeshBuilder
|
||||||
.GetNavMeshCreateParams(geom, cellSize, cellHeight, agentHeight, agentRadius, agentMaxClimb, result);
|
.GetNavMeshCreateParams(geom, cellSize, cellHeight, agentHeight, agentRadius, agentMaxClimb, result);
|
||||||
|
|
||||||
|
|
|
@ -4,56 +4,26 @@ namespace DotRecast.Recast
|
||||||
{
|
{
|
||||||
public class RcBuilderResult
|
public class RcBuilderResult
|
||||||
{
|
{
|
||||||
public readonly int tileX;
|
public readonly int TileX;
|
||||||
public readonly int tileZ;
|
public readonly int TileZ;
|
||||||
|
|
||||||
private readonly RcCompactHeightfield chf;
|
|
||||||
private readonly RcContourSet cs;
|
|
||||||
private readonly RcPolyMesh pmesh;
|
|
||||||
private readonly RcPolyMeshDetail dmesh;
|
|
||||||
private readonly RcHeightfield solid;
|
|
||||||
private readonly RcContext _context;
|
|
||||||
|
|
||||||
public RcBuilderResult(int tileX, int tileZ, RcHeightfield solid, RcCompactHeightfield chf, RcContourSet cs, RcPolyMesh pmesh, RcPolyMeshDetail dmesh, RcContext ctx)
|
public readonly RcHeightfield SolidHeightfiled;
|
||||||
{
|
public readonly RcCompactHeightfield CompactHeightfield;
|
||||||
this.tileX = tileX;
|
public readonly RcContourSet ContourSet;
|
||||||
this.tileZ = tileZ;
|
public readonly RcPolyMesh Mesh;
|
||||||
this.solid = solid;
|
public readonly RcPolyMeshDetail MeshDetail;
|
||||||
this.chf = chf;
|
public readonly RcContext Context;
|
||||||
this.cs = cs;
|
|
||||||
this.pmesh = pmesh;
|
|
||||||
this.dmesh = dmesh;
|
|
||||||
_context = ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RcPolyMesh GetMesh()
|
public RcBuilderResult(int tileX, int tileZ, RcHeightfield solidHeightfiled, RcCompactHeightfield compactHeightfield, RcContourSet contourSet, RcPolyMesh mesh, RcPolyMeshDetail meshDetail, RcContext ctx)
|
||||||
{
|
{
|
||||||
return pmesh;
|
TileX = tileX;
|
||||||
}
|
TileZ = tileZ;
|
||||||
|
SolidHeightfiled = solidHeightfiled;
|
||||||
public RcPolyMeshDetail GetMeshDetail()
|
CompactHeightfield = compactHeightfield;
|
||||||
{
|
ContourSet = contourSet;
|
||||||
return dmesh;
|
Mesh = mesh;
|
||||||
}
|
MeshDetail = meshDetail;
|
||||||
|
Context = ctx;
|
||||||
public RcCompactHeightfield GetCompactHeightfield()
|
|
||||||
{
|
|
||||||
return chf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RcContourSet GetContourSet()
|
|
||||||
{
|
|
||||||
return cs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RcHeightfield GetSolidHeightfield()
|
|
||||||
{
|
|
||||||
return solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RcContext GetTelemetry()
|
|
||||||
{
|
|
||||||
return _context;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,9 +30,9 @@ namespace DotRecast.Recast
|
||||||
hitTime = 0.0f;
|
hitTime = 0.0f;
|
||||||
foreach (RcBuilderResult result in results)
|
foreach (RcBuilderResult result in results)
|
||||||
{
|
{
|
||||||
if (result.GetMeshDetail() != null)
|
if (result.MeshDetail != null)
|
||||||
{
|
{
|
||||||
if (Raycast(result.GetMesh(), result.GetMeshDetail(), src, dst, out hitTime))
|
if (Raycast(result.Mesh, result.MeshDetail, src, dst, out hitTime))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,13 +73,13 @@ public class RecastTestMeshBuilder
|
||||||
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
||||||
RcBuilder rcBuilder = new RcBuilder();
|
RcBuilder rcBuilder = new RcBuilder();
|
||||||
RcBuilderResult rcResult = rcBuilder.Build(geom, bcfg);
|
RcBuilderResult rcResult = rcBuilder.Build(geom, bcfg);
|
||||||
RcPolyMesh m_pmesh = rcResult.GetMesh();
|
RcPolyMesh m_pmesh = rcResult.Mesh;
|
||||||
for (int i = 0; i < m_pmesh.npolys; ++i)
|
for (int i = 0; i < m_pmesh.npolys; ++i)
|
||||||
{
|
{
|
||||||
m_pmesh.flags[i] = 1;
|
m_pmesh.flags[i] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RcPolyMeshDetail m_dmesh = rcResult.GetMeshDetail();
|
RcPolyMeshDetail m_dmesh = rcResult.MeshDetail;
|
||||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||||
option.verts = m_pmesh.verts;
|
option.verts = m_pmesh.verts;
|
||||||
option.vertCount = m_pmesh.nverts;
|
option.vertCount = m_pmesh.nverts;
|
||||||
|
|
|
@ -73,13 +73,13 @@ public class RecastTestMeshBuilder
|
||||||
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
||||||
RcBuilder rcBuilder = new RcBuilder();
|
RcBuilder rcBuilder = new RcBuilder();
|
||||||
RcBuilderResult rcResult = rcBuilder.Build(geom, bcfg);
|
RcBuilderResult rcResult = rcBuilder.Build(geom, bcfg);
|
||||||
RcPolyMesh m_pmesh = rcResult.GetMesh();
|
RcPolyMesh m_pmesh = rcResult.Mesh;
|
||||||
for (int i = 0; i < m_pmesh.npolys; ++i)
|
for (int i = 0; i < m_pmesh.npolys; ++i)
|
||||||
{
|
{
|
||||||
m_pmesh.flags[i] = 1;
|
m_pmesh.flags[i] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RcPolyMeshDetail m_dmesh = rcResult.GetMeshDetail();
|
RcPolyMeshDetail m_dmesh = rcResult.MeshDetail;
|
||||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||||
option.verts = m_pmesh.verts;
|
option.verts = m_pmesh.verts;
|
||||||
option.vertCount = m_pmesh.nverts;
|
option.vertCount = m_pmesh.nverts;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class TestDetourBuilder : DetourBuilder
|
||||||
{
|
{
|
||||||
RcBuilder rcBuilder = new RcBuilder();
|
RcBuilder rcBuilder = new RcBuilder();
|
||||||
RcBuilderResult rcResult = rcBuilder.Build(geom, rcConfig);
|
RcBuilderResult rcResult = rcBuilder.Build(geom, rcConfig);
|
||||||
RcPolyMesh pmesh = rcResult.GetMesh();
|
RcPolyMesh pmesh = rcResult.Mesh;
|
||||||
|
|
||||||
if (applyRecastDemoFlags)
|
if (applyRecastDemoFlags)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ public class TestDetourBuilder : DetourBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RcPolyMeshDetail dmesh = rcResult.GetMeshDetail();
|
RcPolyMeshDetail dmesh = rcResult.MeshDetail;
|
||||||
DtNavMeshCreateParams option = GetNavMeshCreateParams(rcConfig.cfg, pmesh, dmesh, agentHeight, agentRadius,
|
DtNavMeshCreateParams option = GetNavMeshCreateParams(rcConfig.cfg, pmesh, dmesh, agentHeight, agentRadius,
|
||||||
agentMaxClimb);
|
agentMaxClimb);
|
||||||
return Build(option, x, y);
|
return Build(option, x, y);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class TestTiledNavMeshBuilder
|
||||||
|
|
||||||
foreach (RcBuilderResult result in rcResult)
|
foreach (RcBuilderResult result in rcResult)
|
||||||
{
|
{
|
||||||
RcPolyMesh pmesh = result.GetMesh();
|
RcPolyMesh pmesh = result.Mesh;
|
||||||
if (pmesh.npolys == 0)
|
if (pmesh.npolys == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -104,7 +104,7 @@ public class TestTiledNavMeshBuilder
|
||||||
option.polyFlags = pmesh.flags;
|
option.polyFlags = pmesh.flags;
|
||||||
option.polyCount = pmesh.npolys;
|
option.polyCount = pmesh.npolys;
|
||||||
option.nvp = pmesh.nvp;
|
option.nvp = pmesh.nvp;
|
||||||
RcPolyMeshDetail dmesh = result.GetMeshDetail();
|
RcPolyMeshDetail dmesh = result.MeshDetail;
|
||||||
option.detailMeshes = dmesh.meshes;
|
option.detailMeshes = dmesh.meshes;
|
||||||
option.detailVerts = dmesh.verts;
|
option.detailVerts = dmesh.verts;
|
||||||
option.detailVertsCount = dmesh.nverts;
|
option.detailVertsCount = dmesh.nverts;
|
||||||
|
@ -117,8 +117,8 @@ public class TestTiledNavMeshBuilder
|
||||||
option.bmax = pmesh.bmax;
|
option.bmax = pmesh.bmax;
|
||||||
option.cs = cellSize;
|
option.cs = cellSize;
|
||||||
option.ch = cellHeight;
|
option.ch = cellHeight;
|
||||||
option.tileX = result.tileX;
|
option.tileX = result.TileX;
|
||||||
option.tileZ = result.tileZ;
|
option.tileZ = result.TileZ;
|
||||||
option.buildBvTree = true;
|
option.buildBvTree = true;
|
||||||
navMesh.AddTile(DtNavMeshBuilder.CreateNavMeshData(option), 0, 0);
|
navMesh.AddTile(DtNavMeshBuilder.CreateNavMeshData(option), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,28 +70,28 @@ public class RecastTileMeshTest
|
||||||
SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true);
|
SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true);
|
||||||
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 7, 8);
|
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 7, 8);
|
||||||
RcBuilderResult rcResult = builder.Build(geom, bcfg);
|
RcBuilderResult rcResult = builder.Build(geom, bcfg);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(1));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(1));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(5));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(5));
|
||||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 6, 9);
|
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 6, 9);
|
||||||
rcResult = builder.Build(geom, bcfg);
|
rcResult = builder.Build(geom, bcfg);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(2));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(2));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(7));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(7));
|
||||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 2, 9);
|
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 2, 9);
|
||||||
rcResult = builder.Build(geom, bcfg);
|
rcResult = builder.Build(geom, bcfg);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(2));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(2));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(9));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(9));
|
||||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 4, 3);
|
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 4, 3);
|
||||||
rcResult = builder.Build(geom, bcfg);
|
rcResult = builder.Build(geom, bcfg);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(3));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(3));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(6));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(6));
|
||||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 2, 8);
|
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 2, 8);
|
||||||
rcResult = builder.Build(geom, bcfg);
|
rcResult = builder.Build(geom, bcfg);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(5));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(5));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(17));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(17));
|
||||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 0, 8);
|
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 0, 8);
|
||||||
rcResult = builder.Build(geom, bcfg);
|
rcResult = builder.Build(geom, bcfg);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(6));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(6));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(15));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(15));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -142,23 +142,23 @@ public class RecastTileMeshTest
|
||||||
if (validate)
|
if (validate)
|
||||||
{
|
{
|
||||||
RcBuilderResult rcResult = GetTile(tiles, 7, 8);
|
RcBuilderResult rcResult = GetTile(tiles, 7, 8);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(1));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(1));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(5));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(5));
|
||||||
rcResult = GetTile(tiles, 6, 9);
|
rcResult = GetTile(tiles, 6, 9);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(2));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(2));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(7));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(7));
|
||||||
rcResult = GetTile(tiles, 2, 9);
|
rcResult = GetTile(tiles, 2, 9);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(2));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(2));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(9));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(9));
|
||||||
rcResult = GetTile(tiles, 4, 3);
|
rcResult = GetTile(tiles, 4, 3);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(3));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(3));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(6));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(6));
|
||||||
rcResult = GetTile(tiles, 2, 8);
|
rcResult = GetTile(tiles, 2, 8);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(5));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(5));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(17));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(17));
|
||||||
rcResult = GetTile(tiles, 0, 8);
|
rcResult = GetTile(tiles, 0, 8);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(6));
|
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(6));
|
||||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(15));
|
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(15));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -174,6 +174,6 @@ public class RecastTileMeshTest
|
||||||
|
|
||||||
private RcBuilderResult GetTile(List<RcBuilderResult> tiles, int x, int z)
|
private RcBuilderResult GetTile(List<RcBuilderResult> tiles, int x, int z)
|
||||||
{
|
{
|
||||||
return tiles.FirstOrDefault(tile => tile.tileX == x && tile.tileZ == z);
|
return tiles.FirstOrDefault(tile => tile.TileX == x && tile.TileZ == z);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue