Report model load failures to model sets, and bound the tracked model's retries again

The renderer contract gains an optional event on model draw sets,
`on('loadFailed', (id, message) => ...)`, beside `ready`: a model's url
failed to load, once per failed load. The item stays in the set drawing
what it drew before; removing it and adding it again tries at once. A
renderer that cannot tell a failure may never fire it.

The Cesium draw port fires it once Cesium is done with the frame it
raised the error in, and not for a load that was superseded or whose item
went. The stub fails urls under `stub-fail:`, telling each load once. A
conformance check (`draw.models.loadFailed`) runs on both, with a model
url the dev server does not serve for Cesium.

The flights and military layers use it in place of rewriting every
unloaded model every 5 s. A fleet model whose load failed is removed and
added again 5 s later. The tracked model gets back its per-selection
budget: a failed load is let go and tried again 1.5 s later, and after
three failures the contact stays 2D until another is selected, as
before the models moved onto the draw port. A good load retires the
budget, and a model that loads after all is kept.
This commit is contained in:
Sameh Khamis committed 2026-11-07 19:44:15 -08:00
1 parent 396e7f0deb
commit 5370feb825
23 files changed
+536 -58

No files matched your search

+13
View File
@@ -235,3 +235,16 @@ export const COURSE_SLEW_DT_MAX_SEC = 0.25;
// camera, and trail head never visibly jump — with zero steady-state lag. --
export const DR_CORRECTION_MS = 900;
/** Bounded loading for the tracked model. Its driver runs every frame, so a
* missing or corrupt GLB, or a dead network, would otherwise ask for the
* model again for as long as the contact stays selected. Failures (the
* model set's `loadFailed`) are counted PER SELECTION: a short backoff
* absorbs a transient blip, then the layer stops asking until the operator
* selects something else. The icon is the visual throughout (the handoff
* only fades it once a model actually renders), so a latched failure
* degrades to exactly the pre-3D presentation. */
export const TRACKED_MODEL_MAX_LOAD_FAILS = 3;
export const TRACKED_MODEL_RETRY_BACKOFF_MS = 1500;
+9
View File
@@ -270,6 +270,15 @@ export function createFlightState({ source, services }) {
flightState._trackedZoomLatchIcao = null;
/** The tracked-model load-failure budget: the selection it counts for,
* its failures, and when it may load again (`TRACKED_MODEL_*`). */
flightState._trackedModelFailIcao = null;
flightState._trackedModelFailCount = 0;
flightState._trackedModelRetryAtMs = 0;
/** IR hot-target mode — mirror of flights.js: under the luminance-mapped
* NVG/FLIR post-styles every model renders flat white (hottest); the dominant
* amber/tracked tint restores on style exit. */
+7 -3
View File
@@ -361,7 +361,8 @@ export function createTracking({
}
}
/** Clear the per-SELECTION tracked-model latch: the zoom hysteresis band.
/** Clear the per-SELECTION tracked-model latches: the zoom hysteresis band
* and the load-failure budget.
* Called from each path that changes which contact is
* selected — deselect, re-track, cross-layer handoff, init, destroy.
*
@@ -375,6 +376,9 @@ export function createTracking({
function _resetTrackedSelectionState() {
flightState._trackedZoomLatched = false;
flightState._trackedZoomLatchIcao = null;
flightState._trackedModelFailIcao = null;
flightState._trackedModelFailCount = 0;
flightState._trackedModelRetryAtMs = 0;
}
/**
@@ -775,7 +779,7 @@ export function createTracking({
trackedIcon.hide();
flightState._trackedEntity = null;
parts.rendering._releaseTrackedModel();
_resetTrackedSelectionState(); // the zoom band belongs to the selection we just dropped
_resetTrackedSelectionState(); // the zoom band + load-failure budget belong to the selection we just dropped
flightState._trackedIcao = null;
// Hand the contact back to its icon only now, once it no longer reads as
// tracked (the settle plans it as a fleet contact).
@@ -838,7 +842,7 @@ export function createTracking({
const iconCourse = icons.course(icao24, t);
flightState._displayCourse.set(icao24, iconCourse);
flightState._trackedIcao = icao24;
_resetTrackedSelectionState(); // fresh selection: enter at the ENTER ceiling
_resetTrackedSelectionState(); // fresh selection: enter at the ENTER ceiling, full load-retry budget
flightState._cachedDRFrame = -1;
flightState._lastTrackedRotation =
courseScreenRotation(_pose(), iconPosition, iconCourse, 0) ?? 0;