mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
fix(time): latch the Cesium clock at creation; document the clock's limits
Review of Tasks 0–1: - The Cesium engine clock attaches its frame latch to viewer.clock.onTick when the engine is created, so it runs before onTick listeners added later (cameraVerbs installs its own after the engine exists). Before, it attached on first use and would have run after them. A viewer without a clock still latches lazily on the scene's preUpdate. - GlobeClock lists what is not on the app clock yet: Cesium's viewer clock (its lighting and property reads at currentTime), the launch replay timeline and the mission orbit's GMST frame (Task 15a), the satellite cloud's SGP4 and orbit bake (Task 14a), and wall-clock throttles. The plan's T14a/T15a now carry those moves. - freeze/offset/rate change now() at once and frameTime() from the next frame; QA helpers request a render after moving the clock.
This commit is contained in:
1 parent
7c7422e281
commit
f7f4e9a45c
5 files changed
+43
-10
No files matched your search
@@ -28,12 +28,19 @@ function cesiumFrame(viewer, { draw = true } = {}) {
|
||||
viewer.scene.postRender.raiseEvent(viewer.scene, time);
|
||||
}
|
||||
|
||||
test('the clock reads the app clock and subscribes to nothing at creation', () => {
|
||||
test('the clock reads the app clock and latches on the viewer clock from creation', () => {
|
||||
const viewer = createFakeViewer();
|
||||
const wall = manualAppClock();
|
||||
const { clock } = createCesiumClock(viewer, { appClock: wall.appClock });
|
||||
assert.ok(isEngineEvent(clock.ticked));
|
||||
assert.equal(viewer.clock.onTick.numberOfListeners, 0);
|
||||
// Attached at creation, so it runs before onTick listeners added later
|
||||
// (cameraVerbs installs its own after the engine exists).
|
||||
assert.equal(viewer.clock.onTick.numberOfListeners, 1);
|
||||
const order = [];
|
||||
viewer.clock.onTick.addEventListener(() => order.push(clock.frameTime()));
|
||||
wall.advance(9);
|
||||
viewer.clock.onTick.raiseEvent(viewer.clock);
|
||||
assert.deepEqual(order, [wall.appClock.now()]);
|
||||
assert.equal(clock.now(), wall.appClock.now());
|
||||
wall.advance(5);
|
||||
assert.equal(clock.now(), wall.appClock.now());
|
||||
@@ -67,7 +74,7 @@ test('frameTime is latched on the viewer clock tick, before preUpdate', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test('frameTime alone starts the latch; destroy removes it', () => {
|
||||
test('frameTime reads the latch; destroy removes it', () => {
|
||||
const viewer = createFakeViewer();
|
||||
const wall = manualAppClock();
|
||||
const { clock, destroy } = createCesiumClock(viewer, {
|
||||
|
||||
Reference in new issue
Block a user