mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
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:
1 parent
a5c98c6b07
commit
58a196374f
26 files changed
+657
-45
No files matched your search
@@ -5,6 +5,7 @@
|
||||
import {
|
||||
governorRequestRender,
|
||||
holdContinuousRender,
|
||||
isRenderGovernorInstalled,
|
||||
releaseContinuousRender,
|
||||
} from '../../renderGovernor.js';
|
||||
|
||||
@@ -12,17 +13,24 @@ export const RENDER_OWNER = 'globe-engine';
|
||||
|
||||
/**
|
||||
* @param {Cesium.Viewer} viewer
|
||||
* @param {{ requestRender?: (reason: string) => void }} [options]
|
||||
* @param {{ requestRender?: (reason: string) => void }} [options] Defaults to
|
||||
* the render governor when it governs this viewer, else the scene itself
|
||||
* (before the governor is installed, or on another viewer).
|
||||
* @returns {{ render: import('../contract.js').GlobeRender, destroy: () => void }}
|
||||
*/
|
||||
export function createCesiumRender(
|
||||
viewer,
|
||||
{ requestRender = governorRequestRender } = {},
|
||||
{
|
||||
requestRender = (reason) => {
|
||||
if (isRenderGovernorInstalled(viewer)) governorRequestRender(reason);
|
||||
else viewer.scene.requestRender?.();
|
||||
},
|
||||
} = {},
|
||||
) {
|
||||
let held = false;
|
||||
const render = {
|
||||
request() {
|
||||
requestRender(RENDER_OWNER);
|
||||
request(reason = RENDER_OWNER) {
|
||||
requestRender(reason);
|
||||
},
|
||||
setContinuous(enabled) {
|
||||
held = Boolean(enabled);
|
||||
|
||||
Reference in new issue
Block a user