UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.91 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{FeatureTechnique as e}from"./FeatureTechnique.js";import{TechniqueType as t}from"./TechniqueType.js";import{MeshWriter as r}from"./mesh/MeshWriter.js";import{TestShader as i}from"./shaders/TestShader.js";import{StencilOperation as o,CompareFunction as s,DataType as n}from"../../../../../webgl/enums.js";const a={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:s.EQUAL,mask:255,op:{fail:o.KEEP,zFail:o.KEEP,zPass:o.REPLACE}}}};class c extends e{constructor(){super(...arguments),this.type=t.Test,this.shaders={geometry:new i}}render(e,t){const{painter:r}=e,i=t.instance.getInput();r.setShader({shader:this.shaders.geometry,uniforms:{dataDrivenColor:i.uniforms.dataDrivenColor,view:{zoomLevel:1}},defines:{returnRed:!1},optionalAttributes:{},useComputeBuffer:!1}),r.setPipelineState(a),r.submitDraw(e,t)}}const p={createComputedParams:e=>e,optionalAttributes:{},attributes:{pos:{type:n.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:n.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:n.UNSIGNED_BYTE,count:1},size:{type:n.UNSIGNED_BYTE,count:1,packPrecisionFactor:10,pack:e=>.2},offset:{type:n.INT,count:2,packPrecisionFactor:10,packAlternating:{count:4,pack:()=>[[-1,1],[1,1],[-1,-1],[1,-1]]}},color:{type:n.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>e}}};class d extends r{constructor(){super(...arguments),this.vertexSpec=p}_write(e,t){e.recordStart(this.instanceId,this.attributeLayout);const r=655360,i=e.vertexCount(),o=t.readXForDisplay(),s=t.readYForDisplay();this._writeVertex(e,r,o,s),e.indexWrite(i+0),e.indexWrite(i+1),e.indexWrite(i+2),e.indexWrite(i+1),e.indexWrite(i+3),e.indexWrite(i+2),e.recordEnd()}}export{d as TestMeshWriter,c as TestTechnique};