feat(app): construct the globe engine with the viewer

The scene builds the page's Cesium engine right after the viewer
(src/app/globeEngine.js), names the startup Google tileset to it once
loaded, returns it beside the viewer and destroys it before the viewer.
The debug handle exposes it as window.__godsEyeView.engine. Nothing
consumes it yet; render holds taken before the governor is installed
apply at install.

qa-globe-contract now runs on the app's engine (self-built only when the
app has none); a throwaway engine checks creation and destroy leave the
scene untouched.
This commit is contained in:
German Khokhlov committed 2026-10-15 18:02:11 +04:00
1 parent ab2368f3f3
commit a5c98c6b07
7 files changed
+141 -2

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { createCesiumEngine } from '../globe/cesium/createCesiumEngine.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
* 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
* @param {{
* tilesetRef: { current: object | null } | (() => object | null) | null,
* defer: (dispose: () => void) => void,
* createEngine?: typeof createCesiumEngine,
* }} options
* @returns {import('../globe/contract.js').GlobeEngine}
*/
export function createSceneEngine(
viewer,
{ tilesetRef, defer, createEngine = createCesiumEngine },
) {
const engine = createEngine(viewer, { tilesetRef });
defer(() => engine.destroy());
return engine;
}