Draw Local ADS-B aircraft models through the draw port

Local ADS-B's 3D aircraft are now one models set of the renderer's draw
port, re-posed in place each frame, instead of Cesium models of their own.
Ground placement samples heights through the query port and sees through
the layer's sets by id; clicks read the dispatcher's draw-set hit and the
query port's drill. A class change keeps the drawn model, at its own belly
offset, until the new asset is ready; a scale-only change applies at once.
The models file leaves the Cesium allow-list.

Cesium model sets retry a failed load when its item is next updated after
a short wait, and parse an item's tint only when it changes.
This commit is contained in:
Sameh Khamis committed 2026-11-07 15:43:33 -08:00
1 parent 20155ff3fa
commit 20fdfd492e
10 files changed
+502 -375

No files matched your search

+47
View File
@@ -4,6 +4,7 @@ import test from 'node:test';
import { bindRenderer, drawOf, findDraw } from '../rendererOf.js';
import { createCesiumDraw, revealUniform, unboundDrawPart } from './draw.js';
import { drawHitOf } from './drawHit.js';
import { MODEL_RETRY_MS } from './drawModels.js';
// Node has no WebGL context to report line-width limits.
Cesium.ContextLimits._minimumAliasedLineWidth = 1;
@@ -3838,6 +3839,52 @@ test('a model load superseded or failed settles once', async () => {
}
});
test('a failed model load is tried again on a later update, after a wait', async () => {
const { loads, restore } = fakeModelLoads();
const realNow = Date.now;
let now = 1_000_000;
Date.now = () => now;
try {
const scene = fakeScene();
const part = createCesiumDraw({
scene,
report: (error) => assert.fail(error),
});
const set = part.port.models({ id: 'm' });
const item = {
id: 'a',
pos: { lon: 0, lat: 0 },
url: 'a.glb',
orientation: { heading: 0, pitch: 0, roll: 0 },
};
set.upsert([item]);
const host = scene.added[0];
loads[0].reject(new Error('network'));
await settle();
assert.equal(host.failed, 1);
now += MODEL_RETRY_MS - 1;
set.upsert([{ ...item }]);
assert.equal(loads.length, 1, 'not before the wait');
now += 1;
set.upsert([{ ...item }]);
assert.equal(loads.length, 2, 'the same url again');
assert.equal(host.failed, 0, 'loading again, not failed');
assert.equal(host.loading, 1);
const ready = [];
set.on('ready', (id) => ready.push(id));
loads[1].resolve();
await settle();
loads[1].ready();
assert.deepEqual(ready, ['a']);
set.upsert([{ ...item }]);
assert.equal(loads.length, 2, 'a loaded model is not loaded again');
set.dispose();
} finally {
Date.now = realNow;
restore();
}
});
test('a model past its pixel cap is scaled down each frame; fades and culls too', async () => {
const { loads, restore } = fakeModelLoads();
try {