/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t,__param as o}from"tslib";import{tileSize as e}from"../../../definitions.js";import{location as i,uniform as r,texture as s,input as d,VertexInput as n,UniformGroup as p,GraphShaderModule as a,FragmentOutput as l}from"../../GraphShaderModule.js";import{Vec2 as c,Float as m,Sampler2D as y,Mat3 as w,Vec3 as v,texture2D as u,max as h,step as x,Vec4 as f,length as g,smoothstep as S}from"../../graph/glsl.js";import{FeatureFragmentInput as j}from"../shaders/AFeatureShader.js";import{ViewInfo as z}from"../shaders/ViewInfo.js";class P extends n{}t([i(0,c)],P.prototype,"pos",void 0);class R extends j{}class b extends p{}t([r(m)],b.prototype,"dotSize",void 0);class F extends p{}t([r(m)],F.prototype,"pixelRatio",void 0),t([r(m)],F.prototype,"tileZoomFactor",void 0);const C=1e-6;class D extends a{constructor(){super(...arguments),this.type="DotDensityPointShader"}vertex(t){const o=new w(1,0,0,0,-1,0,0,1,1).multiply(new v(t.pos.xy.divide(e),1)),i=u(this.drawLocations,o.xy),r=h(this.instance.dotSize.divide(2),new m(1));let s=new m(0);s=s.add(x(i.a,new m(C)).multiply(2));let d=r.add(this.instance.dotSize);const n=this.view.displayViewScreenMat3.multiply(new v(t.pos.add(.5),1)),p=new f(n.xy,s,1),a=this.instance.dotSize.divide(d),l=new m(-1).divide(r.divide(d));return d=d.multiply(this.draw.pixelRatio.multiply(this.draw.tileZoomFactor)),{glPosition:p,glPointSize:d,color:i,ratio:a,invEdgeRatio:l}}fragment(t){const o=g(t.glPointCoord.subtract(.5)).multiply(2),e=S(new m(0),new m(1),t.invEdgeRatio.multiply(o.subtract(t.ratio)).add(1)),i=new l;return i.fragColor=t.color.multiply(e),i}}t([r(b)],D.prototype,"instance",void 0),t([r(F)],D.prototype,"draw",void 0),t([r(z)],D.prototype,"view",void 0),t([s(y)],D.prototype,"drawLocations",void 0),t([o(0,d(P))],D.prototype,"vertex",null),t([o(0,d(R))],D.prototype,"fragment",null);export{F as DotDensityPointDrawUniforms,R as DotDensityPointFragmentInput,b as DotDensityPointInstanceUniforms,D as DotDensityPointShader,P as DotDensityPointVertexInput};
