forked from mirror/DotRecast
update comments
This commit is contained in:
parent
a4ba159393
commit
9de4b1ee40
|
@ -175,49 +175,37 @@ namespace DotRecast.Recast
|
||||||
FilterHeightfield(solid, cfg, ctx);
|
FilterHeightfield(solid, cfg, ctx);
|
||||||
RcCompactHeightfield chf = BuildCompactHeightfield(geom, cfg, ctx, solid);
|
RcCompactHeightfield chf = BuildCompactHeightfield(geom, cfg, ctx, solid);
|
||||||
|
|
||||||
// Partition the heightfield so that we can use simple algorithm later
|
// Partition the heightfield so that we can use simple algorithm later to triangulate the walkable areas.
|
||||||
// to triangulate the walkable areas.
|
|
||||||
// There are 3 partitioning methods, each with some pros and cons:
|
// There are 3 partitioning methods, each with some pros and cons:
|
||||||
// 1) Watershed partitioning
|
// 1) Watershed partitioning
|
||||||
// - the classic Recast partitioning
|
// - the classic Recast partitioning
|
||||||
// - creates the nicest tessellation
|
// - creates the nicest tessellation
|
||||||
// - usually slowest
|
// - usually slowest
|
||||||
// - partitions the heightfield into nice regions without holes or
|
// - partitions the heightfield into nice regions without holes or overlaps
|
||||||
// overlaps
|
// - the are some corner cases where this method creates produces holes and overlaps
|
||||||
// - the are some corner cases where this method creates produces holes
|
// - holes may appear when a small obstacles is close to large open area (triangulation can handle this)
|
||||||
// and overlaps
|
// - overlaps may occur if you have narrow spiral corridors (i.e stairs), this make triangulation to fail
|
||||||
// - holes may appear when a small obstacles is close to large open area
|
// * generally the best choice if you precompute the navmesh, use this if you have large open areas
|
||||||
// (triangulation can handle this)
|
// 2) Monotone partitioning
|
||||||
// - overlaps may occur if you have narrow spiral corridors (i.e
|
// - fastest
|
||||||
// stairs), this make triangulation to fail
|
// - partitions the heightfield into regions without holes and overlaps (guaranteed)
|
||||||
// * generally the best choice if you precompute the navmesh, use this
|
// - creates long thin polygons, which sometimes causes paths with detours
|
||||||
// if you have large open areas
|
// * use this if you want fast navmesh generation
|
||||||
// 2) Monotone partioning
|
|
||||||
// - fastest
|
|
||||||
// - partitions the heightfield into regions without holes and overlaps
|
|
||||||
// (guaranteed)
|
|
||||||
// - creates long thin polygons, which sometimes causes paths with
|
|
||||||
// detours
|
|
||||||
// * use this if you want fast navmesh generation
|
|
||||||
// 3) Layer partitoining
|
// 3) Layer partitoining
|
||||||
// - quite fast
|
// - quite fast
|
||||||
// - partitions the heighfield into non-overlapping regions
|
// - partitions the heighfield into non-overlapping regions
|
||||||
// - relies on the triangulation code to cope with holes (thus slower
|
// - relies on the triangulation code to cope with holes (thus slower than monotone partitioning)
|
||||||
// than monotone partitioning)
|
// - produces better triangles than monotone partitioning
|
||||||
// - produces better triangles than monotone partitioning
|
// - does not have the corner cases of watershed partitioning
|
||||||
// - does not have the corner cases of watershed partitioning
|
// - can be slow and create a bit ugly tessellation (still better than monotone)
|
||||||
// - can be slow and create a bit ugly tessellation (still better than
|
// if you have large open areas with small obstacles (not a problem if you use tiles)
|
||||||
// monotone)
|
// * good choice to use for tiled navmesh with medium and small sized tiles
|
||||||
// if you have large open areas with small obstacles (not a problem if
|
|
||||||
// you use tiles)
|
|
||||||
// * good choice to use for tiled navmesh with medium and small sized
|
|
||||||
// tiles
|
|
||||||
|
|
||||||
if (cfg.Partition == RcPartitionType.WATERSHED.Value)
|
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.
|
|
||||||
RcRegions.BuildDistanceField(ctx, chf);
|
RcRegions.BuildDistanceField(ctx, chf);
|
||||||
|
|
||||||
// Partition the walkable surface into simple regions without holes.
|
// Partition the walkable surface into simple regions without holes.
|
||||||
RcRegions.BuildRegions(ctx, chf, cfg.MinRegionArea, cfg.MergeRegionArea);
|
RcRegions.BuildRegions(ctx, chf, cfg.MinRegionArea, cfg.MergeRegionArea);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue