lighting: remove the palette terrain model - physics is the only lighting, themes tint it through THEMES[theme].lighting; debug panel shows the active palette and its tint/gain; credits no longer claim VIIRS

This commit is contained in:
Richard Zink committed 2026-10-11 15:39:42 +02:00
1 parent f26ac6c0ce
commit 4369afd3ef
3 files changed
+405 -478

No files matched your search

+19 -75
View File
@@ -9,9 +9,10 @@
<script>
(function() {
var theme = (window.CONFIG && window.CONFIG.theme) || 'ash';
var cssFile = window.THEMES && window.THEMES[theme];
var entry = window.THEMES && window.THEMES[theme];
var cssFile = (entry && entry.css) || (window.THEMES && window.THEMES.ash && window.THEMES.ash.css) || 'ash.css';
var css = document.getElementById('theme-css');
if (css) css.href = cssFile || (window.THEMES && window.THEMES.ash) || 'ash.css';
if (css) css.href = cssFile;
// standalone build (build.py): themes are embedded in
// window.__inlineThemeCss and the external link is disabled
if (window.__inlineThemeCss && window.__inlineThemeCss[theme]) {
@@ -928,13 +929,6 @@ window.sunPalettes = [
}
}
function adjustColor(color, factor) {
var r = Math.min(255, Math.floor(((color >> 16) & 255) * factor));
var g = Math.min(255, Math.floor(((color >> 8) & 255) * factor));
var b = Math.min(255, Math.floor((color & 255) * factor));
return (r << 16) | (g << 8) | b;
}
function shiftColor(color, delta) {
var r = Math.max(0, Math.min(255, ((color >> 16) & 255) + delta));
var g = Math.max(0, Math.min(255, ((color >> 8) & 255) + delta));
@@ -942,50 +936,8 @@ window.sunPalettes = [
return (r << 16) | (g << 8) | b;
}
function getWeatherModifiers(code) {
// Returns {cloudDark: factor, cloudLight: factor, skyShift: shift, bgShift: shift}
// code is WMO weather code from open-meteo
if (code === 0) {
// Clear sky - lighter clouds, brighter sky
return { cloudDark: 0.7, cloudLight: 1.3, skyShift: 15, bgShift: 15 };
} else if (code >= 1 && code <= 3) {
// Mainly clear to overcast - neutral
return { cloudDark: 0.95, cloudLight: 1.0, skyShift: 0, bgShift: -5 };
} else if (code === 45 || code === 48) {
// Fog - cool, washed out
return { cloudDark: 1.1, cloudLight: 0.85, skyShift: 10, bgShift: 10 };
} else if ((code >= 51 && code <= 57) || (code >= 61 && code <= 67)) {
// Drizzle / Rain - darker, slightly cooler
return { cloudDark: 1.3, cloudLight: 0.7, skyShift: -15, bgShift: -20 };
} else if ((code >= 71 && code <= 77) || (code >= 85 && code <= 86)) {
// Snow - brighter (light reflection)
return { cloudDark: 0.7, cloudLight: 1.5, skyShift: 25, bgShift: 25 };
} else if (code >= 80 && code <= 82) {
// Rain showers - darker
return { cloudDark: 1.4, cloudLight: 0.6, skyShift: -20, bgShift: -25 };
} else if (code >= 95) {
// Thunderstorm - very dark, dramatic
return { cloudDark: 1.6, cloudLight: 0.4, skyShift: -30, bgShift: -35 };
}
return { cloudDark: 1.0, cloudLight: 1.0, skyShift: 0, bgShift: 0 };
}
var currentWeatherCode = -1;
function applyWeatherModifiers(c, code) {
var m = getWeatherModifiers(code);
return {
sky: c.sky,
cloud: adjustColor(c.cloud, m.cloudLight),
cloudShadow: adjustColor(c.cloudShadow, m.cloudDark),
sun: adjustColor(c.sun, m.cloudLight),
sunGlare: adjustColor(c.sunGlare, m.cloudLight),
sunLight: adjustColor(c.sunLight, m.cloudLight),
bg: shiftColor(c.bg, m.bgShift),
sunVis: c.sunVis
};
}
// ============ Clock & Sun/Moon Calculations ============
var hourHand = document.getElementById('hour-hand');
@@ -1038,10 +990,6 @@ window.sunPalettes = [
return (h < 10 ? '0' : '') + h + ':' + (m < 10 ? '0' : '') + m;
}
function formatTimeHMS(h, m, s) {
return (h < 10 ? '0' : '') + h + ':' + (m < 10 ? '0' : '') + m + ':' + (s < 10 ? '0' : '') + s;
}
function pad2(n) { return n < 10 ? '0' + n : '' + n; }
function pad3(n) { return n < 10 ? '00' + n : n < 100 ? '0' + n : '' + n; }
@@ -1145,12 +1093,6 @@ window.sunPalettes = [
return result;
}
function formatDateShort(date) {
var d = date.getDate();
var mo = date.getMonth() + 1;
return (d < 10 ? '0' : '') + d + '.' + (mo < 10 ? '0' : '') + mo + '.';
}
function formatDateLong(date) {
var days = ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'];
var d = date.getDate();
@@ -1679,11 +1621,11 @@ window.weatherThemes = {
var t = cfg.terrain || {};
if (t.enabled !== false) {
lines.push('Terrain: Copernicus DEM via Mapzen Terrarium');
if (t.nightLights !== false) lines.push('Night lights: NASA GIBS VIIRS');
if (t.carLights !== false || t.cityLights !== false) lines.push('Roads: \u00a9 OpenStreetMap contributors (ODbL)');
var fc = cfg.flights;
if (!fc || fc.enabled !== false) lines.push('Airliner model: Grab3D (CC0)');
}
var fc = cfg.flights;
if (!fc || fc.enabled !== false) lines.push('Airliner model: Grab3D (CC0)');
lines.push('Stars: Yale Bright Star Catalogue');
lines.push('Weather: Open-Meteo');
el.innerHTML = lines.join('<br>');
})();
@@ -1713,12 +1655,6 @@ window.weatherThemes = {
};
}
function getCurrentDayProgress() {
var now = new Date();
var startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0);
return (now.getTime() - startOfDay.getTime()) / 86400000;
}
function toggleDebugPanel() {
var content = document.getElementById('debug-content');
var title = document.querySelector('.debug-title');
@@ -1814,7 +1750,8 @@ window.weatherThemes = {
}
function setDebugTheme(theme) {
var cssFile = window.THEMES && window.THEMES[theme];
var entry = window.THEMES && window.THEMES[theme];
var cssFile = (entry && entry.css) || 'ash.css';
var css = document.getElementById('theme-css');
if (window.__inlineThemeCss && window.__inlineThemeCss[theme]) {
if (css) css.media = 'not all';
@@ -1939,7 +1876,17 @@ window.weatherThemes = {
'orange', 'yellow', 'red', 'brown', 'pink', 'green', 'blue', 'blue-light', 'purple'
];
var dbgRoot = getComputedStyle(document.documentElement);
var colorHtml = '<div class="theme-table-header">Palette</div>';
// Header names the active theme and its lighting block, so the
// palette table also shows how the theme tints the physical model.
var __thName = (window.CONFIG && window.CONFIG.theme) || 'ash';
var __th = (window.THEMES && window.THEMES[__thName]) || {};
var __lt = __th.lighting || null;
var colorHtml = '<div class="theme-table-header">Palette (' + __thName + ')</div>';
colorHtml += '<div class="palette-table-row">' +
'<span class="theme-table-name">' +
(__lt ? ('lighting tint ' + __lt.tint + ' · gain ' + __lt.gain +
'/' + __lt.nightGain) : 'lighting: physical (no tint)') +
'</span></div>';
for (var k = 0; k < colorKeys.length; k++) {
var ck = colorKeys[k];
var cv = ASH[ck] || dbgRoot.getPropertyValue('--' + ck).trim();
@@ -2205,9 +2152,6 @@ window.weatherThemes = {
}
// Get timezone offset based on user's local time
function getTimezoneOffsetMinutes() {
return new Date().getTimezoneOffset();
}
var weatherData = null;
var WMO_ICONS = {