/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{C as t}from"../../../../../../chunks/ComponentShader.glsl.js";import{isColor as i}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as n}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o,depthOnlyOutputBuffersOr as l}from"../../../core/shaderTechnique/ShaderTechnique.js";import{OITPolygonOffset as s,depthTest as a,blending as d,drawBuffers as p}from"../../../lib/OrderIndependentTransparency.js";import{replaceBitWhenDepthTestPasses as u,stencilBaseAllZerosParams as c,stencilWriteMaskOn as m}from"../../../lib/StencilUtils.js";import{IndexGlLayout as h}from"../../../materials/DefaultLayouts.js";import{cullingParams as f,makePipelineState as b,defaultColorWrite as g,defaultDepthWrite as P,premultipliedAlpha as j}from"../../../../../webgl/renderState.js";let w=class extends o{constructor(e,r,i){super(e,r,i.concat(h)),this.shader=new n(t,()=>import("./ComponentShader.glsl.js"))}getPipeline(e){return e.camera.aboveGround||null==this._belowGroundPipeline?super.getPipeline(e):this._belowGroundPipeline}initializePipeline(e){return this._belowGroundPipeline=0===e.integratedMeshMode?null:this._makePipeline(e,!0),this._makePipeline(e,!1)}_makePipeline(e,r){const{integratedMeshMode:t,output:n,blendingEnabled:o,cullFace:h,hasEmission:w,hasOccludees:S,hasPolygonOffset:T,oitPass:O,renderOccluded:_}=e,y=0!==t,C=0===O,M=2===O;let k=f(h);return r&&k&&(k={...k,mode:2304}),b({blending:_?j:i(n)&&o?d(O):null,culling:k,depthTest:_?null:a(O),depthWrite:_||!C&&!M?null:P,drawBuffers:l(n,p(O,w)),colorWrite:g,stencilWrite:!_&&y||S?m:null,stencilTest:y?u(1):S?c:null,polygonOffset:C||M?T?{factor:2,units:2}:null:s})}};w=e([r("esri.views.3d.webgl-engine.collections.Component.Material.ComponentTechnique")],w);export{w as ComponentTechnique};
