mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-14 23:32:20 +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,29 @@
|
||||
// Frame events on a Cesium scene. Listeners receive the frame's scene time
|
||||
// as Unix milliseconds.
|
||||
|
||||
import * as Cesium from 'cesium';
|
||||
import { bridgeEvent } from './events.js';
|
||||
|
||||
const toMilliseconds = (scene, time) => [
|
||||
Cesium.JulianDate.toDate(time).getTime(),
|
||||
];
|
||||
|
||||
/**
|
||||
* @param {Cesium.Viewer} viewer
|
||||
* @returns {{ frames: object, destroy: () => void }}
|
||||
*/
|
||||
export function createCesiumFrames(viewer) {
|
||||
const { scene } = viewer;
|
||||
const bridges = ['preUpdate', 'preRender', 'postRender'].map((name) => [
|
||||
name,
|
||||
bridgeEvent(scene[name], toMilliseconds),
|
||||
]);
|
||||
return {
|
||||
frames: Object.fromEntries(
|
||||
bridges.map(([name, bridge]) => [name, bridge.event]),
|
||||
),
|
||||
destroy() {
|
||||
for (const [, bridge] of bridges) bridge.detach();
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user