clouds: render clouds after front haze for visibility test

This commit is contained in:
Richard Zink committed 2026-10-12 18:10:33 +02:00
1 parent 778c25859e
commit d9da8fdb47
1 file changed
+16 -16
+16 -16
View File
@@ -6811,6 +6811,22 @@ window.clouds3dRender = function(target) {
gl.drawArrays(gl.TRIANGLES, 0, 3); 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) { if (CLOUDS_ON) {
gl.useProgram(s.prog); gl.useProgram(s.prog);
gl.bindBuffer(gl.ARRAY_BUFFER, s.buf); gl.bindBuffer(gl.ARRAY_BUFFER, s.buf);
@@ -6828,22 +6844,6 @@ window.clouds3dRender = function(target) {
gl.drawArrays(gl.TRIANGLES, 0, 3); 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. // Restore default state for the next frame.
gl.disable(gl.BLEND); gl.disable(gl.BLEND);
gl.enable(gl.DEPTH_TEST); gl.enable(gl.DEPTH_TEST);