Merge origin/main: shipwrecks, news, transit fronts, signal-lost trails and uncredited photos on the renderer's ports

Upstream's layers and changes are carried onto the ports, with no Cesium
outside src/render and no reach into the viewer:

- Shipwrecks draw as one icon set, clicked through the input dispatcher.
- News draws through draw sets, the camera port and the input dispatcher;
  its beacons pulse each frame through the frame port.
- The scene occlusion probe moves into src/render/cesium and reaches
  detection through a new application hook, createOcclusionProbe; its
  private Cesium reads go through internals.js.
- Flight and military trails, the stale and SIGNAL LOST cue, coasting and
  following the world clock run on the draw and frame ports. GPU icons
  follow the scene clock while the world clock is followed, and fade when
  stale. A report that holds is not planned again every tick.
- Vessels are keyed by their record id.

The stub boot now enables military, shipwrecks and news as well.
This commit is contained in:
Sameh Khamis committed 2026-11-10 20:03:28 -08:00
commit a755f63638
331 files changed
+40654 -1666

No files matched your search

+78 -1
View File
@@ -1,7 +1,7 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
import { createTrail } from './trailRenderer.js';
import { CHUNK_POINTS, createTrail } from './trailRenderer.js';
import { findPickOwner } from './pickRegistry.js';
function viewerWithDraw(t) {
@@ -152,3 +152,80 @@ test('a viewer with nothing to draw with draws no trail', () => {
);
trail.destroy();
});
const points = (n, from = 0) =>
Array.from({ length: n }, (_, i) => ({ x: (from + i) * 10, y: 0, z: 0 }));
/** The set's history lines (the head left out), oldest first. */
const historyLines = (set) =>
[...set.items.values()]
.filter((line) => !line.id.endsWith(':head') && line.show !== false)
.sort((a, b) => a.positions[0].x - b.positions[0].x);
test('a trail with breaks draws each segment and nothing between them', (t) => {
const { viewer, draw } = viewerWithDraw(t);
const trail = createTrail(viewer, { color: '#00d4ff' });
trail.setSegments([points(3), points(1, 50), points(4, 100)]);
const lines = historyLines(draw.find('trail:'));
assert.deepEqual(
lines.map((line) => line.positions.map((p) => p.x)),
[
[0, 10, 20],
[1000, 1010, 1020, 1030],
],
'a one-point segment draws nothing, and no line joins the others',
);
});
test('long segments are cut into lines that share their boundary points', (t) => {
const { viewer, draw } = viewerWithDraw(t);
const trail = createTrail(viewer, { color: '#00d4ff' });
const seg = points(CHUNK_POINTS * 2 + 10);
trail.setSegments([seg]);
const lines = historyLines(draw.find('trail:'));
assert.equal(lines.length, 3);
for (let i = 1; i < lines.length; i++)
assert.deepEqual(lines[i].positions[0], lines[i - 1].positions.at(-1));
assert.equal(
lines.reduce((sum, line) => sum + line.positions.length - 1, 0),
seg.length - 1,
'every point drawn once, past the shared ones',
);
});
test('an update that keeps a line’s points never rewrites it', (t) => {
const { viewer, draw } = viewerWithDraw(t);
const trail = createTrail(viewer, { color: '#00d4ff' });
const seg = points(CHUNK_POINTS * 2 + 10);
trail.setSegments([seg]);
const set = draw.find('trail:');
const [first, second] = historyLines(set);
// Appending only moves the newest line on.
trail.setSegments([[...seg, ...points(5, seg.length)]]);
let lines = historyLines(set);
assert.equal(lines[0], first);
assert.equal(lines[1], second);
// A backfill prepended ahead keeps them, joining at a shared point.
const older = points(20, -20);
trail.setSegments([[...older, ...seg]]);
lines = historyLines(set);
assert.ok(lines.includes(first) && lines.includes(second));
assert.deepEqual(lines[0].positions.at(-1), first.positions[0]);
// Dropping the oldest point rewrites only the first line.
trail.setSegments([seg.slice(1)]);
lines = historyLines(set);
assert.notEqual(lines[0], first);
assert.equal(lines[1], second);
assert.deepEqual(lines[0].positions.at(-1), second.positions[0]);
});
test('clearing a segmented trail lets every line go', (t) => {
const { viewer, draw } = viewerWithDraw(t);
const trail = createTrail(viewer, { color: '#00d4ff' });
trail.setSegments([points(CHUNK_POINTS * 3)]);
const set = draw.find('trail:');
trail.clear();
assert.equal(set.items.size, 0);
trail.setSegments([points(4)]);
assert.equal(historyLines(set).length, 1, 'drawn again after a clear');
});