UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.3 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{getPatternSize as t,packComplexFillBitset as s,complexFillVertexSpec as r}from"./ComplexFillMeshWriter.js";import{packBitset as i}from"./meshWriterUtils.js";import{OutlineFillMeshWriter as a,OutlineFillOutlineMeshWriter as o,outlineFillVertexSpec_Outline as u}from"./OutlineFillMeshWriter.js";import{packPrecision as n,signedToUnsignedByte as c,bitsetTypeFillOutline as p}from"../shaders/constants.js";import{DataType as l}from"../../../../../../webgl/enums.js";const d=r,h=u,m={createComputedParams:e=>e,optionalAttributes:d.optionalAttributes,attributes:{...d.attributes,bitset:{type:l.UNSIGNED_BYTE,count:1,pack:e=>s(e)},aux1:{count:1,type:l.HALF_FLOAT,pack:e=>t(e).width},aux2:{count:1,type:l.HALF_FLOAT,pack:e=>t(e).height},aux3:{count:2,type:l.HALF_FLOAT,pack:({offsetX:t,offsetY:s})=>[e(t),e(s)]},aux4:{count:2,type:l.UNSIGNED_BYTE,pack:({scaleX:e,scaleY:t})=>[e*n,t*n]}}},x={createComputedParams:e=>e,optionalAttributes:d.optionalAttributes,attributes:{...d.attributes,color:h.attributes.color,bitset:{type:l.UNSIGNED_BYTE,count:1,pack:e=>i([[p,!0]])},aux1:{count:1,type:l.HALF_FLOAT,pack:t=>e(.5*t.width)},aux2:{count:1,type:l.HALF_FLOAT,pack:t=>e(.5*t.referenceWidth)},aux3:{count:2,type:l.HALF_FLOAT,packTessellation:({extrusionOffsetX:e,extrusionOffsetY:t})=>[e,t]},aux4:{count:2,type:l.UNSIGNED_BYTE,packTessellation:({normalX:e,normalY:t})=>[e*n+c,t*n+c]}}};class A extends o{constructor(){super(...arguments),this.vertexSpec=x}}class f extends a{constructor(){super(...arguments),this.vertexSpec=m}_createOutlineWriter(e,t,s,r){return new A(e,t,s,r)}write(e,t,s,r,i){this.ensurePacked(t,s,r);const a=this.evaluatedMeshParams.sprite?.textureBinding;e.recordStart(this.instanceId,this.attributeLayout,a),this._write(e,s),e.recordEnd()}ensurePacked(e,t,s){super.ensurePacked(e,t,s),this._lineMeshWriter.ensurePacked(e,t,s)}enqueueRequest(e,t,s){super.enqueueRequest(e,t,s),this._lineMeshWriter.enqueueRequest(e,t,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}export{f as ComplexOutlineFillMeshWriter};