mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-10 21:32:23 +00:00
Stop Navara's memory growth on engine switches, hide polygon zones reliably, and drop the Cesium camera rig
- Navara 0.2.1 never frees pick batch ids, and the mover banks rebuilt their instanced meshes on each attach, leaking about 260 KiB of WebAssembly memory per switch. A per-view pool hands released ids back out; the long soak now asserts native growth of at most 32 KiB per switch. - Navara 0.2.1 sometimes drops the first show:false update on a new vector layer, so a zone turned off right after a switch back stayed drawn. Polygon displays hide by deleting their layers and rebuild them when shown. - Camera verbs drive both engines through the globe contract; the Cesium viewer rig and the tests of states it can no longer reach are gone. - Flights and military tracking share src/layers/aircraft/tracking.js. - The geo import scenario reads movers only where the engine has them. - Add the Navara section to docs/CURRENT-STATE.md and a changelog fragment.
This commit is contained in:
1 parent
7abf74518f
commit
a6c64713ee
46 files changed
+2367
-2894
No files matched your search
+64
-1
@@ -98,6 +98,69 @@ across the antimeridian, so they cannot use the strict ±180 check as-is, and
|
||||
`src/sources/adsbRecords.js` and `server/providers/common/geo.js` keep their own
|
||||
implementations.
|
||||
|
||||
## Navara globe engine — November 5, 2026
|
||||
|
||||
Navara, an experimental three.js/WASM globe (`@navaramap/three` 0.2.1), runs
|
||||
next to Cesium. It is picked under Display → Globe Engine or with
|
||||
`?engine=navara`; Cesium stays the default. Switching is live: the page keeps
|
||||
one application, and only the globe-bound parts move to the next engine.
|
||||
|
||||
- **The engine contract** is `src/globe/contract.js`. `src/globe/cesium/*` and
|
||||
`src/globe/navara/*` implement it, `src/globe/testing/fakeEngine.js` stands
|
||||
in for tests, and `src/globe/testing/contractSuite.mjs` runs the same checks
|
||||
on every engine. `movers` and `lines` are optional capabilities: only
|
||||
Navara has them, and the suite skips their checks elsewhere.
|
||||
- **The session owns the state.** Catalog, layer models, sources, selection,
|
||||
camera mode and URL state outlive a switch. A layer that is a session model
|
||||
gets `attachRenderer(engine)` / `detachRenderer()` instead of being rebuilt,
|
||||
so its data is not fetched again. The outgoing globe is parked
|
||||
(`src/standalone/rendererCache.js`), so switching back is warm.
|
||||
- **Renderers per engine.** Each layer keeps its model and display policy in
|
||||
engine-neutral files and draws through `render/cesium*.js` or
|
||||
`render/navara*.js`. Cesium renderers are listed in
|
||||
`src/app/layers/renderers.js` (`CESIUM_LAYER_RENDERERS`), Navara ones are
|
||||
loaded by `registerNavaraLayerRenderers` in `src/app/navaraMode.js`. Navara
|
||||
ground effects (heat, pulses, trails, pads, drapes) are declared with
|
||||
`defineGroundEffect` (`src/layers/shared/render/navaraGroundEffect.js`);
|
||||
their insert order is pinned by `navaraGroundOrder.test.mjs`.
|
||||
- **Cesium only on demand.** The production build loads `/cesium/Cesium.js`
|
||||
when a Cesium globe starts or a Navara user turns on a feature that still
|
||||
uses Cesium's maths or entity model (traffic, Street Level, the Bhote Koshi
|
||||
event and locator, geo import; `src/app/loadCesium.js`). App code does its maths with `src/geo`, a Cesium-free
|
||||
port of the vector, ellipsoid, transform and time functions that
|
||||
`bitExact.test.mjs` compares with Cesium bit for bit.
|
||||
**Invariant: no module reads Cesium while it loads**
|
||||
(`scripts/check-cesium-load-time.mjs`, run by `npm test`).
|
||||
- **Boundaries.** Cesium is imported only from `render/cesium*.js` and
|
||||
`src/globe/cesium/*`; three, postprocessing and Navara only from `navara*`
|
||||
modules, which load through `import()`. `build/initialChunkGuard.js` fails
|
||||
the build when one of them reaches an initial chunk, and
|
||||
`npm run check:main-chunk` holds the main chunk to its gzip budget
|
||||
(`scripts/main-chunk-baseline.json`). Only `src/globe/navara/internals.js`
|
||||
touches Navara's private members.
|
||||
- **Navara 0.2.1 workaround.** The SDK keeps feature-change events of deleted
|
||||
vector layers in its queue, so the view never reaches idle. They are dropped
|
||||
each frame (`src/globe/navara/featureQueue.js`).
|
||||
- **Strict acceptance.** `node scripts/qa-all-layer-switches.mjs <origin> <out>
|
||||
--serve` builds the commit keyless in a clean worktree and runs every layer
|
||||
and switch scenario under a deny-by-default network policy, with free map
|
||||
tiles from a disk cache and a trap that fails any read of Cesium before it
|
||||
has loaded. Every catalog layer must be asserted on both engines. Point
|
||||
`PUPPETEER_EXECUTABLE_PATH` at an installed Chrome if Puppeteer's pinned
|
||||
build is missing. With an OSM base map Navara lights the globe by the real
|
||||
sun, so scenarios over Austin or San Francisco see a dark frame at local
|
||||
night and fail their pixel checks; run them in local daylight.
|
||||
- **Navara 0.2.1 workaround.** The SDK never frees pick batch ids, and the
|
||||
mover banks rebuild their instanced meshes on each attach, so every switch
|
||||
leaked one id per instance of capacity (about 260 KiB of WebAssembly memory).
|
||||
A per-view pool hands released ids back out
|
||||
(`src/globe/navara/movers/batchIds.js`); the long soak asserts both JS
|
||||
objects and native memory stay flat.
|
||||
- **Navara 0.2.1 workaround.** The first `layer.update({ show: false })` after
|
||||
a vector layer is added is sometimes dropped, so a zone turned off right
|
||||
after a switch stayed drawn. Polygon displays hide by deleting their layers
|
||||
and rebuild them when shown (`src/layers/shared/render/navaraPolygons.js`).
|
||||
|
||||
## Prohibited & Restricted Airspace — FAA special-use airspace
|
||||
|
||||
The Infrastructure group includes **Prohibited & Restricted Airspace** (`drone-airspace`,
|
||||
@@ -5585,7 +5648,7 @@ and unreachable upstream (502/504) separately from road geometry.
|
||||
> branch: **2,281 on Node 25.6.1** (allocation suites skipped) = 2,255 on
|
||||
> `main` + 26 route pins; the same tree on Node 24 reports 2,295.
|
||||
|
||||
- **Camera verbs** (`src/cameraVerbs.js`) — one motion slot, driven per clock tick. `move_camera` orbits/pans/tilts/rotates; `fly_route` is a cinematic dolly along an existing route annotation. `rotate_globe` rotates the world-space camera rigidly around Earth's center using its screen-up axis, preserving geocentric range and framing. Left/right describe visible globe motion, while `rotate` turns the camera in place. Omitted globe direction/mode default to right/continuous; explicit values prevail. Other camera motions keep their once default. Admission requires 3D, no Cockpit/tracking owner and the whole globe inside the existing keyhole circle, using the shared keyhole/projection geometry and vertical camera FOV with a rotation-local bounding-sphere cone for off-axis containment. Canvas-edge clipping alone does not block a rigid rotation or its unchanged Globe View preset. There is no altitude cutoff. An already smaller, fully framed globe rotates directly; repeated nudges, direction and speed changes recheck current framing without demanding a reset merely because ellipsoid altitude varied. A close-up or overlap refuses without moving the camera. When the unchanged Globe View preset fits, voice says “Globe rotation isn’t available from this view. You can say ‘Reset to Globe View and rotate the globe.’” without asking a permission question or automatically resetting. Explicit Reset/Show Globe View commands remain direct; an explicit reset-and-rotate request waits for reset success before requesting rotation. If OpenAI dispatches both tools together, rotation waits for earlier same-response resets and is skipped if any fails or is cancelled. OpenAI rejects later tool calls in the same response after a globe refusal, including calls arriving while globe admission is pending, and preserves response-scoped `tool_choice: none` for the refusal follow-up; Gemini rejects further tool execution, including queued sibling calls, until fresh typed input or admitted speech. Model interruption, advisory captions and microphone toggles do not release that guard. There is no pending Yes/No offer. Outside the refused response, explicit-command interpretation and avoiding repeated resets remain model-guided; a distinct model-issued reset call is not an app-enforced proof of user intent. A failed standalone reset can still be retried by the model, and a reset result does not guarantee the camera has fully settled. Before suggesting a reset, a cloned camera checks the unchanged Globe View destination against the same keyhole/depth rules without moving the live camera. If that preset cannot fit, `globe-reset-unavailable` asks for further zoom and the refusal instructs further zoom instead of a reset; this also covers ultrawide views. Unsupported view geometry or non-WGS84 projection assumptions fail closed without the closer-zoom instruction. Supported camera inputs/navigation intents cancel rotation before their action. Finite radius greater than the ellipsoid's maximum radius proves whole-arc clearance at constant centre-distance; no low-altitude swept solver is needed. The unchanged Globe View reset preset remains 18,000,000 m. Terrain and buildings remain outside the guarantee.
|
||||
- **Camera verbs** (`src/cameraVerbs.js`) — one motion slot, driven per frame of the globe engine (Cesium or Navara) through the globe contract. `move_camera` orbits/pans/tilts/rotates; `fly_route` is a cinematic dolly along an existing route annotation. `rotate_globe` rotates the world-space camera rigidly around Earth's center using its screen-up axis, preserving geocentric range and framing. Left/right describe visible globe motion, while `rotate` turns the camera in place. Omitted globe direction/mode default to right/continuous; explicit values prevail. Other camera motions keep their once default. Admission requires 3D, no Cockpit/tracking owner and the whole globe inside the existing keyhole circle, using the shared keyhole/projection geometry and vertical camera FOV with a rotation-local bounding-sphere cone for off-axis containment. Canvas-edge clipping alone does not block a rigid rotation or its unchanged Globe View preset. There is no altitude cutoff. An already smaller, fully framed globe rotates directly; repeated nudges, direction and speed changes recheck current framing without demanding a reset merely because ellipsoid altitude varied. A close-up or overlap refuses without moving the camera. When the unchanged Globe View preset fits, voice says “Globe rotation isn’t available from this view. You can say ‘Reset to Globe View and rotate the globe.’” without asking a permission question or automatically resetting. Explicit Reset/Show Globe View commands remain direct; an explicit reset-and-rotate request waits for reset success before requesting rotation. If OpenAI dispatches both tools together, rotation waits for earlier same-response resets and is skipped if any fails or is cancelled. OpenAI rejects later tool calls in the same response after a globe refusal, including calls arriving while globe admission is pending, and preserves response-scoped `tool_choice: none` for the refusal follow-up; Gemini rejects further tool execution, including queued sibling calls, until fresh typed input or admitted speech. Model interruption, advisory captions and microphone toggles do not release that guard. There is no pending Yes/No offer. Outside the refused response, explicit-command interpretation and avoiding repeated resets remain model-guided; a distinct model-issued reset call is not an app-enforced proof of user intent. A failed standalone reset can still be retried by the model, and a reset result does not guarantee the camera has fully settled. Before suggesting a reset, the unchanged Globe View destination is checked against the same keyhole/depth rules without moving the live camera. If that preset cannot fit, `globe-reset-unavailable` asks for further zoom and the refusal instructs further zoom instead of a reset; this also covers ultrawide views. Unsupported view geometry fails closed without the closer-zoom instruction. Supported camera inputs/navigation intents cancel rotation before their action. Finite radius greater than the ellipsoid's maximum radius proves whole-arc clearance at constant centre-distance; no low-altitude swept solver is needed. The unchanged Globe View reset preset remains 18,000,000 m. Terrain and buildings remain outside the guarantee.
|
||||
- **The route dolly is shaped, not linear** (2026-08-20). A trapezoid speed profile (smoothstep up, cruise, smoothstep down, distance taken as the closed-form integral) eases both ends without changing the pace — duration is still `totalM / ROUTE_M_S[speed]`, with one exception: a 0.5 s minimum keeps a degenerate route from being an instant teleport, so routes under 10 m (slow) / 20 m (normal) / 45 m (fast) fly SLOWER than the speed word, never faster. Turns bank up to **10°** (a 90° street corner settles near 7.5°), measured as a triangular pulse over a 4 s window centred on the camera so the roll leads in and unwinds after. Altitude breathes ±20 m around the 260 m mean and lifts up to 26 m into turns. Pitch is LOCKED at −32°; heading comes from a gaze that leads the path by 6.5 s of travel. `prefers-reduced-motion` zeroes the roll and the altitude shaping and keeps the easing.
|
||||
- **Invariants — do not "fix" these.** (1) **Every** release levels the roll: completion unwinds it through the ease-out envelope, and `interruptCameraMotion` zeroes it synchronously (heading/pitch/position preserved). Cesium keeps the last up vector it was handed, so skipping this leaves the user holding a tilted horizon. (2) Heading is interpolated as an ANGLE about the local up, never as a Cartesian lerp — a lerp cannot cross an antipodal pair, so an out-and-back route looked backwards for the entire return leg; `signedTurnRad` branches the exact-180° case deterministically because the cross product's sign there is a floating-point coin toss. (3) A COLD floor cell is missing data, not flat ground: route vertices carry height 0, so trusting them flew a mountain corridor at 260 m above the ELLIPSOID. The corridor warm is fire-and-forget, so the dolly ARMS — camera untouched, no teleport onto the route — for up to 1.2 s waiting for real floor data, falls back to a rendered-mesh probe (`scene.sampleHeight`) when the DEM stays cold — latched to ONE firing per flight, for exactly the cells the cache could not answer, so a route costs at most 8 `sampleHeight` calls however long it arms — and otherwise holds the launch altitude for the whole route. A corridor is only RESOLVED when every cell is accounted for: one warm cell says nothing about the ground under the other seven, and treating it as an answer let the dolly descend to 460 m over a 1,600 m rendered surface. The probe reads the rendered surface at the current LOD (rooftops and primitives included) — a better estimate than nothing, not a guaranteed upper bound. Never descend blind. The floor is SMOOTHED in both directions for the ride while the hard clearance clamp reads the RAW sample, so a cell boundary cannot pop the eye but a cliff is still cleared on the frame it is seen. A pre-departure floor is adopted whole; one arriving mid-flight is eased onto, and the eye's descent rate is capped.
|
||||
- Pins: `src/routeCinematics.test.mjs` (26 tests), with `scripts/qa-flyroute-mutations.mjs` reverting each fix individually to prove they are load-bearing (19 named defects); rendered proof `scripts/qa-flyroute-cinema.mjs` (drives the real voice runner, measures the real Cesium camera every frame, writes a labelled contact sheet).
|
||||
|
||||
Reference in new issue
Block a user