forked from mirror/DotRecast
Keep Itermediate Results in JumpLinkBuilderSampleTools
This commit is contained in:
parent
80e07ebb3c
commit
8fe46a6450
|
@ -16,6 +16,7 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
using System.Linq;
|
||||
using DotRecast.Core.Numerics;
|
||||
using DotRecast.Detour.Extras.Jumplink;
|
||||
using DotRecast.Recast.Demo.Draw;
|
||||
|
@ -96,13 +97,25 @@ public class JumpLinkBuilderSampleTool : ISampleTool
|
|||
|
||||
if (build || _cfg.buildOffMeshConnections)
|
||||
{
|
||||
if (0 < _sample.GetRecastResults().Count)
|
||||
do
|
||||
{
|
||||
if (0 >= _sample.GetRecastResults().Count)
|
||||
{
|
||||
Logger.Error("build navmesh");
|
||||
break;
|
||||
}
|
||||
|
||||
if (_sample.GetRecastResults().Any(x => null == x.SolidHeightfiled))
|
||||
{
|
||||
Logger.Error("Tick 'Keep Itermediate Results' option");
|
||||
break;
|
||||
}
|
||||
|
||||
var geom = _sample.GetInputGeom();
|
||||
var settings = _sample.GetSettings();
|
||||
|
||||
_tool.Build(geom, settings, _sample.GetRecastResults(), _cfg);
|
||||
}
|
||||
} while (false);
|
||||
}
|
||||
|
||||
ImGui.NewLine();
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace DotRecast.Recast.Toolset.Builder
|
|||
filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans,
|
||||
SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE, true);
|
||||
RcBuilder rcBuilder = new RcBuilder();
|
||||
return rcBuilder.BuildTiles(geom, cfg, Environment.ProcessorCount + 1, Task.Factory);
|
||||
return rcBuilder.BuildTiles(geom, cfg, keepInterResults, buildAll, Environment.ProcessorCount + 1, Task.Factory);
|
||||
}
|
||||
|
||||
public DtNavMesh BuildNavMesh(IInputGeomProvider geom, List<DtMeshData> meshData, float cellSize, int tileSize, int vertsPerPoly)
|
||||
|
|
|
@ -47,9 +47,8 @@ namespace DotRecast.Recast
|
|||
_progressListener = progressListener;
|
||||
}
|
||||
|
||||
public List<RcBuilderResult> BuildTiles(IInputGeomProvider geom, RcConfig cfg,
|
||||
int threads = 0, TaskFactory taskFactory = null, CancellationToken cancellation = default,
|
||||
bool keepInterResults = false, bool buildAll = true)
|
||||
public List<RcBuilderResult> BuildTiles(IInputGeomProvider geom, RcConfig cfg, bool keepInterResults, bool buildAll,
|
||||
int threads = 0, TaskFactory taskFactory = null, CancellationToken cancellation = default)
|
||||
{
|
||||
RcVec3f bmin = geom.GetMeshBoundsMin();
|
||||
RcVec3f bmax = geom.GetMeshBoundsMax();
|
||||
|
|
|
@ -78,7 +78,7 @@ public class TestTiledNavMeshBuilder
|
|||
true, true, true,
|
||||
SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true);
|
||||
RcBuilder rcBuilder = new RcBuilder();
|
||||
List<RcBuilderResult> rcResult = rcBuilder.BuildTiles(geom, cfg);
|
||||
List<RcBuilderResult> rcResult = rcBuilder.BuildTiles(geom, cfg, false, true);
|
||||
|
||||
// Add tiles to nav mesh
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public class RecastTileMeshTest
|
|||
private void Build(IInputGeomProvider geom, RcBuilder builder, RcConfig cfg, int threads, bool validate)
|
||||
{
|
||||
CancellationTokenSource cts = new CancellationTokenSource();
|
||||
List<RcBuilderResult> tiles = builder.BuildTiles(geom, cfg, threads, Task.Factory, cts.Token);
|
||||
List<RcBuilderResult> tiles = builder.BuildTiles(geom, cfg, false, true, threads, Task.Factory, cts.Token);
|
||||
if (validate)
|
||||
{
|
||||
RcBuilderResult rcResult = GetTile(tiles, 7, 8);
|
||||
|
|
Loading…
Reference in New Issue