/
RaskolnickOFF
/
3D
Обзор
Документация
Войти
/
RaskolnickOFF
/
3D
Код
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/debug/CloudsDebugOverlay.js
70 строк
3 KB
RaskolnickOFF
debug refactor part 2
15 июн 2026, 22:32
15 июн 2026, 22:32
f4de7c0
Код
Авторство
О чём код?
// js/debug/CloudDebugUI.js import LIB from 'LIB'; export class CloudsDebugOverlay { constructor(SETTINGS, container) { this.settings = SETTINGS; if (!SETTINGS.debug.weather) return; this.timer = 0; this.cfg = SETTINGS.UI.debug; this.container = container; this._renderDOM(this.container); } _renderDOM(container) { if (!this.settings.debug.weather) return; const label = document.createElement('label'); const span = document.createElement('span'); this.currentClouds = span; span.textContent = this.cfg.weatherClouds; const cloudsCoverage = LIB.dom.range( this.settings.debug.weatherCloudsCoverageValue, this.cfg.weatherCloudsCoverageClass, null, this.settings.debug.weatherCloudsCoverageMin, this.settings.debug.weatherCloudsCoverageMax, this.settings.debug.weatherCloudsCoverageStep ); const cloudsDensity = LIB.dom.range( this.settings.debug.weatherCloudsDensityValue, this.cfg.weatherCloudsDensityClass, null, this.settings.debug.weatherCloudsDensityMin, this.settings.debug.weatherCloudsDensityMax, this.settings.debug.weatherCloudsDensityStep ); const cloudsElevation = LIB.dom.range( this.settings.debug.weatherCloudsElevationValue, this.cfg.weatherCloudsElevationClass, null, this.settings.debug.weatherCloudsElevationMin, this.settings.debug.weatherCloudsElevationMax, this.settings.debug.weatherCloudsElevationStep ); label.append(span, cloudsCoverage, cloudsDensity, cloudsElevation); container.append(label); this._covRange = label.querySelector('.' + this.cfg.weatherCloudsCoverageClass); this._denRange = label.querySelector('.' + this.cfg.weatherCloudsDensityClass); this._elevRange = label.querySelector('.' + this.cfg.weatherCloudsElevationClass); } update(skyMesh, interval, acc) { if (!this.settings.debug.weather) return; this.timer += acc; if (this.timer < interval) return; this.timer -= interval; this.currentClouds.textContent = `${this.cfg.weatherClouds} ${skyMesh.cloudCoverage.value.toFixed(2)} / ${skyMesh.cloudDensity.value.toFixed(2)} / ${skyMesh.cloudElevation.value.toFixed(2)}`; if (document.activeElement !== this._covRange) { this._covRange.value = skyMesh.cloudCoverage.value; } if (document.activeElement !== this._denRange) { this._denRange.value = skyMesh.cloudDensity.value; } if (document.activeElement !== this._elevRange) { this._elevRange.value = skyMesh.cloudElevation.value; } } }