config.maxFps: scene frame-rate cap (default 30, 0 = free; motion stays time-based)

This commit is contained in:
Richard Zink committed 2026-10-10 11:04:44 +02:00
1 parent d0aa86ce9b
commit 4ecef21729
3 files changed
+16 -1

No files matched your search

+1
View File
@@ -83,6 +83,7 @@ window.CONFIG = {
units: { temperature: 'C' }, // 'C' | 'F' units: { temperature: 'C' }, // 'C' | 'F'
credits: true, // data-attribution block in info box credits: true, // data-attribution block in info box
renderScale: 1, // 0.3..1 internal 3D resolution renderScale: 1, // 0.3..1 internal 3D resolution
maxFps: 30, // WebGL scene frame cap (0 = free)
location: { // drives scene anchor, sun/moon, weather location: { // drives scene anchor, sun/moon, weather
lat: 51.5074, // -90..+90, north positive lat: 51.5074, // -90..+90, north positive
+12 -1
View File
@@ -569,17 +569,28 @@ window.__flightDir = _pickDir('flight');
window.__fetchDir = _pickDir('fetch'); window.__fetchDir = _pickDir('fetch');
// ---- WebGL scene (clouds3d.js) ------------------------------------------ // ---- WebGL scene (clouds3d.js) ------------------------------------------
// CONFIG.maxFps caps the scene frame rate (default 30; 0 = free-running).
// All scene animation is time-based (cloud drift, traffic, bobbing), so a
// lower cap changes smoothness, never motion speed. The UI clock/theme
// loop is untouched.
var sceneEl = document.getElementById('scene'); var sceneEl = document.getElementById('scene');
function sceneRender() { function sceneRender() {
if (sceneEl && typeof window.clouds3dRender === 'function') { if (sceneEl && typeof window.clouds3dRender === 'function') {
window.clouds3dRender(sceneEl); window.clouds3dRender(sceneEl);
} }
} }
var _maxFps = (window.CONFIG && typeof window.CONFIG.maxFps === 'number')
? window.CONFIG.maxFps : 30;
var _frameGap = _maxFps > 0 ? 1000 / _maxFps : 0;
var _lastDraw = 0;
sceneRender(); sceneRender();
window.addEventListener('resize', sceneRender); window.addEventListener('resize', sceneRender);
(function sceneLoop() { (function sceneLoop() {
sceneRender();
window._sceneRaf = requestAnimationFrame(sceneLoop); window._sceneRaf = requestAnimationFrame(sceneLoop);
var t = performance.now();
if (_frameGap && t - _lastDraw < _frameGap - 1) return;
_lastDraw = t;
sceneRender();
})(); })();
function hexToRgb(h) { function hexToRgb(h) {
+3
View File
@@ -87,6 +87,9 @@ window.CONFIG = {
// render the clouds/map shader at reduced resolution and upscale // render the clouds/map shader at reduced resolution and upscale
// via CSS - use it if fps is low (GPU-bound) despite a quiet CPU. // via CSS - use it if fps is low (GPU-bound) despite a quiet CPU.
renderScale: 1, renderScale: 1,
// WebGL scene frame cap (default 30; 0 = free-running/vsync). All
// scene motion is time-based, so the cap only changes smoothness.
maxFps: 30,
location: { location: {
// Latitude and longitude for sun/moon calculations // Latitude and longitude for sun/moon calculations
// Passau (vorher: Muenchen 48.1374/11.5755, Innsbruck 47.2692/11.4041) // Passau (vorher: Muenchen 48.1374/11.5755, Innsbruck 47.2692/11.4041)