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
@@ -1,6 +1,8 @@
|
||||
// Builds a Navara look (viewOptions.js navaraScenePlan) on an initialised
|
||||
// view and keeps it current while the view renders: the sun follows the wall
|
||||
// clock as the HUD's SUN elevation does; the cinematic look lights the globe
|
||||
// view and keeps it current while the view renders: the sun follows `now`
|
||||
// (the engine clock's frame time in the app: the app clock, which is the wall
|
||||
// clock the HUD's SUN elevation reads unless QA moves it); the cinematic look
|
||||
// lights the globe
|
||||
// from the atmosphere when seen from space, shows its clouds only for low
|
||||
// views over low ground, brightens the atmosphere (atmosphereLuminance.js)
|
||||
// and shows its stars only at night or from space. All of it runs only on frames the view draws
|
||||
|
||||
Reference in new issue
Block a user