/*
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{inputAttributesToAttributesMap as e}from"./symbolizationUtils.js";import{cloneAttributeData as t}from"../../../../webgl-engine/lib/AttributeArray.js";import{createPolySphereData as n,createConeGeometryData as i}from"../../../../webgl-engine/lib/GeometryUtil.js";function a(t,a){const o=(t,n,i=!1)=>({levels:t.map(t=>{const o=e(n(t.tesselation));i&&s(o);return{components:[{attributes:o,olidColor:void 0,transformation:null,materialId:a,visibilities:new Uint8Array([1]),objectIds:new Uint32Array([-1])}],minScreenSpaceRadius:t.minScreenSpaceRadius}})});switch(t){case"cone":return o(r,e=>i(1,.5,e,!1),!0);case"sphere":return o([{tesselation:0,minScreenSpaceRadius:0},{tesselation:1,minScreenSpaceRadius:8},{tesselation:2,minScreenSpaceRadius:16},{tesselation:3,minScreenSpaceRadius:50},{tesselation:4,minScreenSpaceRadius:250}],e=>n(.5,e,!0));case"cube":case"inverted-cone":case"cylinder":case"tetrahedron":case"diamond":throw new Error("not implemented");default:return}}function s(e){const t=e,n=t.get("position").data,i=t.get("normal").data;if(i){const t=o(e,"normal").data;for(let e=0;e<i.length;e+=3){const n=i[e+1];t[e+1]=-i[e+2],t[e+2]=n}}if(n){const t=o(e,"position").data;for(let e=0;e<n.length;e+=3){const i=n[e+1];t[e+1]=-n[e+2],t[e+2]=i}}}function o(e,n){let i=e.get(n);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:t(i.data)},e.set(n,i)),i}const r=[{tesselation:6,minScreenSpaceRadius:0},{tesselation:18,minScreenSpaceRadius:7},{tesselation:64,minScreenSpaceRadius:65}];export{a as createPrimitiveGeometry};
