clouds: retune weather coverage and make night follow weather
This commit is contained in:
1 parent
d5fb1f12c4
commit
1fe214f403
2 files changed
+19
-8
No files matched your search
@@ -170,7 +170,9 @@ window.CONFIG = {
|
||||
// only ever reports sunny/cloudy/stormy, so the deck keeps that
|
||||
// coverage through the night as well - 'night' is used by the weather
|
||||
// simulation (weatherSim: true) alone.
|
||||
density: { sunny: 0.30, cloudy: 0.70, stormy: 1.00, night: 0.45 },
|
||||
density: { sunny: 0.25, cloudy: 0.50, stormy: 0.80 },
|
||||
// 'night' intentionally has no own density: it follows the last
|
||||
// non-night weather density (sunny/cloudy/stormy).
|
||||
// Cloud motion from Open-Meteo wind. Open-Meteo reports wind FROM
|
||||
// the reported compass direction; clouds advect toward the opposite
|
||||
// bearing. speedScale exaggerates real advection so the motion is
|
||||
@@ -182,7 +184,7 @@ window.CONFIG = {
|
||||
// wind: { speedScale: 0 } // static clouds
|
||||
// wind: { speedScale: 140, maxSpeed: 0.12 } // very visible motion
|
||||
}
|
||||
// density: { sunny: 0.05, cloudy: 0.9, stormy: 1.0, night: 0.2 }
|
||||
// density: { sunny: 0.05, cloudy: 0.9, stormy: 1.0 }
|
||||
},
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
Vendored
+15
-6
@@ -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')
|
||||
|
||||
Reference in new issue
Block a user