Traffic surface keys and readiness through the globe port; draped lines fall back to overlay where the scene cannot drape

The traffic layer keys its cached road heights by the globe port's
surfaceVersion() and waits on isSettled('surface') instead of reading the
scene through render/cesium/surfaceState.js, which is gone. Heat-lines are
always asked for draped; the layer no longer checks whether the scene can
drape and drops them. The traffic layer and application/sources no longer
reach Cesium, and src/layers/traffic/rendering.js leaves the Cesium list.

Where the Cesium renderer cannot drape (no depth textures), its draw port
now draws every draped line over the surface, as the contract asks: along
the surface's curve between its positions, in its colour where the surface
hides it, hidden past the horizon (tested along its arc, shown in 2D). A
segmented line runs from its first shown segment to its last, in its style
colour. A line whose positions hold what they held takes a new colour in
place, so pulsing jam lines build nothing per frame; one that moves is
built anew alone.
This commit is contained in:
Sameh Khamis committed 2026-11-09 03:10:29 -08:00
1 parent f53f691a80
commit 26633106fc
15 files changed
+543 -169

No files matched your search

+2 -27
View File
@@ -12,20 +12,6 @@ import {
} from './policy.js';
import { distance } from '../../geo/vector.js';
import { findCamera } from '../../render/rendererOf.js';
// The layer's other parts reach the renderer through the unbound camera
// factory (with its query port) and globe factory, loaded here with the
// adapter this file needs.
import '../../render/cesium/camera.js';
import '../../render/cesium/globe.js';
// What the dots' surface is, and whether it has loaded, the renderer
// contract cannot say: the Cesium adapter reads it off the scene.
import {
drapesLines,
surfaceTilesReady,
surfaceKey as trafficSurfaceKey,
} from '../../render/cesium/surfaceState.js';
export { surfaceTilesReady, trafficSurfaceKey };
export function createRendering({
state: layerState,
@@ -66,7 +52,8 @@ export function createRendering({
* on top. Lines of the layer's heat-line draw set, draped on the tiles;
* the jam lines pulse together (`pulseHeatLines`). Capped at
* HEAT_LINE_CAP (jam first, longest first); overflow is logged. No-op in
* sim mode, when the heatline mode is off, or where lines cannot drape.
* sim mode or when the heatline mode is off. A renderer that cannot drape
* draws them over the surface instead (the draw port's `overlay`).
*
* @param {Array} roads - Road objects visible in the current render.
*/
@@ -81,18 +68,6 @@ export function createRendering({
removeHeatLines();
return;
}
if (layerState._heatSupported === null) {
layerState._heatSupported = drapesLines(layerState._viewer);
if (!layerState._heatSupported)
console.warn(
'[Data:Traffic] Draped lines unsupported — heat-lines disabled',
);
}
if (!layerState._heatSupported) {
removeHeatLines();
return;
}
const candidates = [];
for (const road of roads) {
const flow = road.flow;