/** * Minified by jsDelivr using Terser v5.39.0. * Original file: /npm/three@0.160.0/examples/jsm/utils/BufferGeometryUtils.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ import{BufferAttribute,BufferGeometry,Float32BufferAttribute,InstancedBufferAttribute,InterleavedBuffer,InterleavedBufferAttribute,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,Vector3}from"three";function computeMikkTSpaceTangents(e,t,r=!0){if(!t||!t.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!e.hasAttribute("position")||!e.hasAttribute("normal")||!e.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function o(e){if(e.normalized||e.isInterleavedBufferAttribute){const t=new Float32Array(e.count*e.itemSize);for(let r=0,o=0;r2&&(t[o++]=e.getZ(r));return t}return e.array instanceof Float32Array?e.array:new Float32Array(e.array)}const n=e.index?e.toNonIndexed():e,i=t.generateTangents(o(n.attributes.position),o(n.attributes.normal),o(n.attributes.uv));if(r)for(let e=3;e=2&&s.setY(t,e.getY(t)),o>=3&&s.setZ(t,e.getZ(t)),o>=4&&s.setW(t,e.getW(t));return s}export function deinterleaveGeometry(e){const t=e.attributes,r=e.morphTargets,o=new Map;for(const e in t){const r=t[e];r.isInterleavedBufferAttribute&&(o.has(r)||o.set(r,deinterleaveAttribute(r)),t[e]=o.get(r))}for(const e in r){const t=r[e];t.isInterleavedBufferAttribute&&(o.has(t)||o.set(t,deinterleaveAttribute(t)),r[e]=o.get(t))}}function estimateBytesUsed(e){let t=0;for(const r in e.attributes){const o=e.getAttribute(r);t+=o.count*o.itemSize*o.array.BYTES_PER_ELEMENT}const r=e.getIndex();return t+=r?r.count*r.itemSize*r.array.BYTES_PER_ELEMENT:0,t}function mergeVertices(e,t=1e-4){t=Math.max(t,Number.EPSILON);const r={},o=e.getIndex(),n=e.getAttribute("position"),i=o?o.count:n.count;let s=0;const u=Object.keys(e.attributes),a={},f={},l=[],c=["getX","getY","getZ","getW"],m=["setX","setY","setZ","setW"];for(let t=0,r=u.length;te.materialIndex!==t.materialIndex?e.materialIndex-t.materialIndex:e.start-t.start)),null===e.getIndex()){const t=e.getAttribute("position"),r=[];for(let e=0;er&&a.add(t)}a.normalize(),d.setXYZ(t+e,a.x,a.y,a.z)}}return l.setAttribute("normal",d),l}function mergeBufferGeometries(e,t=!1){return console.warn("THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries()."),mergeGeometries(e,t)}function mergeBufferAttributes(e){return console.warn("THREE.BufferGeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes()."),mergeAttributes(e)}export{computeMikkTSpaceTangents,mergeGeometries,mergeBufferGeometries,mergeAttributes,mergeBufferAttributes,interleaveAttributes,estimateBytesUsed,mergeVertices,toTrianglesDrawMode,computeMorphedAttributes,mergeGroups,toCreasedNormals}; //# sourceMappingURL=/sm/44d72d96987edbca31772bfa763d1f35fcb2972c6a9013fc0582f56eef1be960.map