mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Fly the remaining flights through the camera port, on any viewer
The embed view, the celestial-ring focus, the ground-guard lift, the Bhote Koshi approach and orbit, launch selection and replay flights, and the cockpit's view and takeover now drive the renderer's camera port. The contract gains a sineInOut easing, pinned by a conformance trace. A viewer with no renderer bound, such as one a caller of a public export brings, now gets a camera port too, as it already got an input port: cameraOf builds one over the viewer's own Cesium camera and keeps it for the viewer's life, until a renderer is bound. The Cesium adapter provides the factory as it loads; code that reaches Cesium takes cameraOf from the adapter so the factory comes with it, and findCamera answers null where a missing camera is not an error (HUD, share link, world focus, Recent Imagery's ZOOM IN). A test walks every package export and fails one that can reach the bridge without loading the factory. A destroyed viewer gets no camera and lets go of a built one, and the application renderer stays bound until its viewer is destroyed.
This commit is contained in:
1 parent
c5b716b107
commit
1d4e4ebe90
44 files changed
+1167
-344
No files matched your search
@@ -34,7 +34,7 @@ import {
|
||||
} from './model.js';
|
||||
import { msg, t } from '../../i18n/index.js';
|
||||
import { READOUT_WORDS, displayDay, displayMetres } from './display.js';
|
||||
import { cameraOf } from '../../render/rendererOf.js';
|
||||
import { findCamera } from '../../render/rendererOf.js';
|
||||
|
||||
/**
|
||||
* Quiet time after the last arrow key before the focused day previews, so a
|
||||
@@ -980,15 +980,17 @@ export function createRecentImageryLayer({
|
||||
const target = _boxError ? _refusalTarget : null;
|
||||
const camera = _viewer?.camera;
|
||||
const ellipsoid = ellipsoidOf(_viewer);
|
||||
if (!target || !camera?.flyTo || !ellipsoid?.cartographicToCartesian)
|
||||
return null;
|
||||
// No camera port: a viewer of the caller's own whose renderer did not
|
||||
// bring the camera factory (GEV's own imagery renderer does).
|
||||
const port = findCamera(_viewer);
|
||||
if (!target || !port || !ellipsoid?.cartographicToCartesian) return null;
|
||||
const canvas = _viewer.scene?.canvas;
|
||||
const height = fitViewHeightM({
|
||||
width: canvas?.clientWidth,
|
||||
height: canvas?.clientHeight,
|
||||
fovy: camera.frustum?.fovy,
|
||||
fovy: camera?.frustum?.fovy,
|
||||
});
|
||||
cameraOf(_viewer).flyTo(
|
||||
port.flyTo(
|
||||
ellipsoid.cartographicToCartesian({
|
||||
longitude: toRadians(target.lon),
|
||||
latitude: toRadians(target.lat),
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
import * as Cesium from 'cesium';
|
||||
import { withTileRequestHook } from '../../render/cesium/tileRequests.js';
|
||||
// The layer is Cesium-free and flies through `cameraOf`; its Cesium renderer
|
||||
// brings the factory a viewer with no renderer bound gets a camera from.
|
||||
import '../../render/cesium/camera.js';
|
||||
import { PRODUCTS, gibsTemplate } from './model.js';
|
||||
|
||||
const SLOT_IDS = ['a', 'b'];
|
||||
|
||||
Reference in new issue
Block a user