/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["require","exports","../../../../chunks/_rollupPluginBabelHelpers","../../../../chunks/tslib.es6","../../../ViewingMode","../core/shaderLibrary/ShaderOutputOptions","../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl","../core/shaderLibrary/util/DoublePrecision.glsl","../core/shaderTechnique/ReloadableShaderModule","../core/shaderTechnique/ShaderTechnique","../core/shaderTechnique/ShaderTechniqueConfiguration","../lib/basicInterfaces","../lib/DefaultVertexAttributeLocations","../lib/OrderIndependentTransparency","../lib/Program","./DefaultTechniqueConfiguration","../../../../chunks/WaterSurface.glsl","../../../webgl/renderState"],(function(e,t,r,a,o,i,n,s,u,p,c,l,d,h,f,y,_,g){"use strict";let b=function(e){function t(t,r,a){var o;return(o=e.call(this,t,r,a)||this)._textureRepository=t.waterTextureRepository,o}r._inheritsLoose(t,e);var a=t.prototype;return a.initializeConfiguration=function(e,t){t.spherical=e.viewingMode===o.ViewingMode.Global,t.doublePrecisionRequiresObfuscation=s.doublePrecisionRequiresObfuscation(e.rctx)},a.initializeProgram=function(e){const r=t.shader.get().build(this.configuration);return new f.Program(e.rctx,r,d.Default3D)},a.bindPass=function(e,t){this.program.bindPass(e,t),this.configuration.output!==i.ShaderOutput.Color&&this.configuration.output!==i.ShaderOutput.Normal||this._textureRepository.bind(this.program)},a._setPipelineState=function(e){const t=this.configuration,r=e===l.TransparencyPassType.NONE,a=e===l.TransparencyPassType.FrontFace;return g.makePipelineState({blending:t.output!==i.ShaderOutput.Normal&&t.output!==i.ShaderOutput.Highlight&&t.transparent?r?h.blendingDefault:h.oitBlending(e):null,depthTest:{func:h.oitDepthTest(e)},depthWrite:r?t.writeDepth&&g.defaultDepthWriteParams:h.oitDepthWrite(e),colorWrite:g.defaultColorWriteParams,polygonOffset:r||a?null:h.getOITPolygonOffset(t.enableOffset)})},a.initializePipeline=function(){return this._setPipelineState(this.configuration.transparencyPassType)},t}(p.ShaderTechnique);b.shader=new u.ReloadableShaderModule(_.WaterSurface,(()=>new Promise(((t,r)=>e(["../shaders/WaterSurface.glsl"],t,r)))));let m=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).output=i.ShaderOutput.Color,t.transparencyPassType=l.TransparencyPassType.NONE,t.spherical=!1,t.receiveShadows=!1,t.hasSlicePlane=!1,t.transparent=!1,t.enableOffset=!0,t.writeDepth=!1,t.hasScreenSpaceReflections=!1,t.doublePrecisionRequiresObfuscation=!1,t.hasCloudsReflections=!1,t.isDraped=!1,t.hasMultipassTerrain=!1,t.cullAboveGround=!1,t}return r._inheritsLoose(t,e),t}(y.DefaultTechniqueConfiguration);a.__decorate([c.parameter({count:i.ShaderOutput.COUNT})],m.prototype,"output",void 0),a.__decorate([c.parameter({count:l.TransparencyPassType.COUNT})],m.prototype,"transparencyPassType",void 0),a.__decorate([c.parameter()],m.prototype,"spherical",void 0),a.__decorate([c.parameter()],m.prototype,"receiveShadows",void 0),a.__decorate([c.parameter()],m.prototype,"hasSlicePlane",void 0),a.__decorate([c.parameter()],m.prototype,"transparent",void 0),a.__decorate([c.parameter()],m.prototype,"enableOffset",void 0),a.__decorate([c.parameter()],m.prototype,"writeDepth",void 0),a.__decorate([c.parameter()],m.prototype,"hasScreenSpaceReflections",void 0),a.__decorate([c.parameter()],m.prototype,"doublePrecisionRequiresObfuscation",void 0),a.__decorate([c.parameter()],m.prototype,"hasCloudsReflections",void 0),a.__decorate([c.parameter()],m.prototype,"isDraped",void 0),a.__decorate([c.parameter()],m.prototype,"hasMultipassTerrain",void 0),a.__decorate([c.parameter()],m.prototype,"cullAboveGround",void 0),a.__decorate([c.parameter({constValue:n.PBRMode.Water})],m.prototype,"pbrMode",void 0),a.__decorate([c.parameter({constValue:!0})],m.prototype,"useCustomDTRExponentForWater",void 0),a.__decorate([c.parameter({constValue:!0})],m.prototype,"highStepCount",void 0),a.__decorate([c.parameter({constValue:!1})],m.prototype,"useFillLights",void 0),t.WaterTechnique=b,t.WaterTechniqueConfiguration=m,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
