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

+59 -7
View File
@@ -23,6 +23,8 @@ import {
} from '../geo/vector.js';
import {
SHARE_VIEW_ENTITY_KINDS,
SHARE_VIEW_FOLLOW_RANGE_MAX_M,
followOffsetFor,
followOffsetFromEnu,
followOffsetToEnu,
} from '../share/follow.js';
@@ -124,18 +126,68 @@ function placeEye(camera, eye) {
});
}
/** Degrees to the share format's 10⁻⁴-degree coordinate precision. */
const toCoordinate = (degrees) => Math.round(degrees * 1e4) / 1e4;
/**
* The entity the camera follows as `{ kind, id, offset, lastKnown }`, with
* the camera's offset from it and its displayed position as of `nowMs`; null
* when the camera follows nothing a share link can name. A selected vessel is
* not followed (the camera stays where the user puts it), so a link made then
* keeps its own camera.
* The selected vessel as a thing view's subject: its drawn position as the
* last-known fix, and the follow offset that puts the derived camera
* (followCameraFor) where the camera is now. The offset is computed from the
* fix at the format's precision, so the opened link's camera matches this
* one to within the offset's whole metres and degrees. Null when the offset
* cannot carry the camera (it is not above the vessel's horizon, or its range
* is outside 1 m to SHARE_VIEW_FOLLOW_RANGE_MAX_M): the link is then a place
* view.
*/
export function readShareFollowSubject({ viewer, nowMs = Date.now() }) {
function selectedVesselSubject(cameraPosition, vessel, nowMs) {
const id = String(vessel?.id || '');
if (!id || !vessel.position) return null;
const fixAt = toLonLatH(vessel.position);
const cameraAt = toLonLatH(cameraPosition);
if (!fixAt || !cameraAt) return null;
const lastKnown = {
lat: toCoordinate(fixAt.lat),
lon: toCoordinate(fixAt.lon),
alt: Math.round(fixAt.height),
observedAtMs: Number.isFinite(vessel.observedAtMs)
? vessel.observedAtMs
: nowMs,
};
const offset = followOffsetFor(lastKnown, {
lat: cameraAt.lat,
lon: cameraAt.lon,
alt: cameraAt.height,
});
if (
!offset ||
!(offset.range >= 1 && offset.range <= SHARE_VIEW_FOLLOW_RANGE_MAX_M)
)
return null;
return { kind: 'vessel', id, offset, lastKnown };
}
/**
* The entity a share link made now names, as `{ kind, id, offset, lastKnown }`:
* the entity the camera follows, with the camera's offset from it and its
* displayed position as of `nowMs`; else, while the camera follows nothing,
* the selected vessel (`readSelectedVessel()`, the vessel layer's
* `getSelectedFix()`). A selected vessel is not followed (the camera stays
* where the user puts it), so its offset is the one that derives the camera
* where it is now. Null when there is nothing a share link can name.
*/
export function readShareFollowSubject({
viewer,
nowMs = Date.now(),
readSelectedVessel = null,
}) {
const cameraPosition = viewer ? findCamera(viewer)?.pose().position : null;
if (!cameraPosition) return null;
const followed = followedOf(viewer);
const trackedId = String(followed?.key || '');
if (!followed) {
const vessel = readSelectedVessel?.() ?? null;
return vessel ? selectedVesselSubject(cameraPosition, vessel, nowMs) : null;
}
const trackedId = String(followed.key || '');
const separator = trackedId.indexOf(':');
if (separator <= 0) return null;
const kind = KIND_BY_LAYER.get(trackedId.slice(0, separator));