/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{addProjViewLocalOrigin as e}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{FloatPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as t}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{ShaderBuilder as i}from"../views/webgl/ShaderBuilder.js";function r(r){const a=new i,{vertex:s,fragment:u,attributes:d,varyings:l}=a;e(s,r);const{isAttributeDriven:n,usesHalfFloat:c}=r;return d.add("position","vec3"),d.add("uv0","vec2"),n&&(d.add("featureAttribute","float"),l.add("attributeValue","float")),c&&u.constants.add("compressionFactor","float",.25),l.add("unitCirclePos","vec2"),s.uniforms.add(new o("radius",({resolutionForScale:e,searchRadius:o},{camera:t,screenToWorldRatio:i,overlayStretch:r})=>2*o*(0===e?1:e/i)*t.pixelRatio/t.fullViewport[2]/r)),s.main.add(t`
    unitCirclePos = uv0;

    vec4 posProj = proj * (view * vec4(${"position"}, 1.0));
    vec4 quadOffset = vec4(unitCirclePos * radius, 0.0, 0.0);

    ${n?t`attributeValue = ${"featureAttribute"};`:""}
    gl_Position = posProj + quadOffset;
  `),u.main.add(t`
    float radiusRatioSquared = dot(unitCirclePos, unitCirclePos);
    if (radiusRatioSquared > 1.0) {
      fragColor = vec4(0.0);
    }
    else {
      float oneMinusRadiusRatioSquared = 1.0 - radiusRatioSquared;
      float density = oneMinusRadiusRatioSquared * oneMinusRadiusRatioSquared ${n?t` * attributeValue`:""} ${c?t` * compressionFactor`:""};
      fragColor = vec4(density);
    }
  `),a}const a=Object.freeze(Object.defineProperty({__proto__:null,build:r},Symbol.toStringTag,{value:"Module"}));export{a as H,r as b};
