/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{spritePadding as r}from"../../../definitions.js";import{packBitset as s}from"../fill/meshWriterUtils.js";import{LineMeshWriter as o,LineVertexSpec as i}from"./LineMeshWriter.js";import{bitsetGenericConsiderAlphaOnly as a,bitsetLineScaleDash as n,bitsetLineIsSdf as c}from"../shaders/constants.js";import{DataType as p}from"../../../../../../webgl/enums.js";const u={createComputedParams:t=>t,optionalAttributes:i.optionalAttributes,attributes:{...i.attributes,bitset:{type:p.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:t,shouldScaleDash:e,isSDF:r})=>s([[a,t],[n,e],[c,r]])},tlbr:{type:p.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:o}=t,i=e.x+r,a=e.y+r;return[i,a,i+s,a+o]}},accumulatedDistance:{type:p.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},segmentDirection:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},offsetAlongLine:{type:p.HALF_FLOAT,count:1,pack:({offsetAlongLine:e})=>t(e)},capType:{type:p.UNSIGNED_BYTE,count:1,pack:({capType:t})=>{switch(t){case"Butt":case"butt":default:return 0;case"Square":case"square":return 1;case"Round":case"round":return 2}}}}};class l extends o{constructor(t,e,r,s){super(t,e,r,s),this.vertexSpec=u,this._tessellationOptions.textured=!0}_write(t,r,s){const o=s??e.fromFeatureSetReaderCIM(r);if(!o)return;const{sprite:i}=this.evaluatedMeshParams;this._writeGeometry(t,r,o,i?.textureBinding)}}export{l as TexturedLineMeshWriter,u as texturedLineVertexSpec};
