mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-24 04:02:19 +00:00
Builds on the ISS 3D model (PR #1690) and brings it onto main's renderer seam: the station models are items of a `models` draw set, posed by heading, pitch and roll from the station's flight axes (`headingPitchRollOfAxes`), with the camera, canvas and clicks read from the renderer's ports; no satellites file reaches Cesium. The joint drivers write column-major matrices into node poses the model part keeps, for a renderer that can pose nodes; until the draw contract has that member the models draw rigid. - ISS joints take their angles from NASA's ISSLive telemetry, relayed by the server behind ISS_TELEMETRY_ENABLED. - STATION and LIVE sections of Context replace the floating command panel and player; both collapse like the Radio section. - Cockpit rides the ISS from mounts on its model; the LIVE page in the Cockpit briefing. - Tiangong as a second station model, with computed joints. - Installations: a label-box click selects the site.
139 lines
4.2 KiB
JavaScript
139 lines
4.2 KiB
JavaScript
/**
|
|
* The Cockpit briefing's pages and the state it starts in. It needs only the
|
|
* i18n module and the regional-news window, so the controller and the view
|
|
* can both read it.
|
|
*/
|
|
import { REGIONAL_NEWS_WINDOW_HOURS } from '../data/regionalNewsWindow.js';
|
|
import { msg, t } from '../i18n/index.js';
|
|
|
|
// i18n-ignore: provider name
|
|
/** The news feed named before any briefing has answered. */
|
|
export const DEFAULT_NEWS_SOURCE = 'GOOGLE NEWS RSS';
|
|
|
|
/**
|
|
* The Regional News footer for a fresh, empty or unavailable list: the feed
|
|
* and the window its articles are held to.
|
|
* @param {string} [source]
|
|
* @param {number} [hours]
|
|
* @returns {string}
|
|
*/
|
|
export function newsWindowFooter(
|
|
source = DEFAULT_NEWS_SOURCE,
|
|
hours = REGIONAL_NEWS_WINDOW_HOURS,
|
|
) {
|
|
return t('{source} · LAST {hours} H', { source, hours });
|
|
}
|
|
|
|
export const COCKPIT_BRIEF_PAGES = [
|
|
{
|
|
id: 'signals',
|
|
kickerKey: msg('LIVE SIGNALS'),
|
|
subtitleKey: msg('OBSERVED / MAPPED PINGS'),
|
|
sourceKey: msg('SOURCE-BACKED EVENTS · NO SYNTHETIC NEWS'),
|
|
},
|
|
{
|
|
id: 'news',
|
|
kickerKey: msg('REGIONAL NEWS'),
|
|
subtitleKey: msg('LATEST LOCATION-MATCHED REPORTING'),
|
|
// The news footer comes from the news state (`news.footer`), not here.
|
|
},
|
|
{
|
|
id: 'local',
|
|
kickerKey: msg('LOCAL INFO'),
|
|
subtitleKey: msg('PLACE / CONDITIONS / POSITION'),
|
|
// Attribution stays English.
|
|
source: 'NATURAL EARTH · OPEN-METEO · UTC',
|
|
},
|
|
];
|
|
|
|
/**
|
|
* The fourth page, LIVE: the ridden subject's live video, the LIVE section
|
|
* of Context in the card. Offered only while a stream is on offer (the
|
|
* `gev-live` store's view is not null); the automatic cycle never turns to it.
|
|
*/
|
|
export const COCKPIT_LIVE_BRIEF_PAGE = Object.freeze({
|
|
id: 'live',
|
|
kickerKey: msg('LIVE VIDEO'),
|
|
subtitleKey: msg('STREAM ATTACHED TO THE SUBJECT'),
|
|
// Attribution stays English; the page itself credits the stream's owner.
|
|
source: 'YOUTUBE EMBEDDED PLAYER · MUTED',
|
|
});
|
|
|
|
/**
|
|
* The pages on offer: the three fixed ones, and LIVE after them while the
|
|
* ridden subject has a stream.
|
|
* @param {boolean} liveOffered
|
|
* @returns {readonly object[]}
|
|
*/
|
|
export function cockpitBriefPages(liveOffered) {
|
|
return liveOffered
|
|
? [...COCKPIT_BRIEF_PAGES, COCKPIT_LIVE_BRIEF_PAGE]
|
|
: COCKPIT_BRIEF_PAGES;
|
|
}
|
|
|
|
/**
|
|
* Where the automatic cycle goes from the page at `index`: the next page
|
|
* that is not LIVE (video is never started by the cycle), wrapping; null
|
|
* while LIVE is the shown page, where the cycle waits as it does under the
|
|
* pointer.
|
|
* @param {readonly object[]} pages
|
|
* @param {number} index
|
|
* @returns {number|null}
|
|
*/
|
|
export function briefCycleTarget(pages, index) {
|
|
if (pages[index]?.id === 'live') return null;
|
|
const count = pages.length;
|
|
let next = (index + 1) % count;
|
|
if (pages[next]?.id === 'live') next = (next + 1) % count;
|
|
return next;
|
|
}
|
|
|
|
// The cycle toggle's tooltip, as literal keys for the extractor.
|
|
export const CYCLE_HELP_KEYS = Object.freeze({
|
|
on: msg(
|
|
'Stop automatic page cycling. Previous, Next, and the SIG/NEWS/LOCAL tabs stay available.',
|
|
),
|
|
off: msg(
|
|
'Cycle briefing pages automatically every 9 seconds (Signals → News → Local). Pauses while you hover or focus the panel. Live signal data refreshes continuously either way.',
|
|
),
|
|
});
|
|
|
|
/**
|
|
* The briefing as it first renders: the Live Signals page, cycling off, news
|
|
* still loading and no region yet. The controller keeps it, changes it in
|
|
* place and publishes a copy; `CockpitBriefing` renders it.
|
|
* @returns {object}
|
|
*/
|
|
export function createBriefState() {
|
|
const page = COCKPIT_BRIEF_PAGES[0];
|
|
return {
|
|
pageIndex: 0,
|
|
pageId: page.id,
|
|
kicker: t(page.kickerKey),
|
|
subtitle: t(page.subtitleKey),
|
|
position: `1 / ${COCKPIT_BRIEF_PAGES.length}`,
|
|
source: t(page.sourceKey),
|
|
autoRotate: false,
|
|
autoLabel: t('CYCLE OFF'),
|
|
autoHelp: t(CYCLE_HELP_KEYS.off),
|
|
regionalStatus: null,
|
|
news: {
|
|
statusHidden: false,
|
|
state: null,
|
|
status: t('ACQUIRING REGIONAL NEWS'),
|
|
footer: newsWindowFooter(),
|
|
articles: [],
|
|
},
|
|
local: {
|
|
place: t('RESOLVING REGION'),
|
|
coordinates: '--',
|
|
temperature: '—',
|
|
wind: '—',
|
|
windDirection: '—',
|
|
condition: t('UNKNOWN'),
|
|
cloud: '—',
|
|
precipitation: '—',
|
|
},
|
|
};
|
|
}
|