perf(scene): reuse model-tile tessellation across pure pans

Phase 3.1 (partial — pan). The Model-tile wire cache keyed on the exact
camera hash, so every pan re-tessellated the whole tile even though pan
changes neither the curve tol nor the culled set (beyond a shift). Re-key
on (geometry_epoch, pan_invariant_hash, tessellated_region):

- pan_invariant_hash covers rotation + wpp (tol) but excludes the pan
  target, so a pure pan keeps it stable;
- the wires were culled to a 1.25x-margin region, recorded with the entry;
- a hit now also requires the tile's current visible rect to still fit
  inside that region, guaranteeing every on-screen wire is present.

Result: panning within the existing margin reuses the tessellation (tess
ms -> ~0 on the PERF HUD) with no missing geometry. Zoom, orbit and edits
change the signature/epoch and rebuild as before; the cull margin is
unchanged so miss cost — and zoom behaviour — is identical. GPU still
re-uploads per camera_generation (diff upload is Phase 3.2).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-05 09:06:12 +03:00
commit d74cb891f9
2 changed files with 73 additions and 31 deletions

View file

@ -165,7 +165,18 @@ geometry is camera-invariant.
changed),
- `frame_visible[handle] → bool` (recomputed per `camera_generation`).
**Partial (landed):** `set_hover_highlight` no longer bumps the geometry
**Partial (landed): pan reuse.** The Model-tile wire cache no longer keys on
the exact camera hash. It now keys on `(geometry_epoch, pan_invariant_hash,
tessellated_region)` where `pan_invariant_hash` covers rotation + tol (`wpp`)
but NOT the pan target. A pure pan keeps the epoch + signature and only shifts
the view, so as long as the new visible rect still fits inside the
1.25×-margin region the wires were culled to, the tessellation is reused
outright — no re-tessellation, `tess ms` drops to ~0 on the PERF HUD. Zoom
(changes `wpp`), orbit (changes rotation) and edits (change epoch) rebuild
exactly as before; the cull margin is unchanged, so miss cost is identical
(no zoom regression).
**Partial (landed): hover.** `set_hover_highlight` no longer bumps the geometry
epoch (a full re-tessellation) when the hovered entity is already selected —
the effective highlight set `selected ∪ {hover}` is then unchanged, so the
tessellation output is identical. Hovering over / between selected entities