/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{degToByte as e}from"../../../../vectorTiles/GeometryUtils.js";import{packBitset as o}from"./meshWriterUtils.js";import{patternFillVertexSpec as s,PatternFillMeshWriter as r}from"./PatternFillMeshWriter.js";import{bitsetFillRandomPatternOffset as i,bitsetGenericConsiderAlphaOnly as c}from"../shaders/constants.js";import{DataType as a}from"../../../../../../webgl/enums.js";function p(e){const{sprite:o,aspectRatio:s,scaleProportionally:r}=e,i=t(e.height),c=i>0?i:o.height;let a=i*s;return a<=0?a=o.width:r&&(a*=o.width/o.height),{width:a,height:c}}function n(t){const{applyRandomOffset:e,sampleAlphaOnly:s}=t;return o([[i,e],[c,s]])}const l={createComputedParams:t=>t,optionalAttributes:s.optionalAttributes,attributes:{...s.attributes,bitset:{count:1,type:a.UNSIGNED_BYTE,pack:n},width:{count:1,type:a.HALF_FLOAT,pack:t=>p(t).width},height:{count:1,type:a.HALF_FLOAT,pack:t=>p(t).height},offset:{count:2,type:a.HALF_FLOAT,pack:({offsetX:e,offsetY:o})=>[t(e),-t(o)]},scale:{count:2,type:a.UNSIGNED_BYTE,packPrecisionFactor:16,pack:({scaleX:t,scaleY:e})=>[t,e]},angle:{count:1,type:a.UNSIGNED_BYTE,pack:({angle:t})=>e(t)}}};class h extends r{constructor(){super(...arguments),this.vertexSpec=l}}export{h as ComplexFillMeshWriter,l as complexFillVertexSpec,p as getPatternSize,n as packComplexFillBitset};
