render: Cesium draws raster-shell fields; weather shells use the draw port

The Cesium draw port now implements draw.field for the rasterShell kind
and advertises the 'fields' capability. The shell surface (a raised
rectangle with a detail window, drawn in primitive order without depth
writes) moves from the weather layer into src/render/cesium/drawFields.js.
A new rectangle or height is drawn invisibly first and swapped in whole,
and 'drawn' is told in the frame of the swap. A stage of older content
never replaces the drawn one while newer content decodes. A field hidden
mid-stage keeps building it.

The weather shell (src/layers/weather/shellRendering.js) now drives one
field through the draw, camera, frame and globe ports and no longer
imports Cesium, so it leaves the Cesium allow list. The wind shell on
photoreal hosts also draws through draw.field. The conformance page runs
each visual scene on its own, so a kind the Cesium renderer does not draw
yet (scalarRaster) fails only its own scene.
This commit is contained in:
Sameh Khamis committed 2026-11-09 07:02:54 -08:00
1 parent 4fc7d66639
commit 50cb7bd5f4
16 files changed
+1765 -761

No files matched your search

+21 -2
View File
@@ -40,6 +40,7 @@ import { createGpuIcons, GPU_ICON_CAPABILITIES } from './gpuIcons.js';
import { createModelSets } from './drawModels.js';
import { createMeshSets } from './drawMeshes.js';
import { createQuadSets } from './drawQuads.js';
import { createCesiumFields } from './drawFields.js';
/** The contract's colour as Cesium's. */
export function toColor(color, alpha = 1) {
@@ -358,6 +359,8 @@ export function createCesiumDraw({
requestRender: requestFrame = null,
}) {
const sets = new Map();
// Fields share the sets' ids.
const fieldPart = createCesiumFields({ scene, report });
let setSeq = 0;
// Bumped whenever what height queries see through may have changed: a
// set made, rebuilt, restyled or gone, or items added or removed (icons
@@ -371,7 +374,8 @@ export function createCesiumDraw({
};
function makeSet(kind, spec, build) {
if (sets.has(spec.id)) throw new Error(`a set with id ${spec.id} is live`);
if (sets.has(spec.id) || fieldPart.has(spec.id))
throw new Error(`a set with id ${spec.id} is live`);
const items = new Map();
const listeners = {
ready: listenerList(report),
@@ -3868,6 +3872,15 @@ export function createCesiumDraw({
makeSet('quads', { ...spec }, (record) => quadSets.build(record)),
meshes: (spec) =>
makeSet('meshes', { ...spec }, (record) => meshSets.build(record)),
...(capabilities.has('fields')
? {
field(spec) {
if (sets.has(spec?.id))
throw new Error(`a set with id ${spec.id} is live`);
return fieldPart.field(spec);
},
}
: {}),
clampState,
on(event, cb) {
if (event !== 'clampState') return () => {};
@@ -3950,6 +3963,8 @@ export function createCesiumDraw({
*/
dispose({ removeHosts = false } = {}) {
clampListeners.clear();
// Fields go with the port, and their frame listeners with them.
fieldPart.dispose();
// Late model loads find no host and destroy themselves.
for (const record of sets.values()) {
if (removeHosts && !scene.isDestroyed?.()) {
@@ -3989,7 +4004,11 @@ provideUnboundDraw((viewer) => {
typeof scene.requestRender !== 'function'
)
return null;
const part = createCesiumDraw({ scene, report: uncaught });
const part = createCesiumDraw({
scene,
report: uncaught,
capabilities: new Set([...GPU_ICON_CAPABILITIES, 'fields']),
});
unboundParts.set(part.port, part);
const offs = [
scene.preRender?.addEventListener?.(() => part.beforeRender()),