Refactor fog handling and add reflection update timestamp

This commit is contained in:
2026-04-07 07:13:33 +02:00
parent 052b0a3bcb
commit bfb3eebd2c
2 changed files with 3 additions and 7 deletions

View File

@@ -786,18 +786,12 @@ export class RuntimeHost {
: null; : null;
if (fogState === null) { if (fogState === null) {
if (this.scene.fog !== null) { this.underwaterSceneFog.density = 0;
this.scene.fog = null;
}
return; return;
} }
this.underwaterSceneFog.color.set(fogState.colorHex); this.underwaterSceneFog.color.set(fogState.colorHex);
this.underwaterSceneFog.density = fogState.density; this.underwaterSceneFog.density = fogState.density;
if (this.scene.fog !== this.underwaterSceneFog) {
this.scene.fog = this.underwaterSceneFog;
}
} }
private getWaterReflectionMode() { private getWaterReflectionMode() {

View File

@@ -190,6 +190,7 @@ interface ViewportWaterSurfaceBinding {
reflectionMatrixUniform: { value: Matrix4 } | null; reflectionMatrixUniform: { value: Matrix4 } | null;
reflectionEnabledUniform: { value: number } | null; reflectionEnabledUniform: { value: number } | null;
reflectionRenderTarget: WebGLRenderTarget | null; reflectionRenderTarget: WebGLRenderTarget | null;
lastReflectionUpdateTime: number;
} }
const BRUSH_SELECTED_EDGE_COLOR = 0xf7d2aa; const BRUSH_SELECTED_EDGE_COLOR = 0xf7d2aa;
@@ -253,6 +254,7 @@ const GIZMO_RENDER_ORDER = 4_000;
const SCALE_SNAP_STEP = 0.1; const SCALE_SNAP_STEP = 0.1;
const MIN_SCALE_COMPONENT = 0.1; const MIN_SCALE_COMPONENT = 0.1;
const MIN_BOX_SIZE_COMPONENT = 0.01; const MIN_BOX_SIZE_COMPONENT = 0.01;
const WATER_REFLECTION_UPDATE_INTERVAL_MS = 96;
interface CachedMaterialTexture { interface CachedMaterialTexture {
signature: string; signature: string;