From c62cfb09850af13c7427cb3a527af6bb8327035a Mon Sep 17 00:00:00 2001 From: ikpil Date: Sat, 2 Sep 2023 13:31:30 +0900 Subject: [PATCH] reformat RcConfig --- src/DotRecast.Detour.Dynamic/DynamicTile.cs | 14 ++-- src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs | 15 ++-- .../Builder/SoloNavMeshBuilder.cs | 68 +++++++++++++------ .../Builder/TileNavMeshBuilder.cs | 17 +++-- .../Tools/RcTileTool.cs | 25 ++----- src/DotRecast.Recast/RcConfig.cs | 56 ++++++++------- .../RecastTestMeshBuilder.cs | 36 +++++++--- .../Io/MeshSetReaderWriterTest.cs | 14 ++-- .../RecastTestMeshBuilder.cs | 39 +++++++---- .../TestTiledNavMeshBuilder.cs | 12 +++- .../TestTileLayerBuilder.cs | 15 ++-- .../DotRecast.Recast.Test/RecastLayersTest.cs | 17 +++-- .../RecastSoloMeshTest.cs | 13 +++- .../RecastTileMeshTest.cs | 31 ++++++--- 14 files changed, 243 insertions(+), 129 deletions(-) diff --git a/src/DotRecast.Detour.Dynamic/DynamicTile.cs b/src/DotRecast.Detour.Dynamic/DynamicTile.cs index 4b28518..3726807 100644 --- a/src/DotRecast.Detour.Dynamic/DynamicTile.cs +++ b/src/DotRecast.Detour.Dynamic/DynamicTile.cs @@ -90,12 +90,16 @@ namespace DotRecast.Detour.Dynamic RcHeightfield heightfield, RcTelemetry telemetry) { RcConfig rcConfig = new RcConfig( - config.useTiles, config.tileSizeX, config.tileSizeZ, vt.borderSize, - RcPartitionType.OfValue(config.partition), vt.cellSize, vt.cellHeight, config.walkableSlopeAngle, true, true, true, - config.walkableHeight, config.walkableRadius, config.walkableClimb, config.minRegionArea, config.regionMergeArea, + config.useTiles, config.tileSizeX, config.tileSizeZ, + vt.borderSize, + RcPartitionType.OfValue(config.partition), + vt.cellSize, vt.cellHeight, + config.walkableSlopeAngle, config.walkableHeight, config.walkableRadius, config.walkableClimb, + config.minRegionArea, config.regionMergeArea, config.maxEdgeLen, config.maxSimplificationError, - Math.Min(DynamicNavMesh.MAX_VERTS_PER_POLY, config.vertsPerPoly), true, config.detailSampleDistance, - config.detailSampleMaxError, null); + Math.Min(DynamicNavMesh.MAX_VERTS_PER_POLY, config.vertsPerPoly), + config.detailSampleDistance, config.detailSampleMaxError, + true, true, true, null, true); RecastBuilderResult r = builder.Build(vt.tileX, vt.tileZ, null, rcConfig, heightfield, telemetry); if (config.keepIntermediateResults) { diff --git a/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs b/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs index f2620e7..bc5c58f 100644 --- a/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs +++ b/src/DotRecast.Detour.Dynamic/Io/VoxelFile.cs @@ -66,10 +66,17 @@ namespace DotRecast.Detour.Dynamic.Io bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, RcAreaModification walkbableAreaMod, bool buildMeshDetail, float detailSampleDist, float detailSampleMaxError) { - return new RcConfig(useTiles, tileSizeX, tileSizeZ, tile.borderSize, partitionType, cellSize, tile.cellHeight, - walkableSlopeAngle, filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans, walkableHeight, - walkableRadius, walkableClimb, minRegionArea, regionMergeArea, maxEdgeLen, maxSimplificationError, maxPolyVerts, - buildMeshDetail, detailSampleDist, detailSampleMaxError, walkbableAreaMod); + return new RcConfig(useTiles, tileSizeX, tileSizeZ, + tile.borderSize, + partitionType, + cellSize, tile.cellHeight, + walkableSlopeAngle, walkableHeight, walkableRadius, walkableClimb, + minRegionArea, regionMergeArea, + maxEdgeLen, maxSimplificationError, + maxPolyVerts, + detailSampleDist, detailSampleMaxError, + filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans, + walkbableAreaMod, buildMeshDetail); } public static VoxelFile From(RcConfig config, List results) diff --git a/src/DotRecast.Recast.Toolset/Builder/SoloNavMeshBuilder.cs b/src/DotRecast.Recast.Toolset/Builder/SoloNavMeshBuilder.cs index 3295f3f..e0aca75 100644 --- a/src/DotRecast.Recast.Toolset/Builder/SoloNavMeshBuilder.cs +++ b/src/DotRecast.Recast.Toolset/Builder/SoloNavMeshBuilder.cs @@ -29,24 +29,36 @@ namespace DotRecast.Recast.Toolset.Builder public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcNavMeshBuildSettings settings) { return Build(geom, - RcPartitionType.OfValue(settings.partitioning), settings.cellSize, settings.cellHeight, settings.agentHeight, - settings.agentRadius, settings.agentMaxClimb, settings.agentMaxSlope, + RcPartitionType.OfValue(settings.partitioning), + settings.cellSize, settings.cellHeight, + settings.agentMaxSlope, settings.agentHeight, settings.agentRadius, settings.agentMaxClimb, settings.minRegionSize, settings.mergedRegionSize, settings.edgeMaxLen, settings.edgeMaxError, - settings.vertsPerPoly, settings.detailSampleDist, settings.detailSampleMaxError, + settings.vertsPerPoly, + settings.detailSampleDist, settings.detailSampleMaxError, settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans); } - public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcPartition partitionType, - float cellSize, float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, - float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, - int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles, - bool filterLedgeSpans, bool filterWalkableLowHeightSpans) + public NavMeshBuildResult Build(DemoInputGeomProvider geom, + RcPartition partitionType, + float cellSize, float cellHeight, + float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb, + int regionMinSize, int regionMergeSize, + float edgeMaxLen, float edgeMaxError, + int vertsPerPoly, + float detailSampleDist, float detailSampleMaxError, + bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans) { - RecastBuilderResult rcResult = BuildRecastResult(geom, partitionType, cellSize, cellHeight, agentHeight, - agentRadius, agentMaxClimb, agentMaxSlope, regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError, - vertsPerPoly, detailSampleDist, detailSampleMaxError, filterLowHangingObstacles, filterLedgeSpans, - filterWalkableLowHeightSpans); + RecastBuilderResult rcResult = BuildRecastResult( + geom, + partitionType, + cellSize, cellHeight, + agentMaxSlope, agentHeight, agentRadius, agentMaxClimb, + regionMinSize, regionMergeSize, + edgeMaxLen, edgeMaxError, + vertsPerPoly, + detailSampleDist, detailSampleMaxError, + filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans); var meshData = BuildMeshData(geom, cellSize, cellHeight, agentHeight, agentRadius, agentMaxClimb, rcResult); if (null == meshData) @@ -63,23 +75,35 @@ namespace DotRecast.Recast.Toolset.Builder return new DtNavMesh(meshData, vertsPerPoly, 0); } - private RecastBuilderResult BuildRecastResult(DemoInputGeomProvider geom, RcPartition partitionType, float cellSize, - float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope, - int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, - float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles, bool filterLedgeSpans, - bool filterWalkableLowHeightSpans) + private RecastBuilderResult BuildRecastResult(DemoInputGeomProvider geom, + RcPartition partitionType, + float cellSize, float cellHeight, + float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb, + int regionMinSize, int regionMergeSize, + float edgeMaxLen, float edgeMaxError, + int vertsPerPoly, + float detailSampleDist, float detailSampleMaxError, + bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans) { - RcConfig cfg = new RcConfig(partitionType, cellSize, cellHeight, agentMaxSlope, filterLowHangingObstacles, - filterLedgeSpans, filterWalkableLowHeightSpans, agentHeight, agentRadius, agentMaxClimb, regionMinSize, - regionMergeSize, edgeMaxLen, edgeMaxError, vertsPerPoly, detailSampleDist, detailSampleMaxError, + RcConfig cfg = new RcConfig( + partitionType, + cellSize, cellHeight, + agentMaxSlope, agentHeight, agentRadius, agentMaxClimb, + regionMinSize, regionMergeSize, + edgeMaxLen, edgeMaxError, + vertsPerPoly, + detailSampleDist, detailSampleMaxError, + filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans, SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE, true); RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax()); RecastBuilder rcBuilder = new RecastBuilder(); return rcBuilder.Build(geom, bcfg); } - public DtMeshData BuildMeshData(DemoInputGeomProvider geom, float cellSize, float cellHeight, float agentHeight, - float agentRadius, float agentMaxClimb, RecastBuilderResult result) + public DtMeshData BuildMeshData(DemoInputGeomProvider geom, + float cellSize, float cellHeight, + float agentHeight, float agentRadius, float agentMaxClimb, + RecastBuilderResult result) { DtNavMeshCreateParams option = DemoNavMeshBuilder .GetNavMeshCreateParams(geom, cellSize, cellHeight, agentHeight, agentRadius, agentMaxClimb, result); diff --git a/src/DotRecast.Recast.Toolset/Builder/TileNavMeshBuilder.cs b/src/DotRecast.Recast.Toolset/Builder/TileNavMeshBuilder.cs index 34f382b..53e6bcf 100644 --- a/src/DotRecast.Recast.Toolset/Builder/TileNavMeshBuilder.cs +++ b/src/DotRecast.Recast.Toolset/Builder/TileNavMeshBuilder.cs @@ -64,12 +64,17 @@ namespace DotRecast.Recast.Toolset.Builder int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, int tileSize) { - RcConfig cfg = new RcConfig(true, tileSize, tileSize, RcConfig.CalcBorder(agentRadius, cellSize), - partitionType, cellSize, cellHeight, agentMaxSlope, filterLowHangingObstacles, filterLedgeSpans, - filterWalkableLowHeightSpans, agentHeight, agentRadius, agentMaxClimb, - regionMinSize * regionMinSize * cellSize * cellSize, - regionMergeSize * regionMergeSize * cellSize * cellSize, edgeMaxLen, edgeMaxError, vertsPerPoly, - true, detailSampleDist, detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE); + RcConfig cfg = new RcConfig(true, tileSize, tileSize, + RcConfig.CalcBorder(agentRadius, cellSize), + partitionType, + cellSize, cellHeight, + agentMaxSlope, agentHeight, agentRadius, agentMaxClimb, + regionMinSize * regionMinSize * cellSize * cellSize, regionMergeSize * regionMergeSize * cellSize * cellSize, + edgeMaxLen, edgeMaxError, + vertsPerPoly, + detailSampleDist, detailSampleMaxError, + filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans, + SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE, true); RecastBuilder rcBuilder = new RecastBuilder(); return rcBuilder.BuildTiles(geom, cfg, Task.Factory); } diff --git a/src/DotRecast.Recast.Toolset/Tools/RcTileTool.cs b/src/DotRecast.Recast.Toolset/Tools/RcTileTool.cs index 7be1264..75e601a 100644 --- a/src/DotRecast.Recast.Toolset/Tools/RcTileTool.cs +++ b/src/DotRecast.Recast.Toolset/Tools/RcTileTool.cs @@ -76,29 +76,18 @@ namespace DotRecast.Recast.Toolset.Tools RcVec3f bmax = geom.GetMeshBoundsMax(); RcConfig cfg = new RcConfig( - true, - settings.tileSize, - settings.tileSize, + true, settings.tileSize, settings.tileSize, RcConfig.CalcBorder(settings.agentRadius, settings.cellSize), RcPartitionType.OfValue(settings.partitioning), - settings.cellSize, - settings.cellHeight, - settings.agentMaxSlope, - settings.filterLowHangingObstacles, - settings.filterLedgeSpans, - settings.filterWalkableLowHeightSpans, - settings.agentHeight, - settings.agentRadius, - settings.agentMaxClimb, + settings.cellSize, settings.cellHeight, + settings.agentMaxSlope, settings.agentHeight, settings.agentRadius, settings.agentMaxClimb, settings.minRegionSize * settings.minRegionSize * settings.cellSize * settings.cellSize, settings.mergedRegionSize * settings.mergedRegionSize * settings.cellSize * settings.cellSize, - settings.edgeMaxLen, - settings.edgeMaxError, + settings.edgeMaxLen, settings.edgeMaxError, settings.vertsPerPoly, - true, - settings.detailSampleDist, - settings.detailSampleMaxError, - SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE + settings.detailSampleDist, settings.detailSampleMaxError, + settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans, + SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE, true ); var beginTick = RcFrequency.Ticks; diff --git a/src/DotRecast.Recast/RcConfig.cs b/src/DotRecast.Recast/RcConfig.cs index 8599ee3..b4b8615 100644 --- a/src/DotRecast.Recast/RcConfig.cs +++ b/src/DotRecast.Recast/RcConfig.cs @@ -116,35 +116,41 @@ namespace DotRecast.Recast /** * Non-tiled build configuration */ - public RcConfig(RcPartition partitionType, float cellSize, float cellHeight, float agentHeight, float agentRadius, - float agentMaxClimb, float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen, - float edgeMaxError, int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, - RcAreaModification walkableAreaMod) : this(partitionType, cellSize, cellHeight, agentMaxSlope, true, true, true, agentHeight, agentRadius, agentMaxClimb, - regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError, vertsPerPoly, detailSampleDist, detailSampleMaxError, - walkableAreaMod, true) - { - } - - /** - * Non-tiled build configuration - */ - public RcConfig(RcPartition partitionType, float cellSize, float cellHeight, float agentMaxSlope, - bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, float agentHeight, - float agentRadius, float agentMaxClimb, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, - int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, RcAreaModification walkableAreaMod, - bool buildMeshDetail) : this(false, 0, 0, 0, partitionType, cellSize, cellHeight, agentMaxSlope, filterLowHangingObstacles, filterLedgeSpans, - filterWalkableLowHeightSpans, agentHeight, agentRadius, agentMaxClimb, - regionMinSize * regionMinSize * cellSize * cellSize, regionMergeSize * regionMergeSize * cellSize * cellSize, - edgeMaxLen, edgeMaxError, vertsPerPoly, buildMeshDetail, detailSampleDist, detailSampleMaxError, walkableAreaMod) + public RcConfig( + RcPartition partitionType, + float cellSize, float cellHeight, + float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb, + int regionMinSize, int regionMergeSize, + float edgeMaxLen, float edgeMaxError, + int vertsPerPoly, + float detailSampleDist, float detailSampleMaxError, + bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, + RcAreaModification walkableAreaMod, bool buildMeshDetail) + : this(false, 0, 0, 0, + partitionType, + cellSize, cellHeight, + agentMaxSlope, agentHeight, agentRadius, agentMaxClimb, + regionMinSize * regionMinSize * cellSize * cellSize, regionMergeSize * regionMergeSize * cellSize * cellSize, + edgeMaxLen, edgeMaxError, + vertsPerPoly, + detailSampleDist, detailSampleMaxError, + filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans, + walkableAreaMod, buildMeshDetail) { // Note: area = size*size in [Units: wu] } - public RcConfig(bool useTiles, int tileSizeX, int tileSizeZ, int borderSize, RcPartition partition, - float cellSize, float cellHeight, float agentMaxSlope, bool filterLowHangingObstacles, bool filterLedgeSpans, - bool filterWalkableLowHeightSpans, float agentHeight, float agentRadius, float agentMaxClimb, float minRegionArea, - float mergeRegionArea, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, bool buildMeshDetail, - float detailSampleDist, float detailSampleMaxError, RcAreaModification walkableAreaMod) + public RcConfig( + bool useTiles, int tileSizeX, int tileSizeZ, + int borderSize, + RcPartition partition, + float cellSize, float cellHeight, + float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb, + float minRegionArea, float mergeRegionArea, + float edgeMaxLen, float edgeMaxError, int vertsPerPoly, + float detailSampleDist, float detailSampleMaxError, + bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, + RcAreaModification walkableAreaMod, bool buildMeshDetail) { UseTiles = useTiles; TileSizeX = tileSizeX; diff --git a/test/DotRecast.Detour.Crowd.Test/RecastTestMeshBuilder.cs b/test/DotRecast.Detour.Crowd.Test/RecastTestMeshBuilder.cs index 7e38ae0..9422bfe 100644 --- a/test/DotRecast.Detour.Crowd.Test/RecastTestMeshBuilder.cs +++ b/test/DotRecast.Detour.Crowd.Test/RecastTestMeshBuilder.cs @@ -39,21 +39,37 @@ public class RecastTestMeshBuilder public const float m_detailSampleDist = 6.0f; public const float m_detailSampleMaxError = 1.0f; - public RecastTestMeshBuilder() : this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")), - RcPartition.WATERSHED, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_agentMaxSlope, - m_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, m_detailSampleDist, - m_detailSampleMaxError) + public RecastTestMeshBuilder() + : this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")), + RcPartition.WATERSHED, + m_cellSize, m_cellHeight, + m_agentMaxSlope, m_agentHeight, m_agentRadius, m_agentMaxClimb, + m_regionMinSize, m_regionMergeSize, + m_edgeMaxLen, m_edgeMaxError, + m_vertsPerPoly, + m_detailSampleDist, m_detailSampleMaxError) { } - public RecastTestMeshBuilder(IInputGeomProvider geom, RcPartition partitionType, float cellSize, - float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope, - int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, + public RecastTestMeshBuilder(IInputGeomProvider geom, + RcPartition partitionType, + float cellSize, float cellHeight, + float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb, + int regionMinSize, int regionMergeSize, + float edgeMaxLen, float edgeMaxError, + int vertsPerPoly, float detailSampleDist, float detailSampleMaxError) { - RcConfig cfg = new RcConfig(partitionType, cellSize, cellHeight, agentHeight, agentRadius, - agentMaxClimb, agentMaxSlope, regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError, - vertsPerPoly, detailSampleDist, detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + RcConfig cfg = new RcConfig( + partitionType, + cellSize, cellHeight, + agentMaxSlope, agentHeight, agentRadius, agentMaxClimb, + regionMinSize, regionMergeSize, + edgeMaxLen, edgeMaxError, + vertsPerPoly, + detailSampleDist, detailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax()); RecastBuilder rcBuilder = new RecastBuilder(); RecastBuilderResult rcResult = rcBuilder.Build(geom, bcfg); diff --git a/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs b/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs index 22e381a..8428403 100644 --- a/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs +++ b/test/DotRecast.Detour.Test/Io/MeshSetReaderWriterTest.cs @@ -75,10 +75,16 @@ public class MeshSetReaderWriterTest for (int x = 0; x < tw; ++x) { RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize, - RcConfig.CalcBorder(m_agentRadius, m_cellSize), RcPartition.WATERSHED, m_cellSize, m_cellHeight, - m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_regionMinArea, - m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true, m_detailSampleDist, - m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + RcConfig.CalcBorder(m_agentRadius, m_cellSize), + RcPartition.WATERSHED, + m_cellSize, m_cellHeight, + m_agentMaxSlope, m_agentHeight, m_agentRadius, m_agentMaxClimb, + m_regionMinArea, m_regionMergeArea, + m_edgeMaxLen, m_edgeMaxError, + m_vertsPerPoly, + m_detailSampleDist, m_detailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, bmin, bmax, x, y); TestDetourBuilder db = new TestDetourBuilder(); DtMeshData data = db.Build(geom, bcfg, m_agentHeight, m_agentRadius, m_agentMaxClimb, x, y, true); diff --git a/test/DotRecast.Detour.Test/RecastTestMeshBuilder.cs b/test/DotRecast.Detour.Test/RecastTestMeshBuilder.cs index 662288d..60a0a14 100644 --- a/test/DotRecast.Detour.Test/RecastTestMeshBuilder.cs +++ b/test/DotRecast.Detour.Test/RecastTestMeshBuilder.cs @@ -39,22 +39,37 @@ public class RecastTestMeshBuilder private const float m_detailSampleDist = 6.0f; private const float m_detailSampleMaxError = 1.0f; - public RecastTestMeshBuilder() : - this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")), - RcPartition.WATERSHED, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_agentMaxSlope, - m_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, m_detailSampleDist, - m_detailSampleMaxError) + public RecastTestMeshBuilder() + : this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")), + RcPartition.WATERSHED, + m_cellSize, m_cellHeight, + m_agentMaxSlope, m_agentHeight, m_agentRadius, m_agentMaxClimb, + m_regionMinSize, m_regionMergeSize, + m_edgeMaxLen, m_edgeMaxError, + m_vertsPerPoly, + m_detailSampleDist, m_detailSampleMaxError) { } - public RecastTestMeshBuilder(IInputGeomProvider geom, RcPartition partition, float cellSize, - float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope, - int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, + public RecastTestMeshBuilder(IInputGeomProvider geom, + RcPartition partition, + float cellSize, float cellHeight, + float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb, + int regionMinSize, int regionMergeSize, + float edgeMaxLen, float edgeMaxError, + int vertsPerPoly, float detailSampleDist, float detailSampleMaxError) { - RcConfig cfg = new RcConfig(partition, cellSize, cellHeight, agentHeight, agentRadius, - agentMaxClimb, agentMaxSlope, regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError, - vertsPerPoly, detailSampleDist, detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + RcConfig cfg = new RcConfig( + partition, + cellSize, cellHeight, + agentMaxSlope, agentHeight, agentRadius, agentMaxClimb, + regionMinSize, regionMergeSize, + edgeMaxLen, edgeMaxError, + vertsPerPoly, + detailSampleDist, detailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax()); RecastBuilder rcBuilder = new RecastBuilder(); RecastBuilderResult rcResult = rcBuilder.Build(geom, bcfg); @@ -112,4 +127,4 @@ public class RecastTestMeshBuilder { return meshData; } -} +} \ No newline at end of file diff --git a/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs b/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs index 8cd740f..bc8b854 100644 --- a/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs +++ b/test/DotRecast.Detour.Test/TestTiledNavMeshBuilder.cs @@ -68,9 +68,15 @@ public class TestTiledNavMeshBuilder // Build all tiles RcConfig cfg = new RcConfig(true, tileSize, tileSize, RcConfig.CalcBorder(agentRadius, cellSize), - partitionType, cellSize, cellHeight, agentMaxSlope, true, true, true, agentHeight, agentRadius, - agentMaxClimb, m_regionMinArea, m_regionMergeArea, edgeMaxLen, edgeMaxError, vertsPerPoly, true, - detailSampleDist, detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + partitionType, + cellSize, cellHeight, + agentMaxSlope, agentHeight, agentRadius, agentMaxClimb, + m_regionMinArea, m_regionMergeArea, + edgeMaxLen, edgeMaxError, + vertsPerPoly, + detailSampleDist, detailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RecastBuilder rcBuilder = new RecastBuilder(); List rcResult = rcBuilder.BuildTiles(geom, cfg, null); diff --git a/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs b/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs index 675860f..f56dc08 100644 --- a/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs +++ b/test/DotRecast.Detour.TileCache.Test/TestTileLayerBuilder.cs @@ -59,10 +59,17 @@ public class TestTileLayerBuilder : DtTileCacheLayerBuilder public TestTileLayerBuilder(IInputGeomProvider geom) : base(DtTileCacheCompressorFactory.Shared) { _geom = geom; - _cfg = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(AgentRadius, CellSize), - RcPartition.WATERSHED, CellSize, CellHeight, AgentMaxSlope, true, true, true, AgentHeight, - AgentRadius, AgentMaxClimb, RegionMinArea, RegionMergeArea, EdgeMaxLen, EdgeMaxError, VertsPerPoly, - true, DetailSampleDist, DetailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + _cfg = new RcConfig(true, m_tileSize, m_tileSize, + RcConfig.CalcBorder(AgentRadius, CellSize), + RcPartition.WATERSHED, + CellSize, CellHeight, + AgentMaxSlope, AgentHeight, AgentRadius, AgentMaxClimb, + RegionMinArea, RegionMergeArea, + EdgeMaxLen, EdgeMaxError, + VertsPerPoly, + DetailSampleDist, DetailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RcVec3f bmin = geom.GetMeshBoundsMin(); RcVec3f bmax = geom.GetMeshBoundsMax(); diff --git a/test/DotRecast.Recast.Test/RecastLayersTest.cs b/test/DotRecast.Recast.Test/RecastLayersTest.cs index 981bc67..1b93921 100644 --- a/test/DotRecast.Recast.Test/RecastLayersTest.cs +++ b/test/DotRecast.Recast.Test/RecastLayersTest.cs @@ -147,12 +147,19 @@ public class RecastLayersTest { IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename)); RecastBuilder builder = new RecastBuilder(); - RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize), - RcPartitionType.OfValue(m_partitionType), m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, - m_agentMaxClimb, m_regionMinArea, m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true, - m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize, + RcConfig.CalcBorder(m_agentRadius, m_cellSize), + RcPartitionType.OfValue(m_partitionType), + m_cellSize, m_cellHeight, + m_agentMaxSlope, m_agentHeight, m_agentRadius, m_agentMaxClimb, + m_regionMinArea, m_regionMergeArea, + m_edgeMaxLen, m_edgeMaxError, + m_vertsPerPoly, + m_detailSampleDist, m_detailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), x, y); RcHeightfieldLayerSet lset = builder.BuildLayers(geom, bcfg); return lset; } -} +} \ No newline at end of file diff --git a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs index fadf497..27dd778 100644 --- a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs @@ -106,9 +106,16 @@ public class RecastSoloMeshTest // // Init build configuration from GUI - RcConfig cfg = new RcConfig(partitionType, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius, - m_agentMaxClimb, m_agentMaxSlope, m_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, - m_vertsPerPoly, m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + RcConfig cfg = new RcConfig( + partitionType, + m_cellSize, m_cellHeight, + m_agentMaxSlope, m_agentHeight, m_agentRadius, m_agentMaxClimb, + m_regionMinSize, m_regionMergeSize, + m_edgeMaxLen, m_edgeMaxError, + m_vertsPerPoly, + m_detailSampleDist, m_detailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, bmin, bmax); // diff --git a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs index 6c5690e..48fd5f5 100644 --- a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs @@ -60,10 +60,17 @@ public class RecastTileMeshTest { IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename)); RecastBuilder builder = new RecastBuilder(); - RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize), - m_partitionType, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, - m_agentMaxClimb, m_regionMinArea, m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true, - m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + RcConfig cfg = new RcConfig( + true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize), + m_partitionType, + m_cellSize, m_cellHeight, + m_agentMaxSlope, m_agentHeight, m_agentRadius, m_agentMaxClimb, + m_regionMinArea, m_regionMergeArea, + m_edgeMaxLen, m_edgeMaxError, + m_vertsPerPoly, + m_detailSampleDist, m_detailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 7, 8); RecastBuilderResult rcResult = builder.Build(geom, bcfg); Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(1)); @@ -95,10 +102,18 @@ public class RecastTileMeshTest { IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj")); RecastBuilder builder = new RecastBuilder(); - RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize), - m_partitionType, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, - m_agentMaxClimb, m_regionMinArea, m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true, - m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND); + RcConfig cfg = new RcConfig( + true, m_tileSize, m_tileSize, + RcConfig.CalcBorder(m_agentRadius, m_cellSize), + m_partitionType, + m_cellSize, m_cellHeight, + m_agentMaxSlope, m_agentHeight, m_agentRadius, m_agentMaxClimb, + m_regionMinArea, m_regionMergeArea, + m_edgeMaxLen, m_edgeMaxError, + m_vertsPerPoly, + m_detailSampleDist, m_detailSampleMaxError, + true, true, true, + SampleAreaModifications.SAMPLE_AREAMOD_GROUND, true); for (int i = 0; i < 4; i++) { Build(geom, builder, cfg, 1, true);