/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{FloatDrawUniform as o}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as t}from"../../shaderModules/FloatPassUniform.js";import{glsl as r,If as e}from"../../shaderModules/glsl.js";import{alphaCutoff as a}from"../../../../../../webscene/support/AlphaCutoff.js";function f(o,r){l(o,r,new t("textureAlphaCutoff",o=>o.textureAlphaCutoff))}function s(t,r){l(t,r,new o("textureAlphaCutoff",o=>o.textureAlphaCutoff))}function l(o,t,f){const s=o.fragment,l=t.alphaDiscardMode,u=0===l;2!==l&&3!==l||s.uniforms.add(f),s.code.add(r`
    void discardOrAdjustAlpha(inout vec4 color) {
      ${1===l?"color.a = 1.0;":`if (color.a < ${u?r.float(a):"textureAlphaCutoff"}) {\n              discard;\n             } ${e(2===l,"else { color.a = 1.0; }")}`}
    }
  `)}export{s as DiscardOrAdjustAlphaDraw,f as DiscardOrAdjustAlphaPass};
