mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +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
+30
-9
@@ -1,18 +1,25 @@
|
||||
/**
|
||||
* @module maps/engine
|
||||
* @description What the map stacks need from the renderer that no contract
|
||||
* port gives yet: the providers each stack's imagery and terrain come from,
|
||||
* and the scene operations the map source controller (`controller.js`)
|
||||
* switches stacks with. Cesium-free: the renderer adapter provides it
|
||||
* as it loads (the Cesium one in `src/render/cesium/mapEngine.js`, loaded by
|
||||
* the application's renderer and by the package's `./render/cesium/unbound`
|
||||
* export), and the map code asks for it when it first needs it.
|
||||
* @description What the map stacks switch through: the providers each
|
||||
* stack's imagery and terrain come from, and the scene operations the map
|
||||
* source controller (`controller.js`) switches stacks with.
|
||||
*
|
||||
* The renderer's plugin may hand the application a map engine of its own
|
||||
* (`mapEngine` in `src/render/applicationHooks.js`); when it hands none, the
|
||||
* renderer switches through its globe port (`globeEngine.js`). A viewer
|
||||
* with no renderer bound uses the engine its adapter
|
||||
* provided as it loaded (the Cesium one through the package's
|
||||
* `./render/cesium/unbound` export).
|
||||
*/
|
||||
import { applicationHooksOf } from '../render/applicationHooks.js';
|
||||
import { rendererOf } from '../render/rendererOf.js';
|
||||
import { globeMapEngine } from './globeEngine.js';
|
||||
|
||||
let provided = null;
|
||||
|
||||
/**
|
||||
* Provide the map engine; a later call replaces it.
|
||||
* Provide the map engine for viewers no renderer is bound to; a later call
|
||||
* replaces it.
|
||||
* @param {object} engine
|
||||
*/
|
||||
export function provideMapEngine(engine) {
|
||||
@@ -20,7 +27,8 @@ export function provideMapEngine(engine) {
|
||||
}
|
||||
|
||||
/**
|
||||
* The map engine the renderer adapter provided.
|
||||
* The map engine the renderer adapter provided for viewers no renderer is
|
||||
* bound to.
|
||||
* @returns {object}
|
||||
* @throws {Error} When no adapter has provided one yet.
|
||||
*/
|
||||
@@ -31,3 +39,16 @@ export function mapEngine() {
|
||||
);
|
||||
return provided;
|
||||
}
|
||||
|
||||
/**
|
||||
* The map engine the map stacks of `host` switch through: its renderer's
|
||||
* own, else its renderer's globe port, else (no renderer bound) the one the
|
||||
* adapter provided.
|
||||
* @param {object} host The scene object.
|
||||
* @returns {object}
|
||||
*/
|
||||
export function mapEngineFor(host) {
|
||||
const renderer = rendererOf(host);
|
||||
if (!renderer) return mapEngine();
|
||||
return applicationHooksOf(renderer).mapEngine ?? globeMapEngine;
|
||||
}
|
||||
Reference in new issue
Block a user