import{a as H,b as q,I as J,c as et,d as rt,B as nt,V as I,T as ot,e as j,f as st}from"./three.module-BB51Dq4E.js";function at(t,o,i=!0){if(!o||!o.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!t.hasAttribute("position")||!t.hasAttribute("normal")||!t.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function u(e){if(e.normalized||e.isInterleavedBufferAttribute){const s=new Float32Array(e.count*e.itemSize);for(let c=0,m=0;c2&&(s[m++]=e.getZ(c));return s}return e.array instanceof Float32Array?e.array:new Float32Array(e.array)}const n=t.index?t.toNonIndexed():t,a=o.generateTangents(u(n.attributes.position),u(n.attributes.normal),u(n.attributes.uv));if(i)for(let e=3;e=2&&e.setY(s,t.getY(s)),u>=3&&e.setZ(s,t.getZ(s)),u>=4&&e.setW(s,t.getW(s));return e}function ft(t){const o=t.attributes,i=t.morphTargets,u=new Map;for(const n in o){const a=o[n];a.isInterleavedBufferAttribute&&(u.has(a)||u.set(a,W(a)),o[n]=u.get(a))}for(const n in i){const a=i[n];a.isInterleavedBufferAttribute&&(u.has(a)||u.set(a,W(a)),i[n]=u.get(a))}}function mt(t){let o=0;for(const u in t.attributes){const n=t.getAttribute(u);o+=n.count*n.itemSize*n.array.BYTES_PER_ELEMENT}const i=t.getIndex();return o+=i?i.count*i.itemSize*i.array.BYTES_PER_ELEMENT:0,o}function dt(t,o=1e-4){o=Math.max(o,Number.EPSILON);const i={},u=t.getIndex(),n=t.getAttribute("position"),a=u?u.count:n.count;let e=0;const s=Object.keys(t.attributes),c={},m={},r=[],l=["getX","getY","getZ","getW"],w=["setX","setY","setZ","setW"];for(let b=0,B=s.length;be.materialIndex!==s.materialIndex?e.materialIndex-s.materialIndex:e.start-s.start),t.getIndex()===null){const e=t.getAttribute("position"),s=[];for(let c=0;ci&&c.add(U)}c.normalize(),g.setXYZ(x+p,c.x,c.y,c.z)}}return r.setAttribute("normal",g),r}function At(t,o=!1){return console.warn("THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries()."),it(t,o)}function wt(t){return console.warn("THREE.BufferGeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes()."),O(t)}export{at as computeMikkTSpaceTangents,pt as computeMorphedAttributes,lt as deepCloneAttribute,W as deinterleaveAttribute,ft as deinterleaveGeometry,mt as estimateBytesUsed,ct as interleaveAttributes,O as mergeAttributes,wt as mergeBufferAttributes,At as mergeBufferGeometries,it as mergeGeometries,gt as mergeGroups,dt as mergeVertices,bt as toCreasedNormals,ht as toTrianglesDrawMode}; //# sourceMappingURL=BufferGeometryUtils-xu92ooFc.js.map