/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import e from"./WGLBrush.js";import{PrimitiveType as t,DataType as r}from"../../../../webgl/enums.js";class a extends e{constructor(){super(...arguments),this._programOptions={id:!1}}dispose(){}drawMany(e,a){const{context:i,displayLevel:n,requiredLevel:l,state:s,painter:o,spriteMosaic:c,styleLayerUID:u,requestRender:d,allowDelayedRender:f}=e;if(!a.some(e=>e.layerData.get(u)?.circleIndexCount??!1))return;const p=e.styleLayer,m=p.circleMaterial,y=o.vectorTilesMaterialManager,g=1.2,M=p.getPaintValue("circle-translate",n),v=p.getPaintValue("circle-translate-anchor",n),x=this._programOptions,_=y.getMaterialProgram(i,m,x);if(f&&null!=d&&!_.compiled)return void d();i.useProgram(_),_.setUniformMatrix3fv("u_displayMat3",1===v?s.displayMat3:s.displayViewMat3),_.setUniform2fv("u_circleTranslation",M),_.setUniform1f("u_depth",p.z),_.setUniform1f("u_antialiasingWidth",g);let I=-1;for(const U of a){if(!U.layerData.has(u))continue;U.key.level!==I&&(I=U.key.level,m.setDataUniforms(_,n,p,I,c));const e=U.layerData.get(u);if(!e.circleIndexCount)continue;e.prepareForRendering(i);const a=e.vao;null!=a&&(i.bindVAO(a),_.setUniformMatrix3fv("u_dvsMat3",U.transforms.displayViewScreenMat3),l!==U.key.level?i.setStencilFunction(514,U.stencilRef,255):i.setStencilFunction(516,255,255),i.drawElements(t.TRIANGLES,e.circleIndexCount,r.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*e.circleIndexStart),U.triangleCount+=e.circleIndexCount/3)}}}export{a as WGLBrushVTLCircle};
