diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index e96835e..54b1be5 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -6580,6 +6580,52 @@ window.clouds3dRender = function(target) { // trails themselves. // Density is uniform over the whole day (flights follow neither the // car rush curve nor a night cut-off). + if (ATMO_MODEL_ON) { + 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.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, 2); + 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); + gl.enableVertexAttribArray(s.aPos); + gl.vertexAttribPointer(s.aPos, 2, gl.FLOAT, false, 0, 0); + gl.activeTexture(gl.TEXTURE7); + gl.bindTexture(gl.TEXTURE_2D, terrainDistTex || null); + gl.uniform1i(s.uTerrainDistTex, 7); + gl.uniform1f(s.uTerrainDistOk, (terrainDistOk && terrainDistTex) ? 1.0 : 0.0); + 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, 1); + gl.drawArrays(gl.TRIANGLES, 0, 3); + } + if (FLT_ON && fltCount && fltAirs) { stepFlights(now); var fl = { x: 0, z: 0, alt: 0, s: 0, tx: 1, tz: 0, gnd: false, leg: null }; @@ -6893,52 +6939,6 @@ window.clouds3dRender = function(target) { } } - if (ATMO_MODEL_ON) { - 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.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, 2); - 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); - gl.enableVertexAttribArray(s.aPos); - gl.vertexAttribPointer(s.aPos, 2, gl.FLOAT, false, 0, 0); - gl.activeTexture(gl.TEXTURE7); - gl.bindTexture(gl.TEXTURE_2D, terrainDistTex || null); - gl.uniform1i(s.uTerrainDistTex, 7); - gl.uniform1f(s.uTerrainDistOk, (terrainDistOk && terrainDistTex) ? 1.0 : 0.0); - 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, 1); - gl.drawArrays(gl.TRIANGLES, 0, 3); - } - // Restore default state for the next frame. gl.disable(gl.BLEND); gl.enable(gl.DEPTH_TEST);