fix(nav): nothing allocated per build - the configuration and the empty lists live in NavState, because Ludic never gives an allocation back and a map is thousands of tile builds; nav_drop lets one kind's mesh go; the detail mesh's spacing is a NavConfig setting held to Recast's own floor of 0.9 m (0 took a 40 m test meadow to 3.5 GB)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 21:23:56 +03:00
parent e6893f58be
commit 950d3134f2
4 changed files with 22 additions and 11 deletions

View file

@ -1,6 +1,7 @@
// nav_build.inl - Recast's pipeline, shared by a whole mesh and a tile: rasterize the triangles,
// filter, mark what nothing stands in, erode, regions, contours, polygons, detail, Detour's data.
// c[] is the configuration: cell size, cell height, agent height, radius, max climb, max slope.
// c[] is the configuration: cell size, cell height, agent height, radius, max climb, max slope, and
// the detail mesh's sample spacing (at least 0.9 m, Recast's own limit; 0 grew without bound)
// cylinders (x, y, z, r, h each) no agent may stand in: trunks, posts, tents
static void nav_mark_cylinders(rcContext &ctx, rcCompactHeightfield &chf, const float *cyl, int nc) {
@ -37,7 +38,7 @@ static void nav_config(rcConfig &cfg, const float *c) {
cfg.minRegionArea = 8 * 8;
cfg.mergeRegionArea = 20 * 20;
cfg.maxVertsPerPoly = 6;
cfg.detailSampleDist = cfg.cs * 6.0f;
cfg.detailSampleDist = c[6] > 0.9f ? c[6] : 0.9f;
cfg.detailSampleMaxError = cfg.ch;
}