@babylonjs/loaders 7.34.3 → 7.35.0
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/solidParser.js +2 -2
- package/OBJ/solidParser.js.map +1 -1
- package/SPLAT/splatFileLoader.js.map +1 -1
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -1
- package/glTF/2.0/Extensions/interactivityFunctions.js +2 -2
- package/glTF/2.0/Extensions/interactivityFunctions.js.map +1 -1
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -1
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.js.map +1 -1
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/package.json +3 -3
package/OBJ/solidParser.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solidParser.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/solidParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAEnD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AACvD,OAAO,EAAE,O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vE,4GAA4G;AAC9F,wBAAY,GAAG,mDAAmD,AAAtD,CAAuD;AACjF,mGAAmG;AACrF,wBAAY,GAAG,2CAA2C,AAA9C,CAA+C;AACzE,qHAAqH;AACvG,wBAAY,GAAG,sDAAsD,AAAzD,CAA0D;AACpF,qDAAqD;AACvC,wBAAY,GAAG,6BAA6B,AAAhC,CAAiC;AAC3D,6EAA6E;AAC/D,wBAAY,GAAG,yCAAyC,AAA5C,CAA6C;AACvE,0FAA0F;AAC5E,wBAAY,GAAG,mDAAmD,AAAtD,CAAuD","sourcesContent":["import type { AssetContainer } from \"core/assetContainer\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { OBJLoadingOptions } from \"./objLoadingOptions\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\ntype MeshObject = {\r\n name: string;\r\n indices: Nullable<Array<number>>;\r\n positions: Nullable<Array<number>>;\r\n normals: Nullable<Array<number>>;\r\n colors: Nullable<Array<number>>;\r\n uvs: Nullable<Array<number>>;\r\n materialName: string;\r\n directMaterial?: Nullable<Material>;\r\n isObject: boolean; // If the entity is defined as an object (\"o\"), or group (\"g\")\r\n _babylonMesh?: AbstractMesh; // The corresponding Babylon mesh\r\n hasLines?: boolean; // If the mesh has lines\r\n};\r\n\r\n/**\r\n * Class used to load mesh data from OBJ content\r\n */\r\nexport class SolidParser {\r\n // Descriptor\r\n /** Object descriptor */\r\n public static ObjectDescriptor = /^o/;\r\n /** Group descriptor */\r\n public static GroupDescriptor = /^g/;\r\n /** Material lib descriptor */\r\n public static MtlLibGroupDescriptor = /^mtllib /;\r\n /** Use a material descriptor */\r\n public static UseMtlDescriptor = /^usemtl /;\r\n /** Smooth descriptor */\r\n public static SmoothDescriptor = /^s /;\r\n\r\n // Patterns\r\n /** Pattern used to detect a vertex */\r\n public static VertexPattern = /^v(\\s+[\\d|.|+|\\-|e|E]+){3,7}/;\r\n /** Pattern used to detect a normal */\r\n public static NormalPattern = /^vn(\\s+[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)/;\r\n /** Pattern used to detect a UV set */\r\n public static UVPattern = /^vt(\\s+[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)/;\r\n /** Pattern used to detect a first kind of face (f vertex vertex vertex) */\r\n public static FacePattern1 = /^f\\s+(([\\d]{1,}[\\s]?){3,})+/;\r\n /** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */\r\n public static FacePattern2 = /^f\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */\r\n public static FacePattern3 = /^f\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/\r\n public static FacePattern4 = /^f\\s+((([\\d]{1,}\\/\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */\r\n public static FacePattern5 = /^f\\s+(((-[\\d]{1,}\\/-[\\d]{1,}\\/-[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a line(l vertex vertex) */\r\n public static LinePattern1 = /^l\\s+(([\\d]{1,}[\\s]?){2,})+/;\r\n /** Pattern used to detect a second kind of line (l vertex/uvs vertex/uvs) */\r\n public static LinePattern2 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\r\n /** Pattern used to detect a third kind of line (l vertex/uvs/normal vertex/uvs/normal) */\r\n public static LinePattern3 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\r\n\r\n private _loadingOptions: OBJLoadingOptions;\r\n private _positions: Array<Vector3> = []; //values for the positions of vertices\r\n private _normals: Array<Vector3> = []; //Values for the normals\r\n private _uvs: Array<Vector2> = []; //Values for the textures\r\n private _colors: Array<Color4> = [];\r\n private _extColors: Array<Color4> = []; //Extension color\r\n private _meshesFromObj: Array<MeshObject> = []; //[mesh] Contains all the obj meshes\r\n private _handledMesh: MeshObject; //The current mesh of meshes array\r\n private _indicesForBabylon: Array<number> = []; //The list of indices for VertexData\r\n private _wrappedPositionForBabylon: Array<Vector3> = []; //The list of position in vectors\r\n private _wrappedUvsForBabylon: Array<Vector2> = []; //Array with all value of uvs to match with the indices\r\n private _wrappedColorsForBabylon: Array<Color4> = []; // Array with all color values to match with the indices\r\n private _wrappedNormalsForBabylon: Array<Vector3> = []; //Array with all value of normals to match with the indices\r\n private _tuplePosNorm: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }> = []; //Create a tuple with indice of Position, Normal, UV [pos, norm, uvs]\r\n private _curPositionInIndices = 0;\r\n private _hasMeshes: Boolean = false; //Meshes are defined in the file\r\n private _unwrappedPositionsForBabylon: Array<number> = []; //Value of positionForBabylon w/o Vector3() [x,y,z]\r\n private _unwrappedColorsForBabylon: Array<number> = []; // Value of colorForBabylon w/o Color4() [r,g,b,a]\r\n private _unwrappedNormalsForBabylon: Array<number> = []; //Value of normalsForBabylon w/o Vector3() [x,y,z]\r\n private _unwrappedUVForBabylon: Array<number> = []; //Value of uvsForBabylon w/o Vector3() [x,y,z]\r\n private _triangles: Array<string> = []; //Indices from new triangles coming from polygons\r\n private _materialNameFromObj: string = \"\"; //The name of the current material\r\n private _objMeshName: string = \"\"; //The name of the current obj mesh\r\n private _increment: number = 1; //Id for meshes created by the multimaterial\r\n private _isFirstMaterial: boolean = true;\r\n private _grayColor = new Color4(0.5, 0.5, 0.5, 1);\r\n private _materialToUse: string[];\r\n private _babylonMeshesArray: Array<Mesh>;\r\n private _pushTriangle: (faces: Array<string>, faceIndex: number) => void;\r\n private _handednessSign: number;\r\n private _hasLineData: boolean = false; //If this mesh has line segment(l) data\r\n\r\n /**\r\n * Creates a new SolidParser\r\n * @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)\r\n * @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)\r\n * @param loadingOptions defines the loading options to use\r\n */\r\n public constructor(materialToUse: string[], babylonMeshesArray: Array<Mesh>, loadingOptions: OBJLoadingOptions) {\r\n this._materialToUse = materialToUse;\r\n this._babylonMeshesArray = babylonMeshesArray;\r\n this._loadingOptions = loadingOptions;\r\n }\r\n\r\n /**\r\n * Search for obj in the given array.\r\n * This function is called to check if a couple of data already exists in an array.\r\n *\r\n * If found, returns the index of the founded tuple index. Returns -1 if not found\r\n * @param arr Array<{ normals: Array<number>, idx: Array<number> }>\r\n * @param obj Array<number>\r\n * @returns {boolean}\r\n */\r\n private _isInArray(arr: Array<{ normals: Array<number>; idx: Array<number> }>, obj: Array<number>) {\r\n if (!arr[obj[0]]) {\r\n arr[obj[0]] = { normals: [], idx: [] };\r\n }\r\n const idx = arr[obj[0]].normals.indexOf(obj[1]);\r\n\r\n return idx === -1 ? -1 : arr[obj[0]].idx[idx];\r\n }\r\n\r\n private _isInArrayUV(arr: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }>, obj: Array<number>) {\r\n if (!arr[obj[0]]) {\r\n arr[obj[0]] = { normals: [], idx: [], uv: [] };\r\n }\r\n const idx = arr[obj[0]].normals.indexOf(obj[1]);\r\n\r\n if (idx != 1 && obj[2] === arr[obj[0]].uv[idx]) {\r\n return arr[obj[0]].idx[idx];\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * This function set the data for each triangle.\r\n * Data are position, normals and uvs\r\n * If a tuple of (position, normal) is not set, add the data into the corresponding array\r\n * If the tuple already exist, add only their indice\r\n *\r\n * @param indicePositionFromObj Integer The index in positions array\r\n * @param indiceUvsFromObj Integer The index in uvs array\r\n * @param indiceNormalFromObj Integer The index in normals array\r\n * @param positionVectorFromOBJ Vector3 The value of position at index objIndice\r\n * @param textureVectorFromOBJ Vector3 The value of uvs\r\n * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale\r\n * @param positionColorsFromOBJ\r\n */\r\n private _setData(\r\n indicePositionFromObj: number,\r\n indiceUvsFromObj: number,\r\n indiceNormalFromObj: number,\r\n positionVectorFromOBJ: Vector3,\r\n textureVectorFromOBJ: Vector2,\r\n normalsVectorFromOBJ: Vector3,\r\n positionColorsFromOBJ?: Color4\r\n ) {\r\n //Check if this tuple already exists in the list of tuples\r\n let _index: number;\r\n if (this._loadingOptions.optimizeWithUV) {\r\n _index = this._isInArrayUV(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj, indiceUvsFromObj]);\r\n } else {\r\n _index = this._isInArray(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj]);\r\n }\r\n\r\n //If it not exists\r\n if (_index === -1) {\r\n //Add an new indice.\r\n //The array of indices is only an array with his length equal to the number of triangles - 1.\r\n //We add vertices data in this order\r\n this._indicesForBabylon.push(this._wrappedPositionForBabylon.length);\r\n //Push the position of vertice for Babylon\r\n //Each element is a Vector3(x,y,z)\r\n this._wrappedPositionForBabylon.push(positionVectorFromOBJ);\r\n //Push the uvs for Babylon\r\n //Each element is a Vector2(u,v)\r\n //If the UVs are missing, set (u,v)=(0,0)\r\n textureVectorFromOBJ = textureVectorFromOBJ ?? new Vector2(0, 0);\r\n this._wrappedUvsForBabylon.push(textureVectorFromOBJ);\r\n //Push the normals for Babylon\r\n //Each element is a Vector3(x,y,z)\r\n this._wrappedNormalsForBabylon.push(normalsVectorFromOBJ);\r\n\r\n if (positionColorsFromOBJ !== undefined) {\r\n //Push the colors for Babylon\r\n //Each element is a BABYLON.Color4(r,g,b,a)\r\n this._wrappedColorsForBabylon.push(positionColorsFromOBJ);\r\n }\r\n\r\n //Add the tuple in the comparison list\r\n this._tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);\r\n this._tuplePosNorm[indicePositionFromObj].idx.push(this._curPositionInIndices++);\r\n if (this._loadingOptions.optimizeWithUV) {\r\n this._tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj);\r\n }\r\n } else {\r\n //The tuple already exists\r\n //Add the index of the already existing tuple\r\n //At this index we can get the value of position, normal, color and uvs of vertex\r\n this._indicesForBabylon.push(_index);\r\n }\r\n }\r\n\r\n /**\r\n * Transform Vector() and BABYLON.Color() objects into numbers in an array\r\n */\r\n private _unwrapData() {\r\n try {\r\n //Every array has the same length\r\n for (let l = 0; l < this._wrappedPositionForBabylon.length; l++) {\r\n //Push the x, y, z values of each element in the unwrapped array\r\n this._unwrappedPositionsForBabylon.push(\r\n this._wrappedPositionForBabylon[l].x * this._handednessSign,\r\n this._wrappedPositionForBabylon[l].y,\r\n this._wrappedPositionForBabylon[l].z\r\n );\r\n this._unwrappedNormalsForBabylon.push(\r\n this._wrappedNormalsForBabylon[l].x * this._handednessSign,\r\n this._wrappedNormalsForBabylon[l].y,\r\n this._wrappedNormalsForBabylon[l].z\r\n );\r\n\r\n this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON\r\n if (this._loadingOptions.importVertexColors) {\r\n //Push the r, g, b, a values of each element in the unwrapped array\r\n this._unwrappedColorsForBabylon.push(\r\n this._wrappedColorsForBabylon[l].r,\r\n this._wrappedColorsForBabylon[l].g,\r\n this._wrappedColorsForBabylon[l].b,\r\n this._wrappedColorsForBabylon[l].a\r\n );\r\n }\r\n }\r\n // Reset arrays for the next new meshes\r\n this._wrappedPositionForBabylon.length = 0;\r\n this._wrappedNormalsForBabylon.length = 0;\r\n this._wrappedUvsForBabylon.length = 0;\r\n this._wrappedColorsForBabylon.length = 0;\r\n this._tuplePosNorm.length = 0;\r\n this._curPositionInIndices = 0;\r\n } catch (e) {\r\n throw new Error(\"Unable to unwrap data while parsing OBJ data.\");\r\n }\r\n }\r\n\r\n /**\r\n * Create triangles from polygons\r\n * It is important to notice that a triangle is a polygon\r\n * We get 5 patterns of face defined in OBJ File :\r\n * facePattern1 = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]\r\n * facePattern2 = [\"1/1\",\"2/2\",\"3/3\",\"4/4\",\"5/5\",\"6/6\"]\r\n * facePattern3 = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"4/4/4\",\"5/5/5\",\"6/6/6\"]\r\n * facePattern4 = [\"1//1\",\"2//2\",\"3//3\",\"4//4\",\"5//5\",\"6//6\"]\r\n * facePattern5 = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-4/-4/-4\",\"-5/-5/-5\",\"-6/-6/-6\"]\r\n * Each pattern is divided by the same method\r\n * @param faces Array[String] The indices of elements\r\n * @param v Integer The variable to increment\r\n */\r\n private _getTriangles(faces: Array<string>, v: number) {\r\n //Work for each element of the array\r\n for (let faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {\r\n //Add on the triangle variable the indexes to obtain triangles\r\n this._pushTriangle(faces, faceIndex);\r\n }\r\n\r\n //Result obtained after 2 iterations:\r\n //Pattern1 => triangle = [\"1\",\"2\",\"3\",\"1\",\"3\",\"4\"];\r\n //Pattern2 => triangle = [\"1/1\",\"2/2\",\"3/3\",\"1/1\",\"3/3\",\"4/4\"];\r\n //Pattern3 => triangle = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"1/1/1\",\"3/3/3\",\"4/4/4\"];\r\n //Pattern4 => triangle = [\"1//1\",\"2//2\",\"3//3\",\"1//1\",\"3//3\",\"4//4\"];\r\n //Pattern5 => triangle = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-1/-1/-1\",\"-3/-3/-3\",\"-4/-4/-4\"];\r\n }\r\n\r\n /**\r\n * To get color between color and extension color\r\n * @param index Integer The index of the element in the array\r\n * @returns value of target color\r\n */\r\n private _getColor(index: number) {\r\n if (this._loadingOptions.importVertexColors) {\r\n return this._extColors[index] ?? this._colors[index];\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 1\r\n * In this pattern we get vertice positions\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern1(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n //For each element in the triangles array.\r\n //This var could contains 1 to an infinity of triangles\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n // Set position indice\r\n const indicePositionFromObj = parseInt(this._triangles[k]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n 0,\r\n 0, // In the pattern 1, normals and uvs are not defined\r\n this._positions[indicePositionFromObj], // Get the vectors data\r\n Vector2.Zero(),\r\n Vector3.Up(), // Create default vectors\r\n this._getColor(indicePositionFromObj)\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 2\r\n * In this pattern we get vertice positions and uvs\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern2(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1/1\"\r\n //Split the data for getting position and uv\r\n const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\"]\r\n //Set position indice\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n //Set uv indice\r\n const indiceUvsFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n 0, //Default value for normals\r\n this._positions[indicePositionFromObj], //Get the values for each element\r\n this._uvs[indiceUvsFromObj] ?? Vector2.Zero(),\r\n Vector3.Up(), //Default value for normals\r\n this._getColor(indicePositionFromObj)\r\n );\r\n }\r\n\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 3\r\n * In this pattern we get vertice positions, uvs and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern3(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1/1/1\"\r\n //Split the data for getting position, uv, and normals\r\n const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\", \"1\"]\r\n // Set position indice\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n // Set uv indice\r\n const indiceUvsFromObj = parseInt(point[1]) - 1;\r\n // Set normal indice\r\n const indiceNormalFromObj = parseInt(point[2]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n indiceNormalFromObj,\r\n this._positions[indicePositionFromObj],\r\n this._uvs[indiceUvsFromObj] ?? Vector2.Zero(),\r\n this._normals[indiceNormalFromObj] ?? Vector3.Up() //Set the vector for each component\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 4\r\n * In this pattern we get vertice positions and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern4(face: Array<string>, v: number) {\r\n this._getTriangles(face, v);\r\n\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1//1\"\r\n //Split the data for getting position and normals\r\n const point = this._triangles[k].split(\"//\"); // [\"1\", \"1\"]\r\n // We check indices, and normals\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n const indiceNormalFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n 1, //Default value for uv\r\n indiceNormalFromObj,\r\n this._positions[indicePositionFromObj], //Get each vector of data\r\n Vector2.Zero(),\r\n this._normals[indiceNormalFromObj],\r\n this._getColor(indicePositionFromObj)\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n /*\r\n * Create triangles and push the data for each polygon for the pattern 3\r\n * In this pattern we get vertice positions, uvs and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern5(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"-1/-1/-1\"\r\n //Split the data for getting position, uv, and normals\r\n const point = this._triangles[k].split(\"/\"); // [\"-1\", \"-1\", \"-1\"]\r\n // Set position indice\r\n const indicePositionFromObj = this._positions.length + parseInt(point[0]);\r\n // Set uv indice\r\n const indiceUvsFromObj = this._uvs.length + parseInt(point[1]);\r\n // Set normal indice\r\n const indiceNormalFromObj = this._normals.length + parseInt(point[2]);\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n indiceNormalFromObj,\r\n this._positions[indicePositionFromObj],\r\n this._uvs[indiceUvsFromObj],\r\n this._normals[indiceNormalFromObj], //Set the vector for each component\r\n this._getColor(indicePositionFromObj)\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n private _addPreviousObjMesh() {\r\n //Check if it is not the first mesh. Otherwise we don't have data.\r\n if (this._meshesFromObj.length > 0) {\r\n //Get the previous mesh for applying the data about the faces\r\n //=> in obj file, faces definition append after the name of the mesh\r\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\r\n\r\n //Set the data into Array for the mesh\r\n this._unwrapData();\r\n\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n // Reverse tab. Otherwise face are displayed in the wrong sens\r\n this._indicesForBabylon.reverse();\r\n }\r\n\r\n //Set the information for the mesh\r\n //Slice the array to avoid rewriting because of the fact this is the same var which be rewrited\r\n this._handledMesh.indices = this._indicesForBabylon.slice();\r\n this._handledMesh.positions = this._unwrappedPositionsForBabylon.slice();\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();\r\n this._handledMesh.hasLines = this._hasLineData;\r\n\r\n if (this._loadingOptions.importVertexColors) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();\r\n }\r\n\r\n //Reset the array for the next mesh\r\n this._indicesForBabylon.length = 0;\r\n this._unwrappedPositionsForBabylon.length = 0;\r\n this._unwrappedColorsForBabylon.length = 0;\r\n this._unwrappedNormalsForBabylon.length = 0;\r\n this._unwrappedUVForBabylon.length = 0;\r\n this._hasLineData = false;\r\n }\r\n }\r\n\r\n private _optimizeNormals(mesh: AbstractMesh): void {\r\n const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = mesh.getVerticesData(VertexBuffer.NormalKind);\r\n const mapVertices: { [key: string]: number[] } = {};\r\n\r\n if (!positions || !normals) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < positions.length / 3; i++) {\r\n const x = positions[i * 3 + 0];\r\n const y = positions[i * 3 + 1];\r\n const z = positions[i * 3 + 2];\r\n const key = x + \"_\" + y + \"_\" + z;\r\n\r\n let lst = mapVertices[key];\r\n if (!lst) {\r\n lst = [];\r\n mapVertices[key] = lst;\r\n }\r\n lst.push(i);\r\n }\r\n\r\n const normal = new Vector3();\r\n for (const key in mapVertices) {\r\n const lst = mapVertices[key];\r\n if (lst.length < 2) {\r\n continue;\r\n }\r\n\r\n const v0Idx = lst[0];\r\n for (let i = 1; i < lst.length; ++i) {\r\n const vIdx = lst[i];\r\n normals[v0Idx * 3 + 0] += normals[vIdx * 3 + 0];\r\n normals[v0Idx * 3 + 1] += normals[vIdx * 3 + 1];\r\n normals[v0Idx * 3 + 2] += normals[vIdx * 3 + 2];\r\n }\r\n\r\n normal.copyFromFloats(normals[v0Idx * 3 + 0], normals[v0Idx * 3 + 1], normals[v0Idx * 3 + 2]);\r\n normal.normalize();\r\n\r\n for (let i = 0; i < lst.length; ++i) {\r\n const vIdx = lst[i];\r\n normals[vIdx * 3 + 0] = normal.x;\r\n normals[vIdx * 3 + 1] = normal.y;\r\n normals[vIdx * 3 + 2] = normal.z;\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normals);\r\n }\r\n\r\n private static _IsLineElement(line: string) {\r\n return line.startsWith(\"l\");\r\n }\r\n\r\n private static _IsObjectElement(line: string) {\r\n return line.startsWith(\"o\");\r\n }\r\n\r\n private static _IsGroupElement(line: string) {\r\n return line.startsWith(\"g\");\r\n }\r\n\r\n private static _GetZbrushMRGB(line: string, notParse: boolean) {\r\n if (!line.startsWith(\"mrgb\")) return null;\r\n line = line.replace(\"mrgb\", \"\").trim();\r\n // if include vertex color , not load mrgb anymore\r\n if (notParse) return [];\r\n const regex = /[a-z0-9]/g;\r\n const regArray = line.match(regex);\r\n if (!regArray || regArray.length % 8 !== 0) {\r\n return [];\r\n }\r\n const array: Color4[] = [];\r\n for (let regIndex = 0; regIndex < regArray.length / 8; regIndex++) {\r\n //each item is MMRRGGBB, m is material index\r\n // const m = regArray[regIndex * 8 + 0] + regArray[regIndex * 8 + 1];\r\n const r = regArray[regIndex * 8 + 2] + regArray[regIndex * 8 + 3];\r\n const g = regArray[regIndex * 8 + 4] + regArray[regIndex * 8 + 5];\r\n const b = regArray[regIndex * 8 + 6] + regArray[regIndex * 8 + 7];\r\n array.push(new Color4(parseInt(r, 16) / 255, parseInt(g, 16) / 255, parseInt(b, 16) / 255, 1));\r\n }\r\n return array;\r\n }\r\n\r\n /**\r\n * Function used to parse an OBJ string\r\n * @param meshesNames defines the list of meshes to load (all if not defined)\r\n * @param data defines the OBJ string\r\n * @param scene defines the hosting scene\r\n * @param assetContainer defines the asset container to load data in\r\n * @param onFileToLoadFound defines a callback that will be called if a MTL file is found\r\n */\r\n public parse(meshesNames: any, data: string, scene: Scene, assetContainer: Nullable<AssetContainer>, onFileToLoadFound: (fileToLoad: string) => void): void {\r\n //Move Santitize here to forbid delete zbrush data\r\n // Sanitize data\r\n data = data.replace(/#MRGB/g, \"mrgb\");\r\n data = data.replace(/#.*$/gm, \"\").trim();\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n this._handednessSign = 1;\r\n } else if (scene.useRightHandedSystem) {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex + 1], faces[faceIndex]);\r\n this._handednessSign = 1;\r\n } else {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n this._handednessSign = -1;\r\n }\r\n\r\n // Split the file into lines\r\n // Preprocess line data\r\n const linesOBJ = data.split(\"\\n\");\r\n const lineLines: string[][] = [];\r\n let currentGroup: string[] = [];\r\n\r\n lineLines.push(currentGroup);\r\n\r\n for (let i = 0; i < linesOBJ.length; i++) {\r\n const line = linesOBJ[i].trim().replace(/\\s\\s/g, \" \");\r\n\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n }\r\n\r\n if (SolidParser._IsGroupElement(line) || SolidParser._IsObjectElement(line)) {\r\n currentGroup = [];\r\n lineLines.push(currentGroup);\r\n }\r\n\r\n if (SolidParser._IsLineElement(line)) {\r\n const lineValues = line.split(\" \");\r\n // create line elements with two vertices only\r\n for (let i = 1; i < lineValues.length - 1; i++) {\r\n currentGroup.push(`l ${lineValues[i]} ${lineValues[i + 1]}`);\r\n }\r\n } else {\r\n currentGroup.push(line);\r\n }\r\n }\r\n\r\n const lines = lineLines.flat();\r\n // Look at each line\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i].trim().replace(/\\s\\s/g, \" \");\r\n let result;\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n } else if (SolidParser.VertexPattern.test(line)) {\r\n //Get information about one position possible for the vertices\r\n result = line.match(/[^ ]+/g)!; // match will return non-null due to passing regex pattern\r\n\r\n // Value of result with line: \"v 1.0 2.0 3.0\"\r\n // [\"v\", \"1.0\", \"2.0\", \"3.0\"]\r\n // Create a Vector3 with the position x, y, z\r\n this._positions.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\r\n\r\n if (this._loadingOptions.importVertexColors) {\r\n if (result.length >= 7) {\r\n const r = parseFloat(result[4]);\r\n const g = parseFloat(result[5]);\r\n const b = parseFloat(result[6]);\r\n\r\n this._colors.push(\r\n 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]))\r\n );\r\n } else {\r\n // TODO: maybe push NULL and if all are NULL to skip (and remove grayColor var).\r\n this._colors.push(this._grayColor);\r\n }\r\n }\r\n } else if ((result = SolidParser.NormalPattern.exec(line)) !== null) {\r\n //Create a Vector3 with the normals x, y, z\r\n //Value of result\r\n // [\"vn 1.0 2.0 3.0\", \"1.0\", \"2.0\", \"3.0\"]\r\n //Add the Vector in the list of normals\r\n this._normals.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\r\n } else if ((result = SolidParser.UVPattern.exec(line)) !== null) {\r\n //Create a Vector2 with the normals u, v\r\n //Value of result\r\n // [\"vt 0.1 0.2 0.3\", \"0.1\", \"0.2\"]\r\n //Add the Vector in the list of uvs\r\n this._uvs.push(new Vector2(parseFloat(result[1]) * this._loadingOptions.UVScaling.x, parseFloat(result[2]) * this._loadingOptions.UVScaling.y));\r\n\r\n //Identify patterns of faces\r\n //Face could be defined in different type of pattern\r\n } else if ((result = SolidParser.FacePattern3.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1/1/1 2/2/2 3/3/3\", \"1/1/1 2/2/2 3/3/3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern3(\r\n result[1].trim().split(\" \"), // [\"1/1/1\", \"2/2/2\", \"3/3/3\"]\r\n 1\r\n );\r\n } else if ((result = SolidParser.FacePattern4.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1//1 2//2 3//3\", \"1//1 2//2 3//3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern4(\r\n result[1].trim().split(\" \"), // [\"1//1\", \"2//2\", \"3//3\"]\r\n 1\r\n );\r\n } else if ((result = SolidParser.FacePattern5.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f -1/-1/-1 -2/-2/-2 -3/-3/-3\", \"-1/-1/-1 -2/-2/-2 -3/-3/-3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern5(\r\n result[1].trim().split(\" \"), // [\"-1/-1/-1\", \"-2/-2/-2\", \"-3/-3/-3\"]\r\n 1\r\n );\r\n } else if ((result = SolidParser.FacePattern2.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1/1 2/2 3/3\", \"1/1 2/2 3/3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern2(\r\n result[1].trim().split(\" \"), // [\"1/1\", \"2/2\", \"3/3\"]\r\n 1\r\n );\r\n } else if ((result = SolidParser.FacePattern1.exec(line)) !== null) {\r\n //Value of result\r\n //[\"f 1 2 3\", \"1 2 3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern1(\r\n result[1].trim().split(\" \"), // [\"1\", \"2\", \"3\"]\r\n 1\r\n );\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser.LinePattern1.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1 2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern1(\r\n result[1].trim().split(\" \"), // [\"1\", \"2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser.LinePattern2.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1/1 2/2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern2(\r\n result[1].trim().split(\" \"), // [\"1/1\", \"2/2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser._GetZbrushMRGB(line, !this._loadingOptions.importVertexColors))) {\r\n result.forEach((element) => {\r\n this._extColors.push(element);\r\n });\r\n } else if ((result = SolidParser.LinePattern3.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1/1/1 2/2/2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern3(\r\n result[1].trim().split(\" \"), // [\"1/1/1\", \"2/2/2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if (SolidParser.GroupDescriptor.test(line) || SolidParser.ObjectDescriptor.test(line)) {\r\n // Create a new mesh corresponding to the name of the group.\r\n // Definition of the mesh\r\n const objMesh: MeshObject = {\r\n name: line.substring(2).trim(), //Set the name of the current obj mesh\r\n indices: null,\r\n positions: null,\r\n normals: null,\r\n uvs: null,\r\n colors: null,\r\n materialName: this._materialNameFromObj,\r\n isObject: SolidParser.ObjectDescriptor.test(line),\r\n };\r\n this._addPreviousObjMesh();\r\n\r\n //Push the last mesh created with only the name\r\n this._meshesFromObj.push(objMesh);\r\n\r\n //Set this variable to indicate that now meshesFromObj has objects defined inside\r\n this._hasMeshes = true;\r\n this._isFirstMaterial = true;\r\n this._increment = 1;\r\n //Keyword for applying a material\r\n } else if (SolidParser.UseMtlDescriptor.test(line)) {\r\n //Get the name of the material\r\n this._materialNameFromObj = line.substring(7).trim();\r\n\r\n //If this new material is in the same mesh\r\n\r\n if (!this._isFirstMaterial || !this._hasMeshes) {\r\n //Set the data for the previous mesh\r\n this._addPreviousObjMesh();\r\n //Create a new mesh\r\n const objMesh: MeshObject =\r\n //Set the name of the current obj mesh\r\n {\r\n name: (this._objMeshName || \"mesh\") + \"_mm\" + this._increment.toString(), //Set the name of the current obj mesh\r\n indices: null,\r\n positions: null,\r\n normals: null,\r\n uvs: null,\r\n colors: null,\r\n materialName: this._materialNameFromObj,\r\n isObject: false,\r\n };\r\n this._increment++;\r\n //If meshes are already defined\r\n this._meshesFromObj.push(objMesh);\r\n this._hasMeshes = true;\r\n }\r\n //Set the material name if the previous line define a mesh\r\n\r\n if (this._hasMeshes && this._isFirstMaterial) {\r\n //Set the material name to the previous mesh (1 material per mesh)\r\n this._meshesFromObj[this._meshesFromObj.length - 1].materialName = this._materialNameFromObj;\r\n this._isFirstMaterial = false;\r\n }\r\n // Keyword for loading the mtl file\r\n } else if (SolidParser.MtlLibGroupDescriptor.test(line)) {\r\n // Get the name of mtl file\r\n onFileToLoadFound(line.substring(7).trim());\r\n\r\n // Apply smoothing\r\n } else if (SolidParser.SmoothDescriptor.test(line)) {\r\n // smooth shading => apply smoothing\r\n // Today I don't know it work with babylon and with obj.\r\n // With the obj file an integer is set\r\n } else {\r\n //If there is another possibility\r\n Logger.Log(\"Unhandled expression at line : \" + line);\r\n }\r\n }\r\n // At the end of the file, add the last mesh into the meshesFromObj array\r\n if (this._hasMeshes) {\r\n // Set the data for the last mesh\r\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\r\n\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n //Reverse indices for displaying faces in the good sense\r\n this._indicesForBabylon.reverse();\r\n }\r\n\r\n //Get the good array\r\n this._unwrapData();\r\n //Set array\r\n this._handledMesh.indices = this._indicesForBabylon;\r\n this._handledMesh.positions = this._unwrappedPositionsForBabylon;\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon;\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon;\r\n this._handledMesh.hasLines = this._hasLineData;\r\n if (this._loadingOptions.importVertexColors) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon;\r\n }\r\n }\r\n\r\n // If any o or g keyword not found, create a mesh with a random id\r\n if (!this._hasMeshes) {\r\n let newMaterial: Nullable<StandardMaterial> = null;\r\n if (this._indicesForBabylon.length) {\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n // reverse tab of indices\r\n this._indicesForBabylon.reverse();\r\n }\r\n\r\n //Get positions normals uvs\r\n this._unwrapData();\r\n } else {\r\n // There is no indices in the file. We will have to switch to point cloud rendering\r\n for (const pos of this._positions) {\r\n this._unwrappedPositionsForBabylon.push(pos.x, pos.y, pos.z);\r\n }\r\n\r\n if (this._normals.length) {\r\n for (const normal of this._normals) {\r\n this._unwrappedNormalsForBabylon.push(normal.x, normal.y, normal.z);\r\n }\r\n }\r\n\r\n if (this._uvs.length) {\r\n for (const uv of this._uvs) {\r\n this._unwrappedUVForBabylon.push(uv.x, uv.y);\r\n }\r\n }\r\n\r\n if (this._extColors.length) {\r\n for (const color of this._extColors) {\r\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\r\n }\r\n } else {\r\n if (this._colors.length) {\r\n for (const color of this._colors) {\r\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\r\n }\r\n }\r\n }\r\n\r\n if (!this._materialNameFromObj) {\r\n // Create a material with point cloud on\r\n newMaterial = new StandardMaterial(Geometry.RandomId(), scene);\r\n\r\n newMaterial.pointsCloud = true;\r\n\r\n this._materialNameFromObj = newMaterial.name;\r\n\r\n if (!this._normals.length) {\r\n newMaterial.disableLighting = true;\r\n newMaterial.emissiveColor = Color3.White();\r\n }\r\n }\r\n }\r\n\r\n //Set data for one mesh\r\n this._meshesFromObj.push({\r\n name: Geometry.RandomId(),\r\n indices: this._indicesForBabylon,\r\n positions: this._unwrappedPositionsForBabylon,\r\n colors: this._unwrappedColorsForBabylon,\r\n normals: this._unwrappedNormalsForBabylon,\r\n uvs: this._unwrappedUVForBabylon,\r\n materialName: this._materialNameFromObj,\r\n directMaterial: newMaterial,\r\n isObject: true,\r\n hasLines: this._hasLineData,\r\n });\r\n }\r\n\r\n //Set data for each mesh\r\n for (let j = 0; j < this._meshesFromObj.length; j++) {\r\n //check meshesNames (stlFileLoader)\r\n if (meshesNames && this._meshesFromObj[j].name) {\r\n if (meshesNames instanceof Array) {\r\n if (meshesNames.indexOf(this._meshesFromObj[j].name) === -1) {\r\n continue;\r\n }\r\n } else {\r\n if (this._meshesFromObj[j].name !== meshesNames) {\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n //Get the current mesh\r\n //Set the data with VertexBuffer for each mesh\r\n this._handledMesh = this._meshesFromObj[j];\r\n //Create a Mesh with the name of the obj mesh\r\n\r\n scene._blockEntityCollection = !!assetContainer;\r\n const babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);\r\n babylonMesh._parentContainer = assetContainer;\r\n scene._blockEntityCollection = false;\r\n this._handledMesh._babylonMesh = babylonMesh;\r\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.\r\n if (!this._handledMesh.isObject) {\r\n for (let k = j - 1; k >= 0; --k) {\r\n if (this._meshesFromObj[k].isObject && this._meshesFromObj[k]._babylonMesh) {\r\n babylonMesh.parent = this._meshesFromObj[k]._babylonMesh!;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n //Push the name of the material to an array\r\n //This is indispensable for the importMesh function\r\n this._materialToUse.push(this._meshesFromObj[j].materialName);\r\n //If the mesh is a line mesh\r\n if (this._handledMesh.hasLines) {\r\n babylonMesh._internalMetadata ??= {};\r\n babylonMesh._internalMetadata[\"_isLine\"] = true; //this is a line mesh\r\n }\r\n\r\n if (this._handledMesh.positions?.length === 0) {\r\n //Push the mesh into an array\r\n this._babylonMeshesArray.push(babylonMesh);\r\n continue;\r\n }\r\n\r\n const vertexData: VertexData = new VertexData(); //The container for the values\r\n //Set the data for the babylonMesh\r\n vertexData.uvs = this._handledMesh.uvs;\r\n vertexData.indices = this._handledMesh.indices;\r\n vertexData.positions = this._handledMesh.positions;\r\n if (this._loadingOptions.computeNormals) {\r\n const normals: Array<number> = new Array<number>();\r\n VertexData.ComputeNormals(this._handledMesh.positions, this._handledMesh.indices, normals);\r\n vertexData.normals = normals;\r\n } else {\r\n vertexData.normals = this._handledMesh.normals;\r\n }\r\n if (this._loadingOptions.importVertexColors) {\r\n vertexData.colors = this._handledMesh.colors;\r\n }\r\n //Set the data from the VertexBuffer to the current Mesh\r\n vertexData.applyToMesh(babylonMesh);\r\n if (this._loadingOptions.invertY) {\r\n babylonMesh.scaling.y *= -1;\r\n }\r\n if (this._loadingOptions.optimizeNormals) {\r\n this._optimizeNormals(babylonMesh);\r\n }\r\n\r\n //Push the mesh into an array\r\n this._babylonMeshesArray.push(babylonMesh);\r\n\r\n if (this._handledMesh.directMaterial) {\r\n babylonMesh.material = this._handledMesh.directMaterial;\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"solidParser.js","sourceRoot":"","sources":["../../../../dev/loaders/src/OBJ/solidParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAEnD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAE1D,OAAO,EAAE,QAAQ,EAAE,2CAA6B;AAChD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,UAAU,EAAE,kDAAoC;AAIzD,OAAO,EAAE,MAAM,E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D;AACpF,qDAAqD;AACvC,wBAAY,GAAG,6BAA6B,AAAhC,CAAiC;AAC3D,6EAA6E;AAC/D,wBAAY,GAAG,yCAAyC,AAA5C,CAA6C;AACvE,0FAA0F;AAC5E,wBAAY,GAAG,mDAAmD,AAAtD,CAAuD","sourcesContent":["import type { AssetContainer } from \"core/assetContainer\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { OBJLoadingOptions } from \"./objLoadingOptions\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\ntype MeshObject = {\r\n name: string;\r\n indices: Nullable<Array<number>>;\r\n positions: Nullable<Array<number>>;\r\n normals: Nullable<Array<number>>;\r\n colors: Nullable<Array<number>>;\r\n uvs: Nullable<Array<number>>;\r\n materialName: string;\r\n directMaterial?: Nullable<Material>;\r\n isObject: boolean; // If the entity is defined as an object (\"o\"), or group (\"g\")\r\n _babylonMesh?: AbstractMesh; // The corresponding Babylon mesh\r\n hasLines?: boolean; // If the mesh has lines\r\n};\r\n\r\n/**\r\n * Class used to load mesh data from OBJ content\r\n */\r\nexport class SolidParser {\r\n // Descriptor\r\n /** Object descriptor */\r\n public static ObjectDescriptor = /^o/;\r\n /** Group descriptor */\r\n public static GroupDescriptor = /^g/;\r\n /** Material lib descriptor */\r\n public static MtlLibGroupDescriptor = /^mtllib /;\r\n /** Use a material descriptor */\r\n public static UseMtlDescriptor = /^usemtl /;\r\n /** Smooth descriptor */\r\n public static SmoothDescriptor = /^s /;\r\n\r\n // Patterns\r\n /** Pattern used to detect a vertex */\r\n public static VertexPattern = /^v(\\s+[\\d|.|+|\\-|e|E]+){3,7}/;\r\n /** Pattern used to detect a normal */\r\n public static NormalPattern = /^vn(\\s+[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)/;\r\n /** Pattern used to detect a UV set */\r\n public static UVPattern = /^vt(\\s+[\\d|.|+|\\-|e|E]+)( +[\\d|.|+|\\-|e|E]+)/;\r\n /** Pattern used to detect a first kind of face (f vertex vertex vertex) */\r\n public static FacePattern1 = /^f\\s+(([\\d]{1,}[\\s]?){3,})+/;\r\n /** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */\r\n public static FacePattern2 = /^f\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */\r\n public static FacePattern3 = /^f\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/\r\n public static FacePattern4 = /^f\\s+((([\\d]{1,}\\/\\/[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */\r\n public static FacePattern5 = /^f\\s+(((-[\\d]{1,}\\/-[\\d]{1,}\\/-[\\d]{1,}[\\s]?){3,})+)/;\r\n /** Pattern used to detect a line(l vertex vertex) */\r\n public static LinePattern1 = /^l\\s+(([\\d]{1,}[\\s]?){2,})+/;\r\n /** Pattern used to detect a second kind of line (l vertex/uvs vertex/uvs) */\r\n public static LinePattern2 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\r\n /** Pattern used to detect a third kind of line (l vertex/uvs/normal vertex/uvs/normal) */\r\n public static LinePattern3 = /^l\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){2,})+)/;\r\n\r\n private _loadingOptions: OBJLoadingOptions;\r\n private _positions: Array<Vector3> = []; //values for the positions of vertices\r\n private _normals: Array<Vector3> = []; //Values for the normals\r\n private _uvs: Array<Vector2> = []; //Values for the textures\r\n private _colors: Array<Color4> = [];\r\n private _extColors: Array<Color4> = []; //Extension color\r\n private _meshesFromObj: Array<MeshObject> = []; //[mesh] Contains all the obj meshes\r\n private _handledMesh: MeshObject; //The current mesh of meshes array\r\n private _indicesForBabylon: Array<number> = []; //The list of indices for VertexData\r\n private _wrappedPositionForBabylon: Array<Vector3> = []; //The list of position in vectors\r\n private _wrappedUvsForBabylon: Array<Vector2> = []; //Array with all value of uvs to match with the indices\r\n private _wrappedColorsForBabylon: Array<Color4> = []; // Array with all color values to match with the indices\r\n private _wrappedNormalsForBabylon: Array<Vector3> = []; //Array with all value of normals to match with the indices\r\n private _tuplePosNorm: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }> = []; //Create a tuple with indice of Position, Normal, UV [pos, norm, uvs]\r\n private _curPositionInIndices = 0;\r\n private _hasMeshes: Boolean = false; //Meshes are defined in the file\r\n private _unwrappedPositionsForBabylon: Array<number> = []; //Value of positionForBabylon w/o Vector3() [x,y,z]\r\n private _unwrappedColorsForBabylon: Array<number> = []; // Value of colorForBabylon w/o Color4() [r,g,b,a]\r\n private _unwrappedNormalsForBabylon: Array<number> = []; //Value of normalsForBabylon w/o Vector3() [x,y,z]\r\n private _unwrappedUVForBabylon: Array<number> = []; //Value of uvsForBabylon w/o Vector3() [x,y,z]\r\n private _triangles: Array<string> = []; //Indices from new triangles coming from polygons\r\n private _materialNameFromObj: string = \"\"; //The name of the current material\r\n private _objMeshName: string = \"\"; //The name of the current obj mesh\r\n private _increment: number = 1; //Id for meshes created by the multimaterial\r\n private _isFirstMaterial: boolean = true;\r\n private _grayColor = new Color4(0.5, 0.5, 0.5, 1);\r\n private _materialToUse: string[];\r\n private _babylonMeshesArray: Array<Mesh>;\r\n private _pushTriangle: (faces: Array<string>, faceIndex: number) => void;\r\n private _handednessSign: number;\r\n private _hasLineData: boolean = false; //If this mesh has line segment(l) data\r\n\r\n /**\r\n * Creates a new SolidParser\r\n * @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)\r\n * @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)\r\n * @param loadingOptions defines the loading options to use\r\n */\r\n public constructor(materialToUse: string[], babylonMeshesArray: Array<Mesh>, loadingOptions: OBJLoadingOptions) {\r\n this._materialToUse = materialToUse;\r\n this._babylonMeshesArray = babylonMeshesArray;\r\n this._loadingOptions = loadingOptions;\r\n }\r\n\r\n /**\r\n * Search for obj in the given array.\r\n * This function is called to check if a couple of data already exists in an array.\r\n *\r\n * If found, returns the index of the founded tuple index. Returns -1 if not found\r\n * @param arr Array<{ normals: Array<number>, idx: Array<number> }>\r\n * @param obj Array<number>\r\n * @returns {boolean}\r\n */\r\n private _isInArray(arr: Array<{ normals: Array<number>; idx: Array<number> }>, obj: Array<number>) {\r\n if (!arr[obj[0]]) {\r\n arr[obj[0]] = { normals: [], idx: [] };\r\n }\r\n const idx = arr[obj[0]].normals.indexOf(obj[1]);\r\n\r\n return idx === -1 ? -1 : arr[obj[0]].idx[idx];\r\n }\r\n\r\n private _isInArrayUV(arr: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }>, obj: Array<number>) {\r\n if (!arr[obj[0]]) {\r\n arr[obj[0]] = { normals: [], idx: [], uv: [] };\r\n }\r\n const idx = arr[obj[0]].normals.indexOf(obj[1]);\r\n\r\n if (idx != 1 && obj[2] === arr[obj[0]].uv[idx]) {\r\n return arr[obj[0]].idx[idx];\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * This function set the data for each triangle.\r\n * Data are position, normals and uvs\r\n * If a tuple of (position, normal) is not set, add the data into the corresponding array\r\n * If the tuple already exist, add only their indice\r\n *\r\n * @param indicePositionFromObj Integer The index in positions array\r\n * @param indiceUvsFromObj Integer The index in uvs array\r\n * @param indiceNormalFromObj Integer The index in normals array\r\n * @param positionVectorFromOBJ Vector3 The value of position at index objIndice\r\n * @param textureVectorFromOBJ Vector3 The value of uvs\r\n * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale\r\n * @param positionColorsFromOBJ\r\n */\r\n private _setData(\r\n indicePositionFromObj: number,\r\n indiceUvsFromObj: number,\r\n indiceNormalFromObj: number,\r\n positionVectorFromOBJ: Vector3,\r\n textureVectorFromOBJ: Vector2,\r\n normalsVectorFromOBJ: Vector3,\r\n positionColorsFromOBJ?: Color4\r\n ) {\r\n //Check if this tuple already exists in the list of tuples\r\n let _index: number;\r\n if (this._loadingOptions.optimizeWithUV) {\r\n _index = this._isInArrayUV(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj, indiceUvsFromObj]);\r\n } else {\r\n _index = this._isInArray(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj]);\r\n }\r\n\r\n //If it not exists\r\n if (_index === -1) {\r\n //Add an new indice.\r\n //The array of indices is only an array with his length equal to the number of triangles - 1.\r\n //We add vertices data in this order\r\n this._indicesForBabylon.push(this._wrappedPositionForBabylon.length);\r\n //Push the position of vertice for Babylon\r\n //Each element is a Vector3(x,y,z)\r\n this._wrappedPositionForBabylon.push(positionVectorFromOBJ);\r\n //Push the uvs for Babylon\r\n //Each element is a Vector2(u,v)\r\n //If the UVs are missing, set (u,v)=(0,0)\r\n textureVectorFromOBJ = textureVectorFromOBJ ?? new Vector2(0, 0);\r\n this._wrappedUvsForBabylon.push(textureVectorFromOBJ);\r\n //Push the normals for Babylon\r\n //Each element is a Vector3(x,y,z)\r\n this._wrappedNormalsForBabylon.push(normalsVectorFromOBJ);\r\n\r\n if (positionColorsFromOBJ !== undefined) {\r\n //Push the colors for Babylon\r\n //Each element is a BABYLON.Color4(r,g,b,a)\r\n this._wrappedColorsForBabylon.push(positionColorsFromOBJ);\r\n }\r\n\r\n //Add the tuple in the comparison list\r\n this._tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);\r\n this._tuplePosNorm[indicePositionFromObj].idx.push(this._curPositionInIndices++);\r\n if (this._loadingOptions.optimizeWithUV) {\r\n this._tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj);\r\n }\r\n } else {\r\n //The tuple already exists\r\n //Add the index of the already existing tuple\r\n //At this index we can get the value of position, normal, color and uvs of vertex\r\n this._indicesForBabylon.push(_index);\r\n }\r\n }\r\n\r\n /**\r\n * Transform Vector() and BABYLON.Color() objects into numbers in an array\r\n */\r\n private _unwrapData() {\r\n try {\r\n //Every array has the same length\r\n for (let l = 0; l < this._wrappedPositionForBabylon.length; l++) {\r\n //Push the x, y, z values of each element in the unwrapped array\r\n this._unwrappedPositionsForBabylon.push(\r\n this._wrappedPositionForBabylon[l].x * this._handednessSign,\r\n this._wrappedPositionForBabylon[l].y,\r\n this._wrappedPositionForBabylon[l].z\r\n );\r\n this._unwrappedNormalsForBabylon.push(\r\n this._wrappedNormalsForBabylon[l].x * this._handednessSign,\r\n this._wrappedNormalsForBabylon[l].y,\r\n this._wrappedNormalsForBabylon[l].z\r\n );\r\n\r\n this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON\r\n if (this._loadingOptions.importVertexColors) {\r\n //Push the r, g, b, a values of each element in the unwrapped array\r\n this._unwrappedColorsForBabylon.push(\r\n this._wrappedColorsForBabylon[l].r,\r\n this._wrappedColorsForBabylon[l].g,\r\n this._wrappedColorsForBabylon[l].b,\r\n this._wrappedColorsForBabylon[l].a\r\n );\r\n }\r\n }\r\n // Reset arrays for the next new meshes\r\n this._wrappedPositionForBabylon.length = 0;\r\n this._wrappedNormalsForBabylon.length = 0;\r\n this._wrappedUvsForBabylon.length = 0;\r\n this._wrappedColorsForBabylon.length = 0;\r\n this._tuplePosNorm.length = 0;\r\n this._curPositionInIndices = 0;\r\n } catch (e) {\r\n throw new Error(\"Unable to unwrap data while parsing OBJ data.\");\r\n }\r\n }\r\n\r\n /**\r\n * Create triangles from polygons\r\n * It is important to notice that a triangle is a polygon\r\n * We get 5 patterns of face defined in OBJ File :\r\n * facePattern1 = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]\r\n * facePattern2 = [\"1/1\",\"2/2\",\"3/3\",\"4/4\",\"5/5\",\"6/6\"]\r\n * facePattern3 = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"4/4/4\",\"5/5/5\",\"6/6/6\"]\r\n * facePattern4 = [\"1//1\",\"2//2\",\"3//3\",\"4//4\",\"5//5\",\"6//6\"]\r\n * facePattern5 = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-4/-4/-4\",\"-5/-5/-5\",\"-6/-6/-6\"]\r\n * Each pattern is divided by the same method\r\n * @param faces Array[String] The indices of elements\r\n * @param v Integer The variable to increment\r\n */\r\n private _getTriangles(faces: Array<string>, v: number) {\r\n //Work for each element of the array\r\n for (let faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {\r\n //Add on the triangle variable the indexes to obtain triangles\r\n this._pushTriangle(faces, faceIndex);\r\n }\r\n\r\n //Result obtained after 2 iterations:\r\n //Pattern1 => triangle = [\"1\",\"2\",\"3\",\"1\",\"3\",\"4\"];\r\n //Pattern2 => triangle = [\"1/1\",\"2/2\",\"3/3\",\"1/1\",\"3/3\",\"4/4\"];\r\n //Pattern3 => triangle = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"1/1/1\",\"3/3/3\",\"4/4/4\"];\r\n //Pattern4 => triangle = [\"1//1\",\"2//2\",\"3//3\",\"1//1\",\"3//3\",\"4//4\"];\r\n //Pattern5 => triangle = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-1/-1/-1\",\"-3/-3/-3\",\"-4/-4/-4\"];\r\n }\r\n\r\n /**\r\n * To get color between color and extension color\r\n * @param index Integer The index of the element in the array\r\n * @returns value of target color\r\n */\r\n private _getColor(index: number) {\r\n if (this._loadingOptions.importVertexColors) {\r\n return this._extColors[index] ?? this._colors[index];\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 1\r\n * In this pattern we get vertice positions\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern1(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n //For each element in the triangles array.\r\n //This var could contains 1 to an infinity of triangles\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n // Set position indice\r\n const indicePositionFromObj = parseInt(this._triangles[k]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n 0,\r\n 0, // In the pattern 1, normals and uvs are not defined\r\n this._positions[indicePositionFromObj], // Get the vectors data\r\n Vector2.Zero(),\r\n Vector3.Up(), // Create default vectors\r\n this._getColor(indicePositionFromObj)\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 2\r\n * In this pattern we get vertice positions and uvs\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern2(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1/1\"\r\n //Split the data for getting position and uv\r\n const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\"]\r\n //Set position indice\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n //Set uv indice\r\n const indiceUvsFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n 0, //Default value for normals\r\n this._positions[indicePositionFromObj], //Get the values for each element\r\n this._uvs[indiceUvsFromObj] ?? Vector2.Zero(),\r\n Vector3.Up(), //Default value for normals\r\n this._getColor(indicePositionFromObj)\r\n );\r\n }\r\n\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 3\r\n * In this pattern we get vertice positions, uvs and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern3(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1/1/1\"\r\n //Split the data for getting position, uv, and normals\r\n const point = this._triangles[k].split(\"/\"); // [\"1\", \"1\", \"1\"]\r\n // Set position indice\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n // Set uv indice\r\n const indiceUvsFromObj = parseInt(point[1]) - 1;\r\n // Set normal indice\r\n const indiceNormalFromObj = parseInt(point[2]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n indiceNormalFromObj,\r\n this._positions[indicePositionFromObj],\r\n this._uvs[indiceUvsFromObj] ?? Vector2.Zero(),\r\n this._normals[indiceNormalFromObj] ?? Vector3.Up() //Set the vector for each component\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n /**\r\n * Create triangles and push the data for each polygon for the pattern 4\r\n * In this pattern we get vertice positions and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern4(face: Array<string>, v: number) {\r\n this._getTriangles(face, v);\r\n\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"1//1\"\r\n //Split the data for getting position and normals\r\n const point = this._triangles[k].split(\"//\"); // [\"1\", \"1\"]\r\n // We check indices, and normals\r\n const indicePositionFromObj = parseInt(point[0]) - 1;\r\n const indiceNormalFromObj = parseInt(point[1]) - 1;\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n 1, //Default value for uv\r\n indiceNormalFromObj,\r\n this._positions[indicePositionFromObj], //Get each vector of data\r\n Vector2.Zero(),\r\n this._normals[indiceNormalFromObj],\r\n this._getColor(indicePositionFromObj)\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n /*\r\n * Create triangles and push the data for each polygon for the pattern 3\r\n * In this pattern we get vertice positions, uvs and normals\r\n * @param face\r\n * @param v\r\n */\r\n private _setDataForCurrentFaceWithPattern5(face: Array<string>, v: number) {\r\n //Get the indices of triangles for each polygon\r\n this._getTriangles(face, v);\r\n\r\n for (let k = 0; k < this._triangles.length; k++) {\r\n //triangle[k] = \"-1/-1/-1\"\r\n //Split the data for getting position, uv, and normals\r\n const point = this._triangles[k].split(\"/\"); // [\"-1\", \"-1\", \"-1\"]\r\n // Set position indice\r\n const indicePositionFromObj = this._positions.length + parseInt(point[0]);\r\n // Set uv indice\r\n const indiceUvsFromObj = this._uvs.length + parseInt(point[1]);\r\n // Set normal indice\r\n const indiceNormalFromObj = this._normals.length + parseInt(point[2]);\r\n\r\n this._setData(\r\n indicePositionFromObj,\r\n indiceUvsFromObj,\r\n indiceNormalFromObj,\r\n this._positions[indicePositionFromObj],\r\n this._uvs[indiceUvsFromObj],\r\n this._normals[indiceNormalFromObj], //Set the vector for each component\r\n this._getColor(indicePositionFromObj)\r\n );\r\n }\r\n //Reset variable for the next line\r\n this._triangles.length = 0;\r\n }\r\n\r\n private _addPreviousObjMesh() {\r\n //Check if it is not the first mesh. Otherwise we don't have data.\r\n if (this._meshesFromObj.length > 0) {\r\n //Get the previous mesh for applying the data about the faces\r\n //=> in obj file, faces definition append after the name of the mesh\r\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\r\n\r\n //Set the data into Array for the mesh\r\n this._unwrapData();\r\n\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n // Reverse tab. Otherwise face are displayed in the wrong sens\r\n this._indicesForBabylon.reverse();\r\n }\r\n\r\n //Set the information for the mesh\r\n //Slice the array to avoid rewriting because of the fact this is the same var which be rewrited\r\n this._handledMesh.indices = this._indicesForBabylon.slice();\r\n this._handledMesh.positions = this._unwrappedPositionsForBabylon.slice();\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();\r\n this._handledMesh.hasLines = this._hasLineData;\r\n\r\n if (this._loadingOptions.importVertexColors) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();\r\n }\r\n\r\n //Reset the array for the next mesh\r\n this._indicesForBabylon.length = 0;\r\n this._unwrappedPositionsForBabylon.length = 0;\r\n this._unwrappedColorsForBabylon.length = 0;\r\n this._unwrappedNormalsForBabylon.length = 0;\r\n this._unwrappedUVForBabylon.length = 0;\r\n this._hasLineData = false;\r\n }\r\n }\r\n\r\n private _optimizeNormals(mesh: AbstractMesh): void {\r\n const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n const normals = mesh.getVerticesData(VertexBuffer.NormalKind);\r\n const mapVertices: { [key: string]: number[] } = {};\r\n\r\n if (!positions || !normals) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < positions.length / 3; i++) {\r\n const x = positions[i * 3 + 0];\r\n const y = positions[i * 3 + 1];\r\n const z = positions[i * 3 + 2];\r\n const key = x + \"_\" + y + \"_\" + z;\r\n\r\n let lst = mapVertices[key];\r\n if (!lst) {\r\n lst = [];\r\n mapVertices[key] = lst;\r\n }\r\n lst.push(i);\r\n }\r\n\r\n const normal = new Vector3();\r\n for (const key in mapVertices) {\r\n const lst = mapVertices[key];\r\n if (lst.length < 2) {\r\n continue;\r\n }\r\n\r\n const v0Idx = lst[0];\r\n for (let i = 1; i < lst.length; ++i) {\r\n const vIdx = lst[i];\r\n normals[v0Idx * 3 + 0] += normals[vIdx * 3 + 0];\r\n normals[v0Idx * 3 + 1] += normals[vIdx * 3 + 1];\r\n normals[v0Idx * 3 + 2] += normals[vIdx * 3 + 2];\r\n }\r\n\r\n normal.copyFromFloats(normals[v0Idx * 3 + 0], normals[v0Idx * 3 + 1], normals[v0Idx * 3 + 2]);\r\n normal.normalize();\r\n\r\n for (let i = 0; i < lst.length; ++i) {\r\n const vIdx = lst[i];\r\n normals[vIdx * 3 + 0] = normal.x;\r\n normals[vIdx * 3 + 1] = normal.y;\r\n normals[vIdx * 3 + 2] = normal.z;\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normals);\r\n }\r\n\r\n private static _IsLineElement(line: string) {\r\n return line.startsWith(\"l\");\r\n }\r\n\r\n private static _IsObjectElement(line: string) {\r\n return line.startsWith(\"o\");\r\n }\r\n\r\n private static _IsGroupElement(line: string) {\r\n return line.startsWith(\"g\");\r\n }\r\n\r\n private static _GetZbrushMRGB(line: string, notParse: boolean) {\r\n if (!line.startsWith(\"mrgb\")) return null;\r\n line = line.replace(\"mrgb\", \"\").trim();\r\n // if include vertex color , not load mrgb anymore\r\n if (notParse) return [];\r\n const regex = /[a-z0-9]/g;\r\n const regArray = line.match(regex);\r\n if (!regArray || regArray.length % 8 !== 0) {\r\n return [];\r\n }\r\n const array: Color4[] = [];\r\n for (let regIndex = 0; regIndex < regArray.length / 8; regIndex++) {\r\n //each item is MMRRGGBB, m is material index\r\n // const m = regArray[regIndex * 8 + 0] + regArray[regIndex * 8 + 1];\r\n const r = regArray[regIndex * 8 + 2] + regArray[regIndex * 8 + 3];\r\n const g = regArray[regIndex * 8 + 4] + regArray[regIndex * 8 + 5];\r\n const b = regArray[regIndex * 8 + 6] + regArray[regIndex * 8 + 7];\r\n array.push(new Color4(parseInt(r, 16) / 255, parseInt(g, 16) / 255, parseInt(b, 16) / 255, 1));\r\n }\r\n return array;\r\n }\r\n\r\n /**\r\n * Function used to parse an OBJ string\r\n * @param meshesNames defines the list of meshes to load (all if not defined)\r\n * @param data defines the OBJ string\r\n * @param scene defines the hosting scene\r\n * @param assetContainer defines the asset container to load data in\r\n * @param onFileToLoadFound defines a callback that will be called if a MTL file is found\r\n */\r\n public parse(meshesNames: any, data: string, scene: Scene, assetContainer: Nullable<AssetContainer>, onFileToLoadFound: (fileToLoad: string) => void): void {\r\n //Move Santitize here to forbid delete zbrush data\r\n // Sanitize data\r\n data = data.replace(/#MRGB/g, \"mrgb\");\r\n data = data.replace(/#.*$/gm, \"\").trim();\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n this._handednessSign = 1;\r\n } else if (scene.useRightHandedSystem) {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex + 1], faces[faceIndex]);\r\n this._handednessSign = 1;\r\n } else {\r\n this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\r\n this._handednessSign = -1;\r\n }\r\n\r\n // Split the file into lines\r\n // Preprocess line data\r\n const linesOBJ = data.split(\"\\n\");\r\n const lineLines: string[][] = [];\r\n let currentGroup: string[] = [];\r\n\r\n lineLines.push(currentGroup);\r\n\r\n for (let i = 0; i < linesOBJ.length; i++) {\r\n const line = linesOBJ[i].trim().replace(/\\s\\s/g, \" \");\r\n\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n }\r\n\r\n if (SolidParser._IsGroupElement(line) || SolidParser._IsObjectElement(line)) {\r\n currentGroup = [];\r\n lineLines.push(currentGroup);\r\n }\r\n\r\n if (SolidParser._IsLineElement(line)) {\r\n const lineValues = line.split(\" \");\r\n // create line elements with two vertices only\r\n for (let i = 1; i < lineValues.length - 1; i++) {\r\n currentGroup.push(`l ${lineValues[i]} ${lineValues[i + 1]}`);\r\n }\r\n } else {\r\n currentGroup.push(line);\r\n }\r\n }\r\n\r\n const lines = lineLines.flat();\r\n // Look at each line\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i].trim().replace(/\\s\\s/g, \" \");\r\n let result;\r\n // Comment or newLine\r\n if (line.length === 0 || line.charAt(0) === \"#\") {\r\n continue;\r\n } else if (SolidParser.VertexPattern.test(line)) {\r\n //Get information about one position possible for the vertices\r\n result = line.match(/[^ ]+/g)!; // match will return non-null due to passing regex pattern\r\n\r\n // Value of result with line: \"v 1.0 2.0 3.0\"\r\n // [\"v\", \"1.0\", \"2.0\", \"3.0\"]\r\n // Create a Vector3 with the position x, y, z\r\n this._positions.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\r\n\r\n if (this._loadingOptions.importVertexColors) {\r\n if (result.length >= 7) {\r\n const r = parseFloat(result[4]);\r\n const g = parseFloat(result[5]);\r\n const b = parseFloat(result[6]);\r\n\r\n this._colors.push(\r\n 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]))\r\n );\r\n } else {\r\n // TODO: maybe push NULL and if all are NULL to skip (and remove grayColor var).\r\n this._colors.push(this._grayColor);\r\n }\r\n }\r\n } else if ((result = SolidParser.NormalPattern.exec(line)) !== null) {\r\n //Create a Vector3 with the normals x, y, z\r\n //Value of result\r\n // [\"vn 1.0 2.0 3.0\", \"1.0\", \"2.0\", \"3.0\"]\r\n //Add the Vector in the list of normals\r\n this._normals.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));\r\n } else if ((result = SolidParser.UVPattern.exec(line)) !== null) {\r\n //Create a Vector2 with the normals u, v\r\n //Value of result\r\n // [\"vt 0.1 0.2 0.3\", \"0.1\", \"0.2\"]\r\n //Add the Vector in the list of uvs\r\n this._uvs.push(new Vector2(parseFloat(result[1]) * this._loadingOptions.UVScaling.x, parseFloat(result[2]) * this._loadingOptions.UVScaling.y));\r\n\r\n //Identify patterns of faces\r\n //Face could be defined in different type of pattern\r\n } else if ((result = SolidParser.FacePattern3.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1/1/1 2/2/2 3/3/3\", \"1/1/1 2/2/2 3/3/3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern3(\r\n result[1].trim().split(\" \"), // [\"1/1/1\", \"2/2/2\", \"3/3/3\"]\r\n 1\r\n );\r\n } else if ((result = SolidParser.FacePattern4.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1//1 2//2 3//3\", \"1//1 2//2 3//3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern4(\r\n result[1].trim().split(\" \"), // [\"1//1\", \"2//2\", \"3//3\"]\r\n 1\r\n );\r\n } else if ((result = SolidParser.FacePattern5.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f -1/-1/-1 -2/-2/-2 -3/-3/-3\", \"-1/-1/-1 -2/-2/-2 -3/-3/-3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern5(\r\n result[1].trim().split(\" \"), // [\"-1/-1/-1\", \"-2/-2/-2\", \"-3/-3/-3\"]\r\n 1\r\n );\r\n } else if ((result = SolidParser.FacePattern2.exec(line)) !== null) {\r\n //Value of result:\r\n //[\"f 1/1 2/2 3/3\", \"1/1 2/2 3/3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern2(\r\n result[1].trim().split(\" \"), // [\"1/1\", \"2/2\", \"3/3\"]\r\n 1\r\n );\r\n } else if ((result = SolidParser.FacePattern1.exec(line)) !== null) {\r\n //Value of result\r\n //[\"f 1 2 3\", \"1 2 3\"...]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern1(\r\n result[1].trim().split(\" \"), // [\"1\", \"2\", \"3\"]\r\n 1\r\n );\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser.LinePattern1.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1 2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern1(\r\n result[1].trim().split(\" \"), // [\"1\", \"2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser.LinePattern2.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1/1 2/2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern2(\r\n result[1].trim().split(\" \"), // [\"1/1\", \"2/2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if ((result = SolidParser._GetZbrushMRGB(line, !this._loadingOptions.importVertexColors))) {\r\n result.forEach((element) => {\r\n this._extColors.push(element);\r\n });\r\n } else if ((result = SolidParser.LinePattern3.exec(line)) !== null) {\r\n //Value of result\r\n //[\"l 1/1/1 2/2/2\"]\r\n\r\n //Set the data for this face\r\n this._setDataForCurrentFaceWithPattern3(\r\n result[1].trim().split(\" \"), // [\"1/1/1\", \"2/2/2\"]\r\n 0\r\n );\r\n this._hasLineData = true;\r\n\r\n // Define a mesh or an object\r\n // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh\r\n } else if (SolidParser.GroupDescriptor.test(line) || SolidParser.ObjectDescriptor.test(line)) {\r\n // Create a new mesh corresponding to the name of the group.\r\n // Definition of the mesh\r\n const objMesh: MeshObject = {\r\n name: line.substring(2).trim(), //Set the name of the current obj mesh\r\n indices: null,\r\n positions: null,\r\n normals: null,\r\n uvs: null,\r\n colors: null,\r\n materialName: this._materialNameFromObj,\r\n isObject: SolidParser.ObjectDescriptor.test(line),\r\n };\r\n this._addPreviousObjMesh();\r\n\r\n //Push the last mesh created with only the name\r\n this._meshesFromObj.push(objMesh);\r\n\r\n //Set this variable to indicate that now meshesFromObj has objects defined inside\r\n this._hasMeshes = true;\r\n this._isFirstMaterial = true;\r\n this._increment = 1;\r\n //Keyword for applying a material\r\n } else if (SolidParser.UseMtlDescriptor.test(line)) {\r\n //Get the name of the material\r\n this._materialNameFromObj = line.substring(7).trim();\r\n\r\n //If this new material is in the same mesh\r\n\r\n if (!this._isFirstMaterial || !this._hasMeshes) {\r\n //Set the data for the previous mesh\r\n this._addPreviousObjMesh();\r\n //Create a new mesh\r\n const objMesh: MeshObject =\r\n //Set the name of the current obj mesh\r\n {\r\n name: (this._objMeshName || \"mesh\") + \"_mm\" + this._increment.toString(), //Set the name of the current obj mesh\r\n indices: null,\r\n positions: null,\r\n normals: null,\r\n uvs: null,\r\n colors: null,\r\n materialName: this._materialNameFromObj,\r\n isObject: false,\r\n };\r\n this._increment++;\r\n //If meshes are already defined\r\n this._meshesFromObj.push(objMesh);\r\n this._hasMeshes = true;\r\n }\r\n //Set the material name if the previous line define a mesh\r\n\r\n if (this._hasMeshes && this._isFirstMaterial) {\r\n //Set the material name to the previous mesh (1 material per mesh)\r\n this._meshesFromObj[this._meshesFromObj.length - 1].materialName = this._materialNameFromObj;\r\n this._isFirstMaterial = false;\r\n }\r\n // Keyword for loading the mtl file\r\n } else if (SolidParser.MtlLibGroupDescriptor.test(line)) {\r\n // Get the name of mtl file\r\n onFileToLoadFound(line.substring(7).trim());\r\n\r\n // Apply smoothing\r\n } else if (SolidParser.SmoothDescriptor.test(line)) {\r\n // smooth shading => apply smoothing\r\n // Today I don't know it work with babylon and with obj.\r\n // With the obj file an integer is set\r\n } else {\r\n //If there is another possibility\r\n Logger.Log(\"Unhandled expression at line : \" + line);\r\n }\r\n }\r\n // At the end of the file, add the last mesh into the meshesFromObj array\r\n if (this._hasMeshes) {\r\n // Set the data for the last mesh\r\n this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];\r\n\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n //Reverse indices for displaying faces in the good sense\r\n this._indicesForBabylon.reverse();\r\n }\r\n\r\n //Get the good array\r\n this._unwrapData();\r\n //Set array\r\n this._handledMesh.indices = this._indicesForBabylon;\r\n this._handledMesh.positions = this._unwrappedPositionsForBabylon;\r\n this._handledMesh.normals = this._unwrappedNormalsForBabylon;\r\n this._handledMesh.uvs = this._unwrappedUVForBabylon;\r\n this._handledMesh.hasLines = this._hasLineData;\r\n if (this._loadingOptions.importVertexColors) {\r\n this._handledMesh.colors = this._unwrappedColorsForBabylon;\r\n }\r\n }\r\n\r\n // If any o or g keyword not found, create a mesh with a random id\r\n if (!this._hasMeshes) {\r\n let newMaterial: Nullable<StandardMaterial> = null;\r\n if (this._indicesForBabylon.length) {\r\n if (this._loadingOptions.useLegacyBehavior) {\r\n // reverse tab of indices\r\n this._indicesForBabylon.reverse();\r\n }\r\n\r\n //Get positions normals uvs\r\n this._unwrapData();\r\n } else {\r\n // There is no indices in the file. We will have to switch to point cloud rendering\r\n for (const pos of this._positions) {\r\n this._unwrappedPositionsForBabylon.push(pos.x, pos.y, pos.z);\r\n }\r\n\r\n if (this._normals.length) {\r\n for (const normal of this._normals) {\r\n this._unwrappedNormalsForBabylon.push(normal.x, normal.y, normal.z);\r\n }\r\n }\r\n\r\n if (this._uvs.length) {\r\n for (const uv of this._uvs) {\r\n this._unwrappedUVForBabylon.push(uv.x, uv.y);\r\n }\r\n }\r\n\r\n if (this._extColors.length) {\r\n for (const color of this._extColors) {\r\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\r\n }\r\n } else {\r\n if (this._colors.length) {\r\n for (const color of this._colors) {\r\n this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);\r\n }\r\n }\r\n }\r\n\r\n if (!this._materialNameFromObj) {\r\n // Create a material with point cloud on\r\n newMaterial = new StandardMaterial(Geometry.RandomId(), scene);\r\n\r\n newMaterial.pointsCloud = true;\r\n\r\n this._materialNameFromObj = newMaterial.name;\r\n\r\n if (!this._normals.length) {\r\n newMaterial.disableLighting = true;\r\n newMaterial.emissiveColor = Color3.White();\r\n }\r\n }\r\n }\r\n\r\n //Set data for one mesh\r\n this._meshesFromObj.push({\r\n name: Geometry.RandomId(),\r\n indices: this._indicesForBabylon,\r\n positions: this._unwrappedPositionsForBabylon,\r\n colors: this._unwrappedColorsForBabylon,\r\n normals: this._unwrappedNormalsForBabylon,\r\n uvs: this._unwrappedUVForBabylon,\r\n materialName: this._materialNameFromObj,\r\n directMaterial: newMaterial,\r\n isObject: true,\r\n hasLines: this._hasLineData,\r\n });\r\n }\r\n\r\n //Set data for each mesh\r\n for (let j = 0; j < this._meshesFromObj.length; j++) {\r\n //check meshesNames (stlFileLoader)\r\n if (meshesNames && this._meshesFromObj[j].name) {\r\n if (meshesNames instanceof Array) {\r\n if (meshesNames.indexOf(this._meshesFromObj[j].name) === -1) {\r\n continue;\r\n }\r\n } else {\r\n if (this._meshesFromObj[j].name !== meshesNames) {\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n //Get the current mesh\r\n //Set the data with VertexBuffer for each mesh\r\n this._handledMesh = this._meshesFromObj[j];\r\n //Create a Mesh with the name of the obj mesh\r\n\r\n scene._blockEntityCollection = !!assetContainer;\r\n const babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);\r\n babylonMesh._parentContainer = assetContainer;\r\n scene._blockEntityCollection = false;\r\n this._handledMesh._babylonMesh = babylonMesh;\r\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.\r\n if (!this._handledMesh.isObject) {\r\n for (let k = j - 1; k >= 0; --k) {\r\n if (this._meshesFromObj[k].isObject && this._meshesFromObj[k]._babylonMesh) {\r\n babylonMesh.parent = this._meshesFromObj[k]._babylonMesh!;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n //Push the name of the material to an array\r\n //This is indispensable for the importMesh function\r\n this._materialToUse.push(this._meshesFromObj[j].materialName);\r\n //If the mesh is a line mesh\r\n if (this._handledMesh.hasLines) {\r\n babylonMesh._internalMetadata ??= {};\r\n babylonMesh._internalMetadata[\"_isLine\"] = true; //this is a line mesh\r\n }\r\n\r\n if (this._handledMesh.positions?.length === 0) {\r\n //Push the mesh into an array\r\n this._babylonMeshesArray.push(babylonMesh);\r\n continue;\r\n }\r\n\r\n const vertexData: VertexData = new VertexData(); //The container for the values\r\n //Set the data for the babylonMesh\r\n vertexData.uvs = this._handledMesh.uvs;\r\n vertexData.indices = this._handledMesh.indices;\r\n vertexData.positions = this._handledMesh.positions;\r\n if (this._loadingOptions.computeNormals) {\r\n const normals: Array<number> = new Array<number>();\r\n VertexData.ComputeNormals(this._handledMesh.positions, this._handledMesh.indices, normals);\r\n vertexData.normals = normals;\r\n } else {\r\n vertexData.normals = this._handledMesh.normals;\r\n }\r\n if (this._loadingOptions.importVertexColors) {\r\n vertexData.colors = this._handledMesh.colors;\r\n }\r\n //Set the data from the VertexBuffer to the current Mesh\r\n vertexData.applyToMesh(babylonMesh);\r\n if (this._loadingOptions.invertY) {\r\n babylonMesh.scaling.y *= -1;\r\n }\r\n if (this._loadingOptions.optimizeNormals) {\r\n this._optimizeNormals(babylonMesh);\r\n }\r\n\r\n //Push the mesh into an array\r\n this._babylonMeshesArray.push(babylonMesh);\r\n\r\n if (this._handledMesh.directMaterial) {\r\n babylonMesh.material = this._handledMesh.directMaterial;\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"splatFileLoader.js","sourceRoot":"","sources":["../../../../dev/loaders/src/SPLAT/splatFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,+CAAiC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,0EAA4D;AAC5F,OAAO,EAAE,cAAc,EAAE,0CAA4B;AAIrD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAC1C,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,iBAAiB,EAAE,uDAAyC;AACrE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,UAAU,EAAE,kDAAoC;AAazD;;GAEG;AACH,IAAW,IAIV;AAJD,WAAW,IAAI;IACX,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QAAQ,EAAE,QAAQ,CAAC,CAAC;YACpF,KAAK,IAAI,aAAa,GAAG,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE;gBAClF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;gBACjD,IAAI,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;oBACzC,aAAa,EAAE,CAAC;iBACnB;gBACD,IAAI,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;oBAC9C,kBAAkB,EAAE,CAAC;iBACxB;aACJ;YACD,MAAM,sBAAsB,GAAG,aAAa,IAAI,eAAe,CAAC,MAAM,IAAI,kBAAkB,IAAI,CAAC,CAAC;YAClG,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,mBAAW,CAAC,CAAC,sBAAsB,CAAC,CAAC,oBAAY,CAAC,wBAAgB,CAAC;YAClG,2CAA2C;YAC3C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC;YACtG,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;;AArUuB,sCAAsB,GAAG;IAC7C,SAAS,EAAE,KAAK;CACoB,AAFM,CAEL;AAsU7C,2CAA2C;AAC3C,yBAAyB,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC","sourcesContent":["import type { ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, ISceneLoaderAsyncResult, ISceneLoaderProgressEvent, SceneLoaderPluginOptions } from \"core/Loading/sceneLoader\";\r\nimport { registerSceneLoaderPlugin } from \"core/Loading/sceneLoader\";\r\nimport { SPLATFileLoaderMetadata } from \"./splatFileLoader.metadata\";\r\nimport { GaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh\";\r\nimport { AssetContainer } from \"core/assetContainer\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { PointsCloudSystem } from \"core/Particles/pointsCloudSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { SPLATLoadingOptions } from \"./splatLoadingOptions\";\r\n\r\ndeclare module \"core/Loading/sceneLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface SceneLoaderPluginOptions {\r\n /**\r\n * Defines options for the splat loader.\r\n */\r\n [SPLATFileLoaderMetadata.name]: Partial<SPLATLoadingOptions>;\r\n }\r\n}\r\n\r\n/**\r\n * Indicator of the parsed ply buffer. A standard ready to use splat or an array of positions for a point cloud\r\n */\r\nconst enum Mode {\r\n Splat = 0,\r\n PointCloud = 1,\r\n Mesh = 2,\r\n}\r\n\r\n/**\r\n * A parsed buffer and how to use it\r\n */\r\ninterface ParsedPLY {\r\n data: ArrayBuffer;\r\n mode: Mode;\r\n faces?: number[];\r\n hasVertexColors?: boolean;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * SPLAT file type loader.\r\n * This is a babylon scene loader plugin.\r\n */\r\nexport class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\r\n /**\r\n * Defines the name of the plugin.\r\n */\r\n public readonly name = SPLATFileLoaderMetadata.name;\r\n\r\n private _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n private readonly _loadingOptions: Readonly<SPLATLoadingOptions>;\r\n /**\r\n * Defines the extensions the splat loader is able to load.\r\n * force data to come in as an ArrayBuffer\r\n */\r\n public readonly extensions = SPLATFileLoaderMetadata.extensions;\r\n\r\n /**\r\n * Creates loader for gaussian splatting files\r\n * @param loadingOptions options for loading and parsing splat and PLY files.\r\n */\r\n constructor(loadingOptions: Partial<Readonly<SPLATLoadingOptions>> = SPLATFileLoader._DefaultLoadingOptions) {\r\n this._loadingOptions = loadingOptions;\r\n }\r\n\r\n private static readonly _DefaultLoadingOptions = {\r\n keepInRam: false,\r\n } as const satisfies SPLATLoadingOptions;\r\n\r\n /** @internal */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync {\r\n return new SPLATFileLoader(options[SPLATFileLoaderMetadata.name]);\r\n }\r\n\r\n /**\r\n * Imports from the loaded gaussian splatting data and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param data the gaussian splatting data to load\r\n * @param rootUrl root url to load from\r\n * @param onProgress callback called while file is loading\r\n * @param fileName Defines the name of the file to load\r\n * @returns a promise containing the loaded meshes, particles, skeletons and animations\r\n */\r\n public async importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n data: any,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName?: string\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return this._parse(meshesNames, scene, data, rootUrl).then((meshes) => {\r\n return {\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: [],\r\n animationGroups: [],\r\n transformNodes: [],\r\n geometries: [],\r\n lights: [],\r\n spriteManagers: [],\r\n };\r\n });\r\n }\r\n\r\n private static _BuildPointCloud(pointcloud: PointsCloudSystem, data: ArrayBuffer): boolean {\r\n if (!data.byteLength) {\r\n return false;\r\n }\r\n const uBuffer = new Uint8Array(data);\r\n const fBuffer = new Float32Array(data);\r\n\r\n // parsed array contains room for position(3floats), normal(3floats), color (4b), quantized quaternion (4b)\r\n const rowLength = 3 * 4 + 3 * 4 + 4 + 4;\r\n const vertexCount = uBuffer.length / rowLength;\r\n\r\n const pointcloudfunc = function (particle: any, i: number) {\r\n const x = fBuffer[8 * i + 0];\r\n const y = fBuffer[8 * i + 1];\r\n const z = fBuffer[8 * i + 2];\r\n particle.position = new Vector3(x, y, z);\r\n\r\n const r = uBuffer[rowLength * i + 24 + 0] / 255;\r\n const g = uBuffer[rowLength * i + 24 + 1] / 255;\r\n const b = uBuffer[rowLength * i + 24 + 2] / 255;\r\n particle.color = new Color4(r, g, b, 1);\r\n };\r\n\r\n pointcloud.addPoints(vertexCount, pointcloudfunc);\r\n return true;\r\n }\r\n\r\n private static _BuildMesh(scene: Scene, parsedPLY: ParsedPLY): Mesh {\r\n const mesh = new Mesh(\"PLYMesh\", scene);\r\n\r\n const uBuffer = new Uint8Array(parsedPLY.data);\r\n const fBuffer = new Float32Array(parsedPLY.data);\r\n\r\n const rowLength = 3 * 4 + 3 * 4 + 4 + 4;\r\n const vertexCount = uBuffer.length / rowLength;\r\n\r\n const positions = [];\r\n\r\n const vertexData = new VertexData();\r\n for (let i = 0; i < vertexCount; i++) {\r\n const x = fBuffer[8 * i + 0];\r\n const y = fBuffer[8 * i + 1];\r\n const z = fBuffer[8 * i + 2];\r\n positions.push(x, y, z);\r\n }\r\n\r\n if (parsedPLY.hasVertexColors) {\r\n const colors = new Float32Array(vertexCount * 4);\r\n for (let i = 0; i < vertexCount; i++) {\r\n const r = uBuffer[rowLength * i + 24 + 0] / 255;\r\n const g = uBuffer[rowLength * i + 24 + 1] / 255;\r\n const b = uBuffer[rowLength * i + 24 + 2] / 255;\r\n colors[i * 4 + 0] = r;\r\n colors[i * 4 + 1] = g;\r\n colors[i * 4 + 2] = b;\r\n colors[i * 4 + 3] = 1;\r\n }\r\n vertexData.colors = colors;\r\n }\r\n\r\n vertexData.positions = positions;\r\n vertexData.indices = parsedPLY.faces!;\r\n\r\n vertexData.applyToMesh(mesh);\r\n return mesh;\r\n }\r\n\r\n private _parse(meshesNames: any, scene: Scene, data: any, rootUrl: string): Promise<Array<AbstractMesh>> {\r\n return SPLATFileLoader._ConvertPLYToSplat(data as ArrayBuffer).then(async (parsedPLY) => {\r\n const babylonMeshesArray: Array<Mesh> = []; //The mesh for babylon\r\n switch (parsedPLY.mode) {\r\n case Mode.Splat:\r\n {\r\n const gaussianSplatting = new GaussianSplattingMesh(\"GaussianSplatting\", null, scene, this._loadingOptions.keepInRam);\r\n gaussianSplatting._parentContainer = this._assetContainer;\r\n babylonMeshesArray.push(gaussianSplatting);\r\n await gaussianSplatting.updateDataAsync(parsedPLY.data);\r\n }\r\n break;\r\n case Mode.PointCloud:\r\n {\r\n const pointcloud = new PointsCloudSystem(\"PointCloud\", 1, scene);\r\n if (SPLATFileLoader._BuildPointCloud(pointcloud, parsedPLY.data)) {\r\n return Promise.all([pointcloud.buildMeshAsync()]).then((mesh) => {\r\n babylonMeshesArray.push(mesh[0]);\r\n return babylonMeshesArray;\r\n });\r\n } else {\r\n pointcloud.dispose();\r\n }\r\n }\r\n break;\r\n case Mode.Mesh:\r\n {\r\n if (parsedPLY.faces) {\r\n babylonMeshesArray.push(SPLATFileLoader._BuildMesh(scene, parsedPLY));\r\n } else {\r\n throw new Error(\"PLY mesh doesn't contain face informations.\");\r\n }\r\n }\r\n break;\r\n default:\r\n throw new Error(\"Unsupported Splat mode\");\r\n }\r\n return new Promise((resolve) => {\r\n resolve(babylonMeshesArray);\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @returns The loaded asset container\r\n */\r\n public loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string): Promise<AssetContainer> {\r\n const container = new AssetContainer(scene);\r\n this._assetContainer = container;\r\n\r\n return this.importMeshAsync(null, scene, data, rootUrl)\r\n .then((result) => {\r\n result.meshes.forEach((mesh) => container.meshes.push(mesh));\r\n // mesh material will be null before 1st rendered frame.\r\n this._assetContainer = null;\r\n return container;\r\n })\r\n .catch((ex) => {\r\n this._assetContainer = null;\r\n throw ex;\r\n });\r\n }\r\n\r\n /**\r\n * Imports all objects from the loaded OBJ data and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data the OBJ data to load\r\n * @param rootUrl root url to load from\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n public loadAsync(scene: Scene, data: string, rootUrl: string): Promise<void> {\r\n //Get the 3D model\r\n return this.importMeshAsync(null, scene, data, rootUrl).then(() => {\r\n // return void\r\n });\r\n }\r\n\r\n /**\r\n * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license\r\n * Converts a .ply data array buffer to splat\r\n * if data array buffer is not ply, returns the original buffer\r\n * @param data the .ply data to load\r\n * @returns the loaded splat buffer\r\n */\r\n private static _ConvertPLYToSplat(data: ArrayBuffer): Promise<ParsedPLY> {\r\n const ubuf = new Uint8Array(data);\r\n const header = new TextDecoder().decode(ubuf.slice(0, 1024 * 10));\r\n const headerEnd = \"end_header\\n\";\r\n const headerEndIndex = header.indexOf(headerEnd);\r\n if (headerEndIndex < 0 || !header) {\r\n // standard splat\r\n return new Promise((resolve) => {\r\n resolve({ mode: Mode.Splat, data: data });\r\n });\r\n }\r\n\r\n const vertexCount = parseInt(/element vertex (\\d+)\\n/.exec(header)![1]);\r\n const faceElement = /element face (\\d+)\\n/.exec(header);\r\n let faceCount = 0;\r\n if (faceElement) {\r\n faceCount = parseInt(faceElement[1]);\r\n }\r\n const chunkElement = /element chunk (\\d+)\\n/.exec(header);\r\n let chunkCount = 0;\r\n if (chunkElement) {\r\n chunkCount = parseInt(chunkElement[1]);\r\n }\r\n\r\n let rowVertexOffset = 0;\r\n let rowChunkOffset = 0;\r\n const offsets: Record<string, number> = {\r\n double: 8,\r\n int: 4,\r\n uint: 4,\r\n float: 4,\r\n short: 2,\r\n ushort: 2,\r\n uchar: 1,\r\n list: 0,\r\n };\r\n\r\n type PlyProperty = {\r\n name: string;\r\n type: string;\r\n offset: number;\r\n };\r\n\r\n const enum ElementMode {\r\n Vertex = 0,\r\n Chunk = 1,\r\n }\r\n\r\n let chunkMode = ElementMode.Chunk;\r\n const vertexProperties: PlyProperty[] = [];\r\n const chunkProperties: PlyProperty[] = [];\r\n const filtered = header.slice(0, headerEndIndex).split(\"\\n\");\r\n for (const prop of filtered) {\r\n if (prop.startsWith(\"property \")) {\r\n const [, type, name] = prop.split(\" \");\r\n\r\n if (chunkMode == ElementMode.Chunk) {\r\n chunkProperties.push({ name, type, offset: rowChunkOffset });\r\n rowChunkOffset += offsets[type];\r\n } else if (chunkMode == ElementMode.Vertex) {\r\n vertexProperties.push({ name, type, offset: rowVertexOffset });\r\n rowVertexOffset += offsets[type];\r\n }\r\n\r\n if (!offsets[type]) {\r\n Logger.Warn(`Unsupported property type: ${type}.`);\r\n }\r\n } else if (prop.startsWith(\"element \")) {\r\n const [, type] = prop.split(\" \");\r\n if (type == \"chunk\") {\r\n chunkMode = ElementMode.Chunk;\r\n } else if (type == \"vertex\") {\r\n chunkMode = ElementMode.Vertex;\r\n }\r\n }\r\n }\r\n\r\n const rowVertexLength = rowVertexOffset;\r\n const rowChunkLength = rowChunkOffset;\r\n\r\n return GaussianSplattingMesh.ConvertPLYToSplatAsync(data).then((buffer) => {\r\n const dataView = new DataView(data, headerEndIndex + headerEnd.length);\r\n let offset = rowChunkLength * chunkCount + rowVertexLength * vertexCount;\r\n // faces\r\n const faces: number[] = [];\r\n if (faceCount) {\r\n for (let i = 0; i < faceCount; i++) {\r\n const faceVertexCount = dataView.getUint8(offset);\r\n if (faceVertexCount != 3) {\r\n continue; // only support triangles\r\n }\r\n offset += 1;\r\n\r\n for (let j = 0; j < faceVertexCount; j++) {\r\n const vertexIndex = dataView.getUint32(offset + (2 - j) * 4, true); // change face winding\r\n faces.push(vertexIndex);\r\n }\r\n offset += 12;\r\n }\r\n }\r\n\r\n // early exit for chunked/quantized ply\r\n if (chunkCount) {\r\n return new Promise((resolve) => {\r\n resolve({ mode: Mode.Splat, data: buffer, faces: faces, hasVertexColors: false });\r\n });\r\n }\r\n // count available properties. if all necessary are present then it's a splat. Otherwise, it's a point cloud\r\n // if faces are found, then it's a standard mesh\r\n let propertyCount = 0;\r\n let propertyColorCount = 0;\r\n const splatProperties = [\"x\", \"y\", \"z\", \"scale_0\", \"scale_1\", \"scale_2\", \"opacity\", \"rot_0\", \"rot_1\", \"rot_2\", \"rot_3\"];\r\n const splatColorProperties = [\"red\", \"green\", \"blue\", \"f_dc_0\", \"f_dc_1\", \"f_dc_2\"];\r\n for (let propertyIndex = 0; propertyIndex < vertexProperties.length; propertyIndex++) {\r\n const property = vertexProperties[propertyIndex];\r\n if (splatProperties.includes(property.name)) {\r\n propertyCount++;\r\n }\r\n if (splatColorProperties.includes(property.name)) {\r\n propertyColorCount++;\r\n }\r\n }\r\n const hasMandatoryProperties = propertyCount == splatProperties.length && propertyColorCount == 3;\r\n const currentMode = faceCount ? Mode.Mesh : hasMandatoryProperties ? Mode.Splat : Mode.PointCloud;\r\n // parsed ready ready to be used as a splat\r\n return new Promise((resolve) => {\r\n resolve({ mode: currentMode, data: buffer, faces: faces, hasVertexColors: !!propertyColorCount });\r\n });\r\n });\r\n }\r\n}\r\n\r\n// Add this loader into the register plugin\r\nregisterSceneLoaderPlugin(new SPLATFileLoader());\r\n"]}
|
1
|
+
{"version":3,"file":"splatFileLoader.js","sourceRoot":"","sources":["../../../../dev/loaders/src/SPLAT/splatFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,+CAAiC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,0EAA4D;AAC5F,OAAO,EAAE,cAAc,EAAE,0CAA4B;AAIrD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAC1C,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,iBAAiB,EAAE,uDAAyC;AACrE,O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AAM,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC;YACtG,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;;AArUuB,sCAAsB,GAAG;IAC7C,SAAS,EAAE,KAAK;CACoB,AAFM,CAEL;AAsU7C,2CAA2C;AAC3C,yBAAyB,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC","sourcesContent":["import type { ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, ISceneLoaderAsyncResult, ISceneLoaderProgressEvent, SceneLoaderPluginOptions } from \"core/Loading/sceneLoader\";\r\nimport { registerSceneLoaderPlugin } from \"core/Loading/sceneLoader\";\r\nimport { SPLATFileLoaderMetadata } from \"./splatFileLoader.metadata\";\r\nimport { GaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh\";\r\nimport { AssetContainer } from \"core/assetContainer\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { PointsCloudSystem } from \"core/Particles/pointsCloudSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { SPLATLoadingOptions } from \"./splatLoadingOptions\";\r\n\r\ndeclare module \"core/Loading/sceneLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface SceneLoaderPluginOptions {\r\n /**\r\n * Defines options for the splat loader.\r\n */\r\n [SPLATFileLoaderMetadata.name]: Partial<SPLATLoadingOptions>;\r\n }\r\n}\r\n\r\n/**\r\n * Indicator of the parsed ply buffer. A standard ready to use splat or an array of positions for a point cloud\r\n */\r\nconst enum Mode {\r\n Splat = 0,\r\n PointCloud = 1,\r\n Mesh = 2,\r\n}\r\n\r\n/**\r\n * A parsed buffer and how to use it\r\n */\r\ninterface ParsedPLY {\r\n data: ArrayBuffer;\r\n mode: Mode;\r\n faces?: number[];\r\n hasVertexColors?: boolean;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * SPLAT file type loader.\r\n * This is a babylon scene loader plugin.\r\n */\r\nexport class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\r\n /**\r\n * Defines the name of the plugin.\r\n */\r\n public readonly name = SPLATFileLoaderMetadata.name;\r\n\r\n private _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n private readonly _loadingOptions: Readonly<SPLATLoadingOptions>;\r\n /**\r\n * Defines the extensions the splat loader is able to load.\r\n * force data to come in as an ArrayBuffer\r\n */\r\n public readonly extensions = SPLATFileLoaderMetadata.extensions;\r\n\r\n /**\r\n * Creates loader for gaussian splatting files\r\n * @param loadingOptions options for loading and parsing splat and PLY files.\r\n */\r\n constructor(loadingOptions: Partial<Readonly<SPLATLoadingOptions>> = SPLATFileLoader._DefaultLoadingOptions) {\r\n this._loadingOptions = loadingOptions;\r\n }\r\n\r\n private static readonly _DefaultLoadingOptions = {\r\n keepInRam: false,\r\n } as const satisfies SPLATLoadingOptions;\r\n\r\n /** @internal */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync {\r\n return new SPLATFileLoader(options[SPLATFileLoaderMetadata.name]);\r\n }\r\n\r\n /**\r\n * Imports from the loaded gaussian splatting data and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param data the gaussian splatting data to load\r\n * @param rootUrl root url to load from\r\n * @param onProgress callback called while file is loading\r\n * @param fileName Defines the name of the file to load\r\n * @returns a promise containing the loaded meshes, particles, skeletons and animations\r\n */\r\n public async importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n data: any,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName?: string\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return this._parse(meshesNames, scene, data, rootUrl).then((meshes) => {\r\n return {\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: [],\r\n animationGroups: [],\r\n transformNodes: [],\r\n geometries: [],\r\n lights: [],\r\n spriteManagers: [],\r\n };\r\n });\r\n }\r\n\r\n private static _BuildPointCloud(pointcloud: PointsCloudSystem, data: ArrayBuffer): boolean {\r\n if (!data.byteLength) {\r\n return false;\r\n }\r\n const uBuffer = new Uint8Array(data);\r\n const fBuffer = new Float32Array(data);\r\n\r\n // parsed array contains room for position(3floats), normal(3floats), color (4b), quantized quaternion (4b)\r\n const rowLength = 3 * 4 + 3 * 4 + 4 + 4;\r\n const vertexCount = uBuffer.length / rowLength;\r\n\r\n const pointcloudfunc = function (particle: any, i: number) {\r\n const x = fBuffer[8 * i + 0];\r\n const y = fBuffer[8 * i + 1];\r\n const z = fBuffer[8 * i + 2];\r\n particle.position = new Vector3(x, y, z);\r\n\r\n const r = uBuffer[rowLength * i + 24 + 0] / 255;\r\n const g = uBuffer[rowLength * i + 24 + 1] / 255;\r\n const b = uBuffer[rowLength * i + 24 + 2] / 255;\r\n particle.color = new Color4(r, g, b, 1);\r\n };\r\n\r\n pointcloud.addPoints(vertexCount, pointcloudfunc);\r\n return true;\r\n }\r\n\r\n private static _BuildMesh(scene: Scene, parsedPLY: ParsedPLY): Mesh {\r\n const mesh = new Mesh(\"PLYMesh\", scene);\r\n\r\n const uBuffer = new Uint8Array(parsedPLY.data);\r\n const fBuffer = new Float32Array(parsedPLY.data);\r\n\r\n const rowLength = 3 * 4 + 3 * 4 + 4 + 4;\r\n const vertexCount = uBuffer.length / rowLength;\r\n\r\n const positions = [];\r\n\r\n const vertexData = new VertexData();\r\n for (let i = 0; i < vertexCount; i++) {\r\n const x = fBuffer[8 * i + 0];\r\n const y = fBuffer[8 * i + 1];\r\n const z = fBuffer[8 * i + 2];\r\n positions.push(x, y, z);\r\n }\r\n\r\n if (parsedPLY.hasVertexColors) {\r\n const colors = new Float32Array(vertexCount * 4);\r\n for (let i = 0; i < vertexCount; i++) {\r\n const r = uBuffer[rowLength * i + 24 + 0] / 255;\r\n const g = uBuffer[rowLength * i + 24 + 1] / 255;\r\n const b = uBuffer[rowLength * i + 24 + 2] / 255;\r\n colors[i * 4 + 0] = r;\r\n colors[i * 4 + 1] = g;\r\n colors[i * 4 + 2] = b;\r\n colors[i * 4 + 3] = 1;\r\n }\r\n vertexData.colors = colors;\r\n }\r\n\r\n vertexData.positions = positions;\r\n vertexData.indices = parsedPLY.faces!;\r\n\r\n vertexData.applyToMesh(mesh);\r\n return mesh;\r\n }\r\n\r\n private _parse(meshesNames: any, scene: Scene, data: any, rootUrl: string): Promise<Array<AbstractMesh>> {\r\n return SPLATFileLoader._ConvertPLYToSplat(data as ArrayBuffer).then(async (parsedPLY) => {\r\n const babylonMeshesArray: Array<Mesh> = []; //The mesh for babylon\r\n switch (parsedPLY.mode) {\r\n case Mode.Splat:\r\n {\r\n const gaussianSplatting = new GaussianSplattingMesh(\"GaussianSplatting\", null, scene, this._loadingOptions.keepInRam);\r\n gaussianSplatting._parentContainer = this._assetContainer;\r\n babylonMeshesArray.push(gaussianSplatting);\r\n await gaussianSplatting.updateDataAsync(parsedPLY.data);\r\n }\r\n break;\r\n case Mode.PointCloud:\r\n {\r\n const pointcloud = new PointsCloudSystem(\"PointCloud\", 1, scene);\r\n if (SPLATFileLoader._BuildPointCloud(pointcloud, parsedPLY.data)) {\r\n return Promise.all([pointcloud.buildMeshAsync()]).then((mesh) => {\r\n babylonMeshesArray.push(mesh[0]);\r\n return babylonMeshesArray;\r\n });\r\n } else {\r\n pointcloud.dispose();\r\n }\r\n }\r\n break;\r\n case Mode.Mesh:\r\n {\r\n if (parsedPLY.faces) {\r\n babylonMeshesArray.push(SPLATFileLoader._BuildMesh(scene, parsedPLY));\r\n } else {\r\n throw new Error(\"PLY mesh doesn't contain face informations.\");\r\n }\r\n }\r\n break;\r\n default:\r\n throw new Error(\"Unsupported Splat mode\");\r\n }\r\n return new Promise((resolve) => {\r\n resolve(babylonMeshesArray);\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @returns The loaded asset container\r\n */\r\n public loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string): Promise<AssetContainer> {\r\n const container = new AssetContainer(scene);\r\n this._assetContainer = container;\r\n\r\n return this.importMeshAsync(null, scene, data, rootUrl)\r\n .then((result) => {\r\n result.meshes.forEach((mesh) => container.meshes.push(mesh));\r\n // mesh material will be null before 1st rendered frame.\r\n this._assetContainer = null;\r\n return container;\r\n })\r\n .catch((ex) => {\r\n this._assetContainer = null;\r\n throw ex;\r\n });\r\n }\r\n\r\n /**\r\n * Imports all objects from the loaded OBJ data and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data the OBJ data to load\r\n * @param rootUrl root url to load from\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n public loadAsync(scene: Scene, data: string, rootUrl: string): Promise<void> {\r\n //Get the 3D model\r\n return this.importMeshAsync(null, scene, data, rootUrl).then(() => {\r\n // return void\r\n });\r\n }\r\n\r\n /**\r\n * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license\r\n * Converts a .ply data array buffer to splat\r\n * if data array buffer is not ply, returns the original buffer\r\n * @param data the .ply data to load\r\n * @returns the loaded splat buffer\r\n */\r\n private static _ConvertPLYToSplat(data: ArrayBuffer): Promise<ParsedPLY> {\r\n const ubuf = new Uint8Array(data);\r\n const header = new TextDecoder().decode(ubuf.slice(0, 1024 * 10));\r\n const headerEnd = \"end_header\\n\";\r\n const headerEndIndex = header.indexOf(headerEnd);\r\n if (headerEndIndex < 0 || !header) {\r\n // standard splat\r\n return new Promise((resolve) => {\r\n resolve({ mode: Mode.Splat, data: data });\r\n });\r\n }\r\n\r\n const vertexCount = parseInt(/element vertex (\\d+)\\n/.exec(header)![1]);\r\n const faceElement = /element face (\\d+)\\n/.exec(header);\r\n let faceCount = 0;\r\n if (faceElement) {\r\n faceCount = parseInt(faceElement[1]);\r\n }\r\n const chunkElement = /element chunk (\\d+)\\n/.exec(header);\r\n let chunkCount = 0;\r\n if (chunkElement) {\r\n chunkCount = parseInt(chunkElement[1]);\r\n }\r\n\r\n let rowVertexOffset = 0;\r\n let rowChunkOffset = 0;\r\n const offsets: Record<string, number> = {\r\n double: 8,\r\n int: 4,\r\n uint: 4,\r\n float: 4,\r\n short: 2,\r\n ushort: 2,\r\n uchar: 1,\r\n list: 0,\r\n };\r\n\r\n type PlyProperty = {\r\n name: string;\r\n type: string;\r\n offset: number;\r\n };\r\n\r\n const enum ElementMode {\r\n Vertex = 0,\r\n Chunk = 1,\r\n }\r\n\r\n let chunkMode = ElementMode.Chunk;\r\n const vertexProperties: PlyProperty[] = [];\r\n const chunkProperties: PlyProperty[] = [];\r\n const filtered = header.slice(0, headerEndIndex).split(\"\\n\");\r\n for (const prop of filtered) {\r\n if (prop.startsWith(\"property \")) {\r\n const [, type, name] = prop.split(\" \");\r\n\r\n if (chunkMode == ElementMode.Chunk) {\r\n chunkProperties.push({ name, type, offset: rowChunkOffset });\r\n rowChunkOffset += offsets[type];\r\n } else if (chunkMode == ElementMode.Vertex) {\r\n vertexProperties.push({ name, type, offset: rowVertexOffset });\r\n rowVertexOffset += offsets[type];\r\n }\r\n\r\n if (!offsets[type]) {\r\n Logger.Warn(`Unsupported property type: ${type}.`);\r\n }\r\n } else if (prop.startsWith(\"element \")) {\r\n const [, type] = prop.split(\" \");\r\n if (type == \"chunk\") {\r\n chunkMode = ElementMode.Chunk;\r\n } else if (type == \"vertex\") {\r\n chunkMode = ElementMode.Vertex;\r\n }\r\n }\r\n }\r\n\r\n const rowVertexLength = rowVertexOffset;\r\n const rowChunkLength = rowChunkOffset;\r\n\r\n return GaussianSplattingMesh.ConvertPLYToSplatAsync(data).then((buffer) => {\r\n const dataView = new DataView(data, headerEndIndex + headerEnd.length);\r\n let offset = rowChunkLength * chunkCount + rowVertexLength * vertexCount;\r\n // faces\r\n const faces: number[] = [];\r\n if (faceCount) {\r\n for (let i = 0; i < faceCount; i++) {\r\n const faceVertexCount = dataView.getUint8(offset);\r\n if (faceVertexCount != 3) {\r\n continue; // only support triangles\r\n }\r\n offset += 1;\r\n\r\n for (let j = 0; j < faceVertexCount; j++) {\r\n const vertexIndex = dataView.getUint32(offset + (2 - j) * 4, true); // change face winding\r\n faces.push(vertexIndex);\r\n }\r\n offset += 12;\r\n }\r\n }\r\n\r\n // early exit for chunked/quantized ply\r\n if (chunkCount) {\r\n return new Promise((resolve) => {\r\n resolve({ mode: Mode.Splat, data: buffer, faces: faces, hasVertexColors: false });\r\n });\r\n }\r\n // count available properties. if all necessary are present then it's a splat. Otherwise, it's a point cloud\r\n // if faces are found, then it's a standard mesh\r\n let propertyCount = 0;\r\n let propertyColorCount = 0;\r\n const splatProperties = [\"x\", \"y\", \"z\", \"scale_0\", \"scale_1\", \"scale_2\", \"opacity\", \"rot_0\", \"rot_1\", \"rot_2\", \"rot_3\"];\r\n const splatColorProperties = [\"red\", \"green\", \"blue\", \"f_dc_0\", \"f_dc_1\", \"f_dc_2\"];\r\n for (let propertyIndex = 0; propertyIndex < vertexProperties.length; propertyIndex++) {\r\n const property = vertexProperties[propertyIndex];\r\n if (splatProperties.includes(property.name)) {\r\n propertyCount++;\r\n }\r\n if (splatColorProperties.includes(property.name)) {\r\n propertyColorCount++;\r\n }\r\n }\r\n const hasMandatoryProperties = propertyCount == splatProperties.length && propertyColorCount == 3;\r\n const currentMode = faceCount ? Mode.Mesh : hasMandatoryProperties ? Mode.Splat : Mode.PointCloud;\r\n // parsed ready ready to be used as a splat\r\n return new Promise((resolve) => {\r\n resolve({ mode: currentMode, data: buffer, faces: faces, hasVertexColors: !!propertyColorCount });\r\n });\r\n });\r\n }\r\n}\r\n\r\n// Add this loader into the register plugin\r\nregisterSceneLoaderPlugin(new SPLATFileLoader());\r\n"]}
|