Merge origin/main into the renderer-contract branch: the procedural fleet models drawn through the renderer's model sets

Aircraft, military, local ADS-B, vessel, transit and rail models come from
the fleet model set, loaded up front and drawn life size through the draw
port's models sets; no layer touches the viewer or Cesium outside
src/render/cesium/. The models capability gains glTF bytes (gltf), a
per-axis stretch (axisScale), a colour for tinted parts (maskColor) and a
cut below the origin (clip: 'belowOrigin'), with conformance checks.

Main's rail layer and Data Library are ported to the ports; the CCTV
footprint probe keeps the globe-terrain clamp through the query port.
This commit is contained in:
Sameh Khamis committed 2026-11-13 14:14:42 -08:00
commit e3865f462f
533 files changed
+55738 -2518

No files matched your search

+75
View File
@@ -3525,6 +3525,81 @@ export function portChecks() {
},
{ capability: 'models' },
),
check(
'draw.models.bytes',
'a model given its bytes is drawn from them, its url never fetched',
async (h, r) => {
if (!h.assets?.modelBytes || !h.assets?.missingModel)
return { skip: 'no model bytes in this harness' };
const gltf = await h.assets.modelBytes();
const set = r.draw.models({ id: 'conf:models.bytes' });
const ready = [];
const failed = [];
set.on('ready', (id) => ready.push(id));
set.on('loadFailed', (id) => failed.push(id));
set.set([
{
id: 'm',
pos: { ...AUSTIN, height: 0 },
// A url that does not load: only the bytes can draw it.
url: h.assets.missingModel,
gltf,
orientation: { heading: 0, pitch: 0, roll: 0 },
},
]);
for (let i = 0; i < 600 && !ready.length && !failed.length; i++)
await drawn(h, r, 1);
deepEqual(ready, ['m'], 'ready from its bytes');
deepEqual(failed, [], 'its url not fetched');
set.dispose();
},
{ capability: 'models' },
),
check(
'draw.models.fleet',
'a model’s axis scale and clip change live, without loading again',
async (h, r) => {
if (!h.assets?.model) return { skip: 'no model asset in this harness' };
await overAustin(h, r);
const set = r.draw.models({ id: 'conf:models.fleet' });
const ready = [];
const failed = [];
set.on('ready', (id) => ready.push(id));
set.on('loadFailed', (id) => failed.push(id));
const pos = h.toEcef({ ...AUSTIN, height: 0 });
const model = (extra) => ({
id: 'm',
pos,
url: h.assets.model,
orientation: { heading: 0, pitch: 0, roll: 0 },
minPixelSize: 96,
meta: { n: 1 },
...extra,
});
const picked = () => {
const s = r.query.project(pos);
return (
s !== null &&
r.query.drillPick(s.x, s.y).some((hit) => hit.set === set.id)
);
};
set.set([model({ axisScale: [1, 1, 1] })]);
for (let i = 0; i < 600 && !ready.length; i++) await drawn(h, r, 1);
deepEqual(ready, ['m'], 'ready');
set.upsert([model({ axisScale: [1, 1.5, 2], clip: 'belowOrigin' })]);
await drawn(h, r, 3);
await settled(r);
ok(picked(), 'stretched and clipped, still drawn where it is');
set.upsert([model({ axisScale: [2, 1, 1], clip: undefined })]);
await drawn(h, r, 3);
await settled(r);
ok(picked(), 'restretched and unclipped');
deepEqual(ready, ['m'], 'restyled without loading again');
deepEqual(failed, [], 'nothing failed');
set.dispose();
},
{ capability: 'models' },
),
// --- Query -------------------------------------------------------------
check(
+1 -1
View File
@@ -55,7 +55,7 @@ import { portChecks } from './checks/ports.js';
* @property {boolean} [cameraInput] The renderer's camera moves on pointer input sent through `pointer` (its own gestures, or a camera controller's): the camera scripts with `input` steps run.
* @property {(r: object, fn: (point: {lon: number, lat: number}, against?: string) => number|null) => void} [scriptHeights]
* @property {(r: object) => number} [wallTime] Epoch ms the renderer's `live` motion clock reads.
* @property {{model?: string}} [assets]
* @property {{model?: string, missingModel?: string, modelBytes?: () => Promise<Uint8Array>}} [assets] `modelBytes`: the bytes of a model, for the check that a model given its bytes never fetches its url.
*/
/**
+1 -1
View File
@@ -45,7 +45,7 @@ function contractOnly(renderer) {
return wrapped;
}
const ctx = { toEcef, assets: { model: '/models/c172.glb' } };
const ctx = { toEcef, assets: { model: '/models/fleet/aircraft/c172.glb' } };
test('every reference scene builds and disposes on the stub through the contract alone', async () => {
const ids = new Set();