/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{isColor as o}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as r}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as l}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as i}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{If as s,glsl as a}from"../core/shaderModules/glsl.js";import{alphaCutoff as t}from"../../../../webscene/support/AlphaCutoff.js";function e(e,n){e.include(l,n),e.include(r,n),e.fragment.include(i);const{output:f,oitPass:u,hasEmission:d,discardInvisibleFragments:m,oitPremultipliedAlpha:p,snowCover:c}=n,C=9===f,g=o(f)&&1===u,h=o(f)&&1!==u;let v=0;(h||g)&&e.outputs.add("fragColor","vec4",v++),d&&e.outputs.add("fragEmission","vec4",v++),g&&e.outputs.add("fragAlpha","float",v++),e.fragment.code.add(a`
    void outputColorHighlightOLID(vec4 finalColor, const in vec3 vWorldPosition, vec3 emissiveSymbolColor ${s(c,", float snow")}) {
      ${s(C,"finalColor.a = 1.0;")}
      ${s(m,`if (finalColor.a < ${a.float(t)}) { discard; }`)}
      finalColor = applySlice(finalColor, vWorldPosition);

      ${s(g,`${s(p,"fragColor = finalColor;","fragColor = premultiplyAlpha(finalColor);")}\n           fragAlpha = finalColor.a;`)}
      ${s(h,"fragColor = finalColor;")}
      ${s(d,`fragEmission = ${s(c,"mix(finalColor.a * getEmissions(emissiveSymbolColor), vec4(0.0), snow);","finalColor.a * getEmissions(emissiveSymbolColor);")}`)}
      calculateOcclusionAndOutputHighlight();
      ${s(C,"outputObjectAndLayerIdColor();")}
    }
  `)}export{e as outputColorHighlightOLID};
