Merge origin/main into the renderer seam

Brings in main up to f24abfc88: cockpit subject providers, the render
failure notice, aircraft drawn in their own mesh colours, airport ground
vehicles, and an aircraft with no ground track facing its true heading.

Under the seam:
- The render failure notice lives in the Cesium adapter
  (src/render/cesium/renderFailure.js) and is the application hook
  renderFailureNotice({allowReload, store}); its private Cesium fields
  (Event's raise queue, the widget's render loop flag) are read through
  internals.js. The inline panel's timer waits while the frame port reports
  the loop stopped, and goes on after a Retry.
- Ordinary aircraft models draw white with the 'highlight' colour blend
  through the draw port; tracked and emergency colours tint the mesh.
- Held trains and transit vehicles hide their route set and markers through
  the draw port; the fleet model test fakes answer loads through the fake
  draw port instead of Cesium's glTF loader.
- The Cockpit's subject view follows and places the camera through the
  camera port.
This commit is contained in:
Sameh Khamis committed 2026-11-14 09:59:55 -08:00
commit 866a9816f2
142 files changed
+9067 -308

No files matched your search

+67
View File
@@ -0,0 +1,67 @@
// Fleet models for a layer test (fleetModelInstances.js): the project's model
// set loaded from public/, a DISPLAY 3D toggle that is on, and the layer's
// draw port (testSupport/fakeDrawPort.mjs) answering each model's load.
import { loadFleetModelSet } from '../data/fleetModels.js';
import { fetchPublicFile } from './fleetGlb.mjs';
/** A model policy whose eligibility is read again on every frame. */
export const FLEET_TEST_POLICY = Object.freeze({
altitudeCeilingM: 800_000,
minimumPixelSize: 16,
cap: 4,
capAll: 8,
addM: 5_000,
addAllM: 20_000,
keepM: 6_000,
keepAllM: 24_000,
intervalMs: 0,
});
/**
* Load the fleet set (once a process, as the app does). Call it before the
* layer's harness, which replaces `fetch`; then `watch` the harness's draw
* port.
* @returns {Promise<{fleet: object, watch: (draw: object) => void,
* load: () => void, drawn: (id: string) => object[]}>} `fleet` for the
* layer's services; `load()` finishes the load of every model the layer
* has asked for, as the renderer does off the frame; `drawn(id)` the
* models drawn for the vehicle `id` now.
*/
export async function fleetModelFakes() {
const info = console.info;
console.info = () => {};
try {
await loadFleetModelSet({ fetchImpl: fetchPublicFile });
} finally {
console.info = info;
}
let draw = null;
const sets = () =>
draw
? [...draw.sets.values()].filter(
(set) =>
!set.disposed &&
set.kind === 'models' &&
set.spec.id.startsWith('fleet-models:'),
)
: [];
return {
fleet: {
policy: FLEET_TEST_POLICY,
display: () => ({ models3d: true, models3dMode: 'proximity' }),
resolveAsset: (url) => url,
},
watch(port) {
draw = port;
},
load() {
for (const set of sets())
for (const id of [...set.items.keys()]) draw.ready(set.spec.id, id);
},
drawn: (id) =>
sets().flatMap((set) => {
const item = set.items.get(id);
return item && item.show !== false && set.show ? [item] : [];
}),
};
}
+21 -5
View File
@@ -5,6 +5,8 @@
// height, layer stats, selected route lines).
import { createRailLayer } from '../layers/rail/index.js';
import { fromDegrees } from '../geo/ellipsoid.js';
import { eastNorthUp } from '../geo/frames.js';
import { scale } from '../geo/vector.js';
import { bindRenderer } from '../render/rendererOf.js';
import { fakeDrawPort } from './fakeDrawPort.mjs';
import { CAMERA_DEBOUNCE_MS } from '../layers/rail/policy.js';
@@ -67,7 +69,7 @@ const headersOf = (values = {}) => ({
* catalog?: object[]|Promise<object[]>|Function|false,
* ground?: object,
* stops?: object|null, scheduleStops?: boolean,
* paths?: Record<string, object>|null}} [options]
* paths?: Record<string, object>|null, fleet?: object|null}} [options]
* `ground`: a floor service in place of the always-cold stub; `catalog`:
* the server's feed catalog (it may list fewer feeds than are bundled; a
* promise answers when it settles, a function is called per request and
@@ -77,8 +79,16 @@ const headersOf = (values = {}) => ({
* layer's own provider, its schedule tier, in its place;
* `paths`: feed id → the path pack the proxy serves, or a
* failure status it answers with (404 for any other feed; without it the
* source has no path route at all).
* source has no path route at all); `fleet`: the fleet-model services
* (testSupport/fleetModelFakes.mjs), with a camera that looks straight
* down for them (none by default: trains stay icons).
*/
/** The frame of an eye over `view`'s place looking straight down. */
function lookingDown(view) {
const enu = eastNorthUp(fromDegrees(view.lon, view.lat, 0));
return { direction: scale(enu.z, -1), up: enu.y, right: enu.x };
}
export function railLayerHarness(
t,
{
@@ -89,6 +99,7 @@ export function railLayerHarness(
stops = null,
scheduleStops = false,
paths = null,
fleet = null,
} = {},
) {
const T0 = RAIL_HARNESS_T0;
@@ -147,9 +158,13 @@ export function railLayerHarness(
position: view.position
? { ...view.position }
: fromDegrees(view.lon, view.lat, view.altitude),
direction: { x: 0, y: 0, z: -1 },
up: { x: 0, y: 1, z: 0 },
right: { x: 1, y: 0, z: 0 },
...(fleet
? lookingDown(view)
: {
direction: { x: 0, y: 0, z: -1 },
up: { x: 0, y: 1, z: 0 },
right: { x: 1, y: 0, z: 0 },
}),
fovy: Math.PI / 3,
aspectRatio: 1,
near: 1,
@@ -370,6 +385,7 @@ export function railLayerHarness(
cachedGroundFloor: () => null,
warmGroundFloor() {},
},
...(fleet ? { fleet } : {}),
camera: {
framing: WORLD_FOCUS_FRAMING.train,
requestWorldFocus(detail) {