config.maxFps: scene frame-rate cap (default 30, 0 = free; motion stays time-based)
This commit is contained in:
1 parent
d0aa86ce9b
commit
4ecef21729
3 files changed
+16
-1
No files matched your search
@@ -83,6 +83,7 @@ window.CONFIG = {
|
||||
units: { temperature: 'C' }, // 'C' | 'F'
|
||||
credits: true, // data-attribution block in info box
|
||||
renderScale: 1, // 0.3..1 internal 3D resolution
|
||||
maxFps: 30, // WebGL scene frame cap (0 = free)
|
||||
|
||||
location: { // drives scene anchor, sun/moon, weather
|
||||
lat: 51.5074, // -90..+90, north positive
|
||||
|
||||
+12
-1
@@ -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) {
|
||||
|
||||
@@ -87,6 +87,9 @@ window.CONFIG = {
|
||||
// render the clouds/map shader at reduced resolution and upscale
|
||||
// via CSS - use it if fps is low (GPU-bound) despite a quiet CPU.
|
||||
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: {
|
||||
// Latitude and longitude for sun/moon calculations
|
||||
// Passau (vorher: Muenchen 48.1374/11.5755, Innsbruck 47.2692/11.4041)
|
||||
|
||||
Reference in new issue
Block a user