Move the transit head across subdivisions in the frame, and keep segmented lines safe beside the draped rework

The transit trail's head is upserted where the vehicle crosses into the next
subdivision, so the Cesium draw port moves it there in the same frame
instead of building it anew; between crossings a frame changes only how far
it is revealed. A test runs the trail through the Cesium draw port across a
crossing and a second's fade, with nothing built anew.

A segmented line that was replaced by a plain one and moved while its set
rebuilds is hidden segment by segment where it was. A segmented line of no
length is patched as nothing to draw instead of rebuilt on every upsert,
and segmented lines are noted as rebuilt when they move.
This commit is contained in:
Sameh Khamis committed 2026-11-07 07:59:33 -08:00
1 parent 87c80856c2
commit e37349a061
3 files changed
+156 -8

No files matched your search

+5 -3
View File
@@ -9,8 +9,8 @@
* with its age; both change in place (`segmentShow`, `segmentColors`), so
* the body is rebuilt only when the history changes. The head is the
* subdivision the vehicle is on, revealed up to the vehicle
* (`revealFraction`): it is drawn anew only where the vehicle crosses into
* the next subdivision, and a frame writes how far it is revealed.
* (`revealFraction`): it moves only where the vehicle crosses into the
* next subdivision, and a frame writes how far it is revealed.
*/
import { cssColor } from '../render/color.js';
import { findDraw } from '../render/rendererOf.js';
@@ -222,7 +222,9 @@ export function createContactTrailRenderer(viewer) {
active = segment;
restyled = false;
revealed = fraction;
headLines?.set(headItems(segment, fraction));
// Upserted, not set: a renderer can move a draped line to where it
// now runs in the same frame, instead of building it anew.
headLines?.upsert(headItems(segment, fraction));
} else if (fraction !== revealed) {
revealed = fraction;
headLines?.upsert(headItems(segment, fraction));