mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Follow aircraft and satellites through the camera port
Flights and military follow their tracked aircraft with an entityFollowTarget: framed in ENU from viewFrom, never closer than 150 m, presentation read from the drawn entity's record. Satellites follow in Cesium's autodetect frame. The layers' own framing (applyTrackedCameraFrame) goes; the port's follow has the same close-range rules, and trackedCamera.js no longer imports Cesium. The port's helper entity draws nothing: its point's outline is transparent too, and click and voice picks of it count as picks of the target's drawn entity. The fake camera binder follows when the fake has Cesium's entity tracking.
This commit is contained in:
1 parent
99f9a701d9
commit
e3a850bc9c
22 files changed
+291
-332
No files matched your search
@@ -9,7 +9,7 @@ import test from 'node:test';
|
||||
import * as Cesium from 'cesium';
|
||||
import { headlessCamera } from './cameraGoldens.js';
|
||||
import { createCesiumCamera } from './camera.js';
|
||||
import { holdFollowZoom } from './follow.js';
|
||||
import { holdFollowZoom, pickThroughFollowHelper } from './follow.js';
|
||||
|
||||
function trackingHost() {
|
||||
const { scene, camera } = headlessCamera();
|
||||
@@ -252,28 +252,21 @@ test('an autodetected follow is framed once Cesium tracks its helper', () => {
|
||||
h.dispose();
|
||||
});
|
||||
|
||||
test('a port follow and a layer frame hold one controller together', async () => {
|
||||
const { applyTrackedCameraFrame } =
|
||||
await import('../../data/trackedCamera.js');
|
||||
test('a pick of the helper is a pick of the target’s drawn entity', () => {
|
||||
const h = trackingHost();
|
||||
const controller = h.scene.screenSpaceCameraController;
|
||||
const viewer = {
|
||||
scene: h.scene,
|
||||
camera: h.camera,
|
||||
clock: h.widget.clock,
|
||||
isDestroyed: () => false,
|
||||
trackedEntity: {},
|
||||
};
|
||||
const stopLayer = applyTrackedCameraFrame(
|
||||
viewer,
|
||||
viewer.trackedEntity,
|
||||
new Cesium.Cartesian3(0, -800, 400),
|
||||
);
|
||||
h.port.follow(target('a', { minRange: 300 }));
|
||||
assert.equal(controller.minimumZoomDistance, 300);
|
||||
stopLayer();
|
||||
assert.equal(controller.minimumZoomDistance, 300, 'the port still holds');
|
||||
h.port.follow(null);
|
||||
assert.deepEqual(controller, { inertiaZoom: 0.8, minimumZoomDistance: 1 });
|
||||
const drawn = h.widget.entities.add({ position: AUSTIN });
|
||||
h.port.follow(target('a', { entity: drawn }));
|
||||
const helper = h.widget.entities.values.find((e) => e !== drawn);
|
||||
const primitive = {};
|
||||
assert.deepEqual(pickThroughFollowHelper({ id: helper, primitive }), {
|
||||
id: drawn,
|
||||
primitive,
|
||||
});
|
||||
h.port.follow(target('b'));
|
||||
const bare = h.widget.entities.values.find((e) => e !== drawn);
|
||||
assert.equal(pickThroughFollowHelper({ id: bare }), undefined);
|
||||
const other = { id: drawn };
|
||||
assert.equal(pickThroughFollowHelper(other), other);
|
||||
assert.equal(pickThroughFollowHelper(undefined), undefined);
|
||||
h.dispose();
|
||||
});
|
||||
Reference in new issue
Block a user