From af3383a5a9d0e551e8080570bf28520b6c87c818 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Fri, 13 Nov 2026 21:13:35 -0800 Subject: [PATCH] Display panel: a Sky group for the atmosphere, day and night, sun, moon, stars and Milky Way createViewSky sets globe.sky from the panel's switches and Milky Way slider and keeps the choice for the next visit; what the user has not set stays as the renderer draws it. Distance fog stays with the styles that switch it. --- CHANGELOG.md | 4 ++ src/app/controls.js | 7 ++ src/i18n/locales/ar.json | 8 ++- src/i18n/locales/de.json | 8 ++- src/i18n/locales/es.json | 8 ++- src/i18n/locales/fr.json | 8 ++- src/i18n/locales/he.json | 8 ++- src/i18n/locales/it.json | 8 ++- src/i18n/locales/ja.json | 8 ++- src/i18n/locales/pt.json | 8 ++- src/i18n/locales/ru.json | 8 ++- src/i18n/locales/sv.json | 8 ++- src/i18n/locales/uk.json | 8 ++- src/i18n/locales/zh-CN.json | 8 ++- src/i18n/locales/zh-Hant.json | 8 ++- src/ui/stores/display.js | 13 ++++ src/ui/views/panels/DisplayPanel.vue | 22 +++++- src/viewSky.js | 103 +++++++++++++++++++++++++++ src/viewSky.test.mjs | 92 ++++++++++++++++++++++++ 19 files changed, 331 insertions(+), 14 deletions(-) create mode 100644 src/viewSky.js create mode 100644 src/viewSky.test.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b06f41f3..0b7ec8980 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +- The Display panel has a Sky group on a renderer with a sky to set: the + atmosphere, day and night (sun lighting by scene time), the sun, the + moon, the stars and the Milky Way's brightness. The choice is kept for the + next visit; what is not set stays as the renderer draws it (samehkhamis). - The renderer contract no longer ties a renderer's look to the default renderer's: `globe.sky` switches parts of the sky on and off, while how the sky, atmosphere, haze, lighting, tone mapping and exposure look is diff --git a/src/app/controls.js b/src/app/controls.js index 70ee51fb8..a3ec11905 100644 --- a/src/app/controls.js +++ b/src/app/controls.js @@ -3,6 +3,7 @@ import { StyleManager } from '../ui/composition.js'; import { applyStartView, START_VIEW } from '../camera.js'; import { initCockpitCloudEffects } from '../cockpitCloudEffects.js'; import { createViewWeather } from '../viewWeather.js'; +import { createViewSky } from '../viewSky.js'; import { findGlobe } from '../render/rendererOf.js'; import { useDisplayStore } from '../ui/stores/display.js'; import { applicationPinia } from '../ui/vueRuntime.js'; @@ -70,6 +71,12 @@ export function createApplicationControls({ store: useDisplayStore(applicationPinia()), }); defer(() => viewWeather.destroy()); + // The atmosphere, sun lighting, sun, moon, stars and Milky Way the user + // chooses in the Display panel. + const viewSky = createViewSky(viewer, { + store: useDisplayStore(applicationPinia()), + }); + defer(() => viewSky.destroy()); loaderStatus.textContent = styleManager.hasShareState ? t('Restoring shared view...') diff --git a/src/i18n/locales/ar.json b/src/i18n/locales/ar.json index c04954e31..f9beec3f6 100644 --- a/src/i18n/locales/ar.json +++ b/src/i18n/locales/ar.json @@ -3956,5 +3956,11 @@ "Confirm: remove every added entry from Data Layers": "تأكيد: إزالة كل الإدخالات المُضافة من طبقات البيانات", "Remove every added entry from Data Layers": "إزالة كل الإدخالات المُضافة من طبقات البيانات", "Showing {shown} of {total}": "عرض {shown} من {total}", - "BROWSE DATA LIBRARY": "تصفّح مكتبة البيانات" + "BROWSE DATA LIBRARY": "تصفّح مكتبة البيانات", + "Atmosphere": "الغلاف الجوي", + "Day and night": "الليل والنهار", + "Sun": "الشمس", + "Moon": "القمر", + "Stars": "النجوم", + "Milky Way": "درب التبانة" } diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 02c709ff8..5520dc750 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -3608,5 +3608,11 @@ "Confirm: remove every added entry from Data Layers": "Bestätigen: alle hinzugefügten Einträge aus Datenebenen entfernen", "Remove every added entry from Data Layers": "Alle hinzugefügten Einträge aus Datenebenen entfernen", "Showing {shown} of {total}": "{shown} von {total} angezeigt", - "BROWSE DATA LIBRARY": "DATENBIBLIOTHEK DURCHSUCHEN" + "BROWSE DATA LIBRARY": "DATENBIBLIOTHEK DURCHSUCHEN", + "Atmosphere": "Atmosphäre", + "Day and night": "Tag und Nacht", + "Sun": "Sonne", + "Moon": "Mond", + "Stars": "Sterne", + "Milky Way": "Milchstraße" } diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index a5d5a370f..c60778c96 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -3695,5 +3695,11 @@ "500–1,000 m": "500–1000 m", "1,000–2,000 m": "1000–2000 m", "2,000–3,000 m": "2000–3000 m", - "3,000 m and above": "3000 m o más" + "3,000 m and above": "3000 m o más", + "Atmosphere": "Atmósfera", + "Day and night": "Día y noche", + "Sun": "Sol", + "Moon": "Luna", + "Stars": "Estrellas", + "Milky Way": "Vía Láctea" } diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index b13b766a6..9a5b365da 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -3695,5 +3695,11 @@ "Confirm: remove every added entry from Data Layers": "Confirmer : retirer du panneau Couches toutes les entrées ajoutées", "Remove every added entry from Data Layers": "Retirer du panneau Couches toutes les entrées ajoutées", "Showing {shown} of {total}": "Affichées : {shown} sur {total}", - "BROWSE DATA LIBRARY": "PARCOURIR LA BIBLIOTHÈQUE DE DONNÉES" + "BROWSE DATA LIBRARY": "PARCOURIR LA BIBLIOTHÈQUE DE DONNÉES", + "Atmosphere": "Atmosphère", + "Day and night": "Jour et nuit", + "Sun": "Soleil", + "Moon": "Lune", + "Stars": "Étoiles", + "Milky Way": "Voie lactée" } diff --git a/src/i18n/locales/he.json b/src/i18n/locales/he.json index 5e4efe08c..0cb21bf65 100644 --- a/src/i18n/locales/he.json +++ b/src/i18n/locales/he.json @@ -3695,5 +3695,11 @@ "Confirm: remove every added entry from Data Layers": "אישור: הסרת כל הפריטים שנוספו משכבות נתונים", "Remove every added entry from Data Layers": "הסרת כל הפריטים שנוספו משכבות נתונים", "Showing {shown} of {total}": "מוצגים {shown} מתוך {total}", - "BROWSE DATA LIBRARY": "עיון בספריית הנתונים" + "BROWSE DATA LIBRARY": "עיון בספריית הנתונים", + "Atmosphere": "אטמוספרה", + "Day and night": "יום ולילה", + "Sun": "שמש", + "Moon": "ירח", + "Stars": "כוכבים", + "Milky Way": "שביל החלב" } diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index ed4ef48a0..729ad3588 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -3695,5 +3695,11 @@ "Confirm: remove every added entry from Data Layers": "Conferma: rimuovi da Livelli dati tutte le voci aggiunte", "Remove every added entry from Data Layers": "Rimuovi da Livelli dati tutte le voci aggiunte", "Showing {shown} of {total}": "Mostrati: {shown} su {total}", - "BROWSE DATA LIBRARY": "ESPLORA LIBRERIA DATI" + "BROWSE DATA LIBRARY": "ESPLORA LIBRERIA DATI", + "Atmosphere": "Atmosfera", + "Day and night": "Giorno e notte", + "Sun": "Sole", + "Moon": "Luna", + "Stars": "Stelle", + "Milky Way": "Via Lattea" } diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 4ff110eff..bd7e9481e 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -3521,5 +3521,11 @@ "Confirm: remove every added entry from Data Layers": "確認:追加したすべての項目をデータレイヤーから削除", "Remove every added entry from Data Layers": "追加したすべての項目をデータレイヤーから削除", "Showing {shown} of {total}": "{total}件中{shown}件を表示", - "BROWSE DATA LIBRARY": "データライブラリを見る" + "BROWSE DATA LIBRARY": "データライブラリを見る", + "Atmosphere": "大気", + "Day and night": "昼と夜", + "Sun": "太陽", + "Moon": "月", + "Stars": "星", + "Milky Way": "天の川" } diff --git a/src/i18n/locales/pt.json b/src/i18n/locales/pt.json index 0f9d59d72..5b869acde 100644 --- a/src/i18n/locales/pt.json +++ b/src/i18n/locales/pt.json @@ -3695,5 +3695,11 @@ "Confirm: remove every added entry from Data Layers": "Confirmar: remover de \"Camadas de dados\" todas as entradas adicionadas", "Remove every added entry from Data Layers": "Remover de \"Camadas de dados\" todas as entradas adicionadas", "Showing {shown} of {total}": "Mostrando {shown} de {total}", - "BROWSE DATA LIBRARY": "EXPLORAR BIBLIOTECA DE DADOS" + "BROWSE DATA LIBRARY": "EXPLORAR BIBLIOTECA DE DADOS", + "Atmosphere": "Atmosfera", + "Day and night": "Dia e noite", + "Sun": "Sol", + "Moon": "Lua", + "Stars": "Estrelas", + "Milky Way": "Via Láctea" } diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index 09bf7cc06..0e205eb49 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -3782,5 +3782,11 @@ "500–1,000 m": "500–1000 м", "1,000–2,000 m": "1000–2000 м", "2,000–3,000 m": "2000–3000 м", - "3,000 m and above": "3000 м и выше" + "3,000 m and above": "3000 м и выше", + "Atmosphere": "Атмосфера", + "Day and night": "День и ночь", + "Sun": "Солнце", + "Moon": "Луна", + "Stars": "Звёзды", + "Milky Way": "Млечный Путь" } diff --git a/src/i18n/locales/sv.json b/src/i18n/locales/sv.json index 6c216ca90..2eda0376c 100644 --- a/src/i18n/locales/sv.json +++ b/src/i18n/locales/sv.json @@ -3608,5 +3608,11 @@ "Confirm: remove every added entry from Data Layers": "Bekräfta: ta bort alla tillagda poster från Datalager", "Remove every added entry from Data Layers": "Ta bort alla tillagda poster från Datalager", "Showing {shown} of {total}": "Visar {shown} av {total}", - "BROWSE DATA LIBRARY": "BLÄDDRA I DATABIBLIOTEKET" + "BROWSE DATA LIBRARY": "BLÄDDRA I DATABIBLIOTEKET", + "Atmosphere": "Atmosfär", + "Day and night": "Dag och natt", + "Sun": "Sol", + "Moon": "Måne", + "Stars": "Stjärnor", + "Milky Way": "Vintergatan" } diff --git a/src/i18n/locales/uk.json b/src/i18n/locales/uk.json index f7d3d0a11..174947d55 100644 --- a/src/i18n/locales/uk.json +++ b/src/i18n/locales/uk.json @@ -3782,5 +3782,11 @@ "Confirm: remove every added entry from Data Layers": "Підтвердити: видалити всі додані записи з «Шарів даних»", "Remove every added entry from Data Layers": "Видалити всі додані записи з «Шарів даних»", "Showing {shown} of {total}": "Показано {shown} з {total}", - "BROWSE DATA LIBRARY": "ВІДКРИТИ БІБЛІОТЕКУ ДАНИХ" + "BROWSE DATA LIBRARY": "ВІДКРИТИ БІБЛІОТЕКУ ДАНИХ", + "Atmosphere": "Атмосфера", + "Day and night": "День і ніч", + "Sun": "Сонце", + "Moon": "Місяць", + "Stars": "Зорі", + "Milky Way": "Чумацький Шлях" } diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 47a56ced6..7346e0bb7 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -3521,5 +3521,11 @@ "Confirm: remove every added entry from Data Layers": "确认:从数据图层中移除所有已添加条目", "Remove every added entry from Data Layers": "从数据图层中移除所有已添加条目", "Showing {shown} of {total}": "显示 {shown} / {total}", - "BROWSE DATA LIBRARY": "浏览数据资源库" + "BROWSE DATA LIBRARY": "浏览数据资源库", + "Atmosphere": "大气", + "Day and night": "昼夜", + "Sun": "太阳", + "Moon": "月亮", + "Stars": "星星", + "Milky Way": "银河" } diff --git a/src/i18n/locales/zh-Hant.json b/src/i18n/locales/zh-Hant.json index 9807e5416..b91e798f1 100644 --- a/src/i18n/locales/zh-Hant.json +++ b/src/i18n/locales/zh-Hant.json @@ -3521,5 +3521,11 @@ "Confirm: remove every added entry from Data Layers": "確認:從數據圖層中移除所有已添加條目", "Remove every added entry from Data Layers": "從數據圖層中移除所有已添加條目", "Showing {shown} of {total}": "顯示 {shown} / {total}", - "BROWSE DATA LIBRARY": "瀏覽數據資源庫" + "BROWSE DATA LIBRARY": "瀏覽數據資源庫", + "Atmosphere": "大氣", + "Day and night": "晝夜", + "Sun": "太陽", + "Moon": "月亮", + "Stars": "星星", + "Milky Way": "銀河" } diff --git a/src/ui/stores/display.js b/src/ui/stores/display.js index 0826c79b9..28ee5c6ba 100644 --- a/src/ui/stores/display.js +++ b/src/ui/stores/display.js @@ -39,6 +39,17 @@ export const useDisplayStore = defineStore('gev-display', () => { weather.value = next && markRaw(next); } + /** + * The Sky group, `{switches, milkyWay}` (switches by name, the Milky Way + * in percent); null where the renderer has no sky to set. + */ + const sky = shallowRef(null); + + /** @param {?object} next A fresh presentation of the Sky group. */ + function publishSky(next) { + sky.value = next && markRaw(next); + } + /** The Draw controls; null until the draw tool first renders. */ const draw = shallowRef(null); @@ -121,6 +132,8 @@ export const useDisplayStore = defineStore('gev-display', () => { publishModels3d, weather, publishWeather, + sky, + publishSky, draw, publishDraw, geoImport, diff --git a/src/ui/views/panels/DisplayPanel.vue b/src/ui/views/panels/DisplayPanel.vue index 9e8d5e524..5f5ff4857 100644 --- a/src/ui/views/panels/DisplayPanel.vue +++ b/src/ui/views/panels/DisplayPanel.vue @@ -17,7 +17,7 @@ import { StyleParameterRows } from '../../styleParameters.js'; // and each publishes them; until they do, the panel shows its initial markup. // Draw and Import live in UTILITIES (LayerPanelsView). const display = useDisplayStore(); -const { view, models3d, parameters, cockpitPortal, weather } = storeToRefs(display); +const { view, models3d, parameters, cockpitPortal, weather, sky } = storeToRefs(display); // A control's change goes to its owner (DisplayBindings). const act = (name, ...args) => display.act(name, ...args); const pct = (value) => `${value}%`; @@ -41,6 +41,13 @@ const weatherRows = computed(() => [ { key: 'rain', label: t('Rain') }, { key: 'snow', label: t('Snow') }, ]); +const skyRows = computed(() => [ + { key: 'atmosphere', label: t('Atmosphere'), icon: 'public' }, + { key: 'lighting', label: t('Day and night'), icon: 'adjust' }, + { key: 'sun', label: t('Sun'), icon: 'light_mode' }, + { key: 'moon', label: t('Moon'), icon: 'dark_mode' }, + { key: 'stars', label: t('Stars'), icon: 'flare' }, +]); const models3dOn = computed(() => models3d.value?.pressed ?? true); const modelsMode = computed(() => models3d.value?.mode ?? 'proximity'); const modelsOptions = computed(() => [ @@ -181,6 +188,19 @@ const allocationOptions = computed(() => [ {{ t('Celestial') }} + +
+ +
+ {{ t('Milky Way') }} + + {{ pct(sky.milkyWay) }} +
+