fix(street-level): coverage keeps its filter, selection and ground

From the IC8 review of #768 (P2s), each with a test that fails before:

- Far-side overview dots no longer show through the globe. They skip the
  depth test so they stay above Google 3D terrain, so points behind the
  horizon are now hidden with an EllipsoidalOccluder (as the cyclones layer
  does), re-culled only when the camera moves.
- The per-tile cap applies after the imagery filter: a dense tile of newer
  flat captures kept no 360° lines at all. Lookup, picking and counts use
  the drawn set.
- Lines whose ground heights were evicted, or whose terrain lookup failed,
  are cast again on the next refresh instead of staying draped for good
  (castRequested no longer latches; castAbort marks a cast in flight). The
  height cache now drops its oldest corners instead of all of them.
- A selection made or cleared while a tile's lines rebuild is applied once
  they are ready (each primitive remembers the selection it was built with).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Said TurkseverandClaude Opus 5.5 committed 2026-10-05 15:55:18 +01:00
1 parent f75cdf3626
commit b1924ebb3e
4 files changed
+464 -60

No files matched your search

+8 -4
View File
@@ -22,7 +22,7 @@ export const GROUND_CAST_DENSIFY_DEG = 0.0005;
export const GROUND_CAST_LIFT_M = 2;
/** Grid corners one prepare call may request; more stays draped. */
export const GROUND_CAST_MAX_CORNERS = 1024;
/** Cached grid corners before the cache is dropped and refilled. */
/** Cached grid corners before the oldest are dropped to make room. */
const GROUND_CAST_CACHE_MAX = 50_000;
/**
@@ -170,9 +170,13 @@ export function createGroundCaster({
async function resolve(points, signal) {
if (signal?.aborted) return false;
// Make room first: clearing after counting would drop corners this
// request already treated as cached.
if (heights.size + maxCorners > cacheMax) heights.clear();
// Make room first: evicting after counting would drop corners this
// request already treated as cached. Oldest first (a Map keeps insertion
// order), so the tiles cast last, likely still on screen, keep theirs.
for (const key of heights.keys()) {
if (heights.size + maxCorners <= cacheMax) break;
heights.delete(key);
}
const missing = missingCorners(points);
if (!missing.length) return true;
if (missing.length > maxCorners) return false;