mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
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:
1 parent
48988015f1
commit
35e70ec280
145 files changed
+4716
-4212
No files matched your search
+10
-20
@@ -4,7 +4,6 @@ import {
|
||||
setOverlaySourceVisible,
|
||||
} from '../overlays/worldOverlay.js';
|
||||
import { WORLD_OVERLAY_STYLE } from '../overlays/worldOverlayTokens.js';
|
||||
import { engineFromViewer } from '../globe/cesium/engineFromViewer.js';
|
||||
|
||||
/**
|
||||
* @module trackedReadout
|
||||
@@ -34,9 +33,7 @@ const DEFAULT_TRACKED_OVERLAY_HOST = Object.freeze({
|
||||
clearSource: clearOverlaySource,
|
||||
});
|
||||
|
||||
let _viewer = null;
|
||||
// The globe engine, when the readout was given one (or a viewer with a
|
||||
// registered engine): the followed target is engine.camera.following().
|
||||
// The globe engine: the followed target is engine.camera.following().
|
||||
let _engine = null;
|
||||
let _trackedEntityChangedRemove = null;
|
||||
let _selectedContext = null;
|
||||
@@ -149,8 +146,7 @@ function followSubject(handle) {
|
||||
}
|
||||
|
||||
function trackedSubject() {
|
||||
if (_engine) return followSubject(_engine.camera.following());
|
||||
return _viewer?.trackedEntity || null;
|
||||
return _engine ? followSubject(_engine.camera.following()) : null;
|
||||
}
|
||||
|
||||
function activeEntity() {
|
||||
@@ -262,22 +258,17 @@ const READOUT_CONTEXT_LAYERS = new Set(['alpr-cameras', 'local-adsb']);
|
||||
/**
|
||||
* Initialize the model bridge and selection listeners. No render listener is
|
||||
* installed; the already-initialized world-overlay host owns the frame lane.
|
||||
* @param {Object} target The globe engine (or a viewer whose engine is
|
||||
* registered): the readout follows engine.camera.following(), its label
|
||||
* (plain data) or its Cesium entity. A bare viewer (tests) is read for
|
||||
* its trackedEntity.
|
||||
* @param {import('../globe/contract.js').GlobeEngine} engine The readout
|
||||
* follows engine.camera.following(), its label (plain data) or its Cesium
|
||||
* entity.
|
||||
*/
|
||||
export function initTrackedReadout(target) {
|
||||
if (!target || _viewer === target) return;
|
||||
if (_viewer) destroyTrackedReadout();
|
||||
_viewer = target;
|
||||
_engine = engineFromViewer(target);
|
||||
export function initTrackedReadout(engine) {
|
||||
if (!engine || _engine === engine) return;
|
||||
if (_engine) destroyTrackedReadout();
|
||||
_engine = engine;
|
||||
_overlayHost.setVisible(TRACKED_OVERLAY_SOURCE_ID, true);
|
||||
const changed = _engine
|
||||
? _engine.camera.followChanged
|
||||
: target.trackedEntityChanged;
|
||||
_trackedEntityChangedRemove =
|
||||
changed?.addEventListener?.(() => {
|
||||
engine.camera.followChanged?.addEventListener?.(() => {
|
||||
if (trackedSubject()) _selectedContext = null;
|
||||
syncActiveEntity();
|
||||
}) || null;
|
||||
@@ -343,7 +334,6 @@ export function destroyTrackedReadout() {
|
||||
_selectedContext = null;
|
||||
clearTrackedSource();
|
||||
_overlayHost.setVisible(TRACKED_OVERLAY_SOURCE_ID, false);
|
||||
_viewer = null;
|
||||
_engine = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user