@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.15 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 t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{location as i,uniform as r,input as o}from"../../GraphShaderModule.js";import{ifElse as s,Float as a,Vec2 as n,greaterThan as d,cond as l,equal as p,sqrt as m,dot as c,abs as u,max as v,clamp as h,mix as f,texture2D as x,Vec4 as g}from"../../graph/glsl.js";import{bitset as y,gradientFillMethods as w}from"../fill/gradientFillConstants.js";import{FeatureFragmentInput as b,BaseHittestVertexInput as j}from"./AFeatureShader.js";import{FillVertexInput as S,FillShader as z}from"./FillShader.js";import{MosaicInfo as F}from"./MosaicInfo.js";import{getBitBool as M,getBit as G,oneMinus as I}from"./utils.js";class P extends S{}t([i(5,g)],P.prototype,"tlbr",void 0),t([i(6,n)],P.prototype,"relativePosition",void 0),t([i(7,a)],P.prototype,"gradientMethod",void 0),t([i(8,n)],P.prototype,"relativeGradientSize",void 0);class D extends b{}class A extends z{constructor(){super(...arguments),this.type="GradientFillShader"}vertex(t,e){const{tlbr:i,relativePosition:r,gradientMethod:o,relativeGradientSize:n}=t,d=s(M(t.bitset,y.isAbsolute),this.view.displayZoomFactor,new a(1));return{...super.vertex(t,e),tlbr:i,relativePosition:r,gradientMethod:o,gradientSize:n.multiply(d),isDiscrete:G(t.bitset,y.isDiscrete)}}fragment(t){const{tlbr:e,relativePosition:i,gradientMethod:r,gradientSize:o,isDiscrete:g}=t,y=s(d(g,new a(.5)),o.subtract(1),new n(0)),b=l([p(r,new a(w.rectangular)),()=>{const t=u(i).add(y).divide(o);return I(v(t.x,t.y))}],[p(r,new a(w.circular)),I(m(c(i,i)).add(y.x).divide(o.x))],[!0,I(i.x.add(y.x).divide(o.x))]),j=new n(h(b,new a(0),new a(1)),.5),S=f(e.xy,e.zw,j).divide(this.mosaicInfo.size),z=x(this.mosaicInfo.texture,S),F=t.color.a;return this.getFragmentOutput(z.multiply(F),t,new a(0))}}t([r(F)],A.prototype,"mosaicInfo",void 0),t([e(0,o(P)),e(1,o(j))],A.prototype,"vertex",null),t([e(0,o(D))],A.prototype,"fragment",null);export{D as GradientFillFragmentInput,A as GradientFillShader,P as GradientFillVertexInput};