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

+20 -5
View File
@@ -1,10 +1,11 @@
/**
* @module render/cesium/drawFields
* @description The Cesium draw port's `field` handles. It draws one kind:
* `rasterShell`, a raster on a rectangle raised above the ellipsoid, drawn
* flat in the opaque pass in the scene's primitive order (ascending height),
* alpha-blended, without depth writes and never picked. Other kinds are
* refused loudly.
* @description The Cesium draw port's `field` handles. It draws two kinds:
* `windStreamlines` (drawStreamlines.js) and `rasterShell`, a raster on a
* rectangle raised above the ellipsoid, drawn flat in the opaque pass in
* the scene's primitive order (ascending height), alpha-blended, without
* depth writes and never picked. Other kinds (`scalarRaster`) are refused
* loudly.
*
* Choices the contract leaves open, taken conservatively:
* - An image is read when it is first named, as a Cesium material reads
@@ -25,6 +26,7 @@
*/
import * as Cesium from 'cesium';
import { listenerList, uncaught } from './common.js';
import { createWindStreamlines } from './drawStreamlines.js';
const MATERIAL_TYPE = 'DrawRasterShell';
// Renders after an image swap: one queues the upload, one uploads and draws, one spare.
@@ -632,6 +634,19 @@ export function createCesiumFields({
if (fields.has(spec?.id))
throw new Error(`a field with id ${spec.id} is live`);
if (spec?.kind === 'rasterShell') return rasterShell(spec);
if (spec?.kind === 'windStreamlines') {
const handle = createWindStreamlines({
scene,
spec,
report,
cesium,
onDispose: () => {
if (fields.get(spec.id) === handle) fields.delete(spec.id);
},
});
fields.set(spec.id, handle);
return handle;
}
throw new TypeError(
`the Cesium renderer draws no ${spec?.kind} fields yet`,
);