feat(globe): engine members and the viewer bridge for the shell

Contract: camera.position(result?) and camera.height() for per-frame
readers, render.request(reason?), maps.releasePhotorealTiles, sources
with a caller-owned ready provider, isGlobeEngine. engine.maps now hides
every tileset it has shown, lets the last imagery/photoreal call win, and
setPhotorealTiles(null) restores the last base imagery and its credit
instead of leaving the photoreal credit on a bare globe.

Cesium engine: reads the Viewer camera/canvas aliases, detaches bridged
events through the remover Cesium returns, raises frame timestamps
without allocating, re-aims the horizon occluder only when the camera
moved, and renders the scene directly when the governor governs another
viewer (or none yet). engineFromViewer returns the registered scene
engine of a viewer, else builds and caches one. The render governor stays
the Cesium render backend under engine.render and gains
isRenderGovernorInstalled.
This commit is contained in:
German Khokhlov committed 2026-10-15 18:18:19 +04:00
1 parent a5c98c6b07
commit 58a196374f
26 files changed
+657 -45

No files matched your search

+8 -2
View File
@@ -1,8 +1,10 @@
import { createCesiumEngine } from '../globe/cesium/createCesiumEngine.js';
import { registerViewerEngine } from '../globe/cesium/engineFromViewer.js';
/**
* Build the page's one globe engine on the application viewer and tie its
* teardown to the scene lifetime. Call after the viewer's own cleanup is
* teardown to the scene lifetime; engineFromViewer(viewer) returns it while
* it lives. Call after the viewer's own cleanup is
* deferred, so the engine is destroyed first. Render holds taken before the
* render governor is installed apply when it is (src/renderGovernor.js).
* @param {Cesium.Viewer} viewer
@@ -18,6 +20,10 @@ export function createSceneEngine(
{ tilesetRef, defer, createEngine = createCesiumEngine },
) {
const engine = createEngine(viewer, { tilesetRef });
defer(() => engine.destroy());
const unregister = registerViewerEngine(viewer, engine);
defer(() => {
unregister();
engine.destroy();
});
return engine;
}