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