mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Start the application through the contract, not on the Cesium viewer
The application scene takes a renderer plugin and no longer refuses one without a Cesium viewer. It loads the default (Cesium) plugin only when it is given none, so a page on the stub never loads Cesium. - Every layer and tool is handed the application's own scene object (createSceneHost): the container and isDestroyed(), bound to the renderer, the same on Cesium and the stub. - What only Cesium needs at startup is done in its plugin's create: the free-look height limit, and keyboard access to its credits' expand link (creditKeyboard.js moves into the adapter). - What a plugin may hand the application beside the contract goes through provideApplicationHooks, each hook optional: Cesium's map engine, stale command trimming, inline panel rendering, viewerDrawsEntity, the zoom-out guard, and the viewer QA scripts read from window.__godsEyeView. - The map stacks, and the photoreal base the scene loads, switch through the renderer's own map engine (mapEngineFor), else its globe port (globeEngine.js). The Cesium engine takes the scene object and changes the viewer behind it.
This commit is contained in:
1 parent
a72d4c3b1f
commit
6daf63d90c
24 files changed
+825
-241
No files matched your search
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @module render/cesium/viewers
|
||||
* @description The Cesium viewer behind each renderer the application's
|
||||
* plugin made (`appRenderer.js`), and the viewer behind a scene object the app
|
||||
* holds: the one its bound renderer draws with, or the scene object itself
|
||||
* when it is a viewer with no renderer bound.
|
||||
*/
|
||||
import { rendererOf } from '../rendererOf.js';
|
||||
|
||||
const viewers = new WeakMap();
|
||||
|
||||
/**
|
||||
* Record `viewer` as the one behind `renderer`.
|
||||
* @param {object} renderer
|
||||
* @param {object} viewer
|
||||
*/
|
||||
export function recordViewer(renderer, viewer) {
|
||||
viewers.set(renderer, viewer);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Cesium viewer behind a renderer the application's plugin made, or
|
||||
* null for the test stub.
|
||||
* @param {object} renderer
|
||||
* @returns {object|null}
|
||||
*/
|
||||
export const cesiumViewerOf = (renderer) =>
|
||||
(renderer && viewers.get(renderer)) || null;
|
||||
|
||||
/**
|
||||
* The Cesium viewer behind the scene object `host`: its bound renderer's,
|
||||
* else `host` itself (a viewer with no renderer bound, or none at all).
|
||||
* @param {object|null|undefined} host
|
||||
* @returns {object|null|undefined}
|
||||
*/
|
||||
export const viewerBehind = (host) => cesiumViewerOf(rendererOf(host)) ?? host;
|
||||
Reference in new issue
Block a user