From 8d4ea42e2fc37ce100509c210cda5fe7470f44c8 Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Mon, 12 Oct 2026 18:24:30 +0200 Subject: [PATCH] clouds: keep clouds after front haze --- vendor/clouds3d.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index 800f73e..e37e024 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -6831,6 +6831,22 @@ window.clouds3dRender = function(target) { gl.drawArrays(gl.TRIANGLES, 0, 3); } + if (FRONT_HAZE_ON && terrainDistOk && terrainDistTex) { + gl.useProgram(s.prog); + gl.bindBuffer(gl.ARRAY_BUFFER, s.buf); + gl.enableVertexAttribArray(s.aPos); + gl.vertexAttribPointer(s.aPos, 2, gl.FLOAT, false, 0, 0); + gl.activeTexture(gl.TEXTURE7); + gl.bindTexture(gl.TEXTURE_2D, terrainDistTex); + gl.uniform1i(s.uTerrainDistTex, 7); + gl.disable(gl.DEPTH_TEST); + gl.depthMask(false); + gl.enable(gl.BLEND); + gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); + gl.uniform1i(s.uMode, 3); + gl.drawArrays(gl.TRIANGLES, 0, 3); + } + if (CLOUDS_ON) { gl.useProgram(s.prog); gl.bindBuffer(gl.ARRAY_BUFFER, s.buf); @@ -6848,22 +6864,6 @@ window.clouds3dRender = function(target) { gl.drawArrays(gl.TRIANGLES, 0, 3); } - if (FRONT_HAZE_ON && terrainDistOk && terrainDistTex) { - gl.useProgram(s.prog); - gl.bindBuffer(gl.ARRAY_BUFFER, s.buf); - gl.enableVertexAttribArray(s.aPos); - gl.vertexAttribPointer(s.aPos, 2, gl.FLOAT, false, 0, 0); - gl.activeTexture(gl.TEXTURE7); - gl.bindTexture(gl.TEXTURE_2D, terrainDistTex); - gl.uniform1i(s.uTerrainDistTex, 7); - gl.disable(gl.DEPTH_TEST); - gl.depthMask(false); - gl.enable(gl.BLEND); - gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); - gl.uniform1i(s.uMode, 3); - gl.drawArrays(gl.TRIANGLES, 0, 3); - } - // Restore default state for the next frame. gl.disable(gl.BLEND); gl.enable(gl.DEPTH_TEST);