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

+12 -1
View File
@@ -569,17 +569,28 @@ window.__flightDir = _pickDir('flight');
window.__fetchDir = _pickDir('fetch');
// ---- 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');
function sceneRender() {
if (sceneEl && typeof window.clouds3dRender === 'function') {
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();
window.addEventListener('resize', sceneRender);
(function sceneLoop() {
sceneRender();
window._sceneRaf = requestAnimationFrame(sceneLoop);
var t = performance.now();
if (_frameGap && t - _lastDraw < _frameGap - 1) return;
_lastDraw = t;
sceneRender();
})();
function hexToRgb(h) {