Draw civil flights from an icon set moved on the GPU

Every flight is now a row in the layer's icon set. Its motion segment
follows the same regime `_deadReckon` picks (interpolate between fixes,
warm up backward from the oldest, coast forward from the newest), and
one shared `_motionRegime` makes that choice for both. The shader moves
every untracked contact between polls, so the 12 Hz fleet tick no
longer touches each billboard. It now only re-plans expired rows,
floors grounded contacts, advances focus while needed, and runs the 3D
model regime.

Grounded contacts the floor lifts are pinned to a hold at the floored
position. Their nose glides on the GPU. Contacts within 50 km re-floor
every tick, and farther ones take turns about once a second. Low
contacts are judged for the horizon at no lower than 12 m above the
ellipsoid, as before. Below hover speed a contact's nose holds. A row
whose fleet model is drawn keeps its focus updated, because the model
reads it. Untracking re-plans and re-floors the icon from the tracked
course.

On the same views with about 6,700 OpenSky flights, frame gaps at p95
drop from 28-40 ms to 17 ms, and the fleet tick from 16-37 ms to about
2 ms at most.
This commit is contained in:
Sameh Khamis committed 2026-11-03 19:40:39 -08:00
1 parent 37dd4058c1
commit fa3a3a3bca
33 files changed
+1598 -986

No files matched your search

+26 -16
View File
@@ -11,7 +11,6 @@ export function createFlightState({ source, services }) {
...services.geoid,
...services.groundFloor,
});
flightState._cullPositions = new Map();
/** Per-class model spec. Hangar-fleet classes (CLASS_MODEL_REAL) ship GLBs
* vertex-baked to real-world METERS in the airplane.glb axis convention, so
@@ -91,22 +90,37 @@ export function createFlightState({ source, services }) {
1.0,
);
// frustum-visibility test
/** Last limb taper per billboard, retained across class/ground/cockpit repaints. */
flightState._billboardLimbScale = new WeakMap();
// keep last N positions per aircraft
// ---------------------------------------------------------------------------
// Module-level state: billboard collection and per-aircraft lookup maps
// ---------------------------------------------------------------------------
/** @type {Cesium.BillboardCollection|null} */
/** Every contact's icon row (see icons.js); null outside a layer lifetime. */
flightState._billboardCollection = null;
flightState._icons = null;
/** @type {Map<string, Cesium.Billboard>} icao24 -> billboard primitive */
/** The primitive drawing `_icons`. */
flightState._billboards = new Map();
flightState._iconPrimitive = null;
flightState._scratchIconRenderTime = new Cesium.JulianDate();
/** Contacts whose latest poll put them on the ground. */
flightState._grounded = new Set();
/** Grounded contacts the floor currently lifts; their rows hold CPU positions. */
flightState._floorPinned = new Set();
/** Fleet ticks since start; far grounded rows take their floor turn by it. */
flightState._floorTick = 0;
/** Rows still away from full focus emphasis after the last focus pass. */
flightState._iconFocusActive = 0;
/** Stable lightweight records reused by the detection overlay between polls. */
@@ -204,14 +218,6 @@ export function createFlightState({ source, services }) {
flightState._lastFleetTickMs = 0;
/** @type {string} Camera pose signature at the last rotation pass */
flightState._lastCamPoseSig = '';
/** @type {number} Epoch ms of the last full rotation pass */
flightState._lastRotPassMs = 0;
/** @type {number} Last computed rotation for the tracked entity (radians) */
flightState._lastTrackedRotation = 0;
@@ -250,6 +256,10 @@ export function createFlightState({ source, services }) {
flightState._scratchFleetPos = new Cesium.Cartesian3();
flightState._scratchCockpitPos = new Cesium.Cartesian3();
flightState._scratchNearbyPos = new Cesium.Cartesian3();
flightState._scratchSonarScreen = new Cesium.Cartesian2();
flightState._scratchDrRaw = new Cesium.Cartesian3();