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
+9
-13
@@ -1,5 +1,4 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { fromDegrees, toDegrees, toRadians } from './geo/index.js';
|
||||
import { toDegrees, toRadians } from './geo/index.js';
|
||||
import { rendererOf } from './render/rendererOf.js';
|
||||
import { BLOOM_INTENSITY_DEFAULT, BLOOM_SCALE_VERSION } from './bloom.js';
|
||||
import {
|
||||
@@ -333,9 +332,7 @@ export class ShareLinkManager {
|
||||
if (this._destroyed || !state)
|
||||
return { succeeded: false, reason: 'unavailable' };
|
||||
const view = {
|
||||
destination: Cesium.Cartesian3.clone(
|
||||
fromDegrees(state.lon, state.lat, state.alt),
|
||||
),
|
||||
destination: { lon: state.lon, lat: state.lat, height: state.alt },
|
||||
orientation: {
|
||||
heading: toRadians(state.heading),
|
||||
pitch: toRadians(state.pitch),
|
||||
@@ -364,11 +361,11 @@ export class ShareLinkManager {
|
||||
};
|
||||
// Re-apply the final pose only while this share restoration still owns
|
||||
// navigation. A later user or voice command wins over delayed restore.
|
||||
this.viewer.camera.flyTo({
|
||||
...view,
|
||||
duration: 3.0,
|
||||
easingFunction: Cesium.EasingFunction.CUBIC_IN_OUT,
|
||||
complete: () => {
|
||||
this._camera.flyTo(view.destination, {
|
||||
orientation: view.orientation,
|
||||
durationS: 3.0,
|
||||
easing: 'cubicInOut',
|
||||
onComplete: () => {
|
||||
if (
|
||||
this._destroyed ||
|
||||
restoreGeneration !== this._restoreGeneration ||
|
||||
@@ -377,11 +374,10 @@ export class ShareLinkManager {
|
||||
releaseOwnedFlight('superseded');
|
||||
return;
|
||||
}
|
||||
this.viewer.camera.setView(view);
|
||||
this.viewer.scene?.requestRender?.();
|
||||
this._camera.setView(view);
|
||||
releaseOwnedFlight('applied');
|
||||
},
|
||||
cancel: () => releaseOwnedFlight('cancelled'),
|
||||
onCancel: () => releaseOwnedFlight('cancelled'),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user