mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Merge main through #1634 into the renderer seam
Brings in the CCTV opening camera, the Iceland, Giroc HLS, Taiwan, Quebec, Ottawa and world camera packs, the world clock and timeline, the zoom-out limit and registered-only layer state, ported onto the renderer contract: the sky follows the world time through the frame port's setTime in preUpdate, the Quebec overlay reads the eye, projects and redraws through the camera, query and frame ports, launches hide pending missions through their draw records, and mission orbit rings turn on the scene clock.
This commit is contained in:
commit
2b60531c3c
170 files changed
+44096
-319
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { findFrame } from '../render/rendererOf.js';
|
||||
|
||||
/**
|
||||
* Draw the sky at the world time: the sun, moon, stars, atmosphere and the
|
||||
* lighting on the tiles all read the frame port's scene time, which never
|
||||
* moved on its own, so before this the sky stayed at the moment the page
|
||||
* loaded.
|
||||
*
|
||||
* Each frame's time is set in `preUpdate`, so the sky is drawn at the same
|
||||
* moment the layers read that frame.
|
||||
* @param {object} viewer
|
||||
* @param {() => number} readTime Epoch ms the sky is drawn at.
|
||||
* @param {{subscribe?: Function, requestRender?: () => void}} [options]
|
||||
* A world clock to hear moves from, so a resting scene repaints when the
|
||||
* world time jumps.
|
||||
* @returns {() => void} Stop following.
|
||||
*/
|
||||
export function followWorldTime(
|
||||
viewer,
|
||||
readTime,
|
||||
{
|
||||
subscribe,
|
||||
requestRender = () => findFrame(viewer)?.requestRender('world-time'),
|
||||
} = {},
|
||||
) {
|
||||
const frame = findFrame(viewer);
|
||||
const off = frame?.on('preUpdate', () => frame.setTime(readTime())) ?? null;
|
||||
let last = readTime();
|
||||
const unsubscribe =
|
||||
subscribe?.(() => {
|
||||
const next = readTime();
|
||||
if (next === last) return;
|
||||
last = next;
|
||||
requestRender();
|
||||
}) ?? (() => {});
|
||||
return () => {
|
||||
off?.();
|
||||
unsubscribe();
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user