@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
16 lines (11 loc) • 2.23 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{If as t,glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as o}from"../views/webgl/NoParameters.js";import{ShaderBuilder as n}from"../views/webgl/ShaderBuilder.js";class i extends o{}function l(o){const{reductionPass:i}=o,l=new n;return l.include(e),l.fragment.uniforms.add(new a("cutFillDepthTexture",e=>e.depthTexture)),l.fragment.main.add(r`
ivec2 iuv = ivec2(gl_FragCoord.xy) * 2;
vec2 t0 = texelFetch(cutFillDepthTexture, iuv + ivec2(0, 0), 0).rg;
vec2 t1 = texelFetch(cutFillDepthTexture, iuv + ivec2(1, 0), 0).rg;
vec2 t2 = texelFetch(cutFillDepthTexture, iuv + ivec2(0, 1), 0).rg;
vec2 t3 = texelFetch(cutFillDepthTexture, iuv + ivec2(1, 1), 0).rg;
${t(0===i,"\n vec2 totalDepth = t0 + t1 + t2 + t3;\n\n fragColor = vec4(totalDepth, 0.0, 0.0);\n ")}
${t(1===i," \n float min01 = min(t0.r, t1.r);\n float minCoordsPacked01 = mix(t0.g, t1.g, float(t1.r < t0.r));\n\n float min23 = min(t2.r, t3.r);\n float minCoordsPacked23 = mix(t2.g, t3.g, float(t3.r < t2.r));\n\n float minValue = min(min01, min23);\n float minCoordsPacked = mix(minCoordsPacked01, minCoordsPacked23, float(min23 < min01));\n\n fragColor = vec4(minValue, minCoordsPacked, 0.0, 0.0);\n ")}
${t(2===i,"\n float max01 = max(t0.r, t1.r);\n float maxCoordsPacked01 = mix(t0.g, t1.g, float(t1.r > t0.r));\n\n float max23 = max(t2.r, t3.r);\n float maxCoordsPacked23 = mix(t2.g, t3.g, float(t3.r > t2.r));\n\n float maxValue = max(max01, max23);\n float maxCoordsPacked = mix(maxCoordsPacked01, maxCoordsPacked23, float(max23 > max01));\n\n fragColor = vec4(maxValue, maxCoordsPacked, 0.0, 0.0);\n ")}
`),l}const m=Object.freeze(Object.defineProperty({__proto__:null,CutFillReductionParameters:i,build:l},Symbol.toStringTag,{value:"Module"}));export{i as C,m as a,l as b};