mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +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,129 @@
|
||||
// Away from live, a launch shows from its lift-off on, so scrubbing the world
|
||||
// time brings the launches up in the order they flew.
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { bindFakeDraw } from '../../testSupport/fakeDrawPort.mjs';
|
||||
import { worldClock } from '../../time/worldClock.js';
|
||||
import { createState } from './state.js';
|
||||
import { createRendering } from './rendering.js';
|
||||
import { createSelection } from './selection.js';
|
||||
|
||||
const noop = () => {};
|
||||
const LAUNCH_MS = Date.UTC(2026, 9, 20, 12);
|
||||
|
||||
function scene(t) {
|
||||
t.after(() => worldClock.goLive());
|
||||
const state = createState({
|
||||
services: {
|
||||
overlays: {
|
||||
setOverlayEntries: noop,
|
||||
setOverlaySourceVisible: noop,
|
||||
clearOverlaySource: noop,
|
||||
},
|
||||
},
|
||||
});
|
||||
const launch = {
|
||||
id: 'ceres-1',
|
||||
name: 'Ceres-1',
|
||||
lon: 0,
|
||||
lat: 0,
|
||||
launchTime: new Date(LAUNCH_MS).toISOString(),
|
||||
status: 'Launch Successful',
|
||||
recoveryStages: [],
|
||||
trajectory: [
|
||||
{ latitude: 0, longitude: 0 },
|
||||
{ latitude: 1, longitude: 1 },
|
||||
],
|
||||
};
|
||||
const viewer = { scene: {} };
|
||||
const { draw, unbind } = bindFakeDraw(viewer, {
|
||||
camera: {
|
||||
pose: () => ({ position: { x: 2e7, y: 0, z: 0 } }),
|
||||
on: () => () => {},
|
||||
},
|
||||
});
|
||||
t.after(unbind);
|
||||
state._enabled = true;
|
||||
state._viewer = viewer;
|
||||
const syncs = { labels: 0, orbits: 0 };
|
||||
const parts = {
|
||||
model: { missionMarkerColor: () => [1, 1, 1, 1] },
|
||||
policyHelpers: { launchStatusAllowsOrbit: () => false },
|
||||
paths: { surfaceSafePath: (positions) => positions },
|
||||
panel: { updateMissionTelemetry: noop },
|
||||
overlays: {
|
||||
missionHoverReticleImage: () => ({}),
|
||||
hideReplayVehicleOverlay: noop,
|
||||
updateReplayVehicleOverlay: noop,
|
||||
refreshSelectedMissionOverlayText: noop,
|
||||
missionAnchorVisible: () => true,
|
||||
syncMissionOverlayEntries: () => syncs.labels++,
|
||||
},
|
||||
orbitRendering: {
|
||||
syncMissionOrbitPrimitiveVisibility: () => syncs.orbits++,
|
||||
},
|
||||
};
|
||||
const services = {
|
||||
geometry: { getKeyholeGeometry: noop },
|
||||
satellites: {},
|
||||
};
|
||||
parts.selection = createSelection({ state, services, parts });
|
||||
const rendering = createRendering({ state, services, parts });
|
||||
rendering.attach(viewer);
|
||||
rendering.showMissions(true);
|
||||
rendering.addLaunchEntity(launch, null);
|
||||
rendering.flushLaunchEntities();
|
||||
// The drawn item by id, across the mission sets.
|
||||
const item = (id) => {
|
||||
for (const record of draw.sets.values())
|
||||
if (!record.disposed && record.items.has(id)) return record.items.get(id);
|
||||
return null;
|
||||
};
|
||||
assert.ok(item(`rocket-launch:${launch.id}`), 'the marker is drawn');
|
||||
assert.ok(item(`rocket-trajectory:${launch.id}:0`), 'the path is drawn');
|
||||
const shown = () => {
|
||||
rendering.updateMissionFrame();
|
||||
return {
|
||||
marker: item(`rocket-launch:${launch.id}`).show,
|
||||
path: item(`rocket-trajectory:${launch.id}:0`).show,
|
||||
};
|
||||
};
|
||||
return { state, rendering, launch, syncs, shown, draw };
|
||||
}
|
||||
|
||||
test('live shows every launch in the window, lifted off or not', (t) => {
|
||||
const { state, launch, shown } = scene(t);
|
||||
assert.equal(state.launchPending(launch), false);
|
||||
assert.deepEqual(shown(), { marker: true, path: true });
|
||||
});
|
||||
|
||||
test('away from live a launch shows from its lift-off on', (t) => {
|
||||
const { state, launch, syncs, shown } = scene(t);
|
||||
worldClock.seek(LAUNCH_MS - 60_000);
|
||||
assert.equal(state.launchPending(launch), true);
|
||||
assert.deepEqual(shown(), { marker: false, path: false });
|
||||
assert.deepEqual(syncs, { labels: 1, orbits: 1 }, 'its label and orbit go');
|
||||
shown();
|
||||
assert.deepEqual(syncs, { labels: 1, orbits: 1 }, 'once, not each frame');
|
||||
|
||||
worldClock.seek(LAUNCH_MS);
|
||||
assert.equal(state.launchPending(launch), false);
|
||||
assert.deepEqual(shown(), { marker: true, path: true });
|
||||
assert.deepEqual(syncs, { labels: 2, orbits: 2 });
|
||||
});
|
||||
|
||||
test('the selected mission stays whenever it flies', (t) => {
|
||||
const { state, rendering, launch, shown } = scene(t);
|
||||
state._selectedLaunchId = launch.id;
|
||||
rendering.isolateMission(launch.id);
|
||||
worldClock.seek(LAUNCH_MS - 60_000);
|
||||
assert.deepEqual(shown(), { marker: true, path: true });
|
||||
});
|
||||
|
||||
test('the live orbit rings turn at the frame time, not the wall clock', (t) => {
|
||||
const { draw } = scene(t);
|
||||
const orbits = [...draw.sets.values()].find((record) =>
|
||||
record.spec.id.endsWith(':orbits'),
|
||||
);
|
||||
assert.deepEqual(orbits.spec.motionClock, { kind: 'scene' });
|
||||
});
|
||||
Reference in new issue
Block a user