forked from bit/DotRecastNetSim
reformat RcConfig
This commit is contained in:
parent
c1a2750555
commit
c62cfb0985
|
@ -90,12 +90,16 @@ namespace DotRecast.Detour.Dynamic
|
||||||
RcHeightfield heightfield, RcTelemetry telemetry)
|
RcHeightfield heightfield, RcTelemetry telemetry)
|
||||||
{
|
{
|
||||||
RcConfig rcConfig = new RcConfig(
|
RcConfig rcConfig = new RcConfig(
|
||||||
config.useTiles, config.tileSizeX, config.tileSizeZ, vt.borderSize,
|
config.useTiles, config.tileSizeX, config.tileSizeZ,
|
||||||
RcPartitionType.OfValue(config.partition), vt.cellSize, vt.cellHeight, config.walkableSlopeAngle, true, true, true,
|
vt.borderSize,
|
||||||
config.walkableHeight, config.walkableRadius, config.walkableClimb, config.minRegionArea, config.regionMergeArea,
|
RcPartitionType.OfValue(config.partition),
|
||||||
|
vt.cellSize, vt.cellHeight,
|
||||||
|
config.walkableSlopeAngle, config.walkableHeight, config.walkableRadius, config.walkableClimb,
|
||||||
|
config.minRegionArea, config.regionMergeArea,
|
||||||
config.maxEdgeLen, config.maxSimplificationError,
|
config.maxEdgeLen, config.maxSimplificationError,
|
||||||
Math.Min(DynamicNavMesh.MAX_VERTS_PER_POLY, config.vertsPerPoly), true, config.detailSampleDistance,
|
Math.Min(DynamicNavMesh.MAX_VERTS_PER_POLY, config.vertsPerPoly),
|
||||||
config.detailSampleMaxError, null);
|
config.detailSampleDistance, config.detailSampleMaxError,
|
||||||
|
true, true, true, null, true);
|
||||||
RecastBuilderResult r = builder.Build(vt.tileX, vt.tileZ, null, rcConfig, heightfield, telemetry);
|
RecastBuilderResult r = builder.Build(vt.tileX, vt.tileZ, null, rcConfig, heightfield, telemetry);
|
||||||
if (config.keepIntermediateResults)
|
if (config.keepIntermediateResults)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,10 +66,17 @@ namespace DotRecast.Detour.Dynamic.Io
|
||||||
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans,
|
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans,
|
||||||
RcAreaModification walkbableAreaMod, bool buildMeshDetail, float detailSampleDist, float detailSampleMaxError)
|
RcAreaModification walkbableAreaMod, bool buildMeshDetail, float detailSampleDist, float detailSampleMaxError)
|
||||||
{
|
{
|
||||||
return new RcConfig(useTiles, tileSizeX, tileSizeZ, tile.borderSize, partitionType, cellSize, tile.cellHeight,
|
return new RcConfig(useTiles, tileSizeX, tileSizeZ,
|
||||||
walkableSlopeAngle, filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans, walkableHeight,
|
tile.borderSize,
|
||||||
walkableRadius, walkableClimb, minRegionArea, regionMergeArea, maxEdgeLen, maxSimplificationError, maxPolyVerts,
|
partitionType,
|
||||||
buildMeshDetail, detailSampleDist, detailSampleMaxError, walkbableAreaMod);
|
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)
|
public static VoxelFile From(RcConfig config, List<RecastBuilderResult> results)
|
||||||
|
|
|
@ -29,24 +29,36 @@ namespace DotRecast.Recast.Toolset.Builder
|
||||||
public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcNavMeshBuildSettings settings)
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcNavMeshBuildSettings settings)
|
||||||
{
|
{
|
||||||
return Build(geom,
|
return Build(geom,
|
||||||
RcPartitionType.OfValue(settings.partitioning), settings.cellSize, settings.cellHeight, settings.agentHeight,
|
RcPartitionType.OfValue(settings.partitioning),
|
||||||
settings.agentRadius, settings.agentMaxClimb, settings.agentMaxSlope,
|
settings.cellSize, settings.cellHeight,
|
||||||
|
settings.agentMaxSlope, settings.agentHeight, settings.agentRadius, settings.agentMaxClimb,
|
||||||
settings.minRegionSize, settings.mergedRegionSize,
|
settings.minRegionSize, settings.mergedRegionSize,
|
||||||
settings.edgeMaxLen, settings.edgeMaxError,
|
settings.edgeMaxLen, settings.edgeMaxError,
|
||||||
settings.vertsPerPoly, settings.detailSampleDist, settings.detailSampleMaxError,
|
settings.vertsPerPoly,
|
||||||
|
settings.detailSampleDist, settings.detailSampleMaxError,
|
||||||
settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans);
|
settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcPartition partitionType,
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom,
|
||||||
float cellSize, float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb,
|
RcPartition partitionType,
|
||||||
float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
float cellSize, float cellHeight,
|
||||||
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb,
|
||||||
bool filterLedgeSpans, bool filterWalkableLowHeightSpans)
|
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,
|
RecastBuilderResult rcResult = BuildRecastResult(
|
||||||
agentRadius, agentMaxClimb, agentMaxSlope, regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError,
|
geom,
|
||||||
vertsPerPoly, detailSampleDist, detailSampleMaxError, filterLowHangingObstacles, filterLedgeSpans,
|
partitionType,
|
||||||
filterWalkableLowHeightSpans);
|
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);
|
var meshData = BuildMeshData(geom, cellSize, cellHeight, agentHeight, agentRadius, agentMaxClimb, rcResult);
|
||||||
if (null == meshData)
|
if (null == meshData)
|
||||||
|
@ -63,23 +75,35 @@ namespace DotRecast.Recast.Toolset.Builder
|
||||||
return new DtNavMesh(meshData, vertsPerPoly, 0);
|
return new DtNavMesh(meshData, vertsPerPoly, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RecastBuilderResult BuildRecastResult(DemoInputGeomProvider geom, RcPartition partitionType, float cellSize,
|
private RecastBuilderResult BuildRecastResult(DemoInputGeomProvider geom,
|
||||||
float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope,
|
RcPartition partitionType,
|
||||||
int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly,
|
float cellSize, float cellHeight,
|
||||||
float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles, bool filterLedgeSpans,
|
float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb,
|
||||||
bool filterWalkableLowHeightSpans)
|
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,
|
RcConfig cfg = new RcConfig(
|
||||||
filterLedgeSpans, filterWalkableLowHeightSpans, agentHeight, agentRadius, agentMaxClimb, regionMinSize,
|
partitionType,
|
||||||
regionMergeSize, edgeMaxLen, edgeMaxError, vertsPerPoly, detailSampleDist, detailSampleMaxError,
|
cellSize, cellHeight,
|
||||||
|
agentMaxSlope, agentHeight, agentRadius, agentMaxClimb,
|
||||||
|
regionMinSize, regionMergeSize,
|
||||||
|
edgeMaxLen, edgeMaxError,
|
||||||
|
vertsPerPoly,
|
||||||
|
detailSampleDist, detailSampleMaxError,
|
||||||
|
filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans,
|
||||||
SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE, true);
|
SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE, true);
|
||||||
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
||||||
RecastBuilder rcBuilder = new RecastBuilder();
|
RecastBuilder rcBuilder = new RecastBuilder();
|
||||||
return rcBuilder.Build(geom, bcfg);
|
return rcBuilder.Build(geom, bcfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtMeshData BuildMeshData(DemoInputGeomProvider geom, float cellSize, float cellHeight, float agentHeight,
|
public DtMeshData BuildMeshData(DemoInputGeomProvider geom,
|
||||||
float agentRadius, float agentMaxClimb, RecastBuilderResult result)
|
float cellSize, float cellHeight,
|
||||||
|
float agentHeight, float agentRadius, float agentMaxClimb,
|
||||||
|
RecastBuilderResult result)
|
||||||
{
|
{
|
||||||
DtNavMeshCreateParams option = DemoNavMeshBuilder
|
DtNavMeshCreateParams option = DemoNavMeshBuilder
|
||||||
.GetNavMeshCreateParams(geom, cellSize, cellHeight, agentHeight, agentRadius, agentMaxClimb, result);
|
.GetNavMeshCreateParams(geom, cellSize, cellHeight, agentHeight, agentRadius, agentMaxClimb, result);
|
||||||
|
|
|
@ -64,12 +64,17 @@ namespace DotRecast.Recast.Toolset.Builder
|
||||||
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
||||||
bool filterLedgeSpans, bool filterWalkableLowHeightSpans, int tileSize)
|
bool filterLedgeSpans, bool filterWalkableLowHeightSpans, int tileSize)
|
||||||
{
|
{
|
||||||
RcConfig cfg = new RcConfig(true, tileSize, tileSize, RcConfig.CalcBorder(agentRadius, cellSize),
|
RcConfig cfg = new RcConfig(true, tileSize, tileSize,
|
||||||
partitionType, cellSize, cellHeight, agentMaxSlope, filterLowHangingObstacles, filterLedgeSpans,
|
RcConfig.CalcBorder(agentRadius, cellSize),
|
||||||
filterWalkableLowHeightSpans, agentHeight, agentRadius, agentMaxClimb,
|
partitionType,
|
||||||
regionMinSize * regionMinSize * cellSize * cellSize,
|
cellSize, cellHeight,
|
||||||
regionMergeSize * regionMergeSize * cellSize * cellSize, edgeMaxLen, edgeMaxError, vertsPerPoly,
|
agentMaxSlope, agentHeight, agentRadius, agentMaxClimb,
|
||||||
true, detailSampleDist, detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE);
|
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();
|
RecastBuilder rcBuilder = new RecastBuilder();
|
||||||
return rcBuilder.BuildTiles(geom, cfg, Task.Factory);
|
return rcBuilder.BuildTiles(geom, cfg, Task.Factory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,29 +76,18 @@ namespace DotRecast.Recast.Toolset.Tools
|
||||||
RcVec3f bmax = geom.GetMeshBoundsMax();
|
RcVec3f bmax = geom.GetMeshBoundsMax();
|
||||||
|
|
||||||
RcConfig cfg = new RcConfig(
|
RcConfig cfg = new RcConfig(
|
||||||
true,
|
true, settings.tileSize, settings.tileSize,
|
||||||
settings.tileSize,
|
|
||||||
settings.tileSize,
|
|
||||||
RcConfig.CalcBorder(settings.agentRadius, settings.cellSize),
|
RcConfig.CalcBorder(settings.agentRadius, settings.cellSize),
|
||||||
RcPartitionType.OfValue(settings.partitioning),
|
RcPartitionType.OfValue(settings.partitioning),
|
||||||
settings.cellSize,
|
settings.cellSize, settings.cellHeight,
|
||||||
settings.cellHeight,
|
settings.agentMaxSlope, settings.agentHeight, settings.agentRadius, settings.agentMaxClimb,
|
||||||
settings.agentMaxSlope,
|
|
||||||
settings.filterLowHangingObstacles,
|
|
||||||
settings.filterLedgeSpans,
|
|
||||||
settings.filterWalkableLowHeightSpans,
|
|
||||||
settings.agentHeight,
|
|
||||||
settings.agentRadius,
|
|
||||||
settings.agentMaxClimb,
|
|
||||||
settings.minRegionSize * settings.minRegionSize * settings.cellSize * settings.cellSize,
|
settings.minRegionSize * settings.minRegionSize * settings.cellSize * settings.cellSize,
|
||||||
settings.mergedRegionSize * settings.mergedRegionSize * settings.cellSize * settings.cellSize,
|
settings.mergedRegionSize * settings.mergedRegionSize * settings.cellSize * settings.cellSize,
|
||||||
settings.edgeMaxLen,
|
settings.edgeMaxLen, settings.edgeMaxError,
|
||||||
settings.edgeMaxError,
|
|
||||||
settings.vertsPerPoly,
|
settings.vertsPerPoly,
|
||||||
true,
|
settings.detailSampleDist, settings.detailSampleMaxError,
|
||||||
settings.detailSampleDist,
|
settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans,
|
||||||
settings.detailSampleMaxError,
|
SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE, true
|
||||||
SampleAreaModifications.SAMPLE_AREAMOD_WALKABLE
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var beginTick = RcFrequency.Ticks;
|
var beginTick = RcFrequency.Ticks;
|
||||||
|
|
|
@ -116,35 +116,41 @@ namespace DotRecast.Recast
|
||||||
/**
|
/**
|
||||||
* Non-tiled build configuration
|
* Non-tiled build configuration
|
||||||
*/
|
*/
|
||||||
public RcConfig(RcPartition partitionType, float cellSize, float cellHeight, float agentHeight, float agentRadius,
|
public RcConfig(
|
||||||
float agentMaxClimb, float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen,
|
RcPartition partitionType,
|
||||||
float edgeMaxError, int vertsPerPoly, float detailSampleDist, float detailSampleMaxError,
|
float cellSize, float cellHeight,
|
||||||
RcAreaModification walkableAreaMod) : this(partitionType, cellSize, cellHeight, agentMaxSlope, true, true, true, agentHeight, agentRadius, agentMaxClimb,
|
float agentMaxSlope, float agentHeight, float agentRadius, float agentMaxClimb,
|
||||||
regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError, vertsPerPoly, detailSampleDist, detailSampleMaxError,
|
int regionMinSize, int regionMergeSize,
|
||||||
walkableAreaMod, true)
|
float edgeMaxLen, float edgeMaxError,
|
||||||
{
|
int vertsPerPoly,
|
||||||
}
|
float detailSampleDist, float detailSampleMaxError,
|
||||||
|
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans,
|
||||||
/**
|
RcAreaModification walkableAreaMod, bool buildMeshDetail)
|
||||||
* Non-tiled build configuration
|
: this(false, 0, 0, 0,
|
||||||
*/
|
partitionType,
|
||||||
public RcConfig(RcPartition partitionType, float cellSize, float cellHeight, float agentMaxSlope,
|
cellSize, cellHeight,
|
||||||
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, float agentHeight,
|
agentMaxSlope, agentHeight, agentRadius, agentMaxClimb,
|
||||||
float agentRadius, float agentMaxClimb, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
regionMinSize * regionMinSize * cellSize * cellSize, regionMergeSize * regionMergeSize * cellSize * cellSize,
|
||||||
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, RcAreaModification walkableAreaMod,
|
edgeMaxLen, edgeMaxError,
|
||||||
bool buildMeshDetail) : this(false, 0, 0, 0, partitionType, cellSize, cellHeight, agentMaxSlope, filterLowHangingObstacles, filterLedgeSpans,
|
vertsPerPoly,
|
||||||
filterWalkableLowHeightSpans, agentHeight, agentRadius, agentMaxClimb,
|
detailSampleDist, detailSampleMaxError,
|
||||||
regionMinSize * regionMinSize * cellSize * cellSize, regionMergeSize * regionMergeSize * cellSize * cellSize,
|
filterLowHangingObstacles, filterLedgeSpans, filterWalkableLowHeightSpans,
|
||||||
edgeMaxLen, edgeMaxError, vertsPerPoly, buildMeshDetail, detailSampleDist, detailSampleMaxError, walkableAreaMod)
|
walkableAreaMod, buildMeshDetail)
|
||||||
{
|
{
|
||||||
// Note: area = size*size in [Units: wu]
|
// Note: area = size*size in [Units: wu]
|
||||||
}
|
}
|
||||||
|
|
||||||
public RcConfig(bool useTiles, int tileSizeX, int tileSizeZ, int borderSize, RcPartition partition,
|
public RcConfig(
|
||||||
float cellSize, float cellHeight, float agentMaxSlope, bool filterLowHangingObstacles, bool filterLedgeSpans,
|
bool useTiles, int tileSizeX, int tileSizeZ,
|
||||||
bool filterWalkableLowHeightSpans, float agentHeight, float agentRadius, float agentMaxClimb, float minRegionArea,
|
int borderSize,
|
||||||
float mergeRegionArea, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, bool buildMeshDetail,
|
RcPartition partition,
|
||||||
float detailSampleDist, float detailSampleMaxError, RcAreaModification walkableAreaMod)
|
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;
|
UseTiles = useTiles;
|
||||||
TileSizeX = tileSizeX;
|
TileSizeX = tileSizeX;
|
||||||
|
|
|
@ -39,21 +39,37 @@ public class RecastTestMeshBuilder
|
||||||
public const float m_detailSampleDist = 6.0f;
|
public const float m_detailSampleDist = 6.0f;
|
||||||
public const float m_detailSampleMaxError = 1.0f;
|
public const float m_detailSampleMaxError = 1.0f;
|
||||||
|
|
||||||
public RecastTestMeshBuilder() : this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
public RecastTestMeshBuilder()
|
||||||
RcPartition.WATERSHED, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_agentMaxSlope,
|
: this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
||||||
m_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, m_detailSampleDist,
|
RcPartition.WATERSHED,
|
||||||
m_detailSampleMaxError)
|
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,
|
public RecastTestMeshBuilder(IInputGeomProvider geom,
|
||||||
float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope,
|
RcPartition partitionType,
|
||||||
int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly,
|
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)
|
float detailSampleDist, float detailSampleMaxError)
|
||||||
{
|
{
|
||||||
RcConfig cfg = new RcConfig(partitionType, cellSize, cellHeight, agentHeight, agentRadius,
|
RcConfig cfg = new RcConfig(
|
||||||
agentMaxClimb, agentMaxSlope, regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError,
|
partitionType,
|
||||||
vertsPerPoly, detailSampleDist, detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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());
|
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
||||||
RecastBuilder rcBuilder = new RecastBuilder();
|
RecastBuilder rcBuilder = new RecastBuilder();
|
||||||
RecastBuilderResult rcResult = rcBuilder.Build(geom, bcfg);
|
RecastBuilderResult rcResult = rcBuilder.Build(geom, bcfg);
|
||||||
|
|
|
@ -75,10 +75,16 @@ public class MeshSetReaderWriterTest
|
||||||
for (int x = 0; x < tw; ++x)
|
for (int x = 0; x < tw; ++x)
|
||||||
{
|
{
|
||||||
RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize,
|
RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize,
|
||||||
RcConfig.CalcBorder(m_agentRadius, m_cellSize), RcPartition.WATERSHED, m_cellSize, m_cellHeight,
|
RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
||||||
m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_regionMinArea,
|
RcPartition.WATERSHED,
|
||||||
m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true, m_detailSampleDist,
|
m_cellSize, m_cellHeight,
|
||||||
m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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);
|
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, bmin, bmax, x, y);
|
||||||
TestDetourBuilder db = new TestDetourBuilder();
|
TestDetourBuilder db = new TestDetourBuilder();
|
||||||
DtMeshData data = db.Build(geom, bcfg, m_agentHeight, m_agentRadius, m_agentMaxClimb, x, y, true);
|
DtMeshData data = db.Build(geom, bcfg, m_agentHeight, m_agentRadius, m_agentMaxClimb, x, y, true);
|
||||||
|
|
|
@ -39,22 +39,37 @@ public class RecastTestMeshBuilder
|
||||||
private const float m_detailSampleDist = 6.0f;
|
private const float m_detailSampleDist = 6.0f;
|
||||||
private const float m_detailSampleMaxError = 1.0f;
|
private const float m_detailSampleMaxError = 1.0f;
|
||||||
|
|
||||||
public RecastTestMeshBuilder() :
|
public RecastTestMeshBuilder()
|
||||||
this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
: this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
||||||
RcPartition.WATERSHED, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_agentMaxSlope,
|
RcPartition.WATERSHED,
|
||||||
m_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, m_detailSampleDist,
|
m_cellSize, m_cellHeight,
|
||||||
m_detailSampleMaxError)
|
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,
|
public RecastTestMeshBuilder(IInputGeomProvider geom,
|
||||||
float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope,
|
RcPartition partition,
|
||||||
int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly,
|
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)
|
float detailSampleDist, float detailSampleMaxError)
|
||||||
{
|
{
|
||||||
RcConfig cfg = new RcConfig(partition, cellSize, cellHeight, agentHeight, agentRadius,
|
RcConfig cfg = new RcConfig(
|
||||||
agentMaxClimb, agentMaxSlope, regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError,
|
partition,
|
||||||
vertsPerPoly, detailSampleDist, detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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());
|
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax());
|
||||||
RecastBuilder rcBuilder = new RecastBuilder();
|
RecastBuilder rcBuilder = new RecastBuilder();
|
||||||
RecastBuilderResult rcResult = rcBuilder.Build(geom, bcfg);
|
RecastBuilderResult rcResult = rcBuilder.Build(geom, bcfg);
|
||||||
|
|
|
@ -68,9 +68,15 @@ public class TestTiledNavMeshBuilder
|
||||||
|
|
||||||
// Build all tiles
|
// Build all tiles
|
||||||
RcConfig cfg = new RcConfig(true, tileSize, tileSize, RcConfig.CalcBorder(agentRadius, cellSize),
|
RcConfig cfg = new RcConfig(true, tileSize, tileSize, RcConfig.CalcBorder(agentRadius, cellSize),
|
||||||
partitionType, cellSize, cellHeight, agentMaxSlope, true, true, true, agentHeight, agentRadius,
|
partitionType,
|
||||||
agentMaxClimb, m_regionMinArea, m_regionMergeArea, edgeMaxLen, edgeMaxError, vertsPerPoly, true,
|
cellSize, cellHeight,
|
||||||
detailSampleDist, detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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();
|
RecastBuilder rcBuilder = new RecastBuilder();
|
||||||
List<RecastBuilderResult> rcResult = rcBuilder.BuildTiles(geom, cfg, null);
|
List<RecastBuilderResult> rcResult = rcBuilder.BuildTiles(geom, cfg, null);
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,17 @@ public class TestTileLayerBuilder : DtTileCacheLayerBuilder
|
||||||
public TestTileLayerBuilder(IInputGeomProvider geom) : base(DtTileCacheCompressorFactory.Shared)
|
public TestTileLayerBuilder(IInputGeomProvider geom) : base(DtTileCacheCompressorFactory.Shared)
|
||||||
{
|
{
|
||||||
_geom = geom;
|
_geom = geom;
|
||||||
_cfg = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(AgentRadius, CellSize),
|
_cfg = new RcConfig(true, m_tileSize, m_tileSize,
|
||||||
RcPartition.WATERSHED, CellSize, CellHeight, AgentMaxSlope, true, true, true, AgentHeight,
|
RcConfig.CalcBorder(AgentRadius, CellSize),
|
||||||
AgentRadius, AgentMaxClimb, RegionMinArea, RegionMergeArea, EdgeMaxLen, EdgeMaxError, VertsPerPoly,
|
RcPartition.WATERSHED,
|
||||||
true, DetailSampleDist, DetailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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 bmin = geom.GetMeshBoundsMin();
|
||||||
RcVec3f bmax = geom.GetMeshBoundsMax();
|
RcVec3f bmax = geom.GetMeshBoundsMax();
|
||||||
|
|
|
@ -147,10 +147,17 @@ public class RecastLayersTest
|
||||||
{
|
{
|
||||||
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename));
|
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename));
|
||||||
RecastBuilder builder = new RecastBuilder();
|
RecastBuilder builder = new RecastBuilder();
|
||||||
RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize,
|
||||||
RcPartitionType.OfValue(m_partitionType), m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius,
|
RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
||||||
m_agentMaxClimb, m_regionMinArea, m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true,
|
RcPartitionType.OfValue(m_partitionType),
|
||||||
m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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);
|
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), x, y);
|
||||||
RcHeightfieldLayerSet lset = builder.BuildLayers(geom, bcfg);
|
RcHeightfieldLayerSet lset = builder.BuildLayers(geom, bcfg);
|
||||||
return lset;
|
return lset;
|
||||||
|
|
|
@ -106,9 +106,16 @@ public class RecastSoloMeshTest
|
||||||
//
|
//
|
||||||
|
|
||||||
// Init build configuration from GUI
|
// Init build configuration from GUI
|
||||||
RcConfig cfg = new RcConfig(partitionType, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius,
|
RcConfig cfg = new RcConfig(
|
||||||
m_agentMaxClimb, m_agentMaxSlope, m_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError,
|
partitionType,
|
||||||
m_vertsPerPoly, m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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);
|
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, bmin, bmax);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -60,10 +60,17 @@ public class RecastTileMeshTest
|
||||||
{
|
{
|
||||||
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename));
|
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes(filename));
|
||||||
RecastBuilder builder = new RecastBuilder();
|
RecastBuilder builder = new RecastBuilder();
|
||||||
RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
RcConfig cfg = new RcConfig(
|
||||||
m_partitionType, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius,
|
true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
||||||
m_agentMaxClimb, m_regionMinArea, m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true,
|
m_partitionType,
|
||||||
m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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);
|
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), 7, 8);
|
||||||
RecastBuilderResult rcResult = builder.Build(geom, bcfg);
|
RecastBuilderResult rcResult = builder.Build(geom, bcfg);
|
||||||
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(1));
|
Assert.That(rcResult.GetMesh().npolys, Is.EqualTo(1));
|
||||||
|
@ -95,10 +102,18 @@ public class RecastTileMeshTest
|
||||||
{
|
{
|
||||||
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj"));
|
IInputGeomProvider geom = ObjImporter.Load(Loader.ToBytes("dungeon.obj"));
|
||||||
RecastBuilder builder = new RecastBuilder();
|
RecastBuilder builder = new RecastBuilder();
|
||||||
RcConfig cfg = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
RcConfig cfg = new RcConfig(
|
||||||
m_partitionType, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius,
|
true, m_tileSize, m_tileSize,
|
||||||
m_agentMaxClimb, m_regionMinArea, m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true,
|
RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
||||||
m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
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++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
Build(geom, builder, cfg, 1, true);
|
Build(geom, builder, cfg, 1, true);
|
||||||
|
|
Loading…
Reference in New Issue