mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Read the camera layer's eye through the camera port
Cards, the geometry queue, the nearest-camera search, auto-hop's view context and the view motion pass read where the eye is from the camera port's pose, through one model helper that answers null when there is no camera or the eye has no geographic position, as the code did for a missing cartographic position. The motion pass measures with geo/vector, and a camera's first position comes from geo/ellipsoid as a plain point; everything that reads it takes x, y and z. Navigation flies through the port it already used, now found through rendererOf; the rendering part loads the camera factory so a viewer of a caller's own still has one. Cards, geometryQueue, navigation and lifecycle leave the allow-list.
This commit is contained in:
1 parent
7d760d32fc
commit
d71d25961f
8 files changed
+50
-48
No files matched your search
@@ -334,10 +334,20 @@ export function createModel({ state: layerState, services, parts, source }) {
|
||||
* @returns {string} Grid key in the form "zoomBucket:latGrid:lonGrid".
|
||||
*/
|
||||
|
||||
function currentViewContext() {
|
||||
/**
|
||||
* The eye's pose from the camera port, or null when there is no camera or
|
||||
* the eye has no geographic position (the earth's centre).
|
||||
* @returns {object|null}
|
||||
*/
|
||||
|
||||
function eyePose() {
|
||||
const pose = findCamera(layerState._viewer)?.pose();
|
||||
// An eye at the earth's centre has no geographic position.
|
||||
if (!pose || !Number.isFinite(pose.lat)) return 'none';
|
||||
return Number.isFinite(pose?.lat) ? pose : null;
|
||||
}
|
||||
|
||||
function currentViewContext() {
|
||||
const pose = eyePose();
|
||||
if (!pose) return 'none';
|
||||
const { lat, lon } = pose;
|
||||
const alt = pose.height || 0;
|
||||
const zoomBucket =
|
||||
@@ -505,6 +515,7 @@ export function createModel({ state: layerState, services, parts, source }) {
|
||||
return cameraId !== activeCameraId || record?.activationDone !== true;
|
||||
}
|
||||
return {
|
||||
eyePose,
|
||||
toRad,
|
||||
normalizeHeading,
|
||||
clamp,
|
||||
|
||||
Reference in new issue
Block a user