reformat RcConfig

This commit is contained in:
ikpil 2023-09-02 13:31:30 +09:00
parent c1a2750555
commit c62cfb0985
14 changed files with 243 additions and 129 deletions

View File

@ -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)
{

View File

@ -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<RecastBuilderResult> results)

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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,
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, buildMeshDetail, detailSampleDist, detailSampleMaxError, walkableAreaMod)
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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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<RecastBuilderResult> rcResult = rcBuilder.BuildTiles(geom, cfg, null);

View File

@ -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();

View File

@ -147,10 +147,17 @@ 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;

View File

@ -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);
//

View File

@ -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);