/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import"../../../../core/has.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{createMaterialFromEdges as r}from"../support/edgeUtils.js";const o=.15,t=.5*o;function a(e){switch(e.filterMode.type){case"solid":return{mode:0};case"wire-frame":return{mode:1,edgeMaterial:r(e.filterMode.edges,{})};case"x-ray":return{mode:2}}}function l(e,r){if(null==r)return e.color[3]=0,void(e.edgeMaterial=null);switch(r.mode){case 0:return;case 1:return e.color[3]=0,void(e.edgeMaterial=r.edgeMaterial);case 2:return e.color[0]=1,e.color[1]=1,e.color[2]=1,e.color[3]*=o,e.colorMixMode=3,e.castShadows=!1,e.pickable=!1,void(e.edgeMaterial=c(e.edgeMaterial))}}function c(e){return null==e?null:(n.lastMaterial!==e&&(n.cachedMaterial=i(e),n.lastMaterial=e),n.cachedMaterial)}function i(r){const o=e(r.color);return o[3]*=t,{...r,color:o}}const n={cachedMaterial:null,lastMaterial:null};export{l as applyFilterMode,a as parseFilterMode};
