/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as o,__param as t}from"tslib";import{FragmentOutput as i,uniform as r,input as e,define as l,UniformGroup as s}from"../../GraphShaderModule.js";import{clamp as p,Float as u,Vec4 as n,texture2D as m,mix as y,Vec3 as d,dot as a,smoothstep as h,Sampler2D as g,FixedArray as c}from"../../graph/glsl.js";import{PostProcessingShader as f,PostProcessingFragmentInput as v}from"./PostProcessingShader.js";class b extends s{}o([r(g)],b.prototype,"luminosityTexture",void 0),o([r(d)],b.prototype,"defaultColor",void 0),o([r(u)],b.prototype,"defaultOpacity",void 0),o([r(u)],b.prototype,"luminosityThreshold",void 0),o([r(u)],b.prototype,"smoothWidth",void 0);class x extends f{constructor(){super(...arguments),this.type="LuminosityHighPassShader"}fragment(o){const t=new i,r=m(this.luminosityHighPassConfig.luminosityTexture,o.uv),e=new d(.299,.587,.114),l=a(r.xyz,e),s=new n(this.luminosityHighPassConfig.defaultColor.rgb,this.luminosityHighPassConfig.defaultOpacity),p=h(this.luminosityHighPassConfig.luminosityThreshold,this.luminosityHighPassConfig.luminosityThreshold.add(this.luminosityHighPassConfig.smoothWidth),l);return t.fragColor=y(s,r,p),t}}o([r(b)],x.prototype,"luminosityHighPassConfig",void 0),o([t(0,e(v))],x.prototype,"fragment",null);class T extends s{}o([r(g)],T.prototype,"blurTexture1",void 0),o([r(g)],T.prototype,"blurTexture2",void 0),o([r(g)],T.prototype,"blurTexture3",void 0),o([r(g)],T.prototype,"blurTexture4",void 0),o([r(g)],T.prototype,"blurTexture5",void 0),o([r(u)],T.prototype,"bloomStrength",void 0),o([r(u)],T.prototype,"bloomRadius",void 0),o([r(c.ofType(u,5))],T.prototype,"bloomFactors",void 0),o([r(d)],T.prototype,"bloomTintColor",void 0);class C extends f{constructor(){super(...arguments),this.type="CompositeShader"}fragment(o){const t=new i,{blurTexture1:r,blurTexture2:e,blurTexture3:l,blurTexture4:s,blurTexture5:y,bloomStrength:d,bloomFactors:a,bloomTintColor:h,bloomRadius:g}=this.compositeConfig,c=p(g,new u(0),new u(1)),f=this._lerpBloomFactor(a[0],c).multiply(new n(h,1).multiply(m(r,o.uv))),v=this._lerpBloomFactor(a[1],c).multiply(new n(h,1).multiply(m(e,o.uv))),b=this._lerpBloomFactor(a[2],c).multiply(new n(h,1).multiply(m(l,o.uv))),x=this._lerpBloomFactor(a[3],c).multiply(new n(h,1).multiply(m(s,o.uv))),T=this._lerpBloomFactor(a[4],c).multiply(new n(h,1).multiply(m(y,o.uv))),C=d.multiply(f.add(v.add(b.add(x.add(T)))));return t.fragColor=C,t}_lerpBloomFactor(o,t){const i=new u(1.2).subtract(o);return y(o,i,t)}}o([l],C.prototype,"numMips",void 0),o([r(T)],C.prototype,"compositeConfig",void 0),o([t(0,e(v))],C.prototype,"fragment",null);export{C as BloomCompositeShader,x as LuminosityHighPassShader};
