/*
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","../../../ViewingMode","../../../../chunks/Terrain.glsl","../core/shaderTechnique/ReloadableShaderModule","../core/shaderTechnique/ShaderTechnique","../lib/basicInterfaces","../lib/DefaultVertexAttributeLocations","../lib/Program","../lib/StencilUtils","../../../webgl/enums","../../../webgl/renderState"],(function(e,i,t,n,r,l,a,c,o,u,s,d,h){"use strict";let g=function(e){function i(){var i;return(i=e.apply(this,arguments)||this).useStencil=!1,i}t._inheritsLoose(i,e);var r=i.prototype;return r.initializeConfiguration=function(e,i){i.spherical=e.viewingMode===n.ViewingMode.Global},r.initializeProgram=function(e){const t=i.shader.get().build(this.configuration);return new u.Program(e.rctx,t,o.Default3D)},r.initializePipeline=function(){return this._stencilPipelineState=this._createPipeline(!0),this._createPipeline(!1)},r._createPipeline=function(e){const i=this.configuration,t=i.backfaceCullingEnabled&&!i.renderOccluded;return h.makePipelineState({blending:i.renderOccluded?h.simpleBlendingParams(d.BlendFactor.ONE,d.BlendFactor.ONE_MINUS_SRC_ALPHA):null,culling:t&&h.backFaceCullingParams,depthTest:!i.renderOccluded&&{func:d.CompareFunction.LESS},depthWrite:!i.renderOccluded&&h.defaultDepthWriteParams,colorWrite:h.defaultColorWriteParams,stencilTest:e?s.renderWhenBitIsNotSet(c.StencilBits.IntegratedMeshMaskExcluded):null})},r.getPipelineState=function(i,t){return this.useStencil?this._stencilPipelineState:e.prototype.getPipelineState.call(this,i,t)},i}(a.ShaderTechnique);g.shader=new l.ReloadableShaderModule(r.Terrain,(()=>new Promise(((i,t)=>e(["../core/shaderLibrary/terrain/Terrain.glsl"],i,t))))),i.TerrainTechnique=g,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
