clouds: retune weather coverage and make night follow weather

This commit is contained in:
Richard Zink committed 2026-10-12 21:19:57 +02:00
1 parent d5fb1f12c4
commit 1fe214f403
2 files changed
+19 -8

No files matched your search

+15 -6
View File
@@ -5912,20 +5912,30 @@ function hex(rgb) {
// Cloud density per weather (0 = clear, 1 = overcast).
// Names mirror the weather themes defined in background.html.
var WEATHER_DENSITY = {
sunny: 0.20,
cloudy: 0.70,
sunny: 0.25,
cloudy: 0.50,
// rain and storm both map to 'stormy' (open-meteo codes 51-67, 71-77,
// 80-86, 95+). Full 1.0 packed the deck so hard that the march showed
// its own layering, so the top end is capped below overcast.
stormy: 0.80,
night: 0.45
stormy: 0.80
};
var LAST_NON_NIGHT_CLOUD_DENSITY = WEATHER_DENSITY.cloudy;
if (window.CONFIG && window.CONFIG.clouds && window.CONFIG.clouds.density) {
for (var _wd in window.CONFIG.clouds.density) {
// Night follows the last non-night weather density instead of having
// its own independent cloud coverage.
if (_wd === 'night') continue;
var _wv = window.CONFIG.clouds.density[_wd];
if (typeof _wv === 'number') WEATHER_DENSITY[_wd] = Math.max(0, Math.min(1, _wv));
}
}
if (typeof WEATHER_DENSITY.cloudy === 'number') LAST_NON_NIGHT_CLOUD_DENSITY = WEATHER_DENSITY.cloudy;
function cloudDensityForWeather(weather) {
var d = (weather && WEATHER_DENSITY[weather] !== undefined) ? WEATHER_DENSITY[weather] : null;
if (d === null || weather === 'night') return LAST_NON_NIGHT_CLOUD_DENSITY;
LAST_NON_NIGHT_CLOUD_DENSITY = d;
return d;
}
var moonTexture = null, moonTexFailed = false;
function loadMoonTexture(gl) {
@@ -6086,8 +6096,7 @@ window.clouds3dRender = function(target) {
gl.uniform3fv(s.uLight, hex(pal.light));
gl.uniform3fv(s.uBg, hex(pal.bg));
var density = (weather && WEATHER_DENSITY[weather] !== undefined)
? WEATHER_DENSITY[weather] : 0.5;
var density = cloudDensityForWeather(weather);
gl.uniform1f(s.uDensity, density);
var day = (typeof dayProgress === 'number')