@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.98 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 r,uniform as o,input as i}from"../../GraphShaderModule.js";import{Vec2 as s,Vec3 as l,mod as n,Float as a,mix as p,texture2D as u,Mat3 as c,negate as d,Vec4 as m}from"../../graph/glsl.js";import{FeatureFragmentInput as f,BaseHittestVertexInput as y}from"./AFeatureShader.js";import{FillVertexInput as x,FillShader as v}from"./FillShader.js";import{LocalTileOffset as b}from"./LocalTileOffset.js";import{MosaicInfo as h}from"./MosaicInfo.js";class w extends x{}t([r(5,m)],w.prototype,"tlbr",void 0),t([r(6,a)],w.prototype,"inverseRasterizationScale",void 0);class g extends f{}function j(t){const e=new a(1),r=new a(0);return new c(e.divide(t.x),r.divide(t.y),0,d(r.divide(t.x)),e.divide(t.y),0,0,0,1)}function O(t,e){const r=e.tlbr.xy,o=e.tlbr.zw,i=o.x.subtract(r.x),n=r.y.subtract(o.y),a=new s(i,n).multiply(e.inverseRasterizationScale),p=a.multiply(t.view.requiredZoomFactor),u=j(p),c=t.localTileOffset.getPatternOffsetAtTileOrigin(a).divide(p),d=new l(e.pos,1);return{tileTextureCoord:u.multiply(d).xy.subtract(c),tlbr:e.tlbr.divide(t.mosaicInfo.size.xyxy)}}function S(t,e){const r=n(t.tileTextureCoord,new a(1)),o=p(t.tlbr.xy,t.tlbr.zw,r),i=u(e.texture,o);return t.color.multiply(i)}class T extends v{constructor(){super(...arguments),this.type="PatternFillShader"}vertex(t,e){return{...super.vertex(t,e),...O(this,t)}}fragment(t){const e=S(t,this.mosaicInfo);return this.getFragmentOutput(e,t,new a(0))}}t([o(h)],T.prototype,"mosaicInfo",void 0),t([o(b)],T.prototype,"localTileOffset",void 0),t([e(0,i(w)),e(1,i(y))],T.prototype,"vertex",null),t([e(0,i(g))],T.prototype,"fragment",null);export{g as PatternFillFragmentInput,T as PatternFillShader,w as PatternFillVertexInput,S as getPatternFillFragmentColor,O as getPatternFillVertexData};