/*
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/mat3f64","../../../../chunks/vec3f64","../../../../chunks/vec4f64","../../../ViewingMode","../core/shaderLibrary/ShaderOutputOptions","../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl","../core/shaderLibrary/attributes/VertexNormal.glsl","../core/shaderLibrary/util/AlphaCutoff","../core/shaderLibrary/util/DoublePrecision.glsl","../core/shaderTechnique/ReloadableShaderModule","../core/shaderTechnique/ShaderTechnique","../lib/basicInterfaces","../lib/DefaultVertexAttributeLocations","../lib/Material","../lib/OrderIndependentTransparency","../lib/Program","../lib/StencilUtils","../../../../chunks/DefaultMaterial.glsl","../../../webgl/enums","../../../webgl/renderState"],(function(e,t,i,r,a,n,l,o,s,u,c,h,d,p,f,b,m,g,P,v,S,T,y){"use strict";let O=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).isSchematic=!1,t.usePBR=!1,t.mrrFactors=a.fromValues(0,1,.5),t.hasVertexColors=!1,t.hasSymbolColors=!1,t.doubleSided=!1,t.doubleSidedType="normal",t.cullFace=f.CullFaceOptions.Back,t.emissiveFactor=a.fromValues(0,0,0),t.instancedDoublePrecision=!1,t.normals="default",t.receiveSSAO=!0,t.receiveShadows=!0,t.castShadows=!0,t.shadowMappingEnabled=!1,t.ambient=a.fromValues(.2,.2,.2),t.diffuse=a.fromValues(.8,.8,.8),t.externalColor=n.fromValues(1,1,1,1),t.colorMixMode="multiply",t.opacity=1,t.layerOpacity=1,t.origin=a.create(),t.hasSlicePlane=!1,t.hasSliceHighlight=!0,t.offsetTransparentBackfaces=!1,t.vvSizeEnabled=!1,t.vvSizeMinSize=[1,1,1],t.vvSizeMaxSize=[100,100,100],t.vvSizeOffset=[0,0,0],t.vvSizeFactor=[1,1,1],t.vvSizeValue=[1,1,1],t.vvColorEnabled=!1,t.vvColorValues=[0,0,0,0,0,0,0,0],t.vvColorColors=[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],t.vvSymbolAnchor=[0,0,0],t.vvSymbolRotationMatrix=r.create(),t.vvOpacityEnabled=!1,t.vvOpacityValues=[],t.vvOpacityOpacities=[],t.transparent=!1,t.writeDepth=!0,t.customDepthTest=f.DepthTestFunction.Less,t.textureAlphaMode=f.AlphaDiscardMode.Blend,t.textureAlphaCutoff=c.defaultMaskAlphaCutoff,t.textureAlphaPremultiplied=!1,t.hasOccludees=!1,t.renderOccluded=m.RenderOccludedFlag.Occlude,t}return i._inheritsLoose(t,e),t}(u.VertexNormalPassParameters),M=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).origin=a.create(),t.slicePlaneLocalOrigin=t.origin,t}return i._inheritsLoose(t,e),t}(u.VertexNormalDrawParameters),D=function(e){function t(){return e.apply(this,arguments)||this}i._inheritsLoose(t,e);var r=t.prototype;return r.initializeConfiguration=function(e,t){t.spherical=e.viewingMode===l.ViewingMode.Global,t.doublePrecisionRequiresObfuscation=h.doublePrecisionRequiresObfuscation(e.rctx),t.textureCoordinateType=t.hasColorTexture||t.hasMetalnessAndRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture||t.hasNormalTexture?s.TextureCoordinateAttributeType.Default:s.TextureCoordinateAttributeType.None},r.initializeProgram=function(e){return this._initializeProgram(e,t.shader)},r._initializeProgram=function(e,t){const i=t.get().build(this.configuration);return new P.Program(e.rctx,i,b.Default3D)},r._convertDepthTestFunction=function(e){return e===f.DepthTestFunction.Lequal?T.CompareFunction.LEQUAL:T.CompareFunction.LESS},r._setPipeline=function(e,t){const i=this.configuration,r=e===f.TransparencyPassType.NONE,a=e===f.TransparencyPassType.FrontFace;return y.makePipelineState({blending:i.output!==o.ShaderOutput.Color&&i.output!==o.ShaderOutput.Alpha||!i.transparent?null:r?g.blendingDefault:g.oitBlending(e),culling:x(i)&&y.cullingParams(i.cullFace),depthTest:{func:g.oitDepthTest(e,this._convertDepthTestFunction(i.customDepthTest))},depthWrite:r||a?i.writeDepth&&y.defaultDepthWriteParams:null,colorWrite:y.defaultColorWriteParams,stencilWrite:i.hasOccludees?v.stencilWriteMaskOn:null,stencilTest:i.hasOccludees?t?v.stencilToolMaskBaseParams:v.stencilBaseAllZerosParams:null,polygonOffset:r||a?null:g.getOITPolygonOffset(i.enableOffset)})},r.initializePipeline=function(){return this._occludeePipelineState=this._setPipeline(this.configuration.transparencyPassType,!0),this._setPipeline(this.configuration.transparencyPassType,!1)},r.getPipelineState=function(t,i){return i?this._occludeePipelineState:e.prototype.getPipelineState.call(this,t,i)},t}(p.ShaderTechnique);function x(e){return e.cullFace!==f.CullFaceOptions.None||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}D.shader=new d.ReloadableShaderModule(S.DefaultMaterial,(()=>new Promise(((t,i)=>e(["./DefaultMaterial.glsl"],t,i))))),t.DefaultMaterialDrawParameters=M,t.DefaultMaterialPassParameters=O,t.DefaultMaterialTechnique=D,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
