feat(weather): a host can supply decoded frames to the weather layers

A weather feed may also be a frame source. With an optional
getFrameImage({ product, time, size, bbox, signal }) the layers take
whole-extent images, detail windows and the global mosaic from it; with an
optional getFrameTile({ product, time, z, x, y, size, signal }) regional
tiles and their prefetch come from it, null being a transparent tile. Pixels
may be an ImageBitmap, ImageData, canvas or VideoFrame of exactly the
requested size; the layer draws them once and closes them. Cancellation
reaches the source, and a feed without these methods reads the image and
tile routes as before.
This commit is contained in:
Sameh Khamis committed 2026-11-10 21:54:08 -08:00
1 parent aff5ce7f17
commit e18353f769
12 files changed
+1068 -31

No files matched your search

+4 -1
View File
@@ -391,7 +391,8 @@ export function detailWindow(footprint, bounds, previous = null) {
/** Observed weather on 3D Tiles: one raised shell per product and one
* full-extent image per frame. The previous image stays until the next is ready.
* Inside a window around the view the same surface samples a sharper image of
* that area, so the two images share one mesh and never blend. */
* that area, so the two images share one mesh and never blend. A `frameSource`
* with `getImage` supplies both images, the detail window through its `bbox`. */
export function createWeatherShell({
viewer,
cesium,
@@ -405,6 +406,7 @@ export function createWeatherShell({
decodeImage,
createCanvas = () => document.createElement('canvas'),
cacheBytes = WEATHER_SHELL_CACHE_BYTES,
frameSource = null,
}) {
if (!Object.hasOwn(WEATHER_IMAGE_SIZES, product))
throw new TypeError('Unknown weather product');
@@ -475,6 +477,7 @@ export function createWeatherShell({
decodeImage,
now,
onFetched,
frameSource,
});
// An aborted decode may still finish; never repopulate a cleared instance.
signal.throwIfAborted();