@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.04 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{FeatureSymbologyDrawOrder as e}from"../../../enums.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{isHittest as s,getSelectionDefines as r,getFeatureUniforms as i,resolveDynamicUniforms as o,isHighlight as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{TechniqueType as p}from"../TechniqueType.js";import{getAntialiasingControls as m}from"./utils.js";import{GradientStrokeShader as c}from"../shaders/GradientStrokeShader.js";import{FramebufferBit as l,StencilOperation as h,CompareFunction as u}from"../../../../../../webgl/enums.js";class d extends t{constructor(){super(...arguments),this.type=p.GradientStroke,this.shaders={geometry:new c},this.symbologyPlane=e.LINE}_getShaderOptions(e,t,a){const{context:n,painter:p,pixelRatio:c}=e,l=t.instance.getInput();return{shader:this.shaders.geometry,uniforms:{...o(e,t.target,l.uniforms),...i(e,t.target),antialiasingControls:m(c),mosaicInfo:p.textureManager.getMosaicInfo(n,t.textureKey),technique:{isColorPass:a}},defines:{...r(e)},optionalAttributes:l.optionalAttributes,useComputeBuffer:s(e)}}render(e,t){const{painter:r}=e;if(s(e)||a(e)){const s=n(e);return r.setPipelineState(s),r.setShader(this._getShaderOptions(e,t,1)),void r.submitDraw(e,t)}e.context.setClearDepth(1),e.context.clear(l.DEPTH);const i={color:!1,depth:{write:{zNear:0,zFar:1},test:u.LESS},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:u.EQUAL,mask:255,op:{fail:h.KEEP,zFail:h.KEEP,zPass:h.KEEP}}}};r.setShader(this._getShaderOptions(e,t,0)),r.setPipelineState(i),r.submitDraw(e,t);const o={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:u.LEQUAL},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:u.EQUAL,mask:255,op:{fail:h.KEEP,zFail:h.KEEP,zPass:h.KEEP}}}};r.setShader(this._getShaderOptions(e,t,1)),r.setPipelineState(o),r.submitDraw(e,t)}}export{d as GradientStrokeTechnique};