Draw the aircraft family, Wildlife Sightings and the Cockpit through the contract

The layers that still had one Cesium and one Navara implementation, or
drew on Cesium only, now draw through engine.movers, engine.lines and
engine.camera on both engines, and application code holds the engine
instead of guessing it from a viewer.

- Aircraft family: flights, military and local ADS-B share one display
  (src/layers/aircraft/render/display.js). The Cesium and Navara
  renderers are gone. Where they differed, the display follows Cesium:
  - attach and visibility tracking, live disableDepthTestDistance
    changes, the tracked glyph's distance scale, model ids that change,
    local ADS-B markers hidden until shown and its UAT ring as a point;
  - the trail head's hidden alpha is 0.45, the contract's
    depthFailAlpha scaled by the head's 0.9.
  The tracked glyph stays over the fleet, as on Navara. The movers
  contract reports readiness per model and reads model axes as the
  glTF's own on every engine. Cesium's follow takes any native target
  through a proxy entity in the ENU frame and mirrors its readout fields.
- Wildlife Sightings draws badges and the density glow as sprite sets
  and its privacy cells as line outlines (no fill yet). It takes clicks
  from engine.input and its card anchors to the engine's canvas and
  camera, so the layer is in both engines' catalogs again and a switch
  keeps the session's layer set.
- Cockpit: cockpitHost takes the engine only. The ridden aircraft is the
  engine follow's target, hidden through its sprite; only the Cesium
  Viewer's stock double-click is still routed around.
- About forty camera, navigation, share-link, HUD, voice, detection and
  layer-lifecycle callers take the engine. isGlobeEngine and
  engineFromViewer calls outside src/globe fall from 51 to 14.

The coupling baseline drops accordingly: layer renderer lines from
5239/12331 to 4546/11106 (Cesium/Navara), `viewer` lines from 2424 to
2209, Cesium-importing files from 69 to 66.
This commit is contained in:
German Khokhlov committed 2026-11-07 02:34:34 +04:00
1 parent 48988015f1
commit 35e70ec280
145 files changed
+4716 -4212

No files matched your search

+20 -8
View File
@@ -3,10 +3,11 @@
// sprites are a BillboardCollection (screen-aligned, rotation in screen
// space, an image per atlas cell cropped from the set's atlas), points a
// PointPrimitiveCollection, models one Model per instance in a
// PrimitiveCollection. commit() writes the changed instances and requests a
// render; nothing else renders. Picks resolve through identify(): the
// billboard, point or model a Cesium pick names → its set, instance and
// the pickId the layer gave it.
// PrimitiveCollection (the glTF's own axes, no axis correction, lit without
// Cesium's dynamic environment map). commit() writes the changed instances
// and requests a render; nothing else renders. Picks resolve through
// identify(): the billboard, point or model a Cesium pick names → its set,
// instance and the pickId the layer gave it.
import * as Cesium from 'cesium';
import { horizonVisible } from '../cameraMath.js';
@@ -246,6 +247,15 @@ function modelPart(options, store, { factories, requestRender, owners }) {
factories
.loadModel({
url: model.url,
// Resources built at once, not spread over frames behind tile jobs.
asynchronous: false,
// The instance orientation turns the glTF's own axes (the contract's
// model frame), as Navara draws them.
upAxis: Cesium.Axis.Z,
forwardAxis: Cesium.Axis.X,
// Navara has no environment map; Cesium's renders the sky around
// each model and reads it back from the GPU.
environmentMapOptions: { enabled: false },
minimumPixelSize: model.minimumPixelSize,
...modelBlend(model.colorBlend),
allowPicking: pickable,
@@ -274,10 +284,12 @@ function modelPart(options, store, { factories, requestRender, owners }) {
};
return {
primitive: collection,
// Every drawn instance's model has loaded.
ready() {
for (let index = 0; index < store.count; index++)
if (!models[index]?.ready) return false;
// Every drawn instance's model has loaded (with an index, that one's).
ready(index) {
if (index !== undefined)
return index < store.count && models[index]?.ready === true;
for (let at = 0; at < store.count; at++)
if (!models[at]?.ready) return false;
return true;
},
commit(range) {