/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t,__param as o}from"tslib";import{location as e,uniform as r,input as i,VertexInput as n,UniformGroup as s,GraphShaderModule as p,FragmentOutput as a,FragmentInput as l}from"../../GraphShaderModule.js";import{Vec2 as d,Mat3 as c,Float as y,Vec4 as h,Int as m,Vec3 as f,abs as g,fract as v,min as x,smoothstep as u,round as w,intMod as j,ifElse as C,lessThan as L,greaterThan as b,multiply as W,step as P,mix as I}from"../../graph/glsl.js";class G extends n{}t([e(0,d)],G.prototype,"position",void 0);class S extends l{}class M extends s{}t([r(c)],M.prototype,"dvs",void 0);class k extends s{}t([r(y)],k.prototype,"halfWidth",void 0),t([r(y)],k.prototype,"aaWidth",void 0),t([r(y)],k.prototype,"pxPerCell",void 0),t([r(h)],k.prototype,"minorLineColor",void 0),t([r(h)],k.prototype,"majorLineColor",void 0),t([r(m)],k.prototype,"majorLineInterval",void 0);class q extends p{constructor(){super(...arguments),this.type="GridShader"}vertex(t){const o=t.position.multiply(2).subtract(1);return{gridPos:this.transform.dvs.multiply(new f(o,1)).xy,glPosition:new h(o,0,1)}}fragment(t){const o=g(t.gridPos),e=v(o),r=x(e.x,new y(1).subtract(e.x)),i=x(e.y,new y(1).subtract(e.y)),n=new d(r,i).multiply(this.config.pxPerCell).subtract(this.config.halfWidth),s=x(n.x,n.y),p=new y(1).subtract(u(new y(0),this.config.aaWidth,s)),l=new m(w(o.x)),c=new m(w(o.y)),h=new y(j(l,this.config.majorLineInterval)),f=new y(j(c,this.config.majorLineInterval)),G=C(L(n.x,n.y),h,f),S=b(W(P(n.x,this.config.aaWidth),P(n.y,this.config.aaWidth)),new y(.5)),M=x(h,f),k=C(S,M,G),q=I(this.config.majorLineColor,this.config.minorLineColor,x(k,new y(1))),z=new a;return z.fragColor=q.multiply(p),z}}t([r(M)],q.prototype,"transform",void 0),t([r(k)],q.prototype,"config",void 0),t([o(0,i(G))],q.prototype,"vertex",null),t([o(0,i(S))],q.prototype,"fragment",null);export{q as GridShader};
