/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{perVertexElevationAligner as e}from"../graphics/ElevationAligners.js";import{createMapSpaceUVCoords as r}from"./uvUtils.js";import{ColorMaterial as a}from"../../webgl-engine/materials/ColorMaterial.js";import{PatternMaterial as n}from"../../webgl-engine/materials/PatternMaterial.js";function o(e,r){const o=e?.pattern;return null==o?new a(r):"none"===o.style||"solid"===o.style?("none"===o.style&&(r.color=t(0,0,0,0),r.forceTransparentMode=!0),new a(r)):(r.style=i(o.style),new n(r))}function i(t){switch(t){case"horizontal":return 0;case"vertical":return 1;case"cross":return 2;case"forward-diagonal":return 3;case"backward-diagonal":return 4;case"diagonal-cross":return 5;default:return}}function s(t){return t.material instanceof n&&!t.material.parameters.draped}function l(t,e){if(s(t)){const a=t.attributes.get("position").data,n=t.getMutableAttribute("uvMapSpace").data,o=t.getMutableAttribute("boundingRect").data;r(n,o,a,e)}}function c(t,r,a,n,o){const i=e(t,r,a,n,o),s=t.stageObject.geometries;for(const e of s)l(e,o);return i}export{o as createMaterial,i as parsePatternStyle,s as requiresUVUpdates,l as updateMapSpaceUVCoords,c as uvElevationAligner};
