diff --git a/src/DotRecast.Recast.Demo/Tools/JumpLinkBuilderSampleTool.cs b/src/DotRecast.Recast.Demo/Tools/JumpLinkBuilderSampleTool.cs index 7a33b6b..4b31c47 100644 --- a/src/DotRecast.Recast.Demo/Tools/JumpLinkBuilderSampleTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/JumpLinkBuilderSampleTool.cs @@ -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(); diff --git a/src/DotRecast.Recast.Toolset/Builder/TileNavMeshBuilder.cs b/src/DotRecast.Recast.Toolset/Builder/TileNavMeshBuilder.cs index 15a431e..5542c25 100644 --- a/src/DotRecast.Recast.Toolset/Builder/TileNavMeshBuilder.cs +++ b/src/DotRecast.Recast.Toolset/Builder/TileNavMeshBuilder.cs @@ -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 meshData, float cellSize, int tileSize, int vertsPerPoly) diff --git a/src/DotRecast.Recast/RcBuilder.cs b/src/DotRecast.Recast/RcBuilder.cs index f0c6ed2..5583f42 100644 --- a/src/DotRecast.Recast/RcBuilder.cs +++ b/src/DotRecast.Recast/RcBuilder.cs @@ -47,9 +47,8 @@ namespace DotRecast.Recast _progressListener = progressListener; } - public List BuildTiles(IInputGeomProvider geom, RcConfig cfg, - int threads = 0, TaskFactory taskFactory = null, CancellationToken cancellation = default, - bool keepInterResults = false, bool buildAll = true) + public List 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(); diff --git a/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs b/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs index 835c247..c03623e 100644 --- a/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs +++ b/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs @@ -78,7 +78,7 @@ public class TestTiledNavMeshBuilder true, true, true, SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RcBuilder rcBuilder = new RcBuilder(); - List rcResult = rcBuilder.BuildTiles(geom, cfg); + List rcResult = rcBuilder.BuildTiles(geom, cfg, false, true); // Add tiles to nav mesh diff --git a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs index 2abb9df..8d98546 100644 --- a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs @@ -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 tiles = builder.BuildTiles(geom, cfg, threads, Task.Factory, cts.Token); + List tiles = builder.BuildTiles(geom, cfg, false, true, threads, Task.Factory, cts.Token); if (validate) { RcBuilderResult rcResult = GetTile(tiles, 7, 8);