mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Fly the camera through the renderer's camera port
The Cesium camera port moves into render/cesium/camera.js, with the listener list and position conversion shared from common.js. It now covers flights (flyTo, flyToBounds, cancelFlight, flying), lookAt and release, command hooks, and a flightEnd event for the flights it starts. A flight's end that Cesium raises inside one of the port's own calls is delivered once Cesium's call returns, so its callback sees the flight let go of. A flight Cesium declines to start, mid scene-mode morph, ends as cancelled instead of never settling. Flight traces run in Node on the recorder's headless camera with a virtual clock; the browser harness keeps the instant traces. The startup fly-in, landmark and viewport flights, share-link restore and the shell's camera state now go through the port. camera.js and sharelink.js leave the Cesium allow-list.
This commit is contained in:
1 parent
b5900b4178
commit
46a53bb49c
20 files changed
+846
-305
No files matched your search
@@ -19,9 +19,10 @@ import {
|
||||
import { runCameraScript } from '../conformance/cameraRunner.js';
|
||||
import { updateCameraChanged } from './internals.js';
|
||||
|
||||
const FRAME_MS = 1000 / 60;
|
||||
|
||||
/** The contract's easings as Cesium's. */
|
||||
/**
|
||||
* The contract's easings as Cesium's, kept here rather than taken from the
|
||||
* port: the traces are the reference the port is checked against.
|
||||
*/
|
||||
const EASINGS = {
|
||||
linear: Cesium.EasingFunction.LINEAR_NONE,
|
||||
quadraticInOut: Cesium.EasingFunction.QUADRATIC_IN_OUT,
|
||||
@@ -30,8 +31,11 @@ const EASINGS = {
|
||||
quinticInOut: Cesium.EasingFunction.QUINTIC_IN_OUT,
|
||||
};
|
||||
|
||||
/** One frame of the virtual clock, ms. */
|
||||
export const FRAME_MS = 1000 / 60;
|
||||
|
||||
/** Run `fn` with `performance.now()` reading the virtual clock. */
|
||||
async function withVirtualClock(fn) {
|
||||
export async function withVirtualClock(fn) {
|
||||
const real = Object.getOwnPropertyDescriptor(globalThis, 'performance');
|
||||
const clock = { now: 0 };
|
||||
Object.defineProperty(globalThis, 'performance', {
|
||||
@@ -45,7 +49,8 @@ async function withVirtualClock(fn) {
|
||||
}
|
||||
}
|
||||
|
||||
function headlessCamera() {
|
||||
/** A Cesium camera on a scene with no globe, sized as the scripts' viewport. */
|
||||
export function headlessCamera() {
|
||||
const scene = {
|
||||
canvas: {
|
||||
clientWidth: SCRIPT_VIEWPORT.width,
|
||||
|
||||
Reference in new issue
Block a user