mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
Follow, credits, embed views and FPS through the engine on Navara
Five places still read the Cesium viewer and so did nothing, or the wrong thing, on Navara. Each now goes through the globe contract, and Cesium behaves as before. - The Navara ground floor stands aside while the camera inputs are suspended, not only while they are switched off. The cockpit suspends them, so its eye 12 m up no longer jumps to the floor's 30 m between updates. A follow's own suspension keeps the floor on, as before. - Follow state comes from engine.camera.following() and followChanged instead of viewer.trackedEntity. Enabling CCTV during a follow no longer flies away and ends it, a new follow stamps navigation, Director cards wait while a subject is followed, and an explicit navigation stops the follow on both engines. - Navara registers every data credit, as Cesium does. The allowlist left out the layers that moved to Navara later (CCTV agencies, street-level imagery, GIBS, routing, bike feeds and others). - Annotation links and embed mode attach on every engine; their camera flights use engine.camera.flyTo. Only Cesium adds the timer that keeps an inline panel drawing. - The FPS readout counts engine.frames.postRender, so it shows on Navara. Each fix has a test that fails without it.
This commit is contained in:
1 parent
e1095ee553
commit
18f69c2699
23 files changed
+144
-158
No files matched your search
@@ -314,7 +314,7 @@ export class StyleManager extends ShellScene {
|
||||
|
||||
this._initSceneOverlays();
|
||||
this._displayBindings = new DisplayBindings({
|
||||
viewer,
|
||||
engine,
|
||||
services: {
|
||||
cycleDetectionMode: services.cycleDetectionMode,
|
||||
isScopeMaskEnabled: services.isScopeMaskEnabled,
|
||||
@@ -1001,7 +1001,7 @@ export class StyleManager extends ShellScene {
|
||||
setEnabled: (next) =>
|
||||
this._dataManager.setEnabled('cctv', next, { origin: 'user' }),
|
||||
readOwnership: () => ({
|
||||
trackedEntity: this.viewer?.trackedEntity,
|
||||
trackedEntity: this.engine?.camera.following() ?? null,
|
||||
cockpitActive: !!this.cockpitView?.active,
|
||||
}),
|
||||
shouldFocus: () =>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { applicationPinia } from './vueRuntime.js';
|
||||
/** Own keyboard/display event subscriptions; settings remain with their state owners. */
|
||||
export class DisplayBindings {
|
||||
constructor({
|
||||
viewer,
|
||||
engine,
|
||||
services,
|
||||
elements,
|
||||
operations,
|
||||
@@ -16,7 +16,7 @@ export class DisplayBindings {
|
||||
}) {
|
||||
Object.assign(
|
||||
this,
|
||||
{ viewer, services, readState, claimDetection, displayStore },
|
||||
{ engine, services, readState, claimDetection, displayStore },
|
||||
elements,
|
||||
operations,
|
||||
);
|
||||
@@ -45,7 +45,7 @@ export class DisplayBindings {
|
||||
_initUI() {
|
||||
const { cycleDetectionMode, isScopeMaskEnabled } = this.services;
|
||||
this._applicationShortcuts?.destroy();
|
||||
this.attachViewer(this.viewer);
|
||||
this.attachEngine(this.engine);
|
||||
this._applicationShortcuts = bindApplicationShortcuts({
|
||||
documentRef: document,
|
||||
searchInput: this._locationSearch,
|
||||
@@ -168,14 +168,14 @@ export class DisplayBindings {
|
||||
this._detachDisplayControls = () => store.detach(token);
|
||||
}
|
||||
/**
|
||||
* Count the frames of another viewer (an engine switch), or none. The
|
||||
* Count the frames of another engine (an engine switch), or none. The
|
||||
* shortcuts and the Display controls stay bound.
|
||||
*/
|
||||
attachViewer(viewer) {
|
||||
this.viewer = viewer ?? null;
|
||||
attachEngine(engine) {
|
||||
this.engine = engine ?? null;
|
||||
this._frameRateMonitor?.destroy();
|
||||
this._frameRateMonitor = createFrameRateMonitor({
|
||||
viewer: this.viewer,
|
||||
engine: this.engine,
|
||||
documentRef: document,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import { applicationPinia } from './vueRuntime.js';
|
||||
* readout is presented to the status store, which the title bar renders.
|
||||
*/
|
||||
export function createFrameRateMonitor({
|
||||
viewer,
|
||||
engine,
|
||||
documentRef = document,
|
||||
store = useStatusStore(applicationPinia()),
|
||||
}) {
|
||||
const frameEvent = viewer?.scene?.postRender;
|
||||
const frameEvent = engine?.frames.postRender;
|
||||
// A page without the scene chrome has no title bar to show it in.
|
||||
if (!documentRef.getElementById('title-bar') || !frameEvent)
|
||||
return { destroy() {} };
|
||||
|
||||
@@ -17,8 +17,8 @@ function fixture(t) {
|
||||
addEventListener: (name, handler) => keys.add(handler),
|
||||
removeEventListener: (name, handler) => keys.delete(handler),
|
||||
};
|
||||
const viewer = {
|
||||
scene: {
|
||||
const engine = {
|
||||
frames: {
|
||||
postRender: {
|
||||
addEventListener(handler) {
|
||||
frames.add(handler);
|
||||
@@ -27,7 +27,7 @@ function fixture(t) {
|
||||
},
|
||||
},
|
||||
};
|
||||
const monitor = createFrameRateMonitor({ viewer, documentRef, store });
|
||||
const monitor = createFrameRateMonitor({ engine, documentRef, store });
|
||||
t.after(() => monitor.destroy());
|
||||
return {
|
||||
monitor,
|
||||
@@ -108,7 +108,7 @@ test('a page without the title bar gets no readout and keeps the key', () => {
|
||||
let listened = false;
|
||||
const store = { publishFps: () => assert.fail('nothing to show it in') };
|
||||
const monitor = createFrameRateMonitor({
|
||||
viewer: { scene: { postRender: { addEventListener: () => () => {} } } },
|
||||
engine: { frames: { postRender: { addEventListener: () => () => {} } } },
|
||||
documentRef: {
|
||||
getElementById: () => null,
|
||||
addEventListener: () => (listened = true),
|
||||
@@ -130,11 +130,11 @@ test("destroying an earlier monitor leaves a newer one's readout", () => {
|
||||
addEventListener() {},
|
||||
removeEventListener() {},
|
||||
};
|
||||
const viewer = {
|
||||
scene: { postRender: { addEventListener: () => () => {} } },
|
||||
const engine = {
|
||||
frames: { postRender: { addEventListener: () => () => {} } },
|
||||
};
|
||||
const first = createFrameRateMonitor({ viewer, documentRef, store });
|
||||
const second = createFrameRateMonitor({ viewer, documentRef, store });
|
||||
const first = createFrameRateMonitor({ engine, documentRef, store });
|
||||
const second = createFrameRateMonitor({ engine, documentRef, store });
|
||||
const shown = store.fps;
|
||||
first.destroy();
|
||||
assert.ok(store.fps === shown);
|
||||
|
||||
@@ -19,7 +19,7 @@ test('the FPS readout sits in the title bar, hidden until the backquote key', as
|
||||
document.querySelector('#title-bar .frame-rate-readout');
|
||||
assert.equal(readout(), null, 'no readout without a monitor');
|
||||
const monitor = createFrameRateMonitor({
|
||||
viewer: { scene: { postRender: { addEventListener: () => () => {} } } },
|
||||
engine: { frames: { postRender: { addEventListener: () => () => {} } } },
|
||||
store: useStatusStore(pinia),
|
||||
});
|
||||
t.after(() => monitor.destroy());
|
||||
|
||||
+10
-11
@@ -82,17 +82,16 @@ export class LayerBindings {
|
||||
window,
|
||||
this._worldRequestFocusHandler,
|
||||
);
|
||||
// Cesium's trackedEntity changes announce navigation through this event.
|
||||
if (this.viewer)
|
||||
this._navigationOwnerChangedRemover =
|
||||
this.viewer.trackedEntityChanged.addEventListener((entity) => {
|
||||
// Rebinding the session's subject (a resumed renderer, a share
|
||||
// restore) is part of the pending restoration, not a new navigation
|
||||
// that supersedes it. The mark lasts only while the follow starts.
|
||||
if (entity && !this._disposed && !entity.gevRestoring)
|
||||
this._stampNavigation({ cancelPendingSelection: false });
|
||||
});
|
||||
// Vessel/installation focus flies without ever assigning a tracked entity,
|
||||
// A new follow announces navigation through this event.
|
||||
this._navigationOwnerChangedRemover =
|
||||
this.engine?.camera.followChanged.addEventListener((handle) => {
|
||||
// Rebinding the session's subject (a resumed renderer, a share
|
||||
// restore) is part of the pending restoration, not a new navigation
|
||||
// that supersedes it. The mark lasts only while the follow starts.
|
||||
if (handle && !this._disposed && !handle.native?.gevRestoring)
|
||||
this._stampNavigation({ cancelPendingSelection: false });
|
||||
}) ?? null;
|
||||
// Vessel/installation focus flies without ever starting a follow,
|
||||
// so it cannot reach the listener above. It announces instead.
|
||||
this._removeNavigationAuthorityListener =
|
||||
registerNavigationAuthorityListener(window, (event) => {
|
||||
|
||||
@@ -386,7 +386,6 @@ export class LocationNavigation {
|
||||
/* best-effort release */
|
||||
}
|
||||
this.engine.camera.following()?.stop();
|
||||
if (this.viewer) this.viewer.trackedEntity = undefined;
|
||||
this.engine.camera.cancelFlight();
|
||||
this.engine.camera.release();
|
||||
this._beginWorldJumpTransition();
|
||||
|
||||
@@ -185,7 +185,7 @@ export class NavigationController {
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
if (this.viewer) this.viewer.trackedEntity = undefined;
|
||||
this.engine?.camera.following()?.stop();
|
||||
this.interruptCameraMotion('explicit-navigation');
|
||||
this.stopOrbit();
|
||||
const camera = this.engine?.camera;
|
||||
|
||||
@@ -127,12 +127,12 @@ test('camera-entry listeners are removed before any asynchronous layer cleanup',
|
||||
const { owner } = bindings(t);
|
||||
let changes = 0;
|
||||
let trackedCallback;
|
||||
owner.viewer = { trackedEntityChanged: {
|
||||
owner.engine = { camera: { followChanged: {
|
||||
addEventListener(callback) {
|
||||
trackedCallback = callback;
|
||||
return () => { changes += 1; };
|
||||
},
|
||||
} };
|
||||
} } };
|
||||
owner._stampNavigation = () => { changes += 100; };
|
||||
owner.observeCamera();
|
||||
owner.stop();
|
||||
|
||||
@@ -344,7 +344,7 @@ export class ShellScene extends ShellFacade {
|
||||
this._locationNavigation.attachScene({ viewer, engine });
|
||||
this.hud.attachEngine(engine, { viewer });
|
||||
this.shareLinkManager.attachEngine(engine);
|
||||
this._displayBindings.attachViewer(viewer);
|
||||
this._displayBindings.attachEngine(engine);
|
||||
this._buildSceneControls();
|
||||
this._buildSceneCockpit();
|
||||
this._shareRestoration.attachLinks(this.shareLinkManager);
|
||||
@@ -441,7 +441,7 @@ export class ShellScene extends ShellFacade {
|
||||
if (this._orientationToken)
|
||||
useGlobeActionsStore(applicationPinia()).detach(this._orientationToken);
|
||||
this._orientationToken = null;
|
||||
this._displayBindings.attachViewer(null);
|
||||
this._displayBindings.attachEngine(null);
|
||||
this._locationNavigation.detachScene();
|
||||
this.hud.attachEngine(null);
|
||||
this.shareLinkManager.attachEngine(null);
|
||||
|
||||
@@ -28,7 +28,7 @@ function fakeShell() {
|
||||
},
|
||||
hud: { attachEngine: record('hud.attachEngine') },
|
||||
shareLink: { attachEngine: record('shareLink.attachEngine') },
|
||||
display: { attachViewer: record('display.attachViewer') },
|
||||
display: { attachEngine: record('display.attachEngine') },
|
||||
context: {
|
||||
canRetainScene: () => true,
|
||||
restoreForDisposal: record('context.restore'),
|
||||
@@ -124,7 +124,7 @@ test('a switch detaches the globe-bound parts and keeps the session objects', as
|
||||
'visual.destroy',
|
||||
'mapSource.destroy',
|
||||
'orientation.destroy',
|
||||
'display.attachViewer',
|
||||
'display.attachEngine',
|
||||
'location.detachScene',
|
||||
'hud.attachEngine',
|
||||
'shareLink.attachEngine',
|
||||
@@ -156,7 +156,7 @@ test('the next globe gets new globe-bound parts and the restore runs on it', asy
|
||||
'location.attachScene',
|
||||
'hud.attachEngine',
|
||||
'shareLink.attachEngine',
|
||||
'display.attachViewer',
|
||||
'display.attachEngine',
|
||||
'_buildSceneControls',
|
||||
'_buildSceneCockpit',
|
||||
'shareRestoration.attachLinks',
|
||||
|
||||
Reference in new issue
Block a user