mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Draw the weather and wind imagery through the renderer's globe port
Radar, satellite clouds and lightning frames are imagery layers of the globe port instead of Cesium providers in the viewer's collection. A frame stages as a transparent layer on the globe's surface and counts its tiles through the layer's admit hook; the global infrared mosaic draws each tile of the geographic grid from the decoded canvas, the regional infrared transfer runs as the layer's tile transform on the upright tile, and throttled tiles are fetched again by the renderer. Readiness reads the port's imagery settling, the camera port gives the view and its move end, and the frame's credit, which a refreshed manifest can still change in place, is owed through the credits port while the layer is shown. Without a host the shown frame is hidden rather than detached. Wind's colour field is a port layer too, so the draw order is a zOrder per product (wind, infrared, radar, lightning), above the port's other imagery, and the raise-to-top helper goes. The Cesium port keeps a tile transform's bitmaps in straight alpha and closes the copies it spends, and a provider that fails to build is told as an error of its root tile. The weather rendering and raster tile modules no longer reach Cesium and leave the allow-list; the 3D Tiles shell still does.
This commit is contained in:
1 parent
9e1f9a1c3d
commit
76880f6eae
15 files changed
+735
-721
No files matched your search
@@ -194,12 +194,26 @@ const decodeTile = (blob) =>
|
||||
* flipped, as Cesium's own bitmaps are.
|
||||
*/
|
||||
async function transformTile(spec, tile, image) {
|
||||
// Straight alpha throughout, as Cesium uploads its own tiles: WebGL does
|
||||
// not premultiply an ImageBitmap, so one premultiplied here stays so.
|
||||
const straight = {
|
||||
premultiplyAlpha: 'none',
|
||||
colorSpaceConversion: 'default',
|
||||
};
|
||||
const upright = await createImageBitmap(
|
||||
image,
|
||||
isBitmap(image) ? FLIPPED : {},
|
||||
isBitmap(image) ? { ...FLIPPED, ...straight } : straight,
|
||||
);
|
||||
const result = await spec.tileTransform(tile, upright);
|
||||
return createImageBitmap(result, FLIPPED);
|
||||
// The input is the hook's until it settles; a bitmap it returns is the
|
||||
// renderer's, spent once copied.
|
||||
let result;
|
||||
try {
|
||||
result = await spec.tileTransform(tile, upright);
|
||||
return await createImageBitmap(result, { ...FLIPPED, ...straight });
|
||||
} finally {
|
||||
if (isBitmap(result) && result !== upright) result.close();
|
||||
upright.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** A hook's synchronous throw as a failed tile, never a throw into the frame. */
|
||||
@@ -527,7 +541,16 @@ export function createCesiumImagery(
|
||||
record.provider = hooked;
|
||||
return hooked;
|
||||
});
|
||||
record.providerPromise.catch(() => {});
|
||||
// A provider that fails to build (its metadata, or a single image)
|
||||
// loads no tile: told as an error of the layer's root tile.
|
||||
record.providerPromise.catch((error) => {
|
||||
if (record.removed || listeners.tileError.size === 0) return;
|
||||
const status = error?.statusCode;
|
||||
listeners.tileError.fire({
|
||||
tile: { x: 0, y: 0, level: 0 },
|
||||
...(Number.isFinite(status) ? { status } : {}),
|
||||
});
|
||||
});
|
||||
} else {
|
||||
record.provider = hookProvider(made, spec, ctx);
|
||||
watchErrors(made);
|
||||
|
||||
Reference in new issue
Block a user