@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.91 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{_ as o,a as t}from"../../../../../../../chunks/tslib.es6.js";import{uniform as e,UniformGroup as r,location as s,GraphShaderModule as p,option as l,define as i,VertexInput as d,FragmentOutput as n,input as a,FragmentInput as c}from"../../GraphShaderModule.js";import{FixedArray as v,Float as y,equal as f,ifElse as u,Int as h,Vec4 as x,and as m,lessThan as w,greaterThan as g,Vec2 as C,Vec3 as b}from"../../graph/glsl.js";class j extends r{}o([e(y)],j.prototype,"zoomLevel",void 0);class k extends r{getColor(o){const t=this.validValues.findIndex((t=>f(t,o)));return u(f(t,new h(-1)),this.colorFallback,this.color)}}o([e(x)],k.prototype,"color",void 0),o([e(x)],k.prototype,"colorFallback",void 0),o([e(v.ofType(y,4))],k.prototype,"validValues",void 0);class z extends d{}o([s(0,C)],z.prototype,"pos",void 0),o([s(1,b)],z.prototype,"id",void 0),o([s(2,y)],z.prototype,"bitset",void 0),o([s(3,C)],z.prototype,"offset",void 0),o([s(4,y)],z.prototype,"size",void 0),o([s(5,x)],z.prototype,"color",void 0);class D extends c{}class F extends p{constructor(){super(...arguments),this.type="TestShader"}vertex(o){const{size:t,offset:e,pos:r}=o;let s=o.color;this.dataDrivenColor&&(s=this.dataDrivenColor.getColor(new y(1)));const p=e.multiply(t);return{glPosition:new x(r.add(p),0,1),color:s,offset:e}}fragment(o){const t=new n,{offset:e}=o;return t.discard=m(g(e.x,new y(-.5)),g(e.y,new y(-.5)),w(e.x,new y(.5)),w(e.y,new y(.5))),this.returnRed?t.fragColor=new x(1,0,0,1):t.fragColor=o.color,t}}o([l(k)],F.prototype,"dataDrivenColor",void 0),o([e(j)],F.prototype,"view",void 0),o([i],F.prototype,"returnRed",void 0),o([t(0,a(z))],F.prototype,"vertex",null),o([t(0,a(D))],F.prototype,"fragment",null);export{k as DataDrivenColorByValueMatch,F as TestShader};