forked from mirror/DotRecast
build by sample settings
This commit is contained in:
parent
e6e17d83a2
commit
afc515c498
|
@ -669,77 +669,21 @@ public class RecastDemo : IRecastDemoChannel
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = _sample.GetSettings();
|
|
||||||
var partitioning = settings.partitioning;
|
|
||||||
var cellSize = settings.cellSize;
|
|
||||||
var cellHeight = settings.cellHeight;
|
|
||||||
var agentHeight = settings.agentHeight;
|
|
||||||
var agentRadius = settings.agentRadius;
|
|
||||||
var agentMaxClimb = settings.agentMaxClimb;
|
|
||||||
var agentMaxSlope = settings.agentMaxSlope;
|
|
||||||
var regionMinSize = settings.minRegionSize;
|
|
||||||
var regionMergeSize = settings.mergedRegionSize;
|
|
||||||
var edgeMaxLen = settings.edgeMaxLen;
|
|
||||||
var edgeMaxError = settings.edgeMaxError;
|
|
||||||
var vertsPerPoly = settings.vertsPerPoly;
|
|
||||||
var detailSampleDist = settings.detailSampleDist;
|
|
||||||
var detailSampleMaxError = settings.detailSampleMaxError;
|
|
||||||
var filterLowHangingObstacles = settings.filterLowHangingObstacles;
|
|
||||||
var filterLedgeSpans = settings.filterLedgeSpans;
|
|
||||||
var filterWalkableLowHeightSpans = settings.filterWalkableLowHeightSpans;
|
|
||||||
var tileSize = settings.tileSize;
|
|
||||||
|
|
||||||
long t = RcFrequency.Ticks;
|
long t = RcFrequency.Ticks;
|
||||||
|
|
||||||
Logger.Information($"build");
|
Logger.Information($"build");
|
||||||
|
|
||||||
NavMeshBuildResult buildResult;
|
NavMeshBuildResult buildResult;
|
||||||
|
|
||||||
|
var settings = _sample.GetSettings();
|
||||||
if (settings.tiled)
|
if (settings.tiled)
|
||||||
{
|
{
|
||||||
buildResult = tileNavMeshBuilder.Build(
|
buildResult = tileNavMeshBuilder.Build(_sample.GetInputGeom(), settings);
|
||||||
_sample.GetInputGeom(),
|
|
||||||
partitioning,
|
|
||||||
cellSize,
|
|
||||||
cellHeight,
|
|
||||||
agentHeight,
|
|
||||||
agentRadius,
|
|
||||||
agentMaxClimb,
|
|
||||||
agentMaxSlope,
|
|
||||||
regionMinSize,
|
|
||||||
regionMergeSize,
|
|
||||||
edgeMaxLen,
|
|
||||||
edgeMaxError,
|
|
||||||
vertsPerPoly,
|
|
||||||
detailSampleDist,
|
|
||||||
detailSampleMaxError,
|
|
||||||
filterLowHangingObstacles,
|
|
||||||
filterLedgeSpans,
|
|
||||||
filterWalkableLowHeightSpans,
|
|
||||||
tileSize
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buildResult = soloNavMeshBuilder.Build(
|
buildResult = soloNavMeshBuilder.Build(_sample.GetInputGeom(), settings);
|
||||||
_sample.GetInputGeom(),
|
|
||||||
partitioning,
|
|
||||||
cellSize,
|
|
||||||
cellHeight,
|
|
||||||
agentHeight,
|
|
||||||
agentRadius,
|
|
||||||
agentMaxClimb,
|
|
||||||
agentMaxSlope,
|
|
||||||
regionMinSize,
|
|
||||||
regionMergeSize,
|
|
||||||
edgeMaxLen,
|
|
||||||
edgeMaxError,
|
|
||||||
vertsPerPoly,
|
|
||||||
detailSampleDist,
|
|
||||||
detailSampleMaxError,
|
|
||||||
filterLowHangingObstacles,
|
|
||||||
filterLedgeSpans,
|
|
||||||
filterWalkableLowHeightSpans
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_sample.Update(_sample.GetInputGeom(), buildResult.RecastBuilderResults, buildResult.NavMesh);
|
_sample.Update(_sample.GetInputGeom(), buildResult.RecastBuilderResults, buildResult.NavMesh);
|
||||||
|
|
|
@ -26,6 +26,17 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
{
|
{
|
||||||
public class SoloNavMeshBuilder
|
public class SoloNavMeshBuilder
|
||||||
{
|
{
|
||||||
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, SampleSettings settings)
|
||||||
|
{
|
||||||
|
return Build(geom,
|
||||||
|
settings.partitioning, settings.cellSize, settings.cellHeight, settings.agentHeight,
|
||||||
|
settings.agentRadius, settings.agentMaxClimb, settings.agentMaxSlope,
|
||||||
|
settings.minRegionSize, settings.mergedRegionSize,
|
||||||
|
settings.edgeMaxLen, settings.edgeMaxError,
|
||||||
|
settings.vertsPerPoly, settings.detailSampleDist, settings.detailSampleMaxError,
|
||||||
|
settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans);
|
||||||
|
}
|
||||||
|
|
||||||
public NavMeshBuildResult Build(DemoInputGeomProvider geom, PartitionType partitionType,
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, PartitionType partitionType,
|
||||||
float cellSize, float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb,
|
float cellSize, float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb,
|
||||||
float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
||||||
|
|
|
@ -30,6 +30,18 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, SampleSettings settings)
|
||||||
|
{
|
||||||
|
return Build(geom,
|
||||||
|
settings.partitioning, settings.cellSize, settings.cellHeight, settings.agentHeight,
|
||||||
|
settings.agentRadius, settings.agentMaxClimb, settings.agentMaxSlope,
|
||||||
|
settings.minRegionSize, settings.mergedRegionSize,
|
||||||
|
settings.edgeMaxLen, settings.edgeMaxError,
|
||||||
|
settings.vertsPerPoly, settings.detailSampleDist, settings.detailSampleMaxError,
|
||||||
|
settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans,
|
||||||
|
settings.tileSize);
|
||||||
|
}
|
||||||
|
|
||||||
public NavMeshBuildResult Build(DemoInputGeomProvider geom, PartitionType partitionType,
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, PartitionType partitionType,
|
||||||
float cellSize, float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb,
|
float cellSize, float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb,
|
||||||
float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.TileCache;
|
using DotRecast.Detour.TileCache;
|
||||||
|
using DotRecast.Recast.DemoTool.Builder;
|
||||||
|
|
||||||
namespace DotRecast.Recast.DemoTool.Tools
|
namespace DotRecast.Recast.DemoTool.Tools
|
||||||
{
|
{
|
||||||
|
@ -38,7 +39,10 @@ namespace DotRecast.Recast.DemoTool.Tools
|
||||||
int tx = (int)((pos.x - bmin[0]) / ts);
|
int tx = (int)((pos.x - bmin[0]) / ts);
|
||||||
int ty = (int)((pos.z - bmin[2]) / ts);
|
int ty = (int)((pos.z - bmin[2]) / ts);
|
||||||
|
|
||||||
var tileRef = navMesh.GetTileRefAt(tx, ty, 0);
|
// var tnmb = new TileNavMeshBuilder();
|
||||||
|
// tnmb.BuildRecastResult(geom, settings.partitioning, )
|
||||||
|
|
||||||
|
//var tileRef = navMesh.GetTileRefAt(tx, ty, 0);
|
||||||
// navMesh.RemoveTile(tileRef);
|
// navMesh.RemoveTile(tileRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue