UNPKG

@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
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{FeatureSymbologyDrawOrder as e}from"../../../enums.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{resolveDynamicUniforms as s,getFeatureUniforms as r,getSelectionDefines as i,isHittest 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,CompareFunction as h,StencilOperation 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:{...s(e,t.target,l.uniforms),...r(e,t.target),antialiasingControls:m(c),mosaicInfo:p.textureManager.getMosaicInfo(n,t.textureKey),technique:{isColorPass:a}},defines:{...i(e)},optionalAttributes:l.optionalAttributes,useComputeBuffer:o(e)}}render(e,t){const{painter:s}=e;if(o(e)||a(e)){const r=n(e);return s.setPipelineState(r),s.setShader(this._getShaderOptions(e,t,1)),void s.submitDraw(e,t)}e.context.setClearDepth(1),e.context.clear(l.DEPTH);const r={color:!1,depth:{write:{zNear:0,zFar:1},test:h.LESS},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:h.EQUAL,mask:255,op:{fail:u.KEEP,zFail:u.KEEP,zPass:u.KEEP}}}};s.setShader(this._getShaderOptions(e,t,0)),s.setPipelineState(r),s.submitDraw(e,t);const i={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:h.LEQUAL},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:h.EQUAL,mask:255,op:{fail:u.KEEP,zFail:u.KEEP,zPass:u.KEEP}}}};s.setShader(this._getShaderOptions(e,t,1)),s.setPipelineState(i),s.submitDraw(e,t)}}export{d as GradientStrokeTechnique};