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,
|
||||
DtDynamicNavMeshConfig config, RcBuilderResult rcResult)
|
||||
{
|
||||
RcPolyMesh m_pmesh = rcResult.GetMesh();
|
||||
RcPolyMeshDetail m_dmesh = rcResult.GetMeshDetail();
|
||||
RcPolyMesh m_pmesh = rcResult.Mesh;
|
||||
RcPolyMeshDetail m_dmesh = rcResult.MeshDetail;
|
||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||
for (int i = 0; i < m_pmesh.npolys; ++i)
|
||||
{
|
||||
|
|
|
@ -109,13 +109,13 @@ namespace DotRecast.Detour.Dynamic.Io
|
|||
};
|
||||
foreach (RcBuilderResult r in results)
|
||||
{
|
||||
f.tiles.Add(new DtVoxelTile(r.tileX, r.tileZ, r.GetSolidHeightfield()));
|
||||
f.bounds[0] = Math.Min(f.bounds[0], r.GetSolidHeightfield().bmin.X);
|
||||
f.bounds[1] = Math.Min(f.bounds[1], r.GetSolidHeightfield().bmin.Y);
|
||||
f.bounds[2] = Math.Min(f.bounds[2], r.GetSolidHeightfield().bmin.Z);
|
||||
f.bounds[3] = Math.Max(f.bounds[3], r.GetSolidHeightfield().bmax.X);
|
||||
f.bounds[4] = Math.Max(f.bounds[4], r.GetSolidHeightfield().bmax.Y);
|
||||
f.bounds[5] = Math.Max(f.bounds[5], r.GetSolidHeightfield().bmax.Z);
|
||||
f.tiles.Add(new DtVoxelTile(r.TileX, r.TileZ, r.SolidHeightfiled));
|
||||
f.bounds[0] = Math.Min(f.bounds[0], r.SolidHeightfiled.bmin.X);
|
||||
f.bounds[1] = Math.Min(f.bounds[1], r.SolidHeightfiled.bmin.Y);
|
||||
f.bounds[2] = Math.Min(f.bounds[2], r.SolidHeightfiled.bmin.Z);
|
||||
f.bounds[3] = Math.Max(f.bounds[3], r.SolidHeightfiled.bmax.X);
|
||||
f.bounds[4] = Math.Max(f.bounds[4], r.SolidHeightfiled.bmax.Y);
|
||||
f.bounds[5] = Math.Max(f.bounds[5], r.SolidHeightfiled.bmax.Z);
|
||||
}
|
||||
|
||||
return f;
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
public JumpLinkBuilder(IList<RcBuilderResult> 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)
|
||||
|
@ -43,7 +43,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
EdgeSampler es = edgeSamplerFactory.Get(acfg, type, edge);
|
||||
groundSampler.Sample(acfg, result, es);
|
||||
trajectorySampler.Sample(acfg, result.GetSolidHeightfield(), es);
|
||||
trajectorySampler.Sample(acfg, result.SolidHeightfiled, es);
|
||||
JumpSegment[] jumpSegments = jumpSegmentBuilder.Build(acfg, es);
|
||||
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)
|
||||
{
|
||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||
option.verts = r.GetMesh().verts;
|
||||
option.vertCount = r.GetMesh().nverts;
|
||||
option.polys = r.GetMesh().polys;
|
||||
option.polyAreas = r.GetMesh().areas;
|
||||
option.polyFlags = r.GetMesh().flags;
|
||||
option.polyCount = r.GetMesh().npolys;
|
||||
option.nvp = r.GetMesh().nvp;
|
||||
option.detailMeshes = r.GetMeshDetail().meshes;
|
||||
option.detailVerts = r.GetMeshDetail().verts;
|
||||
option.detailVertsCount = r.GetMeshDetail().nverts;
|
||||
option.detailTris = r.GetMeshDetail().tris;
|
||||
option.detailTriCount = r.GetMeshDetail().ntris;
|
||||
option.verts = r.Mesh.verts;
|
||||
option.vertCount = r.Mesh.nverts;
|
||||
option.polys = r.Mesh.polys;
|
||||
option.polyAreas = r.Mesh.areas;
|
||||
option.polyFlags = r.Mesh.flags;
|
||||
option.polyCount = r.Mesh.npolys;
|
||||
option.nvp = r.Mesh.nvp;
|
||||
option.detailMeshes = r.MeshDetail.meshes;
|
||||
option.detailVerts = r.MeshDetail.verts;
|
||||
option.detailVertsCount = r.MeshDetail.nverts;
|
||||
option.detailTris = r.MeshDetail.tris;
|
||||
option.detailTriCount = r.MeshDetail.ntris;
|
||||
option.walkableRadius = agentRadius;
|
||||
option.walkableHeight = agentHeight;
|
||||
option.walkableClimb = agentClimb;
|
||||
option.bmin = r.GetMesh().bmin;
|
||||
option.bmax = r.GetMesh().bmax;
|
||||
option.cs = r.GetMesh().cs;
|
||||
option.ch = r.GetMesh().ch;
|
||||
option.bmin = r.Mesh.bmin;
|
||||
option.bmax = r.Mesh.bmax;
|
||||
option.cs = r.Mesh.cs;
|
||||
option.ch = r.Mesh.ch;
|
||||
option.buildBvTree = true;
|
||||
return new DtNavMeshQuery(new DtNavMesh(DtNavMeshBuilder.CreateNavMeshData(option), option.nvp, 0));
|
||||
}
|
||||
|
|
|
@ -123,80 +123,80 @@ public class NavMeshRenderer
|
|||
|
||||
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.DebugDrawHeightfieldSolid(rcBuilderResult.GetSolidHeightfield());
|
||||
_debugDraw.DebugDrawHeightfieldSolid(rcBuilderResult.SolidHeightfiled);
|
||||
_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.DebugDrawHeightfieldWalkable(rcBuilderResult.GetSolidHeightfield());
|
||||
_debugDraw.DebugDrawHeightfieldWalkable(rcBuilderResult.SolidHeightfiled);
|
||||
_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.DebugDrawRawContours(rcBuilderResult.GetContourSet(), 1f);
|
||||
_debugDraw.DebugDrawRawContours(rcBuilderResult.ContourSet, 1f);
|
||||
_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.DebugDrawRawContours(rcBuilderResult.GetContourSet(), 0.5f);
|
||||
_debugDraw.DebugDrawContours(rcBuilderResult.GetContourSet());
|
||||
_debugDraw.DebugDrawRawContours(rcBuilderResult.ContourSet, 0.5f);
|
||||
_debugDraw.DebugDrawContours(rcBuilderResult.ContourSet);
|
||||
_debugDraw.DepthMask(true);
|
||||
}
|
||||
|
||||
if (rcBuilderResult.GetContourSet() != null && drawMode == DrawMode.DRAWMODE_CONTOURS)
|
||||
if (rcBuilderResult.ContourSet != null && drawMode == DrawMode.DRAWMODE_CONTOURS)
|
||||
{
|
||||
_debugDraw.DepthMask(false);
|
||||
_debugDraw.DebugDrawContours(rcBuilderResult.GetContourSet());
|
||||
_debugDraw.DebugDrawContours(rcBuilderResult.ContourSet);
|
||||
_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);
|
||||
if (rcBuilderResult.GetContourSet() != null)
|
||||
if (rcBuilderResult.ContourSet != null)
|
||||
{
|
||||
_debugDraw.DebugDrawRegionConnections(rcBuilderResult.GetContourSet());
|
||||
_debugDraw.DebugDrawRegionConnections(rcBuilderResult.ContourSet);
|
||||
}
|
||||
|
||||
_debugDraw.DepthMask(true);
|
||||
}
|
||||
|
||||
if (rcBuilderResult.GetMesh() != null && drawMode == DrawMode.DRAWMODE_POLYMESH)
|
||||
if (rcBuilderResult.Mesh != null && drawMode == DrawMode.DRAWMODE_POLYMESH)
|
||||
{
|
||||
_debugDraw.DepthMask(false);
|
||||
_debugDraw.DebugDrawPolyMesh(rcBuilderResult.GetMesh());
|
||||
_debugDraw.DebugDrawPolyMesh(rcBuilderResult.Mesh);
|
||||
_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.DebugDrawPolyMeshDetail(rcBuilderResult.GetMeshDetail());
|
||||
_debugDraw.DebugDrawPolyMeshDetail(rcBuilderResult.MeshDetail);
|
||||
_debugDraw.DepthMask(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -552,7 +552,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
{
|
||||
foreach (RcBuilderResult result in _sample.GetRecastResults())
|
||||
{
|
||||
if (result.GetSolidHeightfield() != null)
|
||||
if (result.SolidHeightfiled != null)
|
||||
{
|
||||
if (!hasBound)
|
||||
{
|
||||
|
@ -561,15 +561,15 @@ public class RecastDemo : IRecastDemoChannel
|
|||
}
|
||||
|
||||
bminN = new RcVec3f(
|
||||
Math.Min(bminN.X, result.GetSolidHeightfield().bmin.X),
|
||||
Math.Min(bminN.Y, result.GetSolidHeightfield().bmin.Y),
|
||||
Math.Min(bminN.Z, result.GetSolidHeightfield().bmin.Z)
|
||||
Math.Min(bminN.X, result.SolidHeightfiled.bmin.X),
|
||||
Math.Min(bminN.Y, result.SolidHeightfiled.bmin.Y),
|
||||
Math.Min(bminN.Z, result.SolidHeightfiled.bmin.Z)
|
||||
);
|
||||
|
||||
bmaxN = new RcVec3f(
|
||||
Math.Max(bmaxN.X, result.GetSolidHeightfield().bmax.X),
|
||||
Math.Max(bmaxN.Y, result.GetSolidHeightfield().bmax.Y),
|
||||
Math.Max(bmaxN.Z, result.GetSolidHeightfield().bmax.Z)
|
||||
Math.Max(bmaxN.X, result.SolidHeightfiled.bmax.X),
|
||||
Math.Max(bmaxN.Y, result.SolidHeightfiled.bmax.Y),
|
||||
Math.Max(bmaxN.Z, result.SolidHeightfiled.bmax.Z)
|
||||
);
|
||||
|
||||
hasBound = true;
|
||||
|
@ -713,7 +713,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
Logger.Information($"build times");
|
||||
Logger.Information($"-----------------------------------------");
|
||||
var telemetries = buildResult.RecastBuilderResults
|
||||
.Select(x => x.GetTelemetry())
|
||||
.Select(x => x.Context)
|
||||
.SelectMany(x => x.ToList())
|
||||
.GroupBy(x => x.Key)
|
||||
.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,
|
||||
RcBuilderResult rcResult)
|
||||
{
|
||||
RcPolyMesh pmesh = rcResult.GetMesh();
|
||||
RcPolyMeshDetail dmesh = rcResult.GetMeshDetail();
|
||||
RcPolyMesh pmesh = rcResult.Mesh;
|
||||
RcPolyMeshDetail dmesh = rcResult.MeshDetail;
|
||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||
for (int i = 0; i < pmesh.npolys; ++i)
|
||||
{
|
||||
|
|
|
@ -124,8 +124,8 @@ namespace DotRecast.Recast.Toolset.Builder
|
|||
List<DtMeshData> meshData = new List<DtMeshData>();
|
||||
foreach (RcBuilderResult result in results)
|
||||
{
|
||||
int x = result.tileX;
|
||||
int z = result.tileZ;
|
||||
int x = result.TileX;
|
||||
int z = result.TileZ;
|
||||
DtNavMeshCreateParams option = DemoNavMeshBuilder
|
||||
.GetNavMeshCreateParams(geom, cellSize, cellHeight, agentHeight, agentRadius, agentMaxClimb, result);
|
||||
|
||||
|
|
|
@ -4,56 +4,26 @@ namespace DotRecast.Recast
|
|||
{
|
||||
public class RcBuilderResult
|
||||
{
|
||||
public readonly int tileX;
|
||||
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 readonly int TileX;
|
||||
public readonly int TileZ;
|
||||
|
||||
public RcBuilderResult(int tileX, int tileZ, RcHeightfield solid, RcCompactHeightfield chf, RcContourSet cs, RcPolyMesh pmesh, RcPolyMeshDetail dmesh, RcContext ctx)
|
||||
{
|
||||
this.tileX = tileX;
|
||||
this.tileZ = tileZ;
|
||||
this.solid = solid;
|
||||
this.chf = chf;
|
||||
this.cs = cs;
|
||||
this.pmesh = pmesh;
|
||||
this.dmesh = dmesh;
|
||||
_context = ctx;
|
||||
}
|
||||
public readonly RcHeightfield SolidHeightfiled;
|
||||
public readonly RcCompactHeightfield CompactHeightfield;
|
||||
public readonly RcContourSet ContourSet;
|
||||
public readonly RcPolyMesh Mesh;
|
||||
public readonly RcPolyMeshDetail MeshDetail;
|
||||
public readonly RcContext Context;
|
||||
|
||||
public RcPolyMesh GetMesh()
|
||||
public RcBuilderResult(int tileX, int tileZ, RcHeightfield solidHeightfiled, RcCompactHeightfield compactHeightfield, RcContourSet contourSet, RcPolyMesh mesh, RcPolyMeshDetail meshDetail, RcContext ctx)
|
||||
{
|
||||
return pmesh;
|
||||
}
|
||||
|
||||
public RcPolyMeshDetail GetMeshDetail()
|
||||
{
|
||||
return dmesh;
|
||||
}
|
||||
|
||||
public RcCompactHeightfield GetCompactHeightfield()
|
||||
{
|
||||
return chf;
|
||||
}
|
||||
|
||||
public RcContourSet GetContourSet()
|
||||
{
|
||||
return cs;
|
||||
}
|
||||
|
||||
public RcHeightfield GetSolidHeightfield()
|
||||
{
|
||||
return solid;
|
||||
}
|
||||
|
||||
public RcContext GetTelemetry()
|
||||
{
|
||||
return _context;
|
||||
TileX = tileX;
|
||||
TileZ = tileZ;
|
||||
SolidHeightfiled = solidHeightfiled;
|
||||
CompactHeightfield = compactHeightfield;
|
||||
ContourSet = contourSet;
|
||||
Mesh = mesh;
|
||||
MeshDetail = meshDetail;
|
||||
Context = ctx;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,9 +30,9 @@ namespace DotRecast.Recast
|
|||
hitTime = 0.0f;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -73,13 +73,13 @@ public class RecastTestMeshBuilder
|
|||
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
||||
RcBuilder rcBuilder = new RcBuilder();
|
||||
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)
|
||||
{
|
||||
m_pmesh.flags[i] = 1;
|
||||
}
|
||||
|
||||
RcPolyMeshDetail m_dmesh = rcResult.GetMeshDetail();
|
||||
RcPolyMeshDetail m_dmesh = rcResult.MeshDetail;
|
||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||
option.verts = m_pmesh.verts;
|
||||
option.vertCount = m_pmesh.nverts;
|
||||
|
|
|
@ -73,13 +73,13 @@ public class RecastTestMeshBuilder
|
|||
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
||||
RcBuilder rcBuilder = new RcBuilder();
|
||||
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)
|
||||
{
|
||||
m_pmesh.flags[i] = 1;
|
||||
}
|
||||
|
||||
RcPolyMeshDetail m_dmesh = rcResult.GetMeshDetail();
|
||||
RcPolyMeshDetail m_dmesh = rcResult.MeshDetail;
|
||||
DtNavMeshCreateParams option = new DtNavMeshCreateParams();
|
||||
option.verts = m_pmesh.verts;
|
||||
option.vertCount = m_pmesh.nverts;
|
||||
|
|
|
@ -28,7 +28,7 @@ public class TestDetourBuilder : DetourBuilder
|
|||
{
|
||||
RcBuilder rcBuilder = new RcBuilder();
|
||||
RcBuilderResult rcResult = rcBuilder.Build(geom, rcConfig);
|
||||
RcPolyMesh pmesh = rcResult.GetMesh();
|
||||
RcPolyMesh pmesh = rcResult.Mesh;
|
||||
|
||||
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,
|
||||
agentMaxClimb);
|
||||
return Build(option, x, y);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class TestTiledNavMeshBuilder
|
|||
|
||||
foreach (RcBuilderResult result in rcResult)
|
||||
{
|
||||
RcPolyMesh pmesh = result.GetMesh();
|
||||
RcPolyMesh pmesh = result.Mesh;
|
||||
if (pmesh.npolys == 0)
|
||||
{
|
||||
continue;
|
||||
|
@ -104,7 +104,7 @@ public class TestTiledNavMeshBuilder
|
|||
option.polyFlags = pmesh.flags;
|
||||
option.polyCount = pmesh.npolys;
|
||||
option.nvp = pmesh.nvp;
|
||||
RcPolyMeshDetail dmesh = result.GetMeshDetail();
|
||||
RcPolyMeshDetail dmesh = result.MeshDetail;
|
||||
option.detailMeshes = dmesh.meshes;
|
||||
option.detailVerts = dmesh.verts;
|
||||
option.detailVertsCount = dmesh.nverts;
|
||||
|
@ -117,8 +117,8 @@ public class TestTiledNavMeshBuilder
|
|||
option.bmax = pmesh.bmax;
|
||||
option.cs = cellSize;
|
||||
option.ch = cellHeight;
|
||||
option.tileX = result.tileX;
|
||||
option.tileZ = result.tileZ;
|
||||
option.tileX = result.TileX;
|
||||
option.tileZ = result.TileZ;
|
||||
option.buildBvTree = true;
|
||||
navMesh.AddTile(DtNavMeshBuilder.CreateNavMeshData(option), 0, 0);
|
||||
}
|
||||
|
|
|
@ -70,28 +70,28 @@ public class RecastTileMeshTest
|
|||
SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true);
|
||||
RcBuilderConfig bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 7, 8);
|
||||
RcBuilderResult rcResult = builder.Build(geom, bcfg);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(1));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(5));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(1));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(5));
|
||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 6, 9);
|
||||
rcResult = builder.Build(geom, bcfg);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(2));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(7));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(2));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(7));
|
||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 2, 9);
|
||||
rcResult = builder.Build(geom, bcfg);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(2));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(9));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(2));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(9));
|
||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 4, 3);
|
||||
rcResult = builder.Build(geom, bcfg);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(3));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(6));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(3));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(6));
|
||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 2, 8);
|
||||
rcResult = builder.Build(geom, bcfg);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(5));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(17));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(5));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(17));
|
||||
bcfg = new RcBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 0, 8);
|
||||
rcResult = builder.Build(geom, bcfg);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(6));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(15));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(6));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(15));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -142,23 +142,23 @@ public class RecastTileMeshTest
|
|||
if (validate)
|
||||
{
|
||||
RcBuilderResult rcResult = GetTile(tiles, 7, 8);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(1));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(5));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(1));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(5));
|
||||
rcResult = GetTile(tiles, 6, 9);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(2));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(7));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(2));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(7));
|
||||
rcResult = GetTile(tiles, 2, 9);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(2));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(9));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(2));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(9));
|
||||
rcResult = GetTile(tiles, 4, 3);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(3));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(6));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(3));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(6));
|
||||
rcResult = GetTile(tiles, 2, 8);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(5));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(17));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(5));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(17));
|
||||
rcResult = GetTile(tiles, 0, 8);
|
||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(6));
|
||||
Assert.That(rcResult.GetMesh().nverts, Is.EqualTo(15));
|
||||
Assert.That(rcResult.Mesh.npolys, Is.EqualTo(6));
|
||||
Assert.That(rcResult.Mesh.nverts, Is.EqualTo(15));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -174,6 +174,6 @@ public class RecastTileMeshTest
|
|||
|
||||
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