/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../chunks/_rollupPluginBabelHelpers","../../../../core/maybe","../../../../chunks/vec2f32","../../../../chunks/vec2f64","../../support/buffer/InterleavedLayout","../core/shaderLibrary/ShaderOutputOptions","../core/shaderLibrary/hud/HUD.glsl","../lib/GLMaterial","../lib/Material","../lib/RenderSlot","../lib/VertexAttribute","./internal/bufferWriterUtils","../shaders/LineCalloutTechnique","../shaders/LineCalloutTechniqueConfiguration"],(function(e,t,r,i,n,s,u,a,o,l,c,f,h,d,p){"use strict";let S=function(e){function i(t){var r;return(r=e.call(this,t,new O)||this).techniqueConfig=new p.LineCalloutTechniqueConfiguration,r._uniqueMaterialIdentifier=i.uniqueMaterialIdentifier(r.parameters),r}t._inheritsLoose(i,e);var n=i.prototype;return n.getPassParameters=function(){return this.parameters},n.getConfiguration=function(e,t){const i=(null==t?void 0:t.slot)!==c.RenderSlot.LINE_CALLOUTS;return this.techniqueConfig.occlusionTestEnabled=this.parameters.occlusionTest,this.techniqueConfig.hasVerticalOffset=r.isSome(this.parameters.verticalOffset),this.techniqueConfig.hasScreenSizePerspective=r.isSome(this.parameters.screenSizePerspective),this.techniqueConfig.depthHudEnabled=i,this.techniqueConfig.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this.techniqueConfig.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?a.HUDSpace.Screen:a.HUDSpace.World,this.techniqueConfig.hasSlicePlane=this.parameters.hasSlicePlane,this.techniqueConfig.hasMultipassGeometry=!!t&&t.multipassGeometry.enabled,this.techniqueConfig},n.intersect=function(){},n.requiresSlot=function(e){switch(e){case c.RenderSlot.LINE_CALLOUTS:case c.RenderSlot.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1},n.createGLMaterial=function(e){return e.output===u.ShaderOutput.Color?new g(e):null},n.createBufferWriter=function(){return new L},n.validateParameters=function(e){const t=i.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)},i.uniqueMaterialIdentifier=function(e){return JSON.stringify({screenOffset:e.screenOffset||[0,0],centerOffsetUnits:e.centerOffsetUnits||"world"})},t._createClass(i,[{key:"uniqueMaterialIdentifier",get:function(){return this._uniqueMaterialIdentifier}}]),i}(l.Material),g=function(e){function r(){return e.apply(this,arguments)||this}return t._inheritsLoose(r,e),r.prototype.beginSlot=function(e){return this.ensureTechnique(d.LineCalloutTechnique,e)},r}(o),O=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).screenOffset=n.ZEROS,t.color=[0,0,0,1],t.size=1,t.occlusionTest=!1,t.shaderPolygonOffset=1e-5,t.depthHUDAlignStart=!1,t.centerOffsetUnits="world",t.hasSlicePlane=!1,t}return t._inheritsLoose(r,e),r}(l.MaterialParameters);const b=s.newLayout().vec3f(f.VertexAttribute.POSITION).vec3f(f.VertexAttribute.NORMAL).vec2f(f.VertexAttribute.UV0).vec4f(f.VertexAttribute.AUXPOS1),m=[i.fromValues(0,0),i.fromValues(1,0),i.fromValues(0,1),i.fromValues(1,0),i.fromValues(1,1),i.fromValues(0,1)];let L=function(){function e(){this.vertexBufferLayout=b}var t=e.prototype;return t.allocate=function(e){return this.vertexBufferLayout.createBuffer(e)},t.elementCount=function(e){return 6*e.indices.get(f.VertexAttribute.POSITION).length},t.write=function(e,t,r,i){h.writePosition(t.indices.get(f.VertexAttribute.POSITION),t.vertexAttributes.get(f.VertexAttribute.POSITION).data,e.transformation,r.position,i,6),h.writeNormal(t.indices.get(f.VertexAttribute.NORMAL),t.vertexAttributes.get(f.VertexAttribute.NORMAL).data,e.invTranspTransformation,r.normal,i,6),h.writeBufferVec4(t.indices.get(f.VertexAttribute.AUXPOS1),t.vertexAttributes.get(f.VertexAttribute.AUXPOS1).data,r.auxpos1,i,6);for(let n=0;n<m.length;++n)r.uv0.setVec(i+n,m[n])},e}();e.LineCalloutMaterial=S,e.Parameters=O,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
