mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
feat(globe): implement the engine on Cesium
createCesiumEngine wraps an existing viewer without changing it: camera, picker, projector, frames, render (through the render governor), surface, input, credits and maps, with geo values out and Cesium values in at the boundary. Map and surface code is shared with src/maps and services/groundSnap instead of copied. scripts/qa-globe-contract.mjs runs the contract suite against the engine in headless Chrome; the camera-events check now waits for the previous move to end, as Cesium's moveStart marks a move from rest.
This commit is contained in:
1 parent
cd94a26b9f
commit
d831cbd23a
33 files changed
+2374
-32
No files matched your search
@@ -0,0 +1,41 @@
|
||||
// GlobeRender on the app's render governor, which owns Cesium's
|
||||
// requestRenderMode and maximumRenderTimeChange; the engine only takes a
|
||||
// hold under its own owner id.
|
||||
|
||||
import {
|
||||
governorRequestRender,
|
||||
holdContinuousRender,
|
||||
releaseContinuousRender,
|
||||
} from '../../renderGovernor.js';
|
||||
|
||||
export const RENDER_OWNER = 'globe-engine';
|
||||
|
||||
/**
|
||||
* @param {Cesium.Viewer} viewer
|
||||
* @param {{ requestRender?: (reason: string) => void }} [options]
|
||||
* @returns {{ render: import('../contract.js').GlobeRender, destroy: () => void }}
|
||||
*/
|
||||
export function createCesiumRender(
|
||||
viewer,
|
||||
{ requestRender = governorRequestRender } = {},
|
||||
) {
|
||||
let held = false;
|
||||
const render = {
|
||||
request() {
|
||||
requestRender(RENDER_OWNER);
|
||||
},
|
||||
setContinuous(enabled) {
|
||||
held = Boolean(enabled);
|
||||
if (held) holdContinuousRender(RENDER_OWNER);
|
||||
else releaseContinuousRender(RENDER_OWNER);
|
||||
},
|
||||
// The scene's real mode: another owner's hold keeps it continuous.
|
||||
isContinuous: () => viewer.scene.requestRenderMode === false,
|
||||
};
|
||||
return {
|
||||
render,
|
||||
destroy() {
|
||||
if (held) render.setContinuous(false);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user