flights: full CONFIG.flights parameterization (altitude, count, speed, holds, destination weights, contrail chance/alt/life/width) + curved random-destination routing
This commit is contained in:
1 parent
fbac24773a
commit
d0aa86ce9b
10 files changed
+1231
-210
No files matched your search
+53
-5
@@ -12,6 +12,15 @@
|
||||
var cssFile = window.THEMES && window.THEMES[theme];
|
||||
var css = document.getElementById('theme-css');
|
||||
if (css) css.href = cssFile || (window.THEMES && window.THEMES.ash) || 'ash.css';
|
||||
// standalone build (build.py): themes are embedded in
|
||||
// window.__inlineThemeCss and the external link is disabled
|
||||
if (window.__inlineThemeCss && window.__inlineThemeCss[theme]) {
|
||||
if (css) css.media = 'not all';
|
||||
var s = document.createElement('style');
|
||||
s.id = 'theme-css-inline';
|
||||
s.textContent = window.__inlineThemeCss[theme];
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<link id="theme-css" rel="stylesheet" href="ash.css">
|
||||
@@ -519,6 +528,7 @@
|
||||
<div id="weather-forecast" class="weather-forecast"></div>
|
||||
<div id="credits" class="credits"></div>
|
||||
</div>
|
||||
<script src="vendor/plane3d.js"></script>
|
||||
<script src="vendor/clouds3d.js"></script>
|
||||
<script>
|
||||
window.__cloudsStarted = true;
|
||||
@@ -594,6 +604,24 @@ window.addEventListener('resize', sceneRender);
|
||||
// west). Off = real SunCalc positions.
|
||||
var DAY_SIM = !!(window.CONFIG && window.CONFIG.day && window.CONFIG.day.simulation);
|
||||
var CYCLE = ((window.CONFIG && window.CONFIG.day && window.CONFIG.day.cycleSeconds) || 20) * 1000;
|
||||
// CONFIG.day.fixedTime freezes the simulated clock at one time of
|
||||
// day: 'HH:MM', 'HH:MM:SS' or a number (0..24). null/unset = the
|
||||
// clock advances as before. Only the TIME OF DAY stops - cloud
|
||||
// drift, car flow and the bobbing camera run on wall time, and
|
||||
// the weather sim has its own timer, so all of that keeps moving.
|
||||
var FIXED_T = (function () {
|
||||
var v = window.CONFIG && window.CONFIG.day && window.CONFIG.day.fixedTime;
|
||||
if (v == null || v === '') return null;
|
||||
var h;
|
||||
if (typeof v === 'number') h = v;
|
||||
else {
|
||||
var p = String(v).split(':');
|
||||
h = parseInt(p[0], 10) || 0;
|
||||
if (p.length > 1) h += parseInt(p[1], 10) / 60;
|
||||
if (p.length > 2) h += parseInt(p[2], 10) / 3600;
|
||||
}
|
||||
return (h >= 0 && h < 24) ? h / 24 : null;
|
||||
})();
|
||||
// simulated sun altitude (rad): t=0 midnight, 0.25 sunrise, 0.5 noon
|
||||
function simSunAlt(t) {
|
||||
return Math.sin((t - 0.25) * Math.PI * 2) * 1.45;
|
||||
@@ -603,12 +631,17 @@ window.addEventListener('resize', sceneRender);
|
||||
// simulated cycle. The visible clock hands/digital stay real.
|
||||
function simNow() {
|
||||
if (!DAY_SIM) return new Date();
|
||||
if (FIXED_T !== null) {
|
||||
var f = new Date();
|
||||
f.setHours(Math.floor(FIXED_T * 24), Math.round((FIXED_T * 1440) % 60), 0, 0);
|
||||
return f;
|
||||
}
|
||||
return new Date(startTime + (Date.now() - startTime) * (86400000 / CYCLE));
|
||||
}
|
||||
var __simT = 0;
|
||||
|
||||
var SITE_LAT = (window.CONFIG && window.CONFIG.location && window.CONFIG.location.lat) || 48.5667;
|
||||
var SITE_LON = (window.CONFIG && window.CONFIG.location && window.CONFIG.location.lon) || 13.4319;
|
||||
var SITE_LAT = (window.CONFIG && window.CONFIG.location && window.CONFIG.location.lat) || 51.5074;
|
||||
var SITE_LON = (window.CONFIG && window.CONFIG.location && window.CONFIG.location.lon) || -0.1278;
|
||||
|
||||
var realDayProgress = 0;
|
||||
|
||||
@@ -1598,6 +1631,8 @@ window.weatherThemes = {
|
||||
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)');
|
||||
}
|
||||
lines.push('Weather: Open-Meteo');
|
||||
el.innerHTML = lines.join('<br>');
|
||||
@@ -1731,7 +1766,18 @@ window.weatherThemes = {
|
||||
function setDebugTheme(theme) {
|
||||
var cssFile = window.THEMES && window.THEMES[theme];
|
||||
var css = document.getElementById('theme-css');
|
||||
if (css && cssFile) css.href = cssFile;
|
||||
if (window.__inlineThemeCss && window.__inlineThemeCss[theme]) {
|
||||
if (css) css.media = 'not all';
|
||||
var s = document.getElementById('theme-css-inline');
|
||||
if (!s) {
|
||||
s = document.createElement('style');
|
||||
s.id = 'theme-css-inline';
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
s.textContent = window.__inlineThemeCss[theme];
|
||||
} else if (css && cssFile) {
|
||||
css.href = cssFile;
|
||||
}
|
||||
setTimeout(function() {
|
||||
rebuildFromColors();
|
||||
var pal = document.getElementById('dbg-palette-name');
|
||||
@@ -1862,7 +1908,9 @@ window.weatherThemes = {
|
||||
var __fpsCount = 0, __fpsT0 = performance.now(), __dbgT0 = 0;
|
||||
|
||||
function animate() {
|
||||
var t = (Date.now() - startTime) / CYCLE % 1;
|
||||
var t = (DAY_SIM && FIXED_T !== null)
|
||||
? FIXED_T
|
||||
: (Date.now() - startTime) / CYCLE % 1;
|
||||
var c = getColor(t);
|
||||
c = applyWeatherTheme(c);
|
||||
// Expose current palette + weather info for the WebGL scene
|
||||
@@ -1916,7 +1964,7 @@ window.weatherThemes = {
|
||||
window.__moonElong0 = SunCalc.getMoonIllumination(new Date()).phase * Math.PI * 2;
|
||||
window.__moonSimStartMs = Date.now();
|
||||
}
|
||||
var _simDays = DAY_SIM ? (Date.now() - window.__moonSimStartMs) / CYCLE : 0;
|
||||
var _simDays = (DAY_SIM && FIXED_T === null) ? (Date.now() - window.__moonSimStartMs) / CYCLE : 0;
|
||||
var _elong = window.__moonElong0 + _simDays * (Math.PI * 2 / 29.53);
|
||||
var _sd = window.__currentSunDir;
|
||||
var _cp = SITE_LAT * Math.PI / 180;
|
||||
|
||||
Reference in new issue
Block a user