/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import{ShaderOutputConfiguration as a}from"../ShaderOutputConfiguration.js";import{FloatDrawUniform as o}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as r}from"../../shaderModules/FloatPassUniform.js";import{alphaCutoff as d}from"../../../shaders/alphaCutoff.glsl.js";class e extends a{constructor(){super(...arguments),this.alphaDiscardMode=0}}function t(a,o){c(a,o,new r("textureAlphaCutoff",a=>a.textureAlphaCutoff))}function s(a,r){c(a,r,new o("textureAlphaCutoff",a=>a.textureAlphaCutoff))}function c(a,o,r){const e=a.fragment;switch(e.code.add("void discardOrAdjustAlpha(inout vec4 color) {"),o.alphaDiscardMode){case 1:e.code.add("color.a = 1.0;");break;case 0:0!==o.output&&(e.include(d),e.code.add("if (color.a < alphaCutoff) discard;"));break;case 3:0!==o.output&&e.uniforms.add(r).code.add("if (color.a < textureAlphaCutoff) discard;");break;case 2:e.uniforms.add(r).code.add("\n        if (color.a < textureAlphaCutoff) discard;\n        color.a = 1.0;\n      ");break;case 4:break;default:o.alphaDiscardMode}e.code.add("}")}export{e as DiscardOrAdjustAlphaConfiguration,s as DiscardOrAdjustAlphaDraw,t as DiscardOrAdjustAlphaPass};
