render: Cesium draws wind-streamline fields; the wind layer's flow uses the draw port

The Cesium draw port now implements draw.field for the windStreamlines
kind (src/render/cesium/drawStreamlines.js). It carries the flow shader,
the 30-degree cells, horizon and frustum culling and the path tracing over
from the wind layer. It moves the highlight on the page's own frames, at
most every 32 ms, and only while the field shows, is unpaused, has alpha
and some cell is in view on a visible page. A grid no path runs through,
or one short of the whole globe, is refused. A rebuild that fails draws
nothing and is never told drawn.

The wind layer's GPU flow (src/layers/wind/gpuRendering.js) now builds the
spec, fades it by camera height and pauses it through the draw, camera and
frame ports, and no longer reaches Cesium, so it leaves the Cesium allow
list. The layer runs no animation loop of its own while the renderer draws
the flow; the canvas fallback is unchanged and still takes over wherever
the field is refused. A new conformance check covers the field's 'drawn'
events.
This commit is contained in:
Sameh Khamis committed 2026-11-09 07:38:06 -08:00
1 parent 50cb7bd5f4
commit fcd1c09565
12 files changed
+1414 -701

No files matched your search

+58
View File
@@ -786,6 +786,64 @@ export function portChecks() {
},
{ capability: 'fields' },
),
check(
'draw.field.windStreamlines',
"streamlines' 'drawn' comes once per change, never while hidden",
async (h, r) => {
await overAustin(h, r, 2000000);
const width = 8;
const height = 5;
const errors = [];
const offError = r.on('error', (e) => errors.push(e));
const field = r.draw.field({
kind: 'windStreamlines',
id: 'conf:wind',
u: new Float32Array(width * height).fill(12),
v: new Float32Array(width * height).fill(4),
width,
height,
rectangle: { west: -180, south: -80, east: 180, north: 80 },
pathBudget: 200,
steps: 8,
style: { color: '#80c9e6', widthPx: 2 },
heightM: 12000,
alpha: 1,
});
let drawnCount = 0;
const off = field.on('drawn', () => (drawnCount += 1));
// Frames until 'drawn' has come `want` times, for at most 20 s.
const until = async (want) => {
const deadline = Date.now() + 20000;
while (drawnCount < want && Date.now() < deadline)
await drawn(h, r, 1);
};
try {
await until(1);
equal(drawnCount, 1, 'drawn once made');
await drawn(h, r, 4);
equal(drawnCount, 1, 'not again while nothing changes');
field.update({ alpha: 0.5 });
await until(2);
equal(drawnCount, 2, 'drawn after a new alpha');
field.update({ paused: true });
await until(3);
equal(drawnCount, 3, 'drawn once paused');
field.show = false;
field.update({ alpha: 0.4 });
await drawn(h, r, 6);
equal(drawnCount, 3, 'never while hidden');
field.show = true;
await until(4);
equal(drawnCount, 4, 'drawn once shown again');
deepEqual(errors, [], 'no errors');
} finally {
off();
offError();
field.dispose();
}
},
{ capability: 'fields' },
),
check(
'draw.drawOrder',
'of sets drawn over depth, the higher draw order is on top and picked',