/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../core/maybe","../../terrain/interfaces","./glUtil3D","../../../../chunks/Compositing.glsl","../shaders/CompositingTechnique","../shaders/CompositingTechniqueConfiguration","../../../webgl/enums","../../../webgl/Util"],(function(t,i,e,s,n,o,a,r){"use strict";return function(){function c(t,i){this._rctx=t,this._techniqueRepository=i,this._configuration=new o.CompositingTechniqueConfiguration,this._passParameters=new s.CompositingPassParameters}var h=c.prototype;return h.dispose=function(){this._vao=t.disposeMaybe(this._vao)},h.compositeTransparent=function(t,i,e,s,c=1){this._configuration.alphaMode=o.AlphaMode.Alpha,this._configuration.function=o.CompositingFunction.Transparency,this._configuration.hasOpacityFactor=1!==c,this._passParameters.colorTexture=i,this._passParameters.alphaTexture=e,this._passParameters.frontFaceTexture=s;const h=this._rctx,u=this._techniqueRepository.acquire(n.CompositingTechnique,this._configuration);h.bindTechnique(u,this._passParameters,t);const p=this._ensureVAO();h.bindVAO(p),h.drawArrays(a.PrimitiveType.TRIANGLE_STRIP,0,r.vertexCount(p,"geometry")),u.release()},h.composite=function(t,e,s=o.AlphaMode.None,c=1,h=o.CompositingFunction.Standard,u=i.OverlayIndex.INNER){const p=this._rctx;this._configuration.alphaMode=s,this._configuration.function=h,this._configuration.hasOpacityFactor=1!==c,this._passParameters.overlayIndex=u,this._passParameters.texture=e,this._passParameters.opacity=c;const _=this._techniqueRepository.acquire(n.CompositingTechnique,this._configuration);p.bindTechnique(_,this._passParameters,t);const m=this._ensureVAO();p.bindVAO(m),p.drawArrays(a.PrimitiveType.TRIANGLE_STRIP,0,r.vertexCount(m,"geometry")),_.release()},h._ensureVAO=function(){return t.isNone(this._vao)&&(this._vao=e.createQuadVAO(this._rctx)),this._vao},c}()}));
