/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../../chunks/_rollupPluginBabelHelpers","../../../../../core/maybe","../enums","../Utils","./WGLGeometryBrush","../materialKey/MaterialKey","../techniques/utils","../../../../webgl/enums"],(function(t,e,a,o,r,n,i,s){"use strict";const y={shader:"materials/icon",vertexLayout:{geometry:[{location:0,name:"a_pos",count:2,type:s.DataType.SHORT},{location:1,name:"a_vertexOffset",count:2,type:s.DataType.SHORT},{location:2,name:"a_texCoords",count:2,type:s.DataType.UNSIGNED_SHORT},{location:3,name:"a_bitSetAndDistRatio",count:2,type:s.DataType.UNSIGNED_SHORT},{location:4,name:"a_id",count:4,type:s.DataType.UNSIGNED_BYTE},{location:5,name:"a_color",count:4,type:s.DataType.UNSIGNED_BYTE,normalized:!0},{location:6,name:"a_outlineColor",count:4,type:s.DataType.UNSIGNED_BYTE,normalized:!0},{location:7,name:"a_sizeAndOutlineWidth",count:4,type:s.DataType.UNSIGNED_BYTE},{location:8,name:"a_zoomRange",count:2,type:s.DataType.UNSIGNED_SHORT}]},hittestAttributes:["a_vertexOffset","a_texCoords"]};let u=function(r){function u(){return r.apply(this,arguments)||this}t._inheritsLoose(u,r);var l=u.prototype;return l.dispose=function(){},l.getGeometryType=function(){return a.WGLGeometryType.MARKER},l.supportsSymbology=function(t){return t!==a.WGLSymbologyType.HEATMAP&&t!==a.WGLSymbologyType.PIE_CHART},l.drawGeometry=function(t,a,r,u){const{context:l,painter:p,rendererInfo:c,state:m,passOptions:T,requestRender:d}=t,_=n.MarkerMaterialKey.load(r.materialKey),S=i.getTechniqueFromMaterialKey(_.data),f=e.isSome(T)&&"hittest"===T.type,{shader:E,vertexLayout:g,hittestAttributes:D}=e.unwrapOr(S.programSpec,y);let h=s.PrimitiveType.TRIANGLES,N=o.createProgramDescriptor(_.data,g);f&&(N=this._getTriangleDesc(r.materialKey,N,D),h=s.PrimitiveType.POINTS);const{attributes:G,bufferLayouts:M}=N,O=p.materialManager.getMaterialProgram(t,_,E,G,u);if(e.isSome(d)&&!f&&!O.isCompiled)return void d();l.useProgram(O),_.textureBinding&&p.textureManager.bindTextures(l,O,_,!0),this._setSharedUniforms(O,t,a);const R=_.vvRotation?m.displayViewMat3:m.displayMat3;O.setUniformMatrix3fv("u_displayMat3",R),this._setSizeVVUniforms(_,O,c,a),this._setColorAndOpacityVVUniforms(_,O,c),this._setRotationVVUniforms(_,O,c);const U=r.target.getVAO(l,M,G,f);let b=r.indexCount,x=r.indexFrom*Uint32Array.BYTES_PER_ELEMENT;f&&(b/=3,x/=3),l.bindVAO(U),this._drawMarkers(t,a,O,h,b,x,f),l.bindVAO(null)},l._drawMarkers=function(t,e,a,o,r,n,i){t.context.drawElements(o,r,s.DataType.UNSIGNED_INT,n)},u}(r);return u}));
