UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 2.45 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as t,__param as e}from"tslib";import{GraphShaderModule as n,FragmentOutput as o,location as r,uniform as a,input as i,VertexInput as s,UniformGroup as d,FragmentInput as u}from"../../GraphShaderModule.js";import{Vec4 as p,IVec2 as l,Int as w,texelFetch as m,Float as c,step as y,min as f,max as x,Vec2 as g,Sampler2D as v}from"../../graph/glsl.js";import{maxRepresentableInt as h}from"./constants.js";import{uvToClip as T,sum4 as D}from"./utils.js";class b extends s{}t([r(0,g)],b.prototype,"position",void 0);class j extends u{}class S extends d{}t([a(v)],S.prototype,"minTexture",void 0),t([a(v)],S.prototype,"maxTexture",void 0),t([a(v)],S.prototype,"sumTexture",void 0),t([a(v)],S.prototype,"numOfNoDataTexture",void 0),t([a(w)],S.prototype,"width",void 0),t([a(w)],S.prototype,"height",void 0),t([a(w)],S.prototype,"isFirstPass",void 0);class F extends n{constructor(){super(...arguments),this.type="TextureStatisticsMinMaxSumShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new p(T(e),0,1)}}fragment(t){const e=new o,{minTexture:n,maxTexture:r,sumTexture:a,numOfNoDataTexture:i}=this.config,s=t.glFragCoord.xy,d=new l(s.multiply(2)),u=new w(0),y=m(n,d,u),f=m(n,d.add(new l(-1,0)),u),x=m(n,d.add(new l(0,-1)),u),g=m(n,d.add(new l(-1,-1)),u),v=M(M(y,M(f,new p(h))),M(x,M(g,new p(h)))),T=m(r,d,u),b=m(r,d.add(new l(-1,0)),u),j=m(r,d.add(new l(0,-1)),u),S=m(r,d.add(new l(-1,-1)),u),F=P(P(T,P(b,new p(-h))),P(j,P(S,new p(-h)))),C=m(a,d,u),G=m(a,d.add(new l(-1,0)),u),k=m(a,d.add(new l(0,-1)),u),q=m(a,d.add(new l(-1,-1)),u),z=D(N(C),N(G),N(k),N(q)),A=m(i,d,u),B=m(i,d.add(new l(-1,0)),u),E=m(i,d.add(new l(0,-1)),u),H=m(i,d.add(new l(-1,-1)),u),I=new c(this.config.isFirstPass),J=D(O(A,I),O(B,I),O(E,I),O(H,I));return e.fragData0=v,e.fragData1=F,e.fragData2=z,e.fragData3=J,e}}function M(t,e){const n=y(t.a,new c(0));return f(t,e).multiply(new c(1).subtract(n)).add(e.multiply(n))}function P(t,e){const n=y(t.a,new c(0));return x(t,e).multiply(new c(1).subtract(n)).add(e.multiply(n))}function N(t){const e=y(t.a,new c(0)),n=new c(1).subtract(e);return t.multiply(n)}function O(t,e){const n=y(t.a,new c(0)),o=new c(1).subtract(e);return e.multiply(n).multiply(new p(1)).add(o.multiply(t))}t([a(S)],F.prototype,"config",void 0),t([e(0,i(b))],F.prototype,"vertex",null),t([e(0,i(j))],F.prototype,"fragment",null);export{F as TextureStatisticsMinMaxSumShader};