@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.79 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as t}from"../../../../../../../chunks/tslib.es6.js";import{maxHighlightReasons as i}from"../../../definitions.js";import{GraphShaderModule as e,FragmentOutput as o,location as s,define as r,option as h,uniform as l,VertexInput as n,ComputeVertexInput as d,FragmentInput as g}from"../../GraphShaderModule.js";import{Float as p,float as a,step as u,Vec4 as c,ifElse as m,greaterThan as y,Vec3 as w,Vec2 as f}from"../../graph/glsl.js";import{EntityStorage as v}from"./EntityStorage.js";import{ShaderHighlight as b}from"./ShaderHighlight.js";import{ShaderHittest as H}from"./ShaderHittest.js";import{getFilterBit as _,getHighlightBit as j,getBit as x,uvToClip as R}from"./utils.js";import{ViewInfo as k}from"./ViewInfo.js";class S extends n{}t([s(0,w)],S.prototype,"id",void 0),t([s(1,p)],S.prototype,"bitset",void 0),t([s(2,f)],S.prototype,"pos",void 0);class q extends d{}t([s(14,f)],q.prototype,"nextPos1",void 0),t([s(15,f)],q.prototype,"nextPos2",void 0);class P extends g{}class B extends e{clip(t,i){let e=new p(0);const o=this.storage.getFilterFlags(t);if(e=e.add(a(2).multiply(a(1).subtract(_(o,0)))),this.inside?e=e.add(a(2).multiply(a(1).subtract(_(o,1)))):this.outside?e=e.add(a(2).multiply(_(o,1))):this.highlight&&(e=e.add(a(2).multiply(a(1).subtract(this._checkHighlight(o))))),null!=i){const t=new p(1).subtract(u(i.x,this.view.currentZoom)),o=u(i.y,this.view.currentZoom);e=e.add(new p(2).multiply(t.add(o)))}return e}getFragmentOutput(t,i,e=new p(1/255)){const s=new o;return s.fragColor=this._maybeWriteHittest(i)??this._maybeHighlight(t,e)??t,s}_maybeHighlight(t,i){return this.highlight?new c(t.rgb,u(i,t.a)):null}_checkHighlight(t){let e=this._checkHighlightBit(t,0);for(let o=1;o<i;o++)e=e.add(this._checkHighlightBit(t,o));return u(new p(.1),e.add(this.highlight.highlightAll))}_checkHighlightBit(t,i){return j(t,i).multiply(x(this.highlight.activeReasons,i))}maybeRunHittest(t,i,e){if(null==this.hittestRequest)return null;const o=this.hittest(t,i,e);let s=m(y(o,this.hittestRequest.distance),new p(2),new p(0));const r=this.storage.getAttributeDataCoords(t.id),h=R(r);s=s.add(this.clip(t.id,t.zoomRange));const l=new c(new p(1/255),0,0,0);return{glPointSize:new p(1),glPosition:new c(h,s,1),color:l}}_maybeWriteHittest(t){return null!=this.hittestRequest?t.color:null}}t([r],B.prototype,"inside",void 0),t([r],B.prototype,"outside",void 0),t([h(b)],B.prototype,"highlight",void 0),t([l(v)],B.prototype,"storage",void 0),t([l(k)],B.prototype,"view",void 0),t([h(H)],B.prototype,"hittestRequest",void 0);export{B as AFeatureShader,q as BaseHittestVertexInput,P as FeatureFragmentInput,S as FeatureVertexInput};