mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Read the eye's follow frame through the camera port and take share-follow off the Cesium list
The camera port gains an optional followFrame() (capability followFrame): the frame the eye is placed in now, as a column-major 4x4 matrix to ECEF. Once a follow has framed the camera it is the follow's own frame (east-north-up, or the orbit frame an autodetect follow chose), under lookAt the target's east-north-up frame, otherwise the identity. setView places a world pose and keeps that frame. The Cesium port reads it from camera.transform, only when the capability is on; the stub from its own eye frame. A conformance check covers the world, lookAt and enu-follow frames, the offset in it, and setView keeping it. src/ui/shareFollow.js now reads the pose, the frame and the follow offset through the camera and frame ports: a shared offset is re-expressed in the follow's own frame as before, satellites included, and the eye is placed with setView at exact heading, pitch and roll, so a near-vertical view keeps its roll. placeFollowEye returns false on a camera that cannot say its frame. offsetFromHeadingPitchRange moves to src/geo/frames.js, shared with the stub.
This commit is contained in:
1 parent
b0ed9d7e90
commit
90e73f2ef2
19 files changed
+596
-143
No files matched your search
Vendored
+14
@@ -244,6 +244,20 @@ export interface CameraPort {
|
||||
get(): Vec3 | null;
|
||||
set(offset: Vec3): void;
|
||||
};
|
||||
/**
|
||||
* `followFrame`: the frame the eye is placed in now, as a column-major
|
||||
* 4×4 matrix from that frame to ECEF (a rigid frame: unit axes, then the
|
||||
* origin). Once a follow has framed the camera (`followFramed`) it is the
|
||||
* follow's frame, whose origin is the target and in which `followOffset`
|
||||
* is the eye: east-north-up for an `enu` follow, the renderer's own orbit
|
||||
* frame for `autodetect`; until then it is whatever frame the eye was in
|
||||
* before. Under `lookAt` it is the target's east-north-up frame; in the
|
||||
* world frame, the identity. A follow's frame moves with its target, so a
|
||||
* reading is valid only for the tick it is read in. `setView` places a
|
||||
* world pose and keeps this frame, so code can re-express an offset in
|
||||
* the follow's own frame, whichever frame that is, and place the eye there.
|
||||
*/
|
||||
followFrame?(): Float64Array;
|
||||
readonly controls: CameraControls;
|
||||
on(event: CameraEvent, cb: () => void, options?: { threshold?: number }): Off;
|
||||
/** Runs before each camera command, so an owner can yield to another. */
|
||||
|
||||
Vendored
+2
@@ -208,5 +208,7 @@ export type Capability =
|
||||
| 'followAutodetect'
|
||||
/** Reading back whether the globe surface is shown (`globe.isGlobeVisible`). */
|
||||
| 'globeVisibility'
|
||||
/** Reading the frame the eye is placed in (`camera.followFrame`). */
|
||||
| 'followFrame'
|
||||
/** A built-in quality benchmark. */
|
||||
| 'benchmark';
|
||||
@@ -174,6 +174,12 @@ test('a draw set’s events: ready with the id, loadFailed with the id and why',
|
||||
});
|
||||
});
|
||||
|
||||
test('members added to version 0 later are optional, each behind its capability', () => {
|
||||
// A renderer written before an addition still conforms without it.
|
||||
assert.equal(PORTS.globe.isGlobeVisible, 'globeVisibility');
|
||||
assert.equal(PORTS.camera.followFrame, 'followFrame');
|
||||
});
|
||||
|
||||
test('the shape check names what is missing and what a capability does not allow', () => {
|
||||
assert.deepEqual(checkRendererShape(null), ['renderer is not an object']);
|
||||
assert.deepEqual(checkRendererShape({}), [
|
||||
|
||||
@@ -47,6 +47,7 @@ export const CAPABILITIES = Object.freeze([
|
||||
'sharpen',
|
||||
'followAutodetect',
|
||||
'globeVisibility',
|
||||
'followFrame',
|
||||
'benchmark',
|
||||
]);
|
||||
|
||||
@@ -173,8 +174,8 @@ export const PORTS = deepFreeze({
|
||||
['agents', 'agents'],
|
||||
['orbits', 'orbits'],
|
||||
]),
|
||||
camera: Object.fromEntries(
|
||||
required(
|
||||
camera: Object.fromEntries([
|
||||
...required(
|
||||
'pose',
|
||||
'setView',
|
||||
'setFov',
|
||||
@@ -214,7 +215,8 @@ export const PORTS = deepFreeze({
|
||||
'onCommand',
|
||||
'matrices',
|
||||
),
|
||||
),
|
||||
['followFrame', 'followFrame'],
|
||||
]),
|
||||
query: Object.fromEntries(
|
||||
required(
|
||||
'pick',
|
||||
|
||||
Reference in new issue
Block a user