1 |
- {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { Mesh } from \"./mesh.js\";\nimport { VertexData } from \"./mesh.vertexData.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { MultiMaterial } from \"../Materials/multiMaterial.js\";\nimport { SubMesh } from \"./subMesh.js\";\nimport { _LoadScriptModuleAsync } from \"../Misc/tools.internals.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\n/**\n * Main manifold library\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nlet Manifold;\n/**\n * Manifold mesh\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nlet ManifoldMesh;\n/**\n * First ID to use for materials indexing\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nlet FirstID;\n/**\n * Wrapper around the Manifold library\n * https://manifoldcad.org/\n * Use this class to perform fast boolean operations on meshes\n * #IW43EB#15 - basic operations\n * #JUKXQD#6104 - skull vs box\n * #JUKXQD#6111 - skull vs vertex data\n */\nexport class CSG2 {\n /**\n * Return the size of a vertex (at least 3 for the position)\n */\n get numProp() {\n return this._numProp;\n }\n constructor(manifold, numProp, vertexStructure) {\n this._manifold = manifold;\n this._numProp = numProp;\n this._vertexStructure = vertexStructure;\n }\n _process(operation, csg) {\n if (this.numProp !== csg.numProp) {\n throw new Error(\"CSG must be used with geometries having the same number of properties\");\n }\n return new CSG2(Manifold[operation](this._manifold, csg._manifold), this.numProp, this._vertexStructure);\n }\n /**\n * Run a difference operation between two CSG\n * @param csg defines the CSG to use to create the difference\n * @returns a new csg\n */\n subtract(csg) {\n return this._process(\"difference\", csg);\n }\n /**\n * Run an intersection operation between two CSG\n * @param csg defines the CSG to use to create the intersection\n * @returns a new csg\n */\n intersect(csg) {\n return this._process(\"intersection\", csg);\n }\n /**\n * Run an union operation between two CSG\n * @param csg defines the CSG to use to create the union\n * @returns a new csg\n */\n add(csg) {\n return this._process(\"union\", csg);\n }\n /**\n * Print debug information about the CSG\n */\n printDebug() {\n Logger.Log(\"Genus:\" + this._manifold.genus());\n const properties = this._manifold.getProperties();\n Logger.Log(\"Volume:\" + properties.volume);\n Logger.Log(\"surface area:\" + properties.surfaceArea);\n }\n /**\n * Generate a vertex data from the CSG\n * @param options defines the options to use to rebuild the vertex data\n * @returns a new vertex data\n */\n toVertexData(options) {\n const localOptions = {\n rebuildNormals: false,\n ...options\n };\n const vertexData = new VertexData();\n const normalComponent = this._vertexStructure.find(c => c.kind === VertexBuffer.NormalKind);\n const manifoldMesh = this._manifold.getMesh(localOptions.rebuildNormals && normalComponent ? [3, 4, 5] : undefined);\n vertexData.indices = manifoldMesh.triVerts.length > 65535 ? new Uint32Array(manifoldMesh.triVerts) : new Uint16Array(manifoldMesh.triVerts);\n for (let i = 0; i < manifoldMesh.triVerts.length; i += 3) {\n vertexData.indices[i] = manifoldMesh.triVerts[i + 2];\n vertexData.indices[i + 1] = manifoldMesh.triVerts[i + 1];\n vertexData.indices[i + 2] = manifoldMesh.triVerts[i];\n }\n const vertexCount = manifoldMesh.vertProperties.length / manifoldMesh.numProp;\n // Attributes\n let offset = 0;\n for (let componentIndex = 0; componentIndex < this._vertexStructure.length; componentIndex++) {\n const component = this._vertexStructure[componentIndex];\n const data = new Float32Array(vertexCount * component.stride);\n for (let i = 0; i < vertexCount; i++) {\n for (let strideIndex = 0; strideIndex < component.stride; strideIndex++) {\n data[i * component.stride + strideIndex] = manifoldMesh.vertProperties[i * manifoldMesh.numProp + offset + strideIndex];\n }\n }\n vertexData.set(data, component.kind);\n offset += component.stride;\n }\n // Rebuild mesh from vertex data\n return vertexData;\n }\n /**\n * Generate a mesh from the CSG\n * @param name defines the name of the mesh\n * @param scene defines the scene to use to create the mesh\n * @param options defines the options to use to rebuild the mesh\n * @returns a new Mesh\n */\n toMesh(name, scene, options) {\n const localOptions = {\n rebuildNormals: false,\n centerMesh: true,\n ...options\n };\n const vertexData = this.toVertexData({\n rebuildNormals: localOptions.rebuildNormals\n });\n const normalComponent = this._vertexStructure.find(c => c.kind === VertexBuffer.NormalKind);\n const manifoldMesh = this._manifold.getMesh(localOptions.rebuildNormals && normalComponent ? [3, 4, 5] : undefined);\n const vertexCount = manifoldMesh.vertProperties.length / manifoldMesh.numProp;\n // Rebuild mesh from vertex data\n const output = new Mesh(name, scene);\n vertexData.applyToMesh(output);\n // Center mesh\n if (localOptions.centerMesh) {\n const extents = output.getBoundingInfo().boundingSphere.center;\n output.position.set(-extents.x, -extents.y, -extents.z);\n output.bakeCurrentTransformIntoVertices();\n }\n // Submeshes\n let id = manifoldMesh.runOriginalID[0];\n let start = manifoldMesh.runIndex[0];\n let materialIndex = 0;\n const materials = [];\n scene = output.getScene();\n for (let run = 0; run < manifoldMesh.numRun; ++run) {\n const nextID = manifoldMesh.runOriginalID[run + 1];\n if (nextID !== id) {\n const end = manifoldMesh.runIndex[run + 1];\n new SubMesh(materialIndex, 0, vertexCount, start, end - start, output);\n materials.push(scene.getMaterialByUniqueID(id - FirstID) || scene.defaultMaterial);\n id = nextID;\n start = end;\n materialIndex++;\n }\n }\n if (localOptions.materialToUse) {\n output.material = localOptions.materialToUse;\n } else {\n if (materials.length > 1) {\n const multiMaterial = new MultiMaterial(name, scene);\n multiMaterial.subMaterials = materials;\n output.material = multiMaterial;\n } else {\n output.material = materials[0];\n }\n }\n return output;\n }\n /**\n * Dispose the CSG resources\n */\n dispose() {\n if (this._manifold) {\n this._manifold.delete();\n this._manifold = null;\n }\n }\n static _ProcessData(vertexCount, triVerts, structure, numProp, runIndex, runOriginalID) {\n const vertProperties = new Float32Array(vertexCount * structure.reduce((acc, cur) => acc + cur.stride, 0));\n for (let i = 0; i < vertexCount; i++) {\n let offset = 0;\n for (let idx = 0; idx < structure.length; idx++) {\n const component = structure[idx];\n for (let strideIndex = 0; strideIndex < component.stride; strideIndex++) {\n vertProperties[i * numProp + offset + strideIndex] = component.data[i * component.stride + strideIndex];\n }\n offset += component.stride;\n }\n }\n const manifoldMesh = new ManifoldMesh({\n numProp: numProp,\n vertProperties,\n triVerts,\n runIndex,\n runOriginalID\n });\n manifoldMesh.merge();\n let returnValue;\n try {\n returnValue = new CSG2(new Manifold(manifoldMesh), numProp, structure);\n } catch (e) {\n throw new Error(\"Error while creating the CSG: \" + e.message);\n }\n return returnValue;\n }\n static _Construct(data, worldMatrix, runIndex, runOriginalID) {\n // Create the MeshGL for I/O with Manifold library.\n const triVerts = new Uint32Array(data.indices.length);\n // Revert order\n for (let i = 0; i < data.indices.length; i += 3) {\n triVerts[i] = data.indices[i + 2];\n triVerts[i + 1] = data.indices[i + 1];\n triVerts[i + 2] = data.indices[i];\n }\n const tempVector3 = new Vector3();\n let numProp = 3;\n const structure = [{\n stride: 3,\n kind: VertexBuffer.PositionKind\n }];\n if (!worldMatrix) {\n structure[0].data = data.positions;\n } else {\n const positions = new Float32Array(data.positions.length);\n for (let i = 0; i < data.positions.length; i += 3) {\n Vector3.TransformCoordinatesFromFloatsToRef(data.positions[i], data.positions[i + 1], data.positions[i + 2], worldMatrix, tempVector3);\n tempVector3.toArray(positions, i);\n }\n structure[0].data = positions;\n }\n // Normals\n const sourceNormals = data.normals;\n if (sourceNormals) {\n numProp += 3;\n structure.push({\n stride: 3,\n kind: VertexBuffer.NormalKind\n });\n if (!worldMatrix) {\n structure[1].data = sourceNormals;\n } else {\n const normals = new Float32Array(sourceNormals.length);\n for (let i = 0; i < sourceNormals.length; i += 3) {\n Vector3.TransformNormalFromFloatsToRef(sourceNormals[i], sourceNormals[i + 1], sourceNormals[i + 2], worldMatrix, tempVector3);\n tempVector3.toArray(normals, i);\n }\n structure[1].data = normals;\n }\n }\n // UVs\n for (const kind of [VertexBuffer.UVKind, VertexBuffer.UV2Kind, VertexBuffer.UV3Kind, VertexBuffer.UV4Kind, VertexBuffer.UV5Kind, VertexBuffer.UV6Kind]) {\n const sourceUV = data[kind === VertexBuffer.UVKind ? \"uvs\" : kind];\n if (sourceUV) {\n numProp += 2;\n structure.push({\n stride: 2,\n kind: kind,\n data: sourceUV\n });\n }\n }\n // Colors\n const sourceColors = data.colors;\n if (sourceColors) {\n numProp += 4;\n structure.push({\n stride: 4,\n kind: VertexBuffer.ColorKind,\n data: sourceColors\n });\n }\n return this._ProcessData(data.positions.length / 3, triVerts, structure, numProp, runIndex, runOriginalID);\n }\n /**\n * Create a new Constructive Solid Geometry from a vertexData\n * @param vertexData defines the vertexData to use to create the CSG\n * @returns a new CSG2 class\n */\n static FromVertexData(vertexData) {\n const sourceVertices = vertexData.positions;\n const sourceIndices = vertexData.indices;\n if (!sourceVertices || !sourceIndices) {\n throw new Error(\"The vertexData must at least have positions and indices\");\n }\n return this._Construct(vertexData, null);\n }\n /**\n * Create a new Constructive Solid Geometry from a mesh\n * @param mesh defines the mesh to use to create the CSG\n * @param ignoreWorldMatrix defines if the world matrix should be ignored\n * @returns a new CSG2 class\n */\n static FromMesh(mesh, ignoreWorldMatrix = false) {\n const sourceVertices = mesh.getVerticesData(VertexBuffer.PositionKind);\n const sourceIndices = mesh.getIndices();\n const worldMatrix = mesh.computeWorldMatrix(true);\n if (!sourceVertices || !sourceIndices) {\n throw new Error(\"The mesh must at least have positions and indices\");\n }\n // Create a triangle run for each submesh (material)\n const starts = [...Array(mesh.subMeshes.length)].map((_, idx) => mesh.subMeshes[idx].indexStart);\n // Map the materials to ID.\n const sourceMaterial = mesh.material || mesh.getScene().defaultMaterial;\n const isMultiMaterial = sourceMaterial.getClassName() === \"MultiMaterial\";\n const originalIDs = [...Array(mesh.subMeshes.length)].map((_, idx) => {\n if (isMultiMaterial) {\n return FirstID + sourceMaterial.subMaterials[mesh.subMeshes[idx].materialIndex].uniqueId;\n }\n return FirstID + sourceMaterial.uniqueId;\n });\n // List the runs in sequence.\n const indices = Array.from(starts.keys());\n indices.sort((a, b) => starts[a] - starts[b]);\n const runIndex = new Uint32Array(indices.map(i => starts[i]));\n const runOriginalID = new Uint32Array(indices.map(i => originalIDs[i]));\n // Process\n const data = {\n positions: sourceVertices,\n indices: sourceIndices,\n normals: mesh.getVerticesData(VertexBuffer.NormalKind),\n colors: mesh.getVerticesData(VertexBuffer.ColorKind),\n uvs: mesh.getVerticesData(VertexBuffer.UVKind),\n uvs2: mesh.getVerticesData(VertexBuffer.UV2Kind),\n uvs3: mesh.getVerticesData(VertexBuffer.UV3Kind),\n uvs4: mesh.getVerticesData(VertexBuffer.UV4Kind),\n uvs5: mesh.getVerticesData(VertexBuffer.UV5Kind),\n uvs6: mesh.getVerticesData(VertexBuffer.UV6Kind)\n };\n return this._Construct(data, ignoreWorldMatrix ? null : worldMatrix, runIndex, runOriginalID);\n }\n}\n/**\n * Checks if the Manifold library is ready\n * @returns true if the Manifold library is ready\n */\nexport function IsCSG2Ready() {\n return Manifold !== undefined;\n}\n/**\n * Initialize the Manifold library\n * @param options defines the options to use to initialize the library\n */\nexport function InitializeCSG2Async(_x) {\n return _InitializeCSG2Async.apply(this, arguments);\n}\nfunction _InitializeCSG2Async() {\n _InitializeCSG2Async = _asyncToGenerator(function* (options) {\n const localOptions = {\n manifoldUrl: \"https://unpkg.com/manifold-3d@3.0.0\",\n ...options\n };\n if (localOptions.manifoldInstance) {\n Manifold = localOptions.manifoldInstance;\n ManifoldMesh = localOptions.manifoldMeshInstance;\n } else {\n const result = yield _LoadScriptModuleAsync(`\n import Module from '${localOptions.manifoldUrl}/manifold.js';\n const wasm = await Module();\n wasm.setup();\n const {Manifold, Mesh} = wasm;\n const returnedValue = {Manifold, Mesh};\n `);\n Manifold = result.Manifold;\n ManifoldMesh = result.Mesh;\n }\n // Reserve IDs for materials (we consider that there will be no more than 65536 materials)\n FirstID = Manifold.reserveIDs(65536);\n });\n return _InitializeCSG2Async.apply(this, arguments);\n}","map":{"version":3,"names":["Mesh","VertexData","VertexBuffer","Logger","MultiMaterial","SubMesh","_LoadScriptModuleAsync","Vector3","Manifold","ManifoldMesh","FirstID","CSG2","numProp","_numProp","constructor","manifold","vertexStructure","_manifold","_vertexStructure","_process","operation","csg","Error","subtract","intersect","add","printDebug","Log","genus","properties","getProperties","volume","surfaceArea","toVertexData","options","localOptions","rebuildNormals","vertexData","normalComponent","find","c","kind","NormalKind","manifoldMesh","getMesh","undefined","indices","triVerts","length","Uint32Array","Uint16Array","i","vertexCount","vertProperties","offset","componentIndex","component","data","Float32Array","stride","strideIndex","set","toMesh","name","scene","centerMesh","output","applyToMesh","extents","getBoundingInfo","boundingSphere","center","position","x","y","z","bakeCurrentTransformIntoVertices","id","runOriginalID","start","runIndex","materialIndex","materials","getScene","run","numRun","nextID","end","push","getMaterialByUniqueID","defaultMaterial","materialToUse","material","multiMaterial","subMaterials","dispose","delete","_ProcessData","structure","reduce","acc","cur","idx","merge","returnValue","e","message","_Construct","worldMatrix","tempVector3","PositionKind","positions","TransformCoordinatesFromFloatsToRef","toArray","sourceNormals","normals","TransformNormalFromFloatsToRef","UVKind","UV2Kind","UV3Kind","UV4Kind","UV5Kind","UV6Kind","sourceUV","sourceColors","colors","ColorKind","FromVertexData","sourceVertices","sourceIndices","FromMesh","mesh","ignoreWorldMatrix","getVerticesData","getIndices","computeWorldMatrix","starts","Array","subMeshes","map","_","indexStart","sourceMaterial","isMultiMaterial","getClassName","originalIDs","uniqueId","from","keys","sort","a","b","uvs","uvs2","uvs3","uvs4","uvs5","uvs6","IsCSG2Ready","InitializeCSG2Async","_x","_InitializeCSG2Async","apply","arguments","_asyncToGenerator","manifoldUrl","manifoldInstance","manifoldMeshInstance","result","reserveIDs"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/csg2.js"],"sourcesContent":["import { Mesh } from \"./mesh.js\";\nimport { VertexData } from \"./mesh.vertexData.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { MultiMaterial } from \"../Materials/multiMaterial.js\";\nimport { SubMesh } from \"./subMesh.js\";\nimport { _LoadScriptModuleAsync } from \"../Misc/tools.internals.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\n/**\n * Main manifold library\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nlet Manifold;\n/**\n * Manifold mesh\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nlet ManifoldMesh;\n/**\n * First ID to use for materials indexing\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nlet FirstID;\n/**\n * Wrapper around the Manifold library\n * https://manifoldcad.org/\n * Use this class to perform fast boolean operations on meshes\n * #IW43EB#15 - basic operations\n * #JUKXQD#6104 - skull vs box\n * #JUKXQD#6111 - skull vs vertex data\n */\nexport class CSG2 {\n /**\n * Return the size of a vertex (at least 3 for the position)\n */\n get numProp() {\n return this._numProp;\n }\n constructor(manifold, numProp, vertexStructure) {\n this._manifold = manifold;\n this._numProp = numProp;\n this._vertexStructure = vertexStructure;\n }\n _process(operation, csg) {\n if (this.numProp !== csg.numProp) {\n throw new Error(\"CSG must be used with geometries having the same number of properties\");\n }\n return new CSG2(Manifold[operation](this._manifold, csg._manifold), this.numProp, this._vertexStructure);\n }\n /**\n * Run a difference operation between two CSG\n * @param csg defines the CSG to use to create the difference\n * @returns a new csg\n */\n subtract(csg) {\n return this._process(\"difference\", csg);\n }\n /**\n * Run an intersection operation between two CSG\n * @param csg defines the CSG to use to create the intersection\n * @returns a new csg\n */\n intersect(csg) {\n return this._process(\"intersection\", csg);\n }\n /**\n * Run an union operation between two CSG\n * @param csg defines the CSG to use to create the union\n * @returns a new csg\n */\n add(csg) {\n return this._process(\"union\", csg);\n }\n /**\n * Print debug information about the CSG\n */\n printDebug() {\n Logger.Log(\"Genus:\" + this._manifold.genus());\n const properties = this._manifold.getProperties();\n Logger.Log(\"Volume:\" + properties.volume);\n Logger.Log(\"surface area:\" + properties.surfaceArea);\n }\n /**\n * Generate a vertex data from the CSG\n * @param options defines the options to use to rebuild the vertex data\n * @returns a new vertex data\n */\n toVertexData(options) {\n const localOptions = {\n rebuildNormals: false,\n ...options,\n };\n const vertexData = new VertexData();\n const normalComponent = this._vertexStructure.find((c) => c.kind === VertexBuffer.NormalKind);\n const manifoldMesh = this._manifold.getMesh(localOptions.rebuildNormals && normalComponent ? [3, 4, 5] : undefined);\n vertexData.indices = manifoldMesh.triVerts.length > 65535 ? new Uint32Array(manifoldMesh.triVerts) : new Uint16Array(manifoldMesh.triVerts);\n for (let i = 0; i < manifoldMesh.triVerts.length; i += 3) {\n vertexData.indices[i] = manifoldMesh.triVerts[i + 2];\n vertexData.indices[i + 1] = manifoldMesh.triVerts[i + 1];\n vertexData.indices[i + 2] = manifoldMesh.triVerts[i];\n }\n const vertexCount = manifoldMesh.vertProperties.length / manifoldMesh.numProp;\n // Attributes\n let offset = 0;\n for (let componentIndex = 0; componentIndex < this._vertexStructure.length; componentIndex++) {\n const component = this._vertexStructure[componentIndex];\n const data = new Float32Array(vertexCount * component.stride);\n for (let i = 0; i < vertexCount; i++) {\n for (let strideIndex = 0; strideIndex < component.stride; strideIndex++) {\n data[i * component.stride + strideIndex] = manifoldMesh.vertProperties[i * manifoldMesh.numProp + offset + strideIndex];\n }\n }\n vertexData.set(data, component.kind);\n offset += component.stride;\n }\n // Rebuild mesh from vertex data\n return vertexData;\n }\n /**\n * Generate a mesh from the CSG\n * @param name defines the name of the mesh\n * @param scene defines the scene to use to create the mesh\n * @param options defines the options to use to rebuild the mesh\n * @returns a new Mesh\n */\n toMesh(name, scene, options) {\n const localOptions = {\n rebuildNormals: false,\n centerMesh: true,\n ...options,\n };\n const vertexData = this.toVertexData({ rebuildNormals: localOptions.rebuildNormals });\n const normalComponent = this._vertexStructure.find((c) => c.kind === VertexBuffer.NormalKind);\n const manifoldMesh = this._manifold.getMesh(localOptions.rebuildNormals && normalComponent ? [3, 4, 5] : undefined);\n const vertexCount = manifoldMesh.vertProperties.length / manifoldMesh.numProp;\n // Rebuild mesh from vertex data\n const output = new Mesh(name, scene);\n vertexData.applyToMesh(output);\n // Center mesh\n if (localOptions.centerMesh) {\n const extents = output.getBoundingInfo().boundingSphere.center;\n output.position.set(-extents.x, -extents.y, -extents.z);\n output.bakeCurrentTransformIntoVertices();\n }\n // Submeshes\n let id = manifoldMesh.runOriginalID[0];\n let start = manifoldMesh.runIndex[0];\n let materialIndex = 0;\n const materials = [];\n scene = output.getScene();\n for (let run = 0; run < manifoldMesh.numRun; ++run) {\n const nextID = manifoldMesh.runOriginalID[run + 1];\n if (nextID !== id) {\n const end = manifoldMesh.runIndex[run + 1];\n new SubMesh(materialIndex, 0, vertexCount, start, end - start, output);\n materials.push(scene.getMaterialByUniqueID(id - FirstID) || scene.defaultMaterial);\n id = nextID;\n start = end;\n materialIndex++;\n }\n }\n if (localOptions.materialToUse) {\n output.material = localOptions.materialToUse;\n }\n else {\n if (materials.length > 1) {\n const multiMaterial = new MultiMaterial(name, scene);\n multiMaterial.subMaterials = materials;\n output.material = multiMaterial;\n }\n else {\n output.material = materials[0];\n }\n }\n return output;\n }\n /**\n * Dispose the CSG resources\n */\n dispose() {\n if (this._manifold) {\n this._manifold.delete();\n this._manifold = null;\n }\n }\n static _ProcessData(vertexCount, triVerts, structure, numProp, runIndex, runOriginalID) {\n const vertProperties = new Float32Array(vertexCount * structure.reduce((acc, cur) => acc + cur.stride, 0));\n for (let i = 0; i < vertexCount; i++) {\n let offset = 0;\n for (let idx = 0; idx < structure.length; idx++) {\n const component = structure[idx];\n for (let strideIndex = 0; strideIndex < component.stride; strideIndex++) {\n vertProperties[i * numProp + offset + strideIndex] = component.data[i * component.stride + strideIndex];\n }\n offset += component.stride;\n }\n }\n const manifoldMesh = new ManifoldMesh({ numProp: numProp, vertProperties, triVerts, runIndex, runOriginalID });\n manifoldMesh.merge();\n let returnValue;\n try {\n returnValue = new CSG2(new Manifold(manifoldMesh), numProp, structure);\n }\n catch (e) {\n throw new Error(\"Error while creating the CSG: \" + e.message);\n }\n return returnValue;\n }\n static _Construct(data, worldMatrix, runIndex, runOriginalID) {\n // Create the MeshGL for I/O with Manifold library.\n const triVerts = new Uint32Array(data.indices.length);\n // Revert order\n for (let i = 0; i < data.indices.length; i += 3) {\n triVerts[i] = data.indices[i + 2];\n triVerts[i + 1] = data.indices[i + 1];\n triVerts[i + 2] = data.indices[i];\n }\n const tempVector3 = new Vector3();\n let numProp = 3;\n const structure = [{ stride: 3, kind: VertexBuffer.PositionKind }];\n if (!worldMatrix) {\n structure[0].data = data.positions;\n }\n else {\n const positions = new Float32Array(data.positions.length);\n for (let i = 0; i < data.positions.length; i += 3) {\n Vector3.TransformCoordinatesFromFloatsToRef(data.positions[i], data.positions[i + 1], data.positions[i + 2], worldMatrix, tempVector3);\n tempVector3.toArray(positions, i);\n }\n structure[0].data = positions;\n }\n // Normals\n const sourceNormals = data.normals;\n if (sourceNormals) {\n numProp += 3;\n structure.push({ stride: 3, kind: VertexBuffer.NormalKind });\n if (!worldMatrix) {\n structure[1].data = sourceNormals;\n }\n else {\n const normals = new Float32Array(sourceNormals.length);\n for (let i = 0; i < sourceNormals.length; i += 3) {\n Vector3.TransformNormalFromFloatsToRef(sourceNormals[i], sourceNormals[i + 1], sourceNormals[i + 2], worldMatrix, tempVector3);\n tempVector3.toArray(normals, i);\n }\n structure[1].data = normals;\n }\n }\n // UVs\n for (const kind of [VertexBuffer.UVKind, VertexBuffer.UV2Kind, VertexBuffer.UV3Kind, VertexBuffer.UV4Kind, VertexBuffer.UV5Kind, VertexBuffer.UV6Kind]) {\n const sourceUV = data[kind === VertexBuffer.UVKind ? \"uvs\" : kind];\n if (sourceUV) {\n numProp += 2;\n structure.push({ stride: 2, kind: kind, data: sourceUV });\n }\n }\n // Colors\n const sourceColors = data.colors;\n if (sourceColors) {\n numProp += 4;\n structure.push({ stride: 4, kind: VertexBuffer.ColorKind, data: sourceColors });\n }\n return this._ProcessData(data.positions.length / 3, triVerts, structure, numProp, runIndex, runOriginalID);\n }\n /**\n * Create a new Constructive Solid Geometry from a vertexData\n * @param vertexData defines the vertexData to use to create the CSG\n * @returns a new CSG2 class\n */\n static FromVertexData(vertexData) {\n const sourceVertices = vertexData.positions;\n const sourceIndices = vertexData.indices;\n if (!sourceVertices || !sourceIndices) {\n throw new Error(\"The vertexData must at least have positions and indices\");\n }\n return this._Construct(vertexData, null);\n }\n /**\n * Create a new Constructive Solid Geometry from a mesh\n * @param mesh defines the mesh to use to create the CSG\n * @param ignoreWorldMatrix defines if the world matrix should be ignored\n * @returns a new CSG2 class\n */\n static FromMesh(mesh, ignoreWorldMatrix = false) {\n const sourceVertices = mesh.getVerticesData(VertexBuffer.PositionKind);\n const sourceIndices = mesh.getIndices();\n const worldMatrix = mesh.computeWorldMatrix(true);\n if (!sourceVertices || !sourceIndices) {\n throw new Error(\"The mesh must at least have positions and indices\");\n }\n // Create a triangle run for each submesh (material)\n const starts = [...Array(mesh.subMeshes.length)].map((_, idx) => mesh.subMeshes[idx].indexStart);\n // Map the materials to ID.\n const sourceMaterial = mesh.material || mesh.getScene().defaultMaterial;\n const isMultiMaterial = sourceMaterial.getClassName() === \"MultiMaterial\";\n const originalIDs = [...Array(mesh.subMeshes.length)].map((_, idx) => {\n if (isMultiMaterial) {\n return FirstID + sourceMaterial.subMaterials[mesh.subMeshes[idx].materialIndex].uniqueId;\n }\n return FirstID + sourceMaterial.uniqueId;\n });\n // List the runs in sequence.\n const indices = Array.from(starts.keys());\n indices.sort((a, b) => starts[a] - starts[b]);\n const runIndex = new Uint32Array(indices.map((i) => starts[i]));\n const runOriginalID = new Uint32Array(indices.map((i) => originalIDs[i]));\n // Process\n const data = {\n positions: sourceVertices,\n indices: sourceIndices,\n normals: mesh.getVerticesData(VertexBuffer.NormalKind),\n colors: mesh.getVerticesData(VertexBuffer.ColorKind),\n uvs: mesh.getVerticesData(VertexBuffer.UVKind),\n uvs2: mesh.getVerticesData(VertexBuffer.UV2Kind),\n uvs3: mesh.getVerticesData(VertexBuffer.UV3Kind),\n uvs4: mesh.getVerticesData(VertexBuffer.UV4Kind),\n uvs5: mesh.getVerticesData(VertexBuffer.UV5Kind),\n uvs6: mesh.getVerticesData(VertexBuffer.UV6Kind),\n };\n return this._Construct(data, ignoreWorldMatrix ? null : worldMatrix, runIndex, runOriginalID);\n }\n}\n/**\n * Checks if the Manifold library is ready\n * @returns true if the Manifold library is ready\n */\nexport function IsCSG2Ready() {\n return Manifold !== undefined;\n}\n/**\n * Initialize the Manifold library\n * @param options defines the options to use to initialize the library\n */\nexport async function InitializeCSG2Async(options) {\n const localOptions = {\n manifoldUrl: \"https://unpkg.com/manifold-3d@3.0.0\",\n ...options,\n };\n if (localOptions.manifoldInstance) {\n Manifold = localOptions.manifoldInstance;\n ManifoldMesh = localOptions.manifoldMeshInstance;\n }\n else {\n const result = await _LoadScriptModuleAsync(`\r\n import Module from '${localOptions.manifoldUrl}/manifold.js';\r\n const wasm = await Module();\r\n wasm.setup();\r\n const {Manifold, Mesh} = wasm;\r\n const returnedValue = {Manifold, Mesh};\r\n `);\n Manifold = result.Manifold;\n ManifoldMesh = result.Mesh;\n }\n // Reserve IDs for materials (we consider that there will be no more than 65536 materials)\n FirstID = Manifold.reserveIDs(65536);\n}\n"],"mappings":";AAAA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,OAAO,QAAQ,cAAc;AACtC,SAASC,sBAAsB,QAAQ,4BAA4B;AACnE,SAASC,OAAO,QAAQ,yBAAyB;AACjD;AACA;AACA;AACA;AACA,IAAIC,QAAQ;AACZ;AACA;AACA;AACA;AACA,IAAIC,YAAY;AAChB;AACA;AACA;AACA;AACA,IAAIC,OAAO;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAAI,CAAC;EACd;AACJ;AACA;EACI,IAAIC,OAAOA,CAAA,EAAG;IACV,OAAO,IAAI,CAACC,QAAQ;EACxB;EACAC,WAAWA,CAACC,QAAQ,EAAEH,OAAO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