mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Drive the camera orbit and the FPS readout through the frame port
The orbit controller and the frame-rate monitor had left the Cesium allow-list but still hooked the scene's preRender and postRender events. They now listen through the frame port; the monitor looks the port up each time it is shown, so a renderer bound after it was created is the one it counts.
This commit is contained in:
1 parent
d0aa8d8f7d
commit
30b6be1da0
4 files changed
+20
-7
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createFrameRateMonitor } from './frameRateMonitor.js';
|
||||
import { bindRenderer } from '../render/rendererOf.js';
|
||||
import { fakeSceneFrame } from '../testSupport/fakeCesiumScene.mjs';
|
||||
|
||||
function fixture(t) {
|
||||
const keys = new Set();
|
||||
@@ -27,6 +29,7 @@ function fixture(t) {
|
||||
},
|
||||
},
|
||||
};
|
||||
bindRenderer(viewer, { frame: fakeSceneFrame(viewer) });
|
||||
const monitor = createFrameRateMonitor({ viewer, documentRef, store });
|
||||
t.after(() => monitor.destroy());
|
||||
return {
|
||||
@@ -133,6 +136,7 @@ test("destroying an earlier monitor leaves a newer one's readout", () => {
|
||||
const viewer = {
|
||||
scene: { postRender: { addEventListener: () => () => {} } },
|
||||
};
|
||||
bindRenderer(viewer, { frame: fakeSceneFrame(viewer) });
|
||||
const first = createFrameRateMonitor({ viewer, documentRef, store });
|
||||
const second = createFrameRateMonitor({ viewer, documentRef, store });
|
||||
const shown = store.fps;
|
||||
|
||||
Reference in new issue
Block a user