Give a viewer of its own a frame port, and use it for the active fires layer

findFrame and frameOf find the bound renderer's frame port or, for a
caller's viewer with no renderer bound, one the Cesium adapter's factory
builds over it, as findQuery and findDraw do. Unlike the renderer's own,
it leaves the viewer's loop as its owner set it up: it listens to the
scene's phases, asks for frames, holds by asking again after each one
drawn, and maps suspend, the target rate and scene time onto the viewer.
Its preUpdate says whether the tick draws by the same test the renderer's
frame port makes, now shared by both.

The active fires layer's cards and LOD watcher take their query and frame
ports from findQuery and findFrame, in place of the layer's own copy of
projection, occlusion and preRender over the viewer's scene.
This commit is contained in:
Sameh Khamis committed 2026-11-06 22:25:07 -08:00
1 parent 784561a6ae
commit 4ed51930c2
12 files changed
+604 -132

No files matched your search

+14 -2
View File
@@ -70,10 +70,22 @@ function harness(fires, heightM, { sceneFromViewer = false } = {}) {
};
const ports = bindFakeCesiumScene(viewer);
const { draw } = ports;
// A renderer with no query or frame: the layer reads the viewer's scene.
// A renderer with no query or frame: the Cesium adapter builds them over
// the viewer's scene, as it does for a viewer with no renderer.
if (sceneFromViewer) {
ports.unbind();
bindRenderer(viewer, { draw, camera: ports.camera });
Object.assign(viewer.scene, {
preUpdate: new Cesium.Event(),
postRender: new Cesium.Event(),
requestRender() {},
forceRender() {},
pick: () => undefined,
drillPick: () => [],
camera: viewer.camera,
});
viewer.camera.pickEllipsoid = () => undefined;
viewer.clock = { currentTime: Cesium.JulianDate.now() };
}
const input = fakeInput(viewer);
const layer = createFirmsHeatmapLayer({
@@ -168,7 +180,7 @@ test('close in, detections replace the cells', async () => {
}
});
test("with no query or frame port, the layer still follows the camera through the viewer's scene", async () => {
test("with no query or frame port, the layer still follows the camera through ports built over the viewer's scene", async () => {
const h = harness([raw(30.5, -98.2, 1500)], 12_000_000, {
sceneFromViewer: true,
});