Vessel playback moves icons on the renderer's clock

While the timeline plays or is scrubbed, each vessel icon is handed to the
renderer as a motion segment along its track (a straight piece of at most
10 km between two fixes, on the scene clock), as aircraft already are. The
layer writes an icon again only when its segment runs out or the time
moves back before it, instead of moving every icon on the CPU every frame.

Behaviour is kept:
- Icons follow the same great-circle track between fixes (a 10 km chord
  stays within 2 m of it) with the same course.
- A vessel still appears TIMELINE_UNSEEN_MS before its first fix and
  hides again when the time moves back before that.
- Cards, the selected vessel, ship models and the vessel the bridge camera
  rides are read where they are every frame; the rest within
  HIDDEN_FOLLOW_MS, as before.
- Position reads (getAllPositions, getNearby, the focus pass, the
  detection overlay, single-vessel lookups) return where the icon is drawn
  at the world time.
- Going live, each icon holds where its segment last drew it, unless a
  live update has drawn it since.
- Trails are unchanged: they are built from the feed's fixes, not from the
  per-frame position.
- Live mode and renderers without the motionSegments capability take the
  previous path unchanged.
This commit is contained in:
Sameh Khamis committed 2026-11-15 23:56:03 -08:00
1 parent da81cf743b
commit 0a0c6a0e5b
7 files changed
+746 -21

No files matched your search

+19 -4
View File
@@ -182,18 +182,32 @@ export function createTesting({
components.rendering.followPlacements();
}
/**
* Run what one live frame runs (not following the clock): settle whether
* icons move on the renderer's clock, then the placement pass. Test-only
* seam.
*/
function _runLiveFrameForTest() {
components.rendering.syncSegments();
components.rendering.followPlacements();
}
/** Run one world-clock pass at world time `atMs`. Test-only seam. */
function _runClockPassForTest(atMs) {
vesselState.worldNow = () => atMs;
components.rendering.followClockPositions();
components.rendering.followClock();
}
/** Follow the world clock, standing at world time `atMs`. Test-only seam. */
/**
* Follow the world clock, standing at world time `atMs`; `null` goes back
* to live. Test-only seam.
*/
function _followClockForTest(atMs) {
vesselState.timeline = { active: () => true };
vesselState.worldNow = () => atMs;
vesselState.timeline = { active: () => atMs !== null };
vesselState.worldNow = () => atMs ?? 0;
}
/** True while a trailing visibility frame is scheduled. Test-only seam. */
@@ -240,6 +254,7 @@ export function createTesting({
_vesselVisualForTest,
_runPlacementPassForTest,
_runClockPassForTest,
_runLiveFrameForTest,
_hasTrailingVisibilityPassForTest,
};
}