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
+13
-14
@@ -30,6 +30,7 @@ import {
|
||||
} from './cyberSonarControls.js';
|
||||
|
||||
import * as Cesium from 'cesium';
|
||||
import { cameraOf } from '../render/rendererOf.js';
|
||||
|
||||
import { aircraftTrackingTarget } from '../cockpitTracking.js';
|
||||
|
||||
@@ -441,7 +442,7 @@ export class StyleManager extends ShellFacade {
|
||||
},
|
||||
isNavigationCurrent: (generation) =>
|
||||
generation === this._navigationGeneration,
|
||||
cancelOwnedNavigation: () => this.viewer.camera.cancelFlight(),
|
||||
cancelOwnedNavigation: () => cameraOf(this.viewer).cancelFlight(),
|
||||
// A host may open a share code without a `/share/<code>` address.
|
||||
initialShareCode,
|
||||
});
|
||||
@@ -1452,20 +1453,18 @@ export class StyleManager extends ShellFacade {
|
||||
*/
|
||||
applyCameraState(cameraState, duration = 2.8) {
|
||||
if (!cameraState) return;
|
||||
this.viewer.camera.flyTo({
|
||||
destination: Cesium.Cartesian3.fromDegrees(
|
||||
cameraState.lon,
|
||||
cameraState.lat,
|
||||
cameraState.alt,
|
||||
),
|
||||
orientation: {
|
||||
heading: Cesium.Math.toRadians(cameraState.heading || 0),
|
||||
pitch: Cesium.Math.toRadians(cameraState.pitch || -35),
|
||||
roll: Cesium.Math.toRadians(cameraState.roll || 0),
|
||||
cameraOf(this.viewer).flyTo(
|
||||
{ lon: cameraState.lon, lat: cameraState.lat, height: cameraState.alt },
|
||||
{
|
||||
orientation: {
|
||||
heading: Cesium.Math.toRadians(cameraState.heading || 0),
|
||||
pitch: Cesium.Math.toRadians(cameraState.pitch || -35),
|
||||
roll: Cesium.Math.toRadians(cameraState.roll || 0),
|
||||
},
|
||||
durationS: Math.max(0.2, duration || 0),
|
||||
easing: 'cubicInOut',
|
||||
},
|
||||
duration: Math.max(0.2, duration || 0),
|
||||
easingFunction: Cesium.EasingFunction.CUBIC_IN_OUT,
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user