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

@ -16,6 +16,7 @@ export property NavConfig {
radius: float = 0.35
climb: float = 0.55
slope: float = 45.0
detail: float = 1.5 # the detail mesh's samples, metres apart (at least 0.9: 0 took one small test to 3.5 GB)
}
# what a mesh is built from: v holds nv points (x, y, z) and t nt triangles (three indices each);
@ -38,6 +39,8 @@ export state NavState {
nv_out: []float = floats(NAV_CORNERS * 3)
nv_count: int = 0
nv_near: []float = floats(3)
nv_cfg: []float = floats(7) # the configuration handed to the shim, filled in place per build
nv_empty: []float = floats(1) # what the shim is handed for no cylinders or no footprints
}
function nv_none() -> []pointer {
let m = new []pointer
@ -55,6 +58,9 @@ function nv_set(nav_st: mut NavState, kind: int, h: pointer) -> bool {
return h != null
}
# one kind's mesh let go (a bake writes each kind and drops it before the next)
export function nav_drop(nav_st: mut NavState, kind: int) -> void { nv_set(nav_st, kind, null) }
# every mesh let go: a new map, or the world closed
export function nav_reset(nav_st: mut NavState) -> void {
for k in 0 .. NAV_KINDS { nv_set(nav_st, k, null) }