{"ast":null,"code":"import { VertexBuffer } from \"@babylonjs/core/Buffers/buffer.js\";\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial.js\";\nimport { Color3, Color4 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { Vector2, Vector3 } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry.js\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh.js\";\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData.js\";\nimport { Logger } from \"@babylonjs/core/Misc/logger.js\";\n/**\n * Class used to load mesh data from OBJ content\n */\nexport class SolidParser {\n /**\n * Creates a new SolidParser\n * @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)\n * @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)\n * @param loadingOptions defines the loading options to use\n */\n constructor(materialToUse, babylonMeshesArray, loadingOptions) {\n this._positions = []; //values for the positions of vertices\n this._normals = []; //Values for the normals\n this._uvs = []; //Values for the textures\n this._colors = [];\n this._meshesFromObj = []; //[mesh] Contains all the obj meshes\n this._indicesForBabylon = []; //The list of indices for VertexData\n this._wrappedPositionForBabylon = []; //The list of position in vectors\n this._wrappedUvsForBabylon = []; //Array with all value of uvs to match with the indices\n this._wrappedColorsForBabylon = []; // Array with all color values to match with the indices\n this._wrappedNormalsForBabylon = []; //Array with all value of normals to match with the indices\n this._tuplePosNorm = []; //Create a tuple with indice of Position, Normal, UV [pos, norm, uvs]\n this._curPositionInIndices = 0;\n this._hasMeshes = false; //Meshes are defined in the file\n this._unwrappedPositionsForBabylon = []; //Value of positionForBabylon w/o Vector3() [x,y,z]\n this._unwrappedColorsForBabylon = []; // Value of colorForBabylon w/o Color4() [r,g,b,a]\n this._unwrappedNormalsForBabylon = []; //Value of normalsForBabylon w/o Vector3() [x,y,z]\n this._unwrappedUVForBabylon = []; //Value of uvsForBabylon w/o Vector3() [x,y,z]\n this._triangles = []; //Indices from new triangles coming from polygons\n this._materialNameFromObj = \"\"; //The name of the current material\n this._objMeshName = \"\"; //The name of the current obj mesh\n this._increment = 1; //Id for meshes created by the multimaterial\n this._isFirstMaterial = true;\n this._grayColor = new Color4(0.5, 0.5, 0.5, 1);\n this._materialToUse = materialToUse;\n this._babylonMeshesArray = babylonMeshesArray;\n this._loadingOptions = loadingOptions;\n }\n /**\n * Search for obj in the given array.\n * This function is called to check if a couple of data already exists in an array.\n *\n * If found, returns the index of the founded tuple index. Returns -1 if not found\n * @param arr Array<{ normals: Array, idx: Array }>\n * @param obj Array\n * @returns {boolean}\n */\n _isInArray(arr, obj) {\n if (!arr[obj[0]]) {\n arr[obj[0]] = {\n normals: [],\n idx: []\n };\n }\n const idx = arr[obj[0]].normals.indexOf(obj[1]);\n return idx === -1 ? -1 : arr[obj[0]].idx[idx];\n }\n _isInArrayUV(arr, obj) {\n if (!arr[obj[0]]) {\n arr[obj[0]] = {\n normals: [],\n idx: [],\n uv: []\n };\n }\n const idx = arr[obj[0]].normals.indexOf(obj[1]);\n if (idx != 1 && obj[2] === arr[obj[0]].uv[idx]) {\n return arr[obj[0]].idx[idx];\n }\n return -1;\n }\n /**\n * This function set the data for each triangle.\n * Data are position, normals and uvs\n * If a tuple of (position, normal) is not set, add the data into the corresponding array\n * If the tuple already exist, add only their indice\n *\n * @param indicePositionFromObj Integer The index in positions array\n * @param indiceUvsFromObj Integer The index in uvs array\n * @param indiceNormalFromObj Integer The index in normals array\n * @param positionVectorFromOBJ Vector3 The value of position at index objIndice\n * @param textureVectorFromOBJ Vector3 The value of uvs\n * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale\n * @param positionColorsFromOBJ\n */\n _setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, positionVectorFromOBJ, textureVectorFromOBJ, normalsVectorFromOBJ, positionColorsFromOBJ) {\n //Check if this tuple already exists in the list of tuples\n let _index;\n if (this._loadingOptions.optimizeWithUV) {\n _index = this._isInArrayUV(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj, indiceUvsFromObj]);\n } else {\n _index = this._isInArray(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj]);\n }\n //If it not exists\n if (_index === -1) {\n //Add an new indice.\n //The array of indices is only an array with his length equal to the number of triangles - 1.\n //We add vertices data in this order\n this._indicesForBabylon.push(this._wrappedPositionForBabylon.length);\n //Push the position of vertice for Babylon\n //Each element is a Vector3(x,y,z)\n this._wrappedPositionForBabylon.push(positionVectorFromOBJ);\n //Push the uvs for Babylon\n //Each element is a Vector3(u,v)\n this._wrappedUvsForBabylon.push(textureVectorFromOBJ);\n //Push the normals for Babylon\n //Each element is a Vector3(x,y,z)\n this._wrappedNormalsForBabylon.push(normalsVectorFromOBJ);\n if (positionColorsFromOBJ !== undefined) {\n //Push the colors for Babylon\n //Each element is a BABYLON.Color4(r,g,b,a)\n this._wrappedColorsForBabylon.push(positionColorsFromOBJ);\n }\n //Add the tuple in the comparison list\n this._tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);\n this._tuplePosNorm[indicePositionFromObj].idx.push(this._curPositionInIndices++);\n if (this._loadingOptions.optimizeWithUV) {\n this._tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj);\n }\n } else {\n //The tuple already exists\n //Add the index of the already existing tuple\n //At this index we can get the value of position, normal, color and uvs of vertex\n this._indicesForBabylon.push(_index);\n }\n }\n /**\n * Transform Vector() and BABYLON.Color() objects into numbers in an array\n */\n _unwrapData() {\n //Every array has the same length\n for (let l = 0; l < this._wrappedPositionForBabylon.length; l++) {\n //Push the x, y, z values of each element in the unwrapped array\n this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[l].x * this._handednessSign, this._wrappedPositionForBabylon[l].y, this._wrappedPositionForBabylon[l].z);\n this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[l].x * this._handednessSign, this._wrappedNormalsForBabylon[l].y, this._wrappedNormalsForBabylon[l].z);\n this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON\n if (this._loadingOptions.importVertexColors) {\n //Push the r, g, b, a values of each element in the unwrapped array\n this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[l].r, this._wrappedColorsForBabylon[l].g, this._wrappedColorsForBabylon[l].b, this._wrappedColorsForBabylon[l].a);\n }\n }\n // Reset arrays for the next new meshes\n this._wrappedPositionForBabylon.length = 0;\n this._wrappedNormalsForBabylon.length = 0;\n this._wrappedUvsForBabylon.length = 0;\n this._wrappedColorsForBabylon.length = 0;\n this._tuplePosNorm.length = 0;\n this._curPositionInIndices = 0;\n }\n /**\n * Create triangles from polygons\n * It is important to notice that a triangle is a polygon\n * We get 5 patterns of face defined in OBJ File :\n * facePattern1 = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]\n * facePattern2 = [\"1/1\",\"2/2\",\"3/3\",\"4/4\",\"5/5\",\"6/6\"]\n * facePattern3 = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"4/4/4\",\"5/5/5\",\"6/6/6\"]\n * facePattern4 = [\"1//1\",\"2//2\",\"3//3\",\"4//4\",\"5//5\",\"6//6\"]\n * facePattern5 = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-4/-4/-4\",\"-5/-5/-5\",\"-6/-6/-6\"]\n * Each pattern is divided by the same method\n * @param faces Array[String] The indices of elements\n * @param v Integer The variable to increment\n */\n _getTriangles(faces, v) {\n //Work for each element of the array\n for (let faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {\n //Add on the triangle variable the indexes to obtain triangles\n this._pushTriangle(faces, faceIndex);\n }\n //Result obtained after 2 iterations:\n //Pattern1 => triangle = [\"1\",\"2\",\"3\",\"1\",\"3\",\"4\"];\n //Pattern2 => triangle = [\"1/1\",\"2/2\",\"3/3\",\"1/1\",\"3/3\",\"4/4\"];\n //Pattern3 => triangle = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"1/1/1\",\"3/3/3\",\"4/4/4\"];\n //Pattern4 => triangle = [\"1//1\",\"2//2\",\"3//3\",\"1//1\",\"3//3\",\"4//4\"];\n //Pattern5 => triangle = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-1/-1/-1\",\"-3/-3/-3\",\"-4/-4/-4\"];\n }\n /**\n * Create triangles and push the data for each polygon for the pattern 1\n * In this pattern we get vertice positions\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern1(face, v) {\n //Get the indices of triangles for each polygon\n this._getTriangles(face, v);\n //For each element in the triangles array.\n //This var could contains 1 to an infinity of triangles\n for (let k = 0; k < this._triangles.length; k++) {\n // Set position indice\n const indicePositionFromObj = parseInt(this._triangles[k]) - 1;\n this._setData(indicePositionFromObj, 0, 0,\n // In the pattern 1, normals and uvs are not defined\n this._positions[indicePositionFromObj],\n // Get the vectors data\n Vector2.Zero(), Vector3.Up(),\n // Create default vectors\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n /**\n * Create triangles and push the data for each polygon for the pattern 2\n * In this pattern we get vertice positions and uvs\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern2(face, v) {\n //Get the indices of triangles for each polygon\n this._getTriangles(face, v);\n for (let k = 0; k < this._triangles.length; k++) {\n //triangle[k] = \"1/1\"\n //Split the data for getting position and uv\n const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\"]\n //Set position indice\n const indicePositionFromObj = parseInt(point[0]) - 1;\n //Set uv indice\n const indiceUvsFromObj = parseInt(point[1]) - 1;\n this._setData(indicePositionFromObj, indiceUvsFromObj, 0,\n //Default value for normals\n this._positions[indicePositionFromObj],\n //Get the values for each element\n this._uvs[indiceUvsFromObj], Vector3.Up(),\n //Default value for normals\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n /**\n * Create triangles and push the data for each polygon for the pattern 3\n * In this pattern we get vertice positions, uvs and normals\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern3(face, v) {\n //Get the indices of triangles for each polygon\n this._getTriangles(face, v);\n for (let k = 0; k < this._triangles.length; k++) {\n //triangle[k] = \"1/1/1\"\n //Split the data for getting position, uv, and normals\n const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\", \"1\"]\n // Set position indice\n const indicePositionFromObj = parseInt(point[0]) - 1;\n // Set uv indice\n const indiceUvsFromObj = parseInt(point[1]) - 1;\n // Set normal indice\n const indiceNormalFromObj = parseInt(point[2]) - 1;\n this._setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj], this._normals[indiceNormalFromObj] //Set the vector for each component\n );\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n /**\n * Create triangles and push the data for each polygon for the pattern 4\n * In this pattern we get vertice positions and normals\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern4(face, v) {\n this._getTriangles(face, v);\n for (let k = 0; k < this._triangles.length; k++) {\n //triangle[k] = \"1//1\"\n //Split the data for getting position and normals\n const point = this._triangles[k].split(\"//\"); // [\"1\", \"1\"]\n // We check indices, and normals\n const indicePositionFromObj = parseInt(point[0]) - 1;\n const indiceNormalFromObj = parseInt(point[1]) - 1;\n this._setData(indicePositionFromObj, 1,\n //Default value for uv\n indiceNormalFromObj, this._positions[indicePositionFromObj],\n //Get each vector of data\n Vector2.Zero(), this._normals[indiceNormalFromObj], this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n /*\n * Create triangles and push the data for each polygon for the pattern 3\n * In this pattern we get vertice positions, uvs and normals\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern5(face, v) {\n //Get the indices of triangles for each polygon\n this._getTriangles(face, v);\n for (let k = 0; k < this._triangles.length; k++) {\n //triangle[k] = \"-1/-1/-1\"\n //Split the data for getting position, uv, and normals\n const point = this._triangles[k].split(\"/\"); // [\"-1\", \"-1\", \"-1\"]\n // Set position indice\n const indicePositionFromObj = this._positions.length + parseInt(point[0]);\n // Set uv indice\n const indiceUvsFromObj = this._uvs.length + parseInt(point[1]);\n // Set normal indice\n const indiceNormalFromObj = this._normals.length + parseInt(point[2]);\n this._setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj], this._normals[indiceNormalFromObj],\n //Set the vector for each component\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n _addPreviousObjMesh() {\n //Check if it is not the first mesh. Otherwise we don't have data.\n if (this._meshesFromObj.length > 0) {\n //Get the previous mesh for applying the data about the faces\n //=> in obj file, faces definition append after the name of the mesh\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\n //Set the data into Array for the mesh\n this._unwrapData();\n if (this._loadingOptions.useLegacyBehavior) {\n // Reverse tab. Otherwise face are displayed in the wrong sens\n this._indicesForBabylon.reverse();\n }\n //Set the information for the mesh\n //Slice the array to avoid rewriting because of the fact this is the same var which be rewrited\n this._handledMesh.indices = this._indicesForBabylon.slice();\n this._handledMesh.positions = this._unwrappedPositionsForBabylon.slice();\n this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();\n this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();\n if (this._loadingOptions.importVertexColors) {\n this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();\n }\n //Reset the array for the next mesh\n this._indicesForBabylon.length = 0;\n this._unwrappedPositionsForBabylon.length = 0;\n this._unwrappedColorsForBabylon.length = 0;\n this._unwrappedNormalsForBabylon.length = 0;\n this._unwrappedUVForBabylon.length = 0;\n }\n }\n _optimizeNormals(mesh) {\n const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\n const normals = mesh.getVerticesData(VertexBuffer.NormalKind);\n const mapVertices = {};\n if (!positions || !normals) {\n return;\n }\n for (let i = 0; i < positions.length / 3; i++) {\n const x = positions[i * 3 + 0];\n const y = positions[i * 3 + 1];\n const z = positions[i * 3 + 2];\n const key = x + \"_\" + y + \"_\" + z;\n let lst = mapVertices[key];\n if (!lst) {\n lst = [];\n mapVertices[key] = lst;\n }\n lst.push(i);\n }\n const normal = new Vector3();\n for (const key in mapVertices) {\n const lst = mapVertices[key];\n if (lst.length < 2) {\n continue;\n }\n const v0Idx = lst[0];\n for (let i = 1; i < lst.length; ++i) {\n const vIdx = lst[i];\n normals[v0Idx * 3 + 0] += normals[vIdx * 3 + 0];\n normals[v0Idx * 3 + 1] += normals[vIdx * 3 + 1];\n normals[v0Idx * 3 + 2] += normals[vIdx * 3 + 2];\n }\n normal.copyFromFloats(normals[v0Idx * 3 + 0], normals[v0Idx * 3 + 1], normals[v0Idx * 3 + 2]);\n normal.normalize();\n for (let i = 0; i < lst.length; ++i) {\n const vIdx = lst[i];\n normals[vIdx * 3 + 0] = normal.x;\n normals[vIdx * 3 + 1] = normal.y;\n normals[vIdx * 3 + 2] = normal.z;\n }\n }\n mesh.setVerticesData(VertexBuffer.NormalKind, normals);\n }\n /**\n * Function used to parse an OBJ string\n * @param meshesNames defines the list of meshes to load (all if not defined)\n * @param data defines the OBJ string\n * @param scene defines the hosting scene\n * @param assetContainer defines the asset container to load data in\n * @param onFileToLoadFound defines a callback that will be called if a MTL file is found\n */\n parse(meshesNames, data, scene, assetContainer, onFileToLoadFound) {\n if (this._loadingOptions.useLegacyBehavior) {\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\n this._handednessSign = 1;\n } else if (scene.useRightHandedSystem) {\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex + 1], faces[faceIndex]);\n this._handednessSign = 1;\n } else {\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\n this._handednessSign = -1;\n }\n // Split the file into lines\n const lines = data.split(\"\\n\");\n // Look at each line\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim().replace(/\\s\\s/g, \" \");\n let result;\n // Comment or newLine\n if (line.length === 0 || line.charAt(0) === \"#\") {\n continue;\n //Get information about one position possible for the vertices\n } else if (SolidParser.VertexPattern.test(line)) {\n result = line.match(/[^ ]+/g); // match will return non-null due to passing regex pattern\n // Value of result with line: \"v 1.0 2.0 3.0\"\n // [\"v\", \"1.0\", \"2.0\", \"3.0\"]\n // Create a Vector3 with the position x, y, z\n this._positions.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\n if (this._loadingOptions.importVertexColors) {\n if (result.length >= 7) {\n const r = parseFloat(result[4]);\n const g = parseFloat(result[5]);\n const b = parseFloat(result[6]);\n this._colors.push(new Color4(r > 1 ? r / 255 : r, g > 1 ? g / 255 : g, b > 1 ? b / 255 : b, result.length === 7 || result[7] === undefined ? 1 : parseFloat(result[7])));\n } else {\n // TODO: maybe push NULL and if all are NULL to skip (and remove grayColor var).\n this._colors.push(this._grayColor);\n }\n }\n } else if ((result = SolidParser.NormalPattern.exec(line)) !== null) {\n //Create a Vector3 with the normals x, y, z\n //Value of result\n // [\"vn 1.0 2.0 3.0\", \"1.0\", \"2.0\", \"3.0\"]\n //Add the Vector in the list of normals\n this._normals.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\n } else if ((result = SolidParser.UVPattern.exec(line)) !== null) {\n //Create a Vector2 with the normals u, v\n //Value of result\n // [\"vt 0.1 0.2 0.3\", \"0.1\", \"0.2\"]\n //Add the Vector in the list of uvs\n this._uvs.push(new Vector2(parseFloat(result[1]) * this._loadingOptions.UVScaling.x, parseFloat(result[2]) * this._loadingOptions.UVScaling.y));\n //Identify patterns of faces\n //Face could be defined in different type of pattern\n } else if ((result = SolidParser.FacePattern3.exec(line)) !== null) {\n //Value of result:\n //[\"f 1/1/1 2/2/2 3/3/3\", \"1/1/1 2/2/2 3/3/3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern3(result[1].trim().split(\" \"),\n // [\"1/1/1\", \"2/2/2\", \"3/3/3\"]\n 1);\n } else if ((result = SolidParser.FacePattern4.exec(line)) !== null) {\n //Value of result:\n //[\"f 1//1 2//2 3//3\", \"1//1 2//2 3//3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern4(result[1].trim().split(\" \"),\n // [\"1//1\", \"2//2\", \"3//3\"]\n 1);\n } else if ((result = SolidParser.FacePattern5.exec(line)) !== null) {\n //Value of result:\n //[\"f -1/-1/-1 -2/-2/-2 -3/-3/-3\", \"-1/-1/-1 -2/-2/-2 -3/-3/-3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern5(result[1].trim().split(\" \"),\n // [\"-1/-1/-1\", \"-2/-2/-2\", \"-3/-3/-3\"]\n 1);\n } else if ((result = SolidParser.FacePattern2.exec(line)) !== null) {\n //Value of result:\n //[\"f 1/1 2/2 3/3\", \"1/1 2/2 3/3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern2(result[1].trim().split(\" \"),\n // [\"1/1\", \"2/2\", \"3/3\"]\n 1);\n } else if ((result = SolidParser.FacePattern1.exec(line)) !== null) {\n //Value of result\n //[\"f 1 2 3\", \"1 2 3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern1(result[1].trim().split(\" \"),\n // [\"1\", \"2\", \"3\"]\n 1);\n // Define a mesh or an object\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\n } else if ((result = SolidParser.LinePattern1.exec(line)) !== null) {\n //Value of result\n //[\"l 1 2\"]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern1(result[1].trim().split(\" \"),\n // [\"1\", \"2\"]\n 0);\n // Define a mesh or an object\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\n } else if ((result = SolidParser.LinePattern2.exec(line)) !== null) {\n //Value of result\n //[\"l 1/1 2/2\"]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern2(result[1].trim().split(\" \"),\n // [\"1/1\", \"2/2\"]\n 0);\n // Define a mesh or an object\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\n } else if ((result = SolidParser.LinePattern3.exec(line)) !== null) {\n //Value of result\n //[\"l 1/1/1 2/2/2\"]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern3(result[1].trim().split(\" \"),\n // [\"1/1/1\", \"2/2/2\"]\n 0);\n // Define a mesh or an object\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\n } else if (SolidParser.GroupDescriptor.test(line) || SolidParser.ObjectDescriptor.test(line)) {\n // Create a new mesh corresponding to the name of the group.\n // Definition of the mesh\n const objMesh = {\n name: line.substring(2).trim(),\n indices: null,\n positions: null,\n normals: null,\n uvs: null,\n colors: null,\n materialName: this._materialNameFromObj,\n isObject: SolidParser.ObjectDescriptor.test(line)\n };\n this._addPreviousObjMesh();\n //Push the last mesh created with only the name\n this._meshesFromObj.push(objMesh);\n //Set this variable to indicate that now meshesFromObj has objects defined inside\n this._hasMeshes = true;\n this._isFirstMaterial = true;\n this._increment = 1;\n //Keyword for applying a material\n } else if (SolidParser.UseMtlDescriptor.test(line)) {\n //Get the name of the material\n this._materialNameFromObj = line.substring(7).trim();\n //If this new material is in the same mesh\n if (!this._isFirstMaterial || !this._hasMeshes) {\n //Set the data for the previous mesh\n this._addPreviousObjMesh();\n //Create a new mesh\n const objMesh =\n //Set the name of the current obj mesh\n {\n name: (this._objMeshName || \"mesh\") + \"_mm\" + this._increment.toString(),\n indices: null,\n positions: null,\n normals: null,\n uvs: null,\n colors: null,\n materialName: this._materialNameFromObj,\n isObject: false\n };\n this._increment++;\n //If meshes are already defined\n this._meshesFromObj.push(objMesh);\n this._hasMeshes = true;\n }\n //Set the material name if the previous line define a mesh\n if (this._hasMeshes && this._isFirstMaterial) {\n //Set the material name to the previous mesh (1 material per mesh)\n this._meshesFromObj[this._meshesFromObj.length - 1].materialName = this._materialNameFromObj;\n this._isFirstMaterial = false;\n }\n // Keyword for loading the mtl file\n } else if (SolidParser.MtlLibGroupDescriptor.test(line)) {\n // Get the name of mtl file\n onFileToLoadFound(line.substring(7).trim());\n // Apply smoothing\n } else if (SolidParser.SmoothDescriptor.test(line)) {\n // smooth shading => apply smoothing\n // Today I don't know it work with babylon and with obj.\n // With the obj file an integer is set\n } else {\n //If there is another possibility\n Logger.Log(\"Unhandled expression at line : \" + line);\n }\n }\n // At the end of the file, add the last mesh into the meshesFromObj array\n if (this._hasMeshes) {\n // Set the data for the last mesh\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\n if (this._loadingOptions.useLegacyBehavior) {\n //Reverse indices for displaying faces in the good sense\n this._indicesForBabylon.reverse();\n }\n //Get the good array\n this._unwrapData();\n //Set array\n this._handledMesh.indices = this._indicesForBabylon;\n this._handledMesh.positions = this._unwrappedPositionsForBabylon;\n this._handledMesh.normals = this._unwrappedNormalsForBabylon;\n this._handledMesh.uvs = this._unwrappedUVForBabylon;\n if (this._loadingOptions.importVertexColors) {\n this._handledMesh.colors = this._unwrappedColorsForBabylon;\n }\n }\n // If any o or g keyword not found, create a mesh with a random id\n if (!this._hasMeshes) {\n let newMaterial = null;\n if (this._indicesForBabylon.length) {\n if (this._loadingOptions.useLegacyBehavior) {\n // reverse tab of indices\n this._indicesForBabylon.reverse();\n }\n //Get positions normals uvs\n this._unwrapData();\n } else {\n // There is no indices in the file. We will have to switch to point cloud rendering\n for (const pos of this._positions) {\n this._unwrappedPositionsForBabylon.push(pos.x, pos.y, pos.z);\n }\n if (this._normals.length) {\n for (const normal of this._normals) {\n this._unwrappedNormalsForBabylon.push(normal.x, normal.y, normal.z);\n }\n }\n if (this._uvs.length) {\n for (const uv of this._uvs) {\n this._unwrappedUVForBabylon.push(uv.x, uv.y);\n }\n }\n if (this._colors.length) {\n for (const color of this._colors) {\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\n }\n }\n if (!this._materialNameFromObj) {\n // Create a material with point cloud on\n newMaterial = new StandardMaterial(Geometry.RandomId(), scene);\n newMaterial.pointsCloud = true;\n this._materialNameFromObj = newMaterial.name;\n if (!this._normals.length) {\n newMaterial.disableLighting = true;\n newMaterial.emissiveColor = Color3.White();\n }\n }\n }\n //Set data for one mesh\n this._meshesFromObj.push({\n name: Geometry.RandomId(),\n indices: this._indicesForBabylon,\n positions: this._unwrappedPositionsForBabylon,\n colors: this._unwrappedColorsForBabylon,\n normals: this._unwrappedNormalsForBabylon,\n uvs: this._unwrappedUVForBabylon,\n materialName: this._materialNameFromObj,\n directMaterial: newMaterial,\n isObject: true\n });\n }\n //Set data for each mesh\n for (let j = 0; j < this._meshesFromObj.length; j++) {\n var _this$_handledMesh$po;\n //check meshesNames (stlFileLoader)\n if (meshesNames && this._meshesFromObj[j].name) {\n if (meshesNames instanceof Array) {\n if (meshesNames.indexOf(this._meshesFromObj[j].name) === -1) {\n continue;\n }\n } else {\n if (this._meshesFromObj[j].name !== meshesNames) {\n continue;\n }\n }\n }\n //Get the current mesh\n //Set the data with VertexBuffer for each mesh\n this._handledMesh = this._meshesFromObj[j];\n //Create a Mesh with the name of the obj mesh\n scene._blockEntityCollection = !!assetContainer;\n const babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);\n babylonMesh._parentContainer = assetContainer;\n scene._blockEntityCollection = false;\n this._handledMesh._babylonMesh = babylonMesh;\n // If this is a group mesh, it should have an object mesh as a parent. So look for the first object mesh that appears before it.\n if (!this._handledMesh.isObject) {\n for (let k = j - 1; k >= 0; --k) {\n if (this._meshesFromObj[k].isObject && this._meshesFromObj[k]._babylonMesh) {\n babylonMesh.parent = this._meshesFromObj[k]._babylonMesh;\n break;\n }\n }\n }\n //Push the name of the material to an array\n //This is indispensable for the importMesh function\n this._materialToUse.push(this._meshesFromObj[j].materialName);\n if (((_this$_handledMesh$po = this._handledMesh.positions) === null || _this$_handledMesh$po === void 0 ? void 0 : _this$_handledMesh$po.length) === 0) {\n //Push the mesh into an array\n this._babylonMeshesArray.push(babylonMesh);\n continue;\n }\n const vertexData = new VertexData(); //The container for the values\n //Set the data for the babylonMesh\n vertexData.uvs = this._handledMesh.uvs;\n vertexData.indices = this._handledMesh.indices;\n vertexData.positions = this._handledMesh.positions;\n if (this._loadingOptions.computeNormals) {\n const normals = new Array();\n VertexData.ComputeNormals(this._handledMesh.positions, this._handledMesh.indices, normals);\n vertexData.normals = normals;\n } else {\n vertexData.normals = this._handledMesh.normals;\n }\n if (this._loadingOptions.importVertexColors) {\n vertexData.colors = this._handledMesh.colors;\n }\n //Set the data from the VertexBuffer to the current Mesh\n vertexData.applyToMesh(babylonMesh);\n if (this._loadingOptions.invertY) {\n babylonMesh.scaling.y *= -1;\n }\n if (this._loadingOptions.optimizeNormals) {\n this._optimizeNormals(babylonMesh);\n }\n //Push the mesh into an array\n this._babylonMeshesArray.push(babylonMesh);\n if (this._handledMesh.directMaterial) {\n babylonMesh.material = this._handledMesh.directMaterial;\n }\n }\n }\n}\n// Descriptor\n/** Object descriptor */\nSolidParser.ObjectDescriptor = /^o/;\n/** Group descriptor */\nSolidParser.GroupDescriptor = /^g/;\n/** Material lib descriptor */\nSolidParser.MtlLibGroupDescriptor = /^mtllib /;\n/** Use a material descriptor */\nSolidParser.UseMtlDescriptor = /^usemtl /;\n/** Smooth descriptor */\nSolidParser.SmoothDescriptor = /^s /;\n// Patterns\n/** Pattern used to detect a vertex */\nSolidParser.VertexPattern = /^v(\\s+[\\d|.|+|\\-|e|E]+){3,7}/;\n/** Pattern used to detect a normal */\nSolidParser.NormalPattern = /^vn(\\s+[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)/;\n/** Pattern used to detect a UV set */\nSolidParser.UVPattern = /^vt(\\s+[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)/;\n/** Pattern used to detect a first kind of face (f vertex vertex vertex) */\nSolidParser.FacePattern1 = /^f\\s+(([\\d]{1,}[\\s]?){3,})+/;\n/** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */\nSolidParser.FacePattern2 = /^f\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\n/** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */\nSolidParser.FacePattern3 = /^f\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\n/** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/\nSolidParser.FacePattern4 = /^f\\s+((([\\d]{1,}\\/\\/[\\d]{1,}[\\s]?){3,})+)/;\n/** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */\nSolidParser.FacePattern5 = /^f\\s+(((-[\\d]{1,}\\/-[\\d]{1,}\\/-[\\d]{1,}[\\s]?){3,})+)/;\n/** Pattern used to detect a line(l vertex vertex) */\nSolidParser.LinePattern1 = /^l\\s+(([\\d]{1,}[\\s]?){2,})+/;\n/** Pattern used to detect a second kind of line (l vertex/uvs vertex/uvs) */\nSolidParser.LinePattern2 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\n/** Pattern used to detect a third kind of line (l vertex/uvs/normal vertex/uvs/normal) */\nSolidParser.LinePattern3 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;","map":{"version":3,"names":["VertexBuffer","StandardMaterial","Color3","Color4","Vector2","Vector3","Geometry","Mesh","VertexData","Logger","SolidParser","constructor","materialToUse","babylonMeshesArray","loadingOptions","_positions","_normals","_uvs","_colors","_meshesFromObj","_indicesForBabylon","_wrappedPositionForBabylon","_wrappedUvsForBabylon","_wrappedColorsForBabylon","_wrappedNormalsForBabylon","_tuplePosNorm","_curPositionInIndices","_hasMeshes","_unwrappedPositionsForBabylon","_unwrappedColorsForBabylon","_unwrappedNormalsForBabylon","_unwrappedUVForBabylon","_triangles","_materialNameFromObj","_objMeshName","_increment","_isFirstMaterial","_grayColor","_materialToUse","_babylonMeshesArray","_loadingOptions","_isInArray","arr","obj","normals","idx","indexOf","_isInArrayUV","uv","_setData","indicePositionFromObj","indiceUvsFromObj","indiceNormalFromObj","positionVectorFromOBJ","textureVectorFromOBJ","normalsVectorFromOBJ","positionColorsFromOBJ","_index","optimizeWithUV","push","length","undefined","_unwrapData","l","x","_handednessSign","y","z","importVertexColors","r","g","b","a","_getTriangles","faces","v","faceIndex","_pushTriangle","_setDataForCurrentFaceWithPattern1","face","k","parseInt","Zero","Up","_setDataForCurrentFaceWithPattern2","point","split","_setDataForCurrentFaceWithPattern3","_setDataForCurrentFaceWithPattern4","_setDataForCurrentFaceWithPattern5","_addPreviousObjMesh","_handledMesh","useLegacyBehavior","reverse","indices","slice","positions","uvs","colors","_optimizeNormals","mesh","getVerticesData","PositionKind","NormalKind","mapVertices","i","key","lst","normal","v0Idx","vIdx","copyFromFloats","normalize","setVerticesData","parse","meshesNames","data","scene","assetContainer","onFileToLoadFound","useRightHandedSystem","lines","line","trim","replace","result","charAt","VertexPattern","test","match","parseFloat","NormalPattern","exec","UVPattern","UVScaling","FacePattern3","FacePattern4","FacePattern5","FacePattern2","FacePattern1","LinePattern1","LinePattern2","LinePattern3","GroupDescriptor","ObjectDescriptor","objMesh","name","substring","materialName","isObject","UseMtlDescriptor","toString","MtlLibGroupDescriptor","SmoothDescriptor","Log","newMaterial","pos","color","RandomId","pointsCloud","disableLighting","emissiveColor","White","directMaterial","j","_this$_handledMesh$po","Array","_blockEntityCollection","babylonMesh","_parentContainer","_babylonMesh","parent","vertexData","computeNormals","ComputeNormals","applyToMesh","invertY","scaling","optimizeNormals","material"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/loaders/OBJ/solidParser.js"],"sourcesContent":["import { VertexBuffer } from \"@babylonjs/core/Buffers/buffer.js\";\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial.js\";\nimport { Color3, Color4 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { Vector2, Vector3 } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry.js\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh.js\";\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData.js\";\nimport { Logger } from \"@babylonjs/core/Misc/logger.js\";\n/**\n * Class used to load mesh data from OBJ content\n */\nexport class SolidParser {\n /**\n * Creates a new SolidParser\n * @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)\n * @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)\n * @param loadingOptions defines the loading options to use\n */\n constructor(materialToUse, babylonMeshesArray, loadingOptions) {\n this._positions = []; //values for the positions of vertices\n this._normals = []; //Values for the normals\n this._uvs = []; //Values for the textures\n this._colors = [];\n this._meshesFromObj = []; //[mesh] Contains all the obj meshes\n this._indicesForBabylon = []; //The list of indices for VertexData\n this._wrappedPositionForBabylon = []; //The list of position in vectors\n this._wrappedUvsForBabylon = []; //Array with all value of uvs to match with the indices\n this._wrappedColorsForBabylon = []; // Array with all color values to match with the indices\n this._wrappedNormalsForBabylon = []; //Array with all value of normals to match with the indices\n this._tuplePosNorm = []; //Create a tuple with indice of Position, Normal, UV [pos, norm, uvs]\n this._curPositionInIndices = 0;\n this._hasMeshes = false; //Meshes are defined in the file\n this._unwrappedPositionsForBabylon = []; //Value of positionForBabylon w/o Vector3() [x,y,z]\n this._unwrappedColorsForBabylon = []; // Value of colorForBabylon w/o Color4() [r,g,b,a]\n this._unwrappedNormalsForBabylon = []; //Value of normalsForBabylon w/o Vector3() [x,y,z]\n this._unwrappedUVForBabylon = []; //Value of uvsForBabylon w/o Vector3() [x,y,z]\n this._triangles = []; //Indices from new triangles coming from polygons\n this._materialNameFromObj = \"\"; //The name of the current material\n this._objMeshName = \"\"; //The name of the current obj mesh\n this._increment = 1; //Id for meshes created by the multimaterial\n this._isFirstMaterial = true;\n this._grayColor = new Color4(0.5, 0.5, 0.5, 1);\n this._materialToUse = materialToUse;\n this._babylonMeshesArray = babylonMeshesArray;\n this._loadingOptions = loadingOptions;\n }\n /**\n * Search for obj in the given array.\n * This function is called to check if a couple of data already exists in an array.\n *\n * If found, returns the index of the founded tuple index. Returns -1 if not found\n * @param arr Array<{ normals: Array, idx: Array }>\n * @param obj Array\n * @returns {boolean}\n */\n _isInArray(arr, obj) {\n if (!arr[obj[0]]) {\n arr[obj[0]] = { normals: [], idx: [] };\n }\n const idx = arr[obj[0]].normals.indexOf(obj[1]);\n return idx === -1 ? -1 : arr[obj[0]].idx[idx];\n }\n _isInArrayUV(arr, obj) {\n if (!arr[obj[0]]) {\n arr[obj[0]] = { normals: [], idx: [], uv: [] };\n }\n const idx = arr[obj[0]].normals.indexOf(obj[1]);\n if (idx != 1 && obj[2] === arr[obj[0]].uv[idx]) {\n return arr[obj[0]].idx[idx];\n }\n return -1;\n }\n /**\n * This function set the data for each triangle.\n * Data are position, normals and uvs\n * If a tuple of (position, normal) is not set, add the data into the corresponding array\n * If the tuple already exist, add only their indice\n *\n * @param indicePositionFromObj Integer The index in positions array\n * @param indiceUvsFromObj Integer The index in uvs array\n * @param indiceNormalFromObj Integer The index in normals array\n * @param positionVectorFromOBJ Vector3 The value of position at index objIndice\n * @param textureVectorFromOBJ Vector3 The value of uvs\n * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale\n * @param positionColorsFromOBJ\n */\n _setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, positionVectorFromOBJ, textureVectorFromOBJ, normalsVectorFromOBJ, positionColorsFromOBJ) {\n //Check if this tuple already exists in the list of tuples\n let _index;\n if (this._loadingOptions.optimizeWithUV) {\n _index = this._isInArrayUV(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj, indiceUvsFromObj]);\n }\n else {\n _index = this._isInArray(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj]);\n }\n //If it not exists\n if (_index === -1) {\n //Add an new indice.\n //The array of indices is only an array with his length equal to the number of triangles - 1.\n //We add vertices data in this order\n this._indicesForBabylon.push(this._wrappedPositionForBabylon.length);\n //Push the position of vertice for Babylon\n //Each element is a Vector3(x,y,z)\n this._wrappedPositionForBabylon.push(positionVectorFromOBJ);\n //Push the uvs for Babylon\n //Each element is a Vector3(u,v)\n this._wrappedUvsForBabylon.push(textureVectorFromOBJ);\n //Push the normals for Babylon\n //Each element is a Vector3(x,y,z)\n this._wrappedNormalsForBabylon.push(normalsVectorFromOBJ);\n if (positionColorsFromOBJ !== undefined) {\n //Push the colors for Babylon\n //Each element is a BABYLON.Color4(r,g,b,a)\n this._wrappedColorsForBabylon.push(positionColorsFromOBJ);\n }\n //Add the tuple in the comparison list\n this._tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);\n this._tuplePosNorm[indicePositionFromObj].idx.push(this._curPositionInIndices++);\n if (this._loadingOptions.optimizeWithUV) {\n this._tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj);\n }\n }\n else {\n //The tuple already exists\n //Add the index of the already existing tuple\n //At this index we can get the value of position, normal, color and uvs of vertex\n this._indicesForBabylon.push(_index);\n }\n }\n /**\n * Transform Vector() and BABYLON.Color() objects into numbers in an array\n */\n _unwrapData() {\n //Every array has the same length\n for (let l = 0; l < this._wrappedPositionForBabylon.length; l++) {\n //Push the x, y, z values of each element in the unwrapped array\n this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[l].x * this._handednessSign, this._wrappedPositionForBabylon[l].y, this._wrappedPositionForBabylon[l].z);\n this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[l].x * this._handednessSign, this._wrappedNormalsForBabylon[l].y, this._wrappedNormalsForBabylon[l].z);\n this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON\n if (this._loadingOptions.importVertexColors) {\n //Push the r, g, b, a values of each element in the unwrapped array\n this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[l].r, this._wrappedColorsForBabylon[l].g, this._wrappedColorsForBabylon[l].b, this._wrappedColorsForBabylon[l].a);\n }\n }\n // Reset arrays for the next new meshes\n this._wrappedPositionForBabylon.length = 0;\n this._wrappedNormalsForBabylon.length = 0;\n this._wrappedUvsForBabylon.length = 0;\n this._wrappedColorsForBabylon.length = 0;\n this._tuplePosNorm.length = 0;\n this._curPositionInIndices = 0;\n }\n /**\n * Create triangles from polygons\n * It is important to notice that a triangle is a polygon\n * We get 5 patterns of face defined in OBJ File :\n * facePattern1 = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]\n * facePattern2 = [\"1/1\",\"2/2\",\"3/3\",\"4/4\",\"5/5\",\"6/6\"]\n * facePattern3 = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"4/4/4\",\"5/5/5\",\"6/6/6\"]\n * facePattern4 = [\"1//1\",\"2//2\",\"3//3\",\"4//4\",\"5//5\",\"6//6\"]\n * facePattern5 = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-4/-4/-4\",\"-5/-5/-5\",\"-6/-6/-6\"]\n * Each pattern is divided by the same method\n * @param faces Array[String] The indices of elements\n * @param v Integer The variable to increment\n */\n _getTriangles(faces, v) {\n //Work for each element of the array\n for (let faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {\n //Add on the triangle variable the indexes to obtain triangles\n this._pushTriangle(faces, faceIndex);\n }\n //Result obtained after 2 iterations:\n //Pattern1 => triangle = [\"1\",\"2\",\"3\",\"1\",\"3\",\"4\"];\n //Pattern2 => triangle = [\"1/1\",\"2/2\",\"3/3\",\"1/1\",\"3/3\",\"4/4\"];\n //Pattern3 => triangle = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"1/1/1\",\"3/3/3\",\"4/4/4\"];\n //Pattern4 => triangle = [\"1//1\",\"2//2\",\"3//3\",\"1//1\",\"3//3\",\"4//4\"];\n //Pattern5 => triangle = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-1/-1/-1\",\"-3/-3/-3\",\"-4/-4/-4\"];\n }\n /**\n * Create triangles and push the data for each polygon for the pattern 1\n * In this pattern we get vertice positions\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern1(face, v) {\n //Get the indices of triangles for each polygon\n this._getTriangles(face, v);\n //For each element in the triangles array.\n //This var could contains 1 to an infinity of triangles\n for (let k = 0; k < this._triangles.length; k++) {\n // Set position indice\n const indicePositionFromObj = parseInt(this._triangles[k]) - 1;\n this._setData(indicePositionFromObj, 0, 0, // In the pattern 1, normals and uvs are not defined\n this._positions[indicePositionFromObj], // Get the vectors data\n Vector2.Zero(), Vector3.Up(), // Create default vectors\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n /**\n * Create triangles and push the data for each polygon for the pattern 2\n * In this pattern we get vertice positions and uvs\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern2(face, v) {\n //Get the indices of triangles for each polygon\n this._getTriangles(face, v);\n for (let k = 0; k < this._triangles.length; k++) {\n //triangle[k] = \"1/1\"\n //Split the data for getting position and uv\n const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\"]\n //Set position indice\n const indicePositionFromObj = parseInt(point[0]) - 1;\n //Set uv indice\n const indiceUvsFromObj = parseInt(point[1]) - 1;\n this._setData(indicePositionFromObj, indiceUvsFromObj, 0, //Default value for normals\n this._positions[indicePositionFromObj], //Get the values for each element\n this._uvs[indiceUvsFromObj], Vector3.Up(), //Default value for normals\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n /**\n * Create triangles and push the data for each polygon for the pattern 3\n * In this pattern we get vertice positions, uvs and normals\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern3(face, v) {\n //Get the indices of triangles for each polygon\n this._getTriangles(face, v);\n for (let k = 0; k < this._triangles.length; k++) {\n //triangle[k] = \"1/1/1\"\n //Split the data for getting position, uv, and normals\n const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\", \"1\"]\n // Set position indice\n const indicePositionFromObj = parseInt(point[0]) - 1;\n // Set uv indice\n const indiceUvsFromObj = parseInt(point[1]) - 1;\n // Set normal indice\n const indiceNormalFromObj = parseInt(point[2]) - 1;\n this._setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj], this._normals[indiceNormalFromObj] //Set the vector for each component\n );\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n /**\n * Create triangles and push the data for each polygon for the pattern 4\n * In this pattern we get vertice positions and normals\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern4(face, v) {\n this._getTriangles(face, v);\n for (let k = 0; k < this._triangles.length; k++) {\n //triangle[k] = \"1//1\"\n //Split the data for getting position and normals\n const point = this._triangles[k].split(\"//\"); // [\"1\", \"1\"]\n // We check indices, and normals\n const indicePositionFromObj = parseInt(point[0]) - 1;\n const indiceNormalFromObj = parseInt(point[1]) - 1;\n this._setData(indicePositionFromObj, 1, //Default value for uv\n indiceNormalFromObj, this._positions[indicePositionFromObj], //Get each vector of data\n Vector2.Zero(), this._normals[indiceNormalFromObj], this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n /*\n * Create triangles and push the data for each polygon for the pattern 3\n * In this pattern we get vertice positions, uvs and normals\n * @param face\n * @param v\n */\n _setDataForCurrentFaceWithPattern5(face, v) {\n //Get the indices of triangles for each polygon\n this._getTriangles(face, v);\n for (let k = 0; k < this._triangles.length; k++) {\n //triangle[k] = \"-1/-1/-1\"\n //Split the data for getting position, uv, and normals\n const point = this._triangles[k].split(\"/\"); // [\"-1\", \"-1\", \"-1\"]\n // Set position indice\n const indicePositionFromObj = this._positions.length + parseInt(point[0]);\n // Set uv indice\n const indiceUvsFromObj = this._uvs.length + parseInt(point[1]);\n // Set normal indice\n const indiceNormalFromObj = this._normals.length + parseInt(point[2]);\n this._setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj], this._normals[indiceNormalFromObj], //Set the vector for each component\n this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);\n }\n //Reset variable for the next line\n this._triangles.length = 0;\n }\n _addPreviousObjMesh() {\n //Check if it is not the first mesh. Otherwise we don't have data.\n if (this._meshesFromObj.length > 0) {\n //Get the previous mesh for applying the data about the faces\n //=> in obj file, faces definition append after the name of the mesh\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\n //Set the data into Array for the mesh\n this._unwrapData();\n if (this._loadingOptions.useLegacyBehavior) {\n // Reverse tab. Otherwise face are displayed in the wrong sens\n this._indicesForBabylon.reverse();\n }\n //Set the information for the mesh\n //Slice the array to avoid rewriting because of the fact this is the same var which be rewrited\n this._handledMesh.indices = this._indicesForBabylon.slice();\n this._handledMesh.positions = this._unwrappedPositionsForBabylon.slice();\n this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();\n this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();\n if (this._loadingOptions.importVertexColors) {\n this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();\n }\n //Reset the array for the next mesh\n this._indicesForBabylon.length = 0;\n this._unwrappedPositionsForBabylon.length = 0;\n this._unwrappedColorsForBabylon.length = 0;\n this._unwrappedNormalsForBabylon.length = 0;\n this._unwrappedUVForBabylon.length = 0;\n }\n }\n _optimizeNormals(mesh) {\n const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\n const normals = mesh.getVerticesData(VertexBuffer.NormalKind);\n const mapVertices = {};\n if (!positions || !normals) {\n return;\n }\n for (let i = 0; i < positions.length / 3; i++) {\n const x = positions[i * 3 + 0];\n const y = positions[i * 3 + 1];\n const z = positions[i * 3 + 2];\n const key = x + \"_\" + y + \"_\" + z;\n let lst = mapVertices[key];\n if (!lst) {\n lst = [];\n mapVertices[key] = lst;\n }\n lst.push(i);\n }\n const normal = new Vector3();\n for (const key in mapVertices) {\n const lst = mapVertices[key];\n if (lst.length < 2) {\n continue;\n }\n const v0Idx = lst[0];\n for (let i = 1; i < lst.length; ++i) {\n const vIdx = lst[i];\n normals[v0Idx * 3 + 0] += normals[vIdx * 3 + 0];\n normals[v0Idx * 3 + 1] += normals[vIdx * 3 + 1];\n normals[v0Idx * 3 + 2] += normals[vIdx * 3 + 2];\n }\n normal.copyFromFloats(normals[v0Idx * 3 + 0], normals[v0Idx * 3 + 1], normals[v0Idx * 3 + 2]);\n normal.normalize();\n for (let i = 0; i < lst.length; ++i) {\n const vIdx = lst[i];\n normals[vIdx * 3 + 0] = normal.x;\n normals[vIdx * 3 + 1] = normal.y;\n normals[vIdx * 3 + 2] = normal.z;\n }\n }\n mesh.setVerticesData(VertexBuffer.NormalKind, normals);\n }\n /**\n * Function used to parse an OBJ string\n * @param meshesNames defines the list of meshes to load (all if not defined)\n * @param data defines the OBJ string\n * @param scene defines the hosting scene\n * @param assetContainer defines the asset container to load data in\n * @param onFileToLoadFound defines a callback that will be called if a MTL file is found\n */\n parse(meshesNames, data, scene, assetContainer, onFileToLoadFound) {\n if (this._loadingOptions.useLegacyBehavior) {\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\n this._handednessSign = 1;\n }\n else if (scene.useRightHandedSystem) {\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex + 1], faces[faceIndex]);\n this._handednessSign = 1;\n }\n else {\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\n this._handednessSign = -1;\n }\n // Split the file into lines\n const lines = data.split(\"\\n\");\n // Look at each line\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim().replace(/\\s\\s/g, \" \");\n let result;\n // Comment or newLine\n if (line.length === 0 || line.charAt(0) === \"#\") {\n continue;\n //Get information about one position possible for the vertices\n }\n else if (SolidParser.VertexPattern.test(line)) {\n result = line.match(/[^ ]+/g); // match will return non-null due to passing regex pattern\n // Value of result with line: \"v 1.0 2.0 3.0\"\n // [\"v\", \"1.0\", \"2.0\", \"3.0\"]\n // Create a Vector3 with the position x, y, z\n this._positions.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\n if (this._loadingOptions.importVertexColors) {\n if (result.length >= 7) {\n const r = parseFloat(result[4]);\n const g = parseFloat(result[5]);\n const b = parseFloat(result[6]);\n this._colors.push(new Color4(r > 1 ? r / 255 : r, g > 1 ? g / 255 : g, b > 1 ? b / 255 : b, result.length === 7 || result[7] === undefined ? 1 : parseFloat(result[7])));\n }\n else {\n // TODO: maybe push NULL and if all are NULL to skip (and remove grayColor var).\n this._colors.push(this._grayColor);\n }\n }\n }\n else if ((result = SolidParser.NormalPattern.exec(line)) !== null) {\n //Create a Vector3 with the normals x, y, z\n //Value of result\n // [\"vn 1.0 2.0 3.0\", \"1.0\", \"2.0\", \"3.0\"]\n //Add the Vector in the list of normals\n this._normals.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\n }\n else if ((result = SolidParser.UVPattern.exec(line)) !== null) {\n //Create a Vector2 with the normals u, v\n //Value of result\n // [\"vt 0.1 0.2 0.3\", \"0.1\", \"0.2\"]\n //Add the Vector in the list of uvs\n this._uvs.push(new Vector2(parseFloat(result[1]) * this._loadingOptions.UVScaling.x, parseFloat(result[2]) * this._loadingOptions.UVScaling.y));\n //Identify patterns of faces\n //Face could be defined in different type of pattern\n }\n else if ((result = SolidParser.FacePattern3.exec(line)) !== null) {\n //Value of result:\n //[\"f 1/1/1 2/2/2 3/3/3\", \"1/1/1 2/2/2 3/3/3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern3(result[1].trim().split(\" \"), // [\"1/1/1\", \"2/2/2\", \"3/3/3\"]\n 1);\n }\n else if ((result = SolidParser.FacePattern4.exec(line)) !== null) {\n //Value of result:\n //[\"f 1//1 2//2 3//3\", \"1//1 2//2 3//3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern4(result[1].trim().split(\" \"), // [\"1//1\", \"2//2\", \"3//3\"]\n 1);\n }\n else if ((result = SolidParser.FacePattern5.exec(line)) !== null) {\n //Value of result:\n //[\"f -1/-1/-1 -2/-2/-2 -3/-3/-3\", \"-1/-1/-1 -2/-2/-2 -3/-3/-3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern5(result[1].trim().split(\" \"), // [\"-1/-1/-1\", \"-2/-2/-2\", \"-3/-3/-3\"]\n 1);\n }\n else if ((result = SolidParser.FacePattern2.exec(line)) !== null) {\n //Value of result:\n //[\"f 1/1 2/2 3/3\", \"1/1 2/2 3/3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern2(result[1].trim().split(\" \"), // [\"1/1\", \"2/2\", \"3/3\"]\n 1);\n }\n else if ((result = SolidParser.FacePattern1.exec(line)) !== null) {\n //Value of result\n //[\"f 1 2 3\", \"1 2 3\"...]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern1(result[1].trim().split(\" \"), // [\"1\", \"2\", \"3\"]\n 1);\n // Define a mesh or an object\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\n }\n else if ((result = SolidParser.LinePattern1.exec(line)) !== null) {\n //Value of result\n //[\"l 1 2\"]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern1(result[1].trim().split(\" \"), // [\"1\", \"2\"]\n 0);\n // Define a mesh or an object\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\n }\n else if ((result = SolidParser.LinePattern2.exec(line)) !== null) {\n //Value of result\n //[\"l 1/1 2/2\"]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern2(result[1].trim().split(\" \"), // [\"1/1\", \"2/2\"]\n 0);\n // Define a mesh or an object\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\n }\n else if ((result = SolidParser.LinePattern3.exec(line)) !== null) {\n //Value of result\n //[\"l 1/1/1 2/2/2\"]\n //Set the data for this face\n this._setDataForCurrentFaceWithPattern3(result[1].trim().split(\" \"), // [\"1/1/1\", \"2/2/2\"]\n 0);\n // Define a mesh or an object\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\n }\n else if (SolidParser.GroupDescriptor.test(line) || SolidParser.ObjectDescriptor.test(line)) {\n // Create a new mesh corresponding to the name of the group.\n // Definition of the mesh\n const objMesh = {\n name: line.substring(2).trim(),\n indices: null,\n positions: null,\n normals: null,\n uvs: null,\n colors: null,\n materialName: this._materialNameFromObj,\n isObject: SolidParser.ObjectDescriptor.test(line),\n };\n this._addPreviousObjMesh();\n //Push the last mesh created with only the name\n this._meshesFromObj.push(objMesh);\n //Set this variable to indicate that now meshesFromObj has objects defined inside\n this._hasMeshes = true;\n this._isFirstMaterial = true;\n this._increment = 1;\n //Keyword for applying a material\n }\n else if (SolidParser.UseMtlDescriptor.test(line)) {\n //Get the name of the material\n this._materialNameFromObj = line.substring(7).trim();\n //If this new material is in the same mesh\n if (!this._isFirstMaterial || !this._hasMeshes) {\n //Set the data for the previous mesh\n this._addPreviousObjMesh();\n //Create a new mesh\n const objMesh = \n //Set the name of the current obj mesh\n {\n name: (this._objMeshName || \"mesh\") + \"_mm\" + this._increment.toString(),\n indices: null,\n positions: null,\n normals: null,\n uvs: null,\n colors: null,\n materialName: this._materialNameFromObj,\n isObject: false,\n };\n this._increment++;\n //If meshes are already defined\n this._meshesFromObj.push(objMesh);\n this._hasMeshes = true;\n }\n //Set the material name if the previous line define a mesh\n if (this._hasMeshes && this._isFirstMaterial) {\n //Set the material name to the previous mesh (1 material per mesh)\n this._meshesFromObj[this._meshesFromObj.length - 1].materialName = this._materialNameFromObj;\n this._isFirstMaterial = false;\n }\n // Keyword for loading the mtl file\n }\n else if (SolidParser.MtlLibGroupDescriptor.test(line)) {\n // Get the name of mtl file\n onFileToLoadFound(line.substring(7).trim());\n // Apply smoothing\n }\n else if (SolidParser.SmoothDescriptor.test(line)) {\n // smooth shading => apply smoothing\n // Today I don't know it work with babylon and with obj.\n // With the obj file an integer is set\n }\n else {\n //If there is another possibility\n Logger.Log(\"Unhandled expression at line : \" + line);\n }\n }\n // At the end of the file, add the last mesh into the meshesFromObj array\n if (this._hasMeshes) {\n // Set the data for the last mesh\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\n if (this._loadingOptions.useLegacyBehavior) {\n //Reverse indices for displaying faces in the good sense\n this._indicesForBabylon.reverse();\n }\n //Get the good array\n this._unwrapData();\n //Set array\n this._handledMesh.indices = this._indicesForBabylon;\n this._handledMesh.positions = this._unwrappedPositionsForBabylon;\n this._handledMesh.normals = this._unwrappedNormalsForBabylon;\n this._handledMesh.uvs = this._unwrappedUVForBabylon;\n if (this._loadingOptions.importVertexColors) {\n this._handledMesh.colors = this._unwrappedColorsForBabylon;\n }\n }\n // If any o or g keyword not found, create a mesh with a random id\n if (!this._hasMeshes) {\n let newMaterial = null;\n if (this._indicesForBabylon.length) {\n if (this._loadingOptions.useLegacyBehavior) {\n // reverse tab of indices\n this._indicesForBabylon.reverse();\n }\n //Get positions normals uvs\n this._unwrapData();\n }\n else {\n // There is no indices in the file. We will have to switch to point cloud rendering\n for (const pos of this._positions) {\n this._unwrappedPositionsForBabylon.push(pos.x, pos.y, pos.z);\n }\n if (this._normals.length) {\n for (const normal of this._normals) {\n this._unwrappedNormalsForBabylon.push(normal.x, normal.y, normal.z);\n }\n }\n if (this._uvs.length) {\n for (const uv of this._uvs) {\n this._unwrappedUVForBabylon.push(uv.x, uv.y);\n }\n }\n if (this._colors.length) {\n for (const color of this._colors) {\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\n }\n }\n if (!this._materialNameFromObj) {\n // Create a material with point cloud on\n newMaterial = new StandardMaterial(Geometry.RandomId(), scene);\n newMaterial.pointsCloud = true;\n this._materialNameFromObj = newMaterial.name;\n if (!this._normals.length) {\n newMaterial.disableLighting = true;\n newMaterial.emissiveColor = Color3.White();\n }\n }\n }\n //Set data for one mesh\n this._meshesFromObj.push({\n name: Geometry.RandomId(),\n indices: this._indicesForBabylon,\n positions: this._unwrappedPositionsForBabylon,\n colors: this._unwrappedColorsForBabylon,\n normals: this._unwrappedNormalsForBabylon,\n uvs: this._unwrappedUVForBabylon,\n materialName: this._materialNameFromObj,\n directMaterial: newMaterial,\n isObject: true,\n });\n }\n //Set data for each mesh\n for (let j = 0; j < this._meshesFromObj.length; j++) {\n //check meshesNames (stlFileLoader)\n if (meshesNames && this._meshesFromObj[j].name) {\n if (meshesNames instanceof Array) {\n if (meshesNames.indexOf(this._meshesFromObj[j].name) === -1) {\n continue;\n }\n }\n else {\n if (this._meshesFromObj[j].name !== meshesNames) {\n continue;\n }\n }\n }\n //Get the current mesh\n //Set the data with VertexBuffer for each mesh\n this._handledMesh = this._meshesFromObj[j];\n //Create a Mesh with the name of the obj mesh\n scene._blockEntityCollection = !!assetContainer;\n const babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);\n babylonMesh._parentContainer = assetContainer;\n scene._blockEntityCollection = false;\n this._handledMesh._babylonMesh = babylonMesh;\n // If this is a group mesh, it should have an object mesh as a parent. So look for the first object mesh that appears before it.\n if (!this._handledMesh.isObject) {\n for (let k = j - 1; k >= 0; --k) {\n if (this._meshesFromObj[k].isObject && this._meshesFromObj[k]._babylonMesh) {\n babylonMesh.parent = this._meshesFromObj[k]._babylonMesh;\n break;\n }\n }\n }\n //Push the name of the material to an array\n //This is indispensable for the importMesh function\n this._materialToUse.push(this._meshesFromObj[j].materialName);\n if (this._handledMesh.positions?.length === 0) {\n //Push the mesh into an array\n this._babylonMeshesArray.push(babylonMesh);\n continue;\n }\n const vertexData = new VertexData(); //The container for the values\n //Set the data for the babylonMesh\n vertexData.uvs = this._handledMesh.uvs;\n vertexData.indices = this._handledMesh.indices;\n vertexData.positions = this._handledMesh.positions;\n if (this._loadingOptions.computeNormals) {\n const normals = new Array();\n VertexData.ComputeNormals(this._handledMesh.positions, this._handledMesh.indices, normals);\n vertexData.normals = normals;\n }\n else {\n vertexData.normals = this._handledMesh.normals;\n }\n if (this._loadingOptions.importVertexColors) {\n vertexData.colors = this._handledMesh.colors;\n }\n //Set the data from the VertexBuffer to the current Mesh\n vertexData.applyToMesh(babylonMesh);\n if (this._loadingOptions.invertY) {\n babylonMesh.scaling.y *= -1;\n }\n if (this._loadingOptions.optimizeNormals) {\n this._optimizeNormals(babylonMesh);\n }\n //Push the mesh into an array\n this._babylonMeshesArray.push(babylonMesh);\n if (this._handledMesh.directMaterial) {\n babylonMesh.material = this._handledMesh.directMaterial;\n }\n }\n }\n}\n// Descriptor\n/** Object descriptor */\nSolidParser.ObjectDescriptor = /^o/;\n/** Group descriptor */\nSolidParser.GroupDescriptor = /^g/;\n/** Material lib descriptor */\nSolidParser.MtlLibGroupDescriptor = /^mtllib /;\n/** Use a material descriptor */\nSolidParser.UseMtlDescriptor = /^usemtl /;\n/** Smooth descriptor */\nSolidParser.SmoothDescriptor = /^s /;\n// Patterns\n/** Pattern used to detect a vertex */\nSolidParser.VertexPattern = /^v(\\s+[\\d|.|+|\\-|e|E]+){3,7}/;\n/** Pattern used to detect a normal */\nSolidParser.NormalPattern = /^vn(\\s+[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)/;\n/** Pattern used to detect a UV set */\nSolidParser.UVPattern = /^vt(\\s+[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)/;\n/** Pattern used to detect a first kind of face (f vertex vertex vertex) */\nSolidParser.FacePattern1 = /^f\\s+(([\\d]{1,}[\\s]?){3,})+/;\n/** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */\nSolidParser.FacePattern2 = /^f\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\n/** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */\nSolidParser.FacePattern3 = /^f\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\n/** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/\nSolidParser.FacePattern4 = /^f\\s+((([\\d]{1,}\\/\\/[\\d]{1,}[\\s]?){3,})+)/;\n/** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */\nSolidParser.FacePattern5 = /^f\\s+(((-[\\d]{1,}\\/-[\\d]{1,}\\/-[\\d]{1,}[\\s]?){3,})+)/;\n/** Pattern used to detect a line(l vertex vertex) */\nSolidParser.LinePattern1 = /^l\\s+(([\\d]{1,}[\\s]?){2,})+/;\n/** Pattern used to detect a second kind of line (l vertex/uvs vertex/uvs) */\nSolidParser.LinePattern2 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\n/** Pattern used to detect a third kind of line (l vertex/uvs/normal vertex/uvs/normal) */\nSolidParser.LinePattern3 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,mCAAmC;AAChE,SAASC,gBAAgB,QAAQ,+CAA+C;AAChF,SAASC,MAAM,EAAEC,MAAM,QAAQ,qCAAqC;AACpE,SAASC,OAAO,EAAEC,OAAO,QAAQ,sCAAsC;AACvE,SAASC,QAAQ,QAAQ,oCAAoC;AAC7D,SAASC,IAAI,QAAQ,gCAAgC;AACrD,SAASC,UAAU,QAAQ,2CAA2C;AACtE,SAASC,MAAM,QAAQ,gCAAgC;AACvD;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAC;EACrB;AACJ;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,aAAa,EAAEC,kB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