@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.88 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as t,__param as e}from"tslib";import{location as r,uniform as o,input as i}from"../../GraphShaderModule.js";import{Float as s,Vec2 as l,Vec3 as n,mod as a,mix as p,texture2D as u,Mat3 as d,negate as c,Vec4 as m}from"../../graph/glsl.js";import{BaseHittestVertexInput as f,FeatureFragmentInput as y}from"./AFeatureShader.js";import{FillShader as x,FillVertexInput as v}from"./FillShader.js";import{LocalTileOffset as b}from"./LocalTileOffset.js";import{MosaicInfo as h}from"./MosaicInfo.js";class w extends v{}t([r(5,m)],w.prototype,"tlbr",void 0),t([r(6,s)],w.prototype,"inverseRasterizationScale",void 0);class g extends y{}function j(t){const e=new s(1),r=new s(0);return new d(e.divide(t.x),r.divide(t.y),0,c(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),s=r.y.subtract(o.y),a=new l(i,s).multiply(e.inverseRasterizationScale),p=a.multiply(t.view.requiredZoomFactor),u=j(p),d=t.localTileOffset.getPatternOffsetAtTileOrigin(a).divide(p),c=new n(e.pos,1);return{tileTextureCoord:u.multiply(c).xy.subtract(d),tlbr:e.tlbr.divide(t.mosaicInfo.size.xyxy)}}function S(t,e){const r=a(t.tileTextureCoord,new s(1)),o=p(t.tlbr.xy,t.tlbr.zw,r),i=u(e.texture,o);return t.color.multiply(i)}class T extends x{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 s(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(f))],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};