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

+17
View File
@@ -29,6 +29,13 @@
* diagnostics read like a story.
*
* The governor is O(1) passive: no per-frame work of its own, ever.
*
* Globe engine: the governor is the Cesium engine's render backend.
* `engine.render.request()/setContinuous()` (src/globe/cesium/render.js)
* delegate here, so the governor never uses `engine.render` (that would be a
* cycle) and keeps the viewer for what the contract leaves to the engine:
* `scene.requestRenderMode`, `scene.maximumRenderTimeChange` and
* `scene.requestRender()`. It needs no frame events (`engine.frames`).
*/
let _viewer = null;
@@ -129,6 +136,16 @@ export function getRenderGovernorDiagnostics() {
};
}
/**
* Whether the governor is installed on this viewer (its render requests then
* go through `governorRequestRender`).
* @param {object} viewer
* @returns {boolean}
*/
export function isRenderGovernorInstalled(viewer) {
return _installed && viewer != null && _viewer === viewer;
}
/** Release the installed viewer after its animation owners have stopped. */
export function uninstallRenderGovernor(viewer) {
if (_viewer !== viewer) return;