forked from mirror/DotRecast
for unity3d
This commit is contained in:
parent
2553e40ad3
commit
2842c65bb7
|
@ -26,7 +26,7 @@ namespace DotRecast.Detour.Dynamic
|
||||||
public readonly int tileSizeX;
|
public readonly int tileSizeX;
|
||||||
public readonly int tileSizeZ;
|
public readonly int tileSizeZ;
|
||||||
public readonly float cellSize;
|
public readonly float cellSize;
|
||||||
public PartitionType partitionType = PartitionType.WATERSHED;
|
public int partition = RcPartitionType.WATERSHED.Value;
|
||||||
public RcAreaModification walkableAreaModification = new RcAreaModification(1);
|
public RcAreaModification walkableAreaModification = new RcAreaModification(1);
|
||||||
public float walkableHeight;
|
public float walkableHeight;
|
||||||
public float walkableSlopeAngle;
|
public float walkableSlopeAngle;
|
||||||
|
|
|
@ -82,8 +82,9 @@ namespace DotRecast.Detour.Dynamic
|
||||||
private RecastBuilderResult BuildRecast(RecastBuilder builder, DynamicNavMeshConfig config, VoxelTile vt,
|
private RecastBuilderResult BuildRecast(RecastBuilder builder, DynamicNavMeshConfig config, VoxelTile vt,
|
||||||
RcHeightfield heightfield, RcTelemetry telemetry)
|
RcHeightfield heightfield, RcTelemetry telemetry)
|
||||||
{
|
{
|
||||||
RcConfig rcConfig = new RcConfig(config.useTiles, config.tileSizeX, config.tileSizeZ, vt.borderSize,
|
RcConfig rcConfig = new RcConfig(
|
||||||
config.partitionType, vt.cellSize, vt.cellHeight, config.walkableSlopeAngle, true, true, true,
|
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.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), true, config.detailSampleDistance,
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace DotRecast.Detour.Dynamic.Io
|
||||||
public const int VERSION_EXPORTER_RECAST4J = 0x1000;
|
public const int VERSION_EXPORTER_RECAST4J = 0x1000;
|
||||||
public const int VERSION_COMPRESSION_LZ4 = 0x0100;
|
public const int VERSION_COMPRESSION_LZ4 = 0x0100;
|
||||||
public int version;
|
public int version;
|
||||||
public PartitionType partitionType = PartitionType.WATERSHED;
|
public int partition = RcPartitionType.WATERSHED.Value;
|
||||||
public bool filterLowHangingObstacles = true;
|
public bool filterLowHangingObstacles = true;
|
||||||
public bool filterLedgeSpans = true;
|
public bool filterLedgeSpans = true;
|
||||||
public bool filterWalkableLowHeightSpans = true;
|
public bool filterWalkableLowHeightSpans = true;
|
||||||
|
@ -61,7 +61,7 @@ namespace DotRecast.Detour.Dynamic.Io
|
||||||
tiles.Add(tile);
|
tiles.Add(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RcConfig GetConfig(VoxelTile tile, PartitionType partitionType, int maxPolyVerts, int regionMergeSize,
|
public RcConfig GetConfig(VoxelTile tile, RcPartition partitionType, int maxPolyVerts, int regionMergeSize,
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ namespace DotRecast.Detour.Dynamic.Io
|
||||||
{
|
{
|
||||||
VoxelFile f = new VoxelFile();
|
VoxelFile f = new VoxelFile();
|
||||||
f.version = 1;
|
f.version = 1;
|
||||||
f.partitionType = config.partitionType;
|
f.partition = config.partition;
|
||||||
f.filterLowHangingObstacles = config.filterLowHangingObstacles;
|
f.filterLowHangingObstacles = config.filterLowHangingObstacles;
|
||||||
f.filterLedgeSpans = config.filterLedgeSpans;
|
f.filterLedgeSpans = config.filterLedgeSpans;
|
||||||
f.filterWalkableLowHeightSpans = config.filterWalkableLowHeightSpans;
|
f.filterWalkableLowHeightSpans = config.filterWalkableLowHeightSpans;
|
||||||
|
@ -119,7 +119,7 @@ namespace DotRecast.Detour.Dynamic.Io
|
||||||
VoxelFile f = new VoxelFile();
|
VoxelFile f = new VoxelFile();
|
||||||
f.version = 1;
|
f.version = 1;
|
||||||
DynamicNavMeshConfig config = mesh.config;
|
DynamicNavMeshConfig config = mesh.config;
|
||||||
f.partitionType = config.partitionType;
|
f.partition = config.partition;
|
||||||
f.filterLowHangingObstacles = config.filterLowHangingObstacles;
|
f.filterLowHangingObstacles = config.filterLowHangingObstacles;
|
||||||
f.filterLedgeSpans = config.filterLedgeSpans;
|
f.filterLedgeSpans = config.filterLedgeSpans;
|
||||||
f.filterWalkableLowHeightSpans = config.filterWalkableLowHeightSpans;
|
f.filterWalkableLowHeightSpans = config.filterWalkableLowHeightSpans;
|
||||||
|
|
|
@ -45,8 +45,7 @@ public class DynamicUpdateTool : IRcTool
|
||||||
private DynamicUpdateToolMode mode = DynamicUpdateToolMode.BUILD;
|
private DynamicUpdateToolMode mode = DynamicUpdateToolMode.BUILD;
|
||||||
private float cellSize = 0.3f;
|
private float cellSize = 0.3f;
|
||||||
|
|
||||||
private int partitioningIdx = PartitionType.WATERSHED.Idx;
|
private int partitioning = RcPartitionType.WATERSHED.Value;
|
||||||
private PartitionType partitioning = PartitionType.WATERSHED;
|
|
||||||
private bool filterLowHangingObstacles = true;
|
private bool filterLowHangingObstacles = true;
|
||||||
private bool filterLedgeSpans = true;
|
private bool filterLedgeSpans = true;
|
||||||
private bool filterWalkableLowHeightSpans = true;
|
private bool filterWalkableLowHeightSpans = true;
|
||||||
|
@ -575,11 +574,11 @@ public class DynamicUpdateTool : IRcTool
|
||||||
|
|
||||||
ImGui.Text("Partitioning");
|
ImGui.Text("Partitioning");
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
PartitionType.Values.ForEach(partition =>
|
RcPartitionType.Values.ForEach(partition =>
|
||||||
{
|
{
|
||||||
var label = partition.Name.Substring(0, 1).ToUpper()
|
var label = partition.Name.Substring(0, 1).ToUpper()
|
||||||
+ partition.Name.Substring(1).ToLower();
|
+ partition.Name.Substring(1).ToLower();
|
||||||
ImGui.RadioButton(label, ref partitioningIdx, partition.Idx);
|
ImGui.RadioButton(label, ref partitioning, partition.Value);
|
||||||
});
|
});
|
||||||
ImGui.NewLine();
|
ImGui.NewLine();
|
||||||
|
|
||||||
|
@ -721,7 +720,7 @@ public class DynamicUpdateTool : IRcTool
|
||||||
|
|
||||||
private void ConfigDynaMesh()
|
private void ConfigDynaMesh()
|
||||||
{
|
{
|
||||||
dynaMesh.config.partitionType = partitioning;
|
dynaMesh.config.partition = partitioning;
|
||||||
dynaMesh.config.walkableHeight = walkableHeight;
|
dynaMesh.config.walkableHeight = walkableHeight;
|
||||||
dynaMesh.config.walkableSlopeAngle = walkableSlopeAngle;
|
dynaMesh.config.walkableSlopeAngle = walkableSlopeAngle;
|
||||||
dynaMesh.config.walkableRadius = walkableRadius;
|
dynaMesh.config.walkableRadius = walkableRadius;
|
||||||
|
@ -742,7 +741,7 @@ public class DynamicUpdateTool : IRcTool
|
||||||
private void UpdateUI()
|
private void UpdateUI()
|
||||||
{
|
{
|
||||||
cellSize = dynaMesh.config.cellSize;
|
cellSize = dynaMesh.config.cellSize;
|
||||||
partitioning = dynaMesh.config.partitionType;
|
partitioning = (int)dynaMesh.config.partition;
|
||||||
walkableHeight = dynaMesh.config.walkableHeight;
|
walkableHeight = dynaMesh.config.walkableHeight;
|
||||||
walkableSlopeAngle = dynaMesh.config.walkableSlopeAngle;
|
walkableSlopeAngle = dynaMesh.config.walkableSlopeAngle;
|
||||||
walkableRadius = dynaMesh.config.walkableRadius;
|
walkableRadius = dynaMesh.config.walkableRadius;
|
||||||
|
|
|
@ -142,10 +142,10 @@ public class RcSettingsView : IRcView
|
||||||
|
|
||||||
ImGui.Text("Partitioning");
|
ImGui.Text("Partitioning");
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
PartitionType.Values.ForEach(partition =>
|
RcPartitionType.Values.ForEach(partition =>
|
||||||
{
|
{
|
||||||
var label = partition.Name.Substring(0, 1).ToUpper() + partition.Name.Substring(1).ToLower();
|
var label = partition.Name.Substring(0, 1).ToUpper() + partition.Name.Substring(1).ToLower();
|
||||||
ImGui.RadioButton(label, ref settings.partitioningIdx, partition.Idx);
|
ImGui.RadioButton(label, ref settings.partitioning, partition.Value);
|
||||||
});
|
});
|
||||||
ImGui.NewLine();
|
ImGui.NewLine();
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
{
|
{
|
||||||
public class SoloNavMeshBuilder
|
public class SoloNavMeshBuilder
|
||||||
{
|
{
|
||||||
public NavMeshBuildResult Build(DemoInputGeomProvider geom, SampleSettings settings)
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcNavMeshBuildSetting settings)
|
||||||
{
|
{
|
||||||
return Build(geom,
|
return Build(geom,
|
||||||
settings.partitioning, settings.cellSize, settings.cellHeight, settings.agentHeight,
|
RcPartitionType.OfValue(settings.partitioning), settings.cellSize, settings.cellHeight, settings.agentHeight,
|
||||||
settings.agentRadius, settings.agentMaxClimb, settings.agentMaxSlope,
|
settings.agentRadius, settings.agentMaxClimb, settings.agentMaxSlope,
|
||||||
settings.minRegionSize, settings.mergedRegionSize,
|
settings.minRegionSize, settings.mergedRegionSize,
|
||||||
settings.edgeMaxLen, settings.edgeMaxError,
|
settings.edgeMaxLen, settings.edgeMaxError,
|
||||||
|
@ -37,7 +37,7 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans);
|
settings.filterLowHangingObstacles, settings.filterLedgeSpans, settings.filterWalkableLowHeightSpans);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NavMeshBuildResult Build(DemoInputGeomProvider geom, PartitionType partitionType,
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcPartition 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,
|
||||||
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
||||||
|
@ -58,7 +58,7 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
return new DtNavMesh(meshData, vertsPerPoly, 0);
|
return new DtNavMesh(meshData, vertsPerPoly, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RecastBuilderResult BuildRecastResult(DemoInputGeomProvider geom, PartitionType partitionType, float cellSize,
|
private RecastBuilderResult BuildRecastResult(DemoInputGeomProvider geom, RcPartition partitionType, float cellSize,
|
||||||
float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope,
|
float cellHeight, float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope,
|
||||||
int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly,
|
int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError, int vertsPerPoly,
|
||||||
float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles, bool filterLedgeSpans,
|
float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles, bool filterLedgeSpans,
|
||||||
|
|
|
@ -30,10 +30,10 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public NavMeshBuildResult Build(DemoInputGeomProvider geom, SampleSettings settings)
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcNavMeshBuildSetting settings)
|
||||||
{
|
{
|
||||||
return Build(geom,
|
return Build(geom,
|
||||||
settings.partitioning, settings.cellSize, settings.cellHeight, settings.agentHeight,
|
RcPartitionType.OfValue(settings.partitioning), settings.cellSize, settings.cellHeight, settings.agentHeight,
|
||||||
settings.agentRadius, settings.agentMaxClimb, settings.agentMaxSlope,
|
settings.agentRadius, settings.agentMaxClimb, settings.agentMaxSlope,
|
||||||
settings.minRegionSize, settings.mergedRegionSize,
|
settings.minRegionSize, settings.mergedRegionSize,
|
||||||
settings.edgeMaxLen, settings.edgeMaxError,
|
settings.edgeMaxLen, settings.edgeMaxError,
|
||||||
|
@ -42,7 +42,7 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
settings.tileSize);
|
settings.tileSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NavMeshBuildResult Build(DemoInputGeomProvider geom, PartitionType partitionType,
|
public NavMeshBuildResult Build(DemoInputGeomProvider geom, RcPartition 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,
|
||||||
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
||||||
|
@ -57,7 +57,7 @@ namespace DotRecast.Recast.DemoTool.Builder
|
||||||
return new NavMeshBuildResult(results, tileNavMesh);
|
return new NavMeshBuildResult(results, tileNavMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RecastBuilderResult> BuildRecastResult(DemoInputGeomProvider geom, PartitionType partitionType,
|
public List<RecastBuilderResult> BuildRecastResult(DemoInputGeomProvider geom, RcPartition 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,
|
||||||
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, bool filterLowHangingObstacles,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace DotRecast.Recast.DemoTool
|
namespace DotRecast.Recast.DemoTool
|
||||||
{
|
{
|
||||||
public class SampleSettings
|
public class RcNavMeshBuildSetting
|
||||||
{
|
{
|
||||||
public float cellSize = 0.3f;
|
public float cellSize = 0.3f;
|
||||||
public float cellHeight = 0.2f;
|
public float cellHeight = 0.2f;
|
||||||
|
@ -16,8 +16,7 @@
|
||||||
public int minRegionSize = 8;
|
public int minRegionSize = 8;
|
||||||
public int mergedRegionSize = 20;
|
public int mergedRegionSize = 20;
|
||||||
|
|
||||||
public int partitioningIdx = 0;
|
public int partitioning = RcPartitionType.WATERSHED.Value;
|
||||||
public PartitionType partitioning = PartitionType.WATERSHED;
|
|
||||||
|
|
||||||
public bool filterLowHangingObstacles = true;
|
public bool filterLowHangingObstacles = true;
|
||||||
public bool filterLedgeSpans = true;
|
public bool filterLedgeSpans = true;
|
|
@ -30,7 +30,7 @@ namespace DotRecast.Recast.DemoTool
|
||||||
private DemoInputGeomProvider _inputGeom;
|
private DemoInputGeomProvider _inputGeom;
|
||||||
private DtNavMesh _navMesh;
|
private DtNavMesh _navMesh;
|
||||||
private DtNavMeshQuery _navMeshQuery;
|
private DtNavMeshQuery _navMeshQuery;
|
||||||
private readonly SampleSettings _settings;
|
private readonly RcNavMeshBuildSetting _settings;
|
||||||
private IList<RecastBuilderResult> _recastResults;
|
private IList<RecastBuilderResult> _recastResults;
|
||||||
private bool _changed;
|
private bool _changed;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace DotRecast.Recast.DemoTool
|
||||||
_inputGeom = inputGeom;
|
_inputGeom = inputGeom;
|
||||||
_recastResults = recastResults;
|
_recastResults = recastResults;
|
||||||
_navMesh = navMesh;
|
_navMesh = navMesh;
|
||||||
_settings = new SampleSettings();
|
_settings = new RcNavMeshBuildSetting();
|
||||||
|
|
||||||
SetQuery(navMesh);
|
SetQuery(navMesh);
|
||||||
_changed = true;
|
_changed = true;
|
||||||
|
@ -65,7 +65,7 @@ namespace DotRecast.Recast.DemoTool
|
||||||
return _navMesh;
|
return _navMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SampleSettings GetSettings()
|
public RcNavMeshBuildSetting GetSettings()
|
||||||
{
|
{
|
||||||
return _settings;
|
return _settings;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace DotRecast.Recast.DemoTool.Tools
|
||||||
settings.tileSize,
|
settings.tileSize,
|
||||||
settings.tileSize,
|
settings.tileSize,
|
||||||
RcConfig.CalcBorder(settings.agentRadius, settings.cellSize),
|
RcConfig.CalcBorder(settings.agentRadius, settings.cellSize),
|
||||||
settings.partitioning,
|
RcPartitionType.OfValue(settings.partitioning),
|
||||||
settings.cellSize,
|
settings.cellSize,
|
||||||
settings.cellHeight,
|
settings.cellHeight,
|
||||||
settings.agentMaxSlope,
|
settings.agentMaxSlope,
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
using System.Collections.Immutable;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace DotRecast.Recast
|
|
||||||
{
|
|
||||||
/// < Tessellate edges between areas during contour
|
|
||||||
/// simplification.
|
|
||||||
public class PartitionType
|
|
||||||
{
|
|
||||||
public static readonly PartitionType WATERSHED = new PartitionType(0, nameof(WATERSHED));
|
|
||||||
public static readonly PartitionType MONOTONE = new PartitionType(1, nameof(MONOTONE));
|
|
||||||
public static readonly PartitionType LAYERS = new PartitionType(2, nameof(LAYERS));
|
|
||||||
|
|
||||||
public static readonly ImmutableArray<PartitionType> Values = ImmutableArray.Create(WATERSHED, MONOTONE, LAYERS);
|
|
||||||
|
|
||||||
public int Idx { get; }
|
|
||||||
public string Name { get; }
|
|
||||||
|
|
||||||
private PartitionType(int idx, string name)
|
|
||||||
{
|
|
||||||
Idx = idx;
|
|
||||||
Name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PartitionType OfIdx(int idx)
|
|
||||||
{
|
|
||||||
return Values.FirstOrDefault(x => x.Idx == idx) ?? WATERSHED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() => Name;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -24,7 +24,7 @@ namespace DotRecast.Recast
|
||||||
{
|
{
|
||||||
public class RcConfig
|
public class RcConfig
|
||||||
{
|
{
|
||||||
public readonly PartitionType partitionType;
|
public readonly int partition;
|
||||||
|
|
||||||
public readonly bool useTiles;
|
public readonly bool useTiles;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ namespace DotRecast.Recast
|
||||||
/**
|
/**
|
||||||
* Non-tiled build configuration
|
* Non-tiled build configuration
|
||||||
*/
|
*/
|
||||||
public RcConfig(PartitionType partitionType, float cellSize, float cellHeight, float agentHeight, float agentRadius,
|
public RcConfig(RcPartition partitionType, float cellSize, float cellHeight, float agentHeight, float agentRadius,
|
||||||
float agentMaxClimb, float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen,
|
float agentMaxClimb, float agentMaxSlope, int regionMinSize, int regionMergeSize, float edgeMaxLen,
|
||||||
float edgeMaxError, int vertsPerPoly, float detailSampleDist, float detailSampleMaxError,
|
float edgeMaxError, int vertsPerPoly, float detailSampleDist, float detailSampleMaxError,
|
||||||
RcAreaModification walkableAreaMod) : this(partitionType, cellSize, cellHeight, agentMaxSlope, true, true, true, agentHeight, agentRadius, agentMaxClimb,
|
RcAreaModification walkableAreaMod) : this(partitionType, cellSize, cellHeight, agentMaxSlope, true, true, true, agentHeight, agentRadius, agentMaxClimb,
|
||||||
|
@ -128,7 +128,7 @@ namespace DotRecast.Recast
|
||||||
/**
|
/**
|
||||||
* Non-tiled build configuration
|
* Non-tiled build configuration
|
||||||
*/
|
*/
|
||||||
public RcConfig(PartitionType partitionType, float cellSize, float cellHeight, float agentMaxSlope,
|
public RcConfig(RcPartition partitionType, float cellSize, float cellHeight, float agentMaxSlope,
|
||||||
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, float agentHeight,
|
bool filterLowHangingObstacles, bool filterLedgeSpans, bool filterWalkableLowHeightSpans, float agentHeight,
|
||||||
float agentRadius, float agentMaxClimb, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
float agentRadius, float agentMaxClimb, int regionMinSize, int regionMergeSize, float edgeMaxLen, float edgeMaxError,
|
||||||
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, RcAreaModification walkableAreaMod,
|
int vertsPerPoly, float detailSampleDist, float detailSampleMaxError, RcAreaModification walkableAreaMod,
|
||||||
|
@ -140,7 +140,7 @@ namespace DotRecast.Recast
|
||||||
// Note: area = size*size in [Units: wu]
|
// Note: area = size*size in [Units: wu]
|
||||||
}
|
}
|
||||||
|
|
||||||
public RcConfig(bool useTiles, int tileSizeX, int tileSizeZ, int borderSize, PartitionType partitionType,
|
public RcConfig(bool useTiles, int tileSizeX, int tileSizeZ, int borderSize, RcPartition partition,
|
||||||
float cellSize, float cellHeight, float agentMaxSlope, bool filterLowHangingObstacles, bool filterLedgeSpans,
|
float cellSize, float cellHeight, float agentMaxSlope, bool filterLowHangingObstacles, bool filterLedgeSpans,
|
||||||
bool filterWalkableLowHeightSpans, float agentHeight, float agentRadius, float agentMaxClimb, float minRegionArea,
|
bool filterWalkableLowHeightSpans, float agentHeight, float agentRadius, float agentMaxClimb, float minRegionArea,
|
||||||
float mergeRegionArea, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, bool buildMeshDetail,
|
float mergeRegionArea, float edgeMaxLen, float edgeMaxError, int vertsPerPoly, bool buildMeshDetail,
|
||||||
|
@ -150,7 +150,7 @@ namespace DotRecast.Recast
|
||||||
this.tileSizeX = tileSizeX;
|
this.tileSizeX = tileSizeX;
|
||||||
this.tileSizeZ = tileSizeZ;
|
this.tileSizeZ = tileSizeZ;
|
||||||
this.borderSize = borderSize;
|
this.borderSize = borderSize;
|
||||||
this.partitionType = partitionType;
|
this.partition = RcPartitionType.Of(partition).Value;
|
||||||
cs = cellSize;
|
cs = cellSize;
|
||||||
ch = cellHeight;
|
ch = cellHeight;
|
||||||
walkableSlopeAngle = agentMaxSlope;
|
walkableSlopeAngle = agentMaxSlope;
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace DotRecast.Recast
|
||||||
|
{
|
||||||
|
public enum RcPartition
|
||||||
|
{
|
||||||
|
WATERSHED = 0,
|
||||||
|
MONOTONE = 1,
|
||||||
|
LAYERS = 2,
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace DotRecast.Recast
|
||||||
|
{
|
||||||
|
public class RcPartitionType
|
||||||
|
{
|
||||||
|
public static readonly RcPartitionType WATERSHED = new RcPartitionType(RcPartition.WATERSHED);
|
||||||
|
public static readonly RcPartitionType MONOTONE = new RcPartitionType(RcPartition.MONOTONE);
|
||||||
|
public static readonly RcPartitionType LAYERS = new RcPartitionType(RcPartition.LAYERS);
|
||||||
|
|
||||||
|
public static readonly RcPartitionType[] Values = { WATERSHED, MONOTONE, LAYERS };
|
||||||
|
|
||||||
|
public readonly RcPartition EnumType;
|
||||||
|
public readonly int Value;
|
||||||
|
public readonly string Name;
|
||||||
|
|
||||||
|
private RcPartitionType(RcPartition et)
|
||||||
|
{
|
||||||
|
EnumType = et;
|
||||||
|
Value = (int)et;
|
||||||
|
Name = et.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RcPartition OfValue(int value)
|
||||||
|
{
|
||||||
|
return Values.FirstOrDefault(x => x.Value == value)?.EnumType ?? RcPartition.WATERSHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RcPartitionType Of(RcPartition partition)
|
||||||
|
{
|
||||||
|
return Values.FirstOrDefault(x => x.EnumType == partition) ?? WATERSHED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -210,7 +210,7 @@ namespace DotRecast.Recast
|
||||||
// * good choice to use for tiled navmesh with medium and small sized
|
// * good choice to use for tiled navmesh with medium and small sized
|
||||||
// tiles
|
// tiles
|
||||||
|
|
||||||
if (cfg.partitionType == PartitionType.WATERSHED)
|
if (cfg.partition == RcPartitionType.WATERSHED.Value)
|
||||||
{
|
{
|
||||||
// Prepare for region partitioning, by calculating distance field
|
// Prepare for region partitioning, by calculating distance field
|
||||||
// along the walkable surface.
|
// along the walkable surface.
|
||||||
|
@ -218,7 +218,7 @@ namespace DotRecast.Recast
|
||||||
// Partition the walkable surface into simple regions without holes.
|
// Partition the walkable surface into simple regions without holes.
|
||||||
RecastRegion.BuildRegions(ctx, chf, cfg.minRegionArea, cfg.mergeRegionArea);
|
RecastRegion.BuildRegions(ctx, chf, cfg.minRegionArea, cfg.mergeRegionArea);
|
||||||
}
|
}
|
||||||
else if (cfg.partitionType == PartitionType.MONOTONE)
|
else if (cfg.partition == RcPartitionType.MONOTONE.Value)
|
||||||
{
|
{
|
||||||
// Partition the walkable surface into simple regions without holes.
|
// Partition the walkable surface into simple regions without holes.
|
||||||
// Monotone partitioning does not need distancefield.
|
// Monotone partitioning does not need distancefield.
|
||||||
|
|
|
@ -40,13 +40,13 @@ public class RecastTestMeshBuilder
|
||||||
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() : this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
||||||
PartitionType.WATERSHED, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_agentMaxSlope,
|
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_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, m_detailSampleDist,
|
||||||
m_detailSampleMaxError)
|
m_detailSampleMaxError)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecastTestMeshBuilder(IInputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize,
|
public RecastTestMeshBuilder(IInputGeomProvider m_geom, RcPartition m_partitionType, float m_cellSize,
|
||||||
float m_cellHeight, float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope,
|
float m_cellHeight, float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope,
|
||||||
int m_regionMinSize, int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly,
|
int m_regionMinSize, int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly,
|
||||||
float m_detailSampleDist, float m_detailSampleMaxError)
|
float m_detailSampleDist, float m_detailSampleMaxError)
|
||||||
|
|
|
@ -75,7 +75,7 @@ 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), PartitionType.WATERSHED, m_cellSize, m_cellHeight,
|
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_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_regionMinArea,
|
||||||
m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true, m_detailSampleDist,
|
m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true, m_detailSampleDist,
|
||||||
m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
||||||
|
|
|
@ -41,13 +41,13 @@ public class RecastTestMeshBuilder
|
||||||
|
|
||||||
public RecastTestMeshBuilder() :
|
public RecastTestMeshBuilder() :
|
||||||
this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
||||||
PartitionType.WATERSHED, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_agentMaxSlope,
|
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_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, m_detailSampleDist,
|
||||||
m_detailSampleMaxError)
|
m_detailSampleMaxError)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecastTestMeshBuilder(IInputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize,
|
public RecastTestMeshBuilder(IInputGeomProvider m_geom, RcPartition m_partitionType, float m_cellSize,
|
||||||
float m_cellHeight, float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope,
|
float m_cellHeight, float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope,
|
||||||
int m_regionMinSize, int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly,
|
int m_regionMinSize, int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly,
|
||||||
float m_detailSampleDist, float m_detailSampleMaxError)
|
float m_detailSampleDist, float m_detailSampleMaxError)
|
||||||
|
|
|
@ -46,13 +46,13 @@ public class TestTiledNavMeshBuilder
|
||||||
|
|
||||||
public TestTiledNavMeshBuilder() :
|
public TestTiledNavMeshBuilder() :
|
||||||
this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
this(ObjImporter.Load(Loader.ToBytes("dungeon.obj")),
|
||||||
PartitionType.WATERSHED, m_cellSize, m_cellHeight, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_agentMaxSlope,
|
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_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, m_detailSampleDist,
|
||||||
m_detailSampleMaxError, m_tileSize)
|
m_detailSampleMaxError, m_tileSize)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestTiledNavMeshBuilder(IInputGeomProvider m_geom, PartitionType m_partitionType, float m_cellSize, float m_cellHeight,
|
public TestTiledNavMeshBuilder(IInputGeomProvider m_geom, RcPartition m_partitionType, float m_cellSize, float m_cellHeight,
|
||||||
float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope, int m_regionMinSize,
|
float m_agentHeight, float m_agentRadius, float m_agentMaxClimb, float m_agentMaxSlope, int m_regionMinSize,
|
||||||
int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly, float m_detailSampleDist,
|
int m_regionMergeSize, float m_edgeMaxLen, float m_edgeMaxError, int m_vertsPerPoly, float m_detailSampleDist,
|
||||||
float m_detailSampleMaxError, int m_tileSize)
|
float m_detailSampleMaxError, int m_tileSize)
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class TestTileLayerBuilder : AbstractTileLayersBuilder
|
||||||
{
|
{
|
||||||
this.geom = geom;
|
this.geom = geom;
|
||||||
rcConfig = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
rcConfig = new RcConfig(true, m_tileSize, m_tileSize, RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
||||||
PartitionType.WATERSHED, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight,
|
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,
|
m_agentRadius, m_agentMaxClimb, m_regionMinArea, m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly,
|
||||||
true, m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
true, m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
||||||
RcVec3f bmin = geom.GetMeshBoundsMin();
|
RcVec3f bmin = geom.GetMeshBoundsMin();
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class RecastLayersTest
|
||||||
private const int m_vertsPerPoly = 6;
|
private const int m_vertsPerPoly = 6;
|
||||||
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;
|
||||||
private readonly PartitionType m_partitionType = PartitionType.WATERSHED;
|
private readonly int m_partitionType = RcPartitionType.WATERSHED.Value;
|
||||||
private const int m_tileSize = 48;
|
private const int m_tileSize = 48;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -148,7 +148,7 @@ 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, RcConfig.CalcBorder(m_agentRadius, m_cellSize),
|
||||||
m_partitionType, m_cellSize, m_cellHeight, m_agentMaxSlope, true, true, true, m_agentHeight, m_agentRadius,
|
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_agentMaxClimb, m_regionMinArea, m_regionMergeArea, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, true,
|
||||||
m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
m_detailSampleDist, m_detailSampleMaxError, SampleAreaModifications.SAMPLE_AREAMOD_GROUND);
|
||||||
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), x, y);
|
RecastBuilderConfig bcfg = new RecastBuilderConfig(cfg, geom.GetMeshBoundsMin(), geom.GetMeshBoundsMax(), x, y);
|
||||||
|
|
|
@ -43,56 +43,56 @@ public class RecastSoloMeshTest
|
||||||
private const int m_vertsPerPoly = 6;
|
private const int m_vertsPerPoly = 6;
|
||||||
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;
|
||||||
private PartitionType m_partitionType = PartitionType.WATERSHED;
|
private RcPartition m_partitionType = RcPartition.WATERSHED;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPerformance()
|
public void TestPerformance()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
TestBuild("dungeon.obj", PartitionType.WATERSHED, 52, 16, 15, 223, 118, 118, 513, 291);
|
TestBuild("dungeon.obj", RcPartition.WATERSHED, 52, 16, 15, 223, 118, 118, 513, 291);
|
||||||
TestBuild("dungeon.obj", PartitionType.MONOTONE, 0, 17, 16, 210, 100, 100, 453, 264);
|
TestBuild("dungeon.obj", RcPartition.MONOTONE, 0, 17, 16, 210, 100, 100, 453, 264);
|
||||||
TestBuild("dungeon.obj", PartitionType.LAYERS, 0, 5, 5, 203, 97, 97, 446, 266);
|
TestBuild("dungeon.obj", RcPartition.LAYERS, 0, 5, 5, 203, 97, 97, 446, 266);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDungeonWatershed()
|
public void TestDungeonWatershed()
|
||||||
{
|
{
|
||||||
TestBuild("dungeon.obj", PartitionType.WATERSHED, 52, 16, 15, 223, 118, 118, 513, 291);
|
TestBuild("dungeon.obj", RcPartition.WATERSHED, 52, 16, 15, 223, 118, 118, 513, 291);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDungeonMonotone()
|
public void TestDungeonMonotone()
|
||||||
{
|
{
|
||||||
TestBuild("dungeon.obj", PartitionType.MONOTONE, 0, 17, 16, 210, 100, 100, 453, 264);
|
TestBuild("dungeon.obj", RcPartition.MONOTONE, 0, 17, 16, 210, 100, 100, 453, 264);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDungeonLayers()
|
public void TestDungeonLayers()
|
||||||
{
|
{
|
||||||
TestBuild("dungeon.obj", PartitionType.LAYERS, 0, 5, 5, 203, 97, 97, 446, 266);
|
TestBuild("dungeon.obj", RcPartition.LAYERS, 0, 5, 5, 203, 97, 97, 446, 266);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestWatershed()
|
public void TestWatershed()
|
||||||
{
|
{
|
||||||
TestBuild("nav_test.obj", PartitionType.WATERSHED, 60, 48, 47, 349, 155, 155, 812, 561);
|
TestBuild("nav_test.obj", RcPartition.WATERSHED, 60, 48, 47, 349, 155, 155, 812, 561);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestMonotone()
|
public void TestMonotone()
|
||||||
{
|
{
|
||||||
TestBuild("nav_test.obj", PartitionType.MONOTONE, 0, 50, 49, 341, 186, 186, 878, 567);
|
TestBuild("nav_test.obj", RcPartition.MONOTONE, 0, 50, 49, 341, 186, 186, 878, 567);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestLayers()
|
public void TestLayers()
|
||||||
{
|
{
|
||||||
TestBuild("nav_test.obj", PartitionType.LAYERS, 0, 19, 32, 310, 150, 150, 773, 526);
|
TestBuild("nav_test.obj", RcPartition.LAYERS, 0, 19, 32, 310, 150, 150, 773, 526);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TestBuild(string filename, PartitionType partitionType, int expDistance, int expRegions,
|
public void TestBuild(string filename, RcPartition partitionType, int expDistance, int expRegions,
|
||||||
int expContours, int expVerts, int expPolys, int expDetMeshes, int expDetVerts, int expDetTris)
|
int expContours, int expVerts, int expPolys, int expDetMeshes, int expDetVerts, int expDetTris)
|
||||||
{
|
{
|
||||||
m_partitionType = partitionType;
|
m_partitionType = partitionType;
|
||||||
|
@ -206,7 +206,7 @@ public class RecastSoloMeshTest
|
||||||
// tiles
|
// tiles
|
||||||
long time3 = RcFrequency.Ticks;
|
long time3 = RcFrequency.Ticks;
|
||||||
|
|
||||||
if (m_partitionType == PartitionType.WATERSHED)
|
if (m_partitionType == RcPartition.WATERSHED)
|
||||||
{
|
{
|
||||||
// Prepare for region partitioning, by calculating distance field
|
// Prepare for region partitioning, by calculating distance field
|
||||||
// along the walkable surface.
|
// along the walkable surface.
|
||||||
|
@ -214,7 +214,7 @@ public class RecastSoloMeshTest
|
||||||
// Partition the walkable surface into simple regions without holes.
|
// Partition the walkable surface into simple regions without holes.
|
||||||
RecastRegion.BuildRegions(m_ctx, m_chf, cfg.minRegionArea, cfg.mergeRegionArea);
|
RecastRegion.BuildRegions(m_ctx, m_chf, cfg.minRegionArea, cfg.mergeRegionArea);
|
||||||
}
|
}
|
||||||
else if (m_partitionType == PartitionType.MONOTONE)
|
else if (m_partitionType == RcPartition.MONOTONE)
|
||||||
{
|
{
|
||||||
// Partition the walkable surface into simple regions without holes.
|
// Partition the walkable surface into simple regions without holes.
|
||||||
// Monotone partitioning does not need distancefield.
|
// Monotone partitioning does not need distancefield.
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class RecastTileMeshTest
|
||||||
private const int m_vertsPerPoly = 6;
|
private const int m_vertsPerPoly = 6;
|
||||||
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;
|
||||||
private PartitionType m_partitionType = PartitionType.WATERSHED;
|
private RcPartition m_partitionType = RcPartition.WATERSHED;
|
||||||
private const int m_tileSize = 32;
|
private const int m_tileSize = 32;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Reference in New Issue