mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(time): the app clock on the engine
src/time/clock.js is the app's own time in ms since the epoch: by default
Date.now exactly (read at each call), with freeze/offset/rate/reset for QA
and tests, and one frame time latched per engine frame (beginFrame). The
contract gains engine.clock { now, frameTime, ticked }, in the fake engine
(a controllable wall clock, fake.advanceTime, fake.appClock), the contract
suite (one frame time for every listener of a frame, latched before
preUpdate, never decreasing), Cesium and Navara.
Cesium latches on the viewer clock's onTick, which CesiumWidget runs right
before scene.render, so scene listeners the app added before the engine
existed read the same frame time; the subscription appears on first use
and destroy removes it. The viewer clock itself is untouched: in the app
it never animates (shouldAnimate false, multiplier 1, its time frozen at
boot), and its time still drives Cesium's lighting as before. Navara
latches in the engine's handler of the view's preUpdate, and the look
reads the engine clock's frame time for the sun, so the app clock is the
one time source on Navara too.
src/time is a portable root in check-import-directions: no engine
packages, no browser globals.
This commit is contained in:
1 parent
27e28373d0
commit
f1a2df5cfe
20 files changed
+771
-13
No files matched your search
@@ -100,6 +100,23 @@ for (const [name, files, pattern] of [
|
||||
},
|
||||
/src\/data\/helper\.js: geo reaches platform\/rendering dependency: cesium/,
|
||||
],
|
||||
[
|
||||
'app clock imports cesium',
|
||||
{ 'src/time/clock.js': "import 'cesium';" },
|
||||
/src\/time\/clock\.js: time reaches platform\/rendering dependency: cesium/,
|
||||
],
|
||||
[
|
||||
'app clock imports three',
|
||||
{ 'src/time/clock.js': "import * as THREE from 'three';" },
|
||||
/src\/time\/clock\.js: time reaches platform\/rendering dependency: three/,
|
||||
],
|
||||
[
|
||||
'app clock reaches the DOM',
|
||||
{
|
||||
'src/time/clock.js': 'export const now = () => window.performance.now();',
|
||||
},
|
||||
/src\/time\/clock\.js: time reaches browser globals/,
|
||||
],
|
||||
[
|
||||
'globe contract imports cesium',
|
||||
{ 'src/globe/contract.js': "import 'cesium';" },
|
||||
|
||||
Reference in new issue
Block a user