Carry the Nepal event images, playback and media across globes

This commit is contained in:
German Khokhlov committed 2026-11-03 03:57:18 +04:00
1 parent 811bcaff85
commit 4e09559337
19 files changed
+426 -84

No files matched your search

+3 -1
View File
@@ -160,7 +160,9 @@ export function createApplicationCatalog({
// Catalog order: [layer id(s), construction]. Only the layers the
// engine can show are constructed (renderers.js).
const entries = [
['bhote-koshi-2026', () => createBhoteKoshiEventLayer()],
['bhote-koshi-2026', () => sessionModel('bhote-koshi-2026', () => createBhoteKoshiEventLayer({
createNativeRenderer: (engine) => rendererFor('bhote-koshi-2026', engine),
}))],
[
'bhote-koshi-locator',
() =>
+2 -2
View File
@@ -45,10 +45,10 @@ export function createApplicationData({
onData?.(dataManager);
if (!catalog?.layers || !catalog?.metadata)
throw new TypeError('An application layer catalog is required');
const attached = dataManager.bindCatalog(viewer, engine, catalog);
for (const layer of catalog.layers) layer.attachDataManager?.(dataManager);
for (const layer of catalog.layers)
layer.attachMapStackController?.(mapStackController);
const attached = dataManager.bindCatalog(viewer, engine, catalog);
for (const layer of catalog.layers) layer.attachDataManager?.(dataManager);
if (allowQaRegistration) {
window.__gevQaRegisterLayer = (targetManager, layerModule) => {
+1
View File
@@ -43,6 +43,7 @@ test('the Navara mode registers migrated renderers once', async () => {
.available()
.map(({ id }) => id),
[
'bhote-koshi-2026',
'bhote-koshi-locator',
'flights',
'military',
+9 -6
View File
@@ -38,9 +38,7 @@ export function navaraModeNotice(availability) {
const names = availability.available().map(({ name }) => name);
return Object.freeze({
label: t('Experimental Navara engine'),
detail: names.length
? `Data layers: ${names.join(', ')}; the other layers and director are unavailable`
: 'No data layers on this engine yet; cockpit and director are unavailable',
detail: names.length ? `Data layers: ${names.join(', ')}` : 'No registered data layers',
});
}
@@ -120,6 +118,10 @@ export async function registerNavaraLayerRenderers() {
return (engine, options) => createWeatherNavaraRenderer(engine, navaraViews.get(engine), options);
},
])),
'bhote-koshi-2026': async () => {
const { createNepalEventDisplay } = await import('../layers/bhoteKoshi/render/navara.js');
return (engine) => createNepalEventDisplay(engine, navaraViews.get(engine));
},
'bhote-koshi-locator': async () => {
const { drawStorySource } = await import('../layers/shared/render/navaraStory.js');
return (engine, { data }) => drawStorySource(engine, navaraViews.get(engine), data);
@@ -331,6 +333,7 @@ export function createViewerlessTools({
placeSearch,
voice = {},
startChrome,
sceneDirector,
signal,
defer,
}) {
@@ -402,7 +405,7 @@ export function createViewerlessTools({
styleManager,
tileset: null,
dataManager,
sceneDirector: null,
sceneDirector,
mapStackController,
annotations: null,
weatherEffects: null,
@@ -428,7 +431,7 @@ export function createViewerlessTools({
engine,
styleManager,
dataManager,
sceneDirector: null,
sceneDirector,
annotations: null,
});
defer(() => {
@@ -437,5 +440,5 @@ export function createViewerlessTools({
delete window.__gevVoiceCommands;
});
debug.voiceCommands = voiceCommands;
return { sceneDirector: null, annotations: null, voiceCommands };
return { sceneDirector, annotations: null, voiceCommands };
}
+17 -16
View File
@@ -41,22 +41,6 @@ export function createApplicationTools({
const { viewer, engine, tileset, mapStackController, operations } = scene;
const { styleManager, weatherEffects, cockpitCloudEffects } = controls;
const { dataManager } = data;
// Without a viewer (the Navara mode) the tools load with that mode's code.
if (!viewer) {
return import('./navaraMode.js').then(({ createViewerlessTools }) =>
createViewerlessTools({
scene,
controls,
data,
loadingScreen,
placeSearch,
voice,
startChrome,
signal,
defer,
}),
);
}
const sceneDirector = new SceneDirector(viewer, styleManager, dataManager, {
engine,
dataPacks: sceneDataPacks,
@@ -68,6 +52,23 @@ export function createApplicationTools({
?.module.attachSceneController(sceneDirector);
defer(() => sceneDirector.destroy());
onSceneDirector?.(sceneDirector);
// Without a viewer (the Navara mode) the tools load with that mode's code.
if (!viewer) {
return import('./navaraMode.js').then(({ createViewerlessTools }) =>
createViewerlessTools({
scene,
controls,
data,
loadingScreen,
placeSearch,
voice,
sceneDirector,
startChrome,
signal,
defer,
}),
);
}
const annotations = initAnnotations({
viewer,
tileset,
+10 -7
View File
@@ -17,11 +17,15 @@ import {
// The tools without a viewer (the experimental Navara engine); they load
// from src/app/navaraMode.js.
test('without a viewer the tools run the governor on the engine, show the notice, create no viewer tools and run voice on the engine', async (t) => {
const saved = { window: globalThis.window, document: globalThis.document };
const saved = { window: globalThis.window, document: globalThis.document, localStorage:globalThis.localStorage };
const listeners = new Map();
globalThis.window = {};
globalThis.localStorage = { getItem:()=>null,setItem(){},removeItem(){} };
globalThis.document = {
hidden: false,
getElementById: () => null,
querySelector: () => null,
body: {classList:{add(){},remove(){},toggle(){},contains(){return false;}},appendChild(){}},
addEventListener: (type, fn) => listeners.set(type, fn),
removeEventListener: (type, fn) => {
if (listeners.get(type) === fn) listeners.delete(type);
@@ -84,7 +88,7 @@ test('without a viewer the tools run the governor on the engine, show the notice
signal: new AbortController().signal,
defer: (dispose) => cleanups.push(dispose),
});
assert.equal(tools.sceneDirector, null);
assert.ok(tools.sceneDirector);
assert.equal(tools.annotations, null);
assert.ok(tools.voiceCommands, 'voice runs on the engine');
assert.equal(window.__gevVoiceCommands, tools.voiceCommands);
@@ -94,8 +98,7 @@ test('without a viewer the tools run the governor on the engine, show the notice
const scene = await voice.runner('control_scene', {
action: 'list',
});
assert.equal(scene.ok, false);
assert.equal(scene.code, 'UNAVAILABLE_ON_ENGINE');
assert.equal(scene.ok, true);
assert.equal(chrome.length, 1);
assert.equal(chrome[0].initializeWelcome, null, 'no first-run welcome');
assert.equal(chrome[0].styleManager, styleManager);
@@ -112,14 +115,14 @@ test('without a viewer the tools run the governor on the engine, show the notice
]);
assert.match(
`${notice.label}: ${notice.detail}`,
/^Experimental Navara engine: no data layers on this engine yet; cockpit and director are unavailable$/i,
/^Experimental Navara engine: no registered data layers$/i,
);
// With Navara renderers, the notice names the layers it shows.
const registry = createRendererRegistry();
registry.register('navara', { satellites: () => ({}), flights: () => ({}) });
assert.equal(
navaraModeNotice(createLayerAvailability('navara', { registry })).detail,
'Data layers: Live Flights, Satellites; the other layers and director are unavailable',
'Data layers: Live Flights, Satellites',
);
// The governor drives the engine's continuous rendering.
assert.equal(isRenderGovernorInstalled(engine), true);
@@ -130,7 +133,7 @@ test('without a viewer the tools run the governor on the engine, show the notice
const debug = window.__godsEyeView;
assert.equal(debug.viewer, null);
assert.equal(debug.engine, engine);
assert.equal(debug.sceneDirector, null);
assert.equal(debug.sceneDirector, tools.sceneDirector);
assert.equal(debug.dataManager, dataManager);
assert.equal(debug.voiceCommands, tools.voiceCommands);
listeners.get('visibilitychange')();