@babylonjs/loaders 5.0.0-alpha.8 → 5.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.d.ts +2 -0
- package/OBJ/index.js +4 -2
- package/OBJ/index.js.map +1 -1
- package/OBJ/mtlFileLoader.d.ts +4 -2
- package/OBJ/mtlFileLoader.js +7 -6
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +12 -84
- package/OBJ/objFileLoader.js +50 -667
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +43 -0
- package/OBJ/objLoadingOptions.js +2 -0
- package/OBJ/objLoadingOptions.js.map +1 -0
- package/OBJ/solidParser.d.ts +153 -0
- package/OBJ/solidParser.js +700 -0
- package/OBJ/solidParser.js.map +1 -0
- package/STL/index.js +1 -1
- package/STL/stlFileLoader.d.ts +6 -0
- package/STL/stlFileLoader.js +38 -11
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.js +4 -4
- package/glTF/1.0/glTFLoader.d.ts +4 -4
- package/glTF/1.0/glTFLoader.js +60 -55
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +3 -1
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.js +6 -6
- package/glTF/1.0/glTFMaterialsCommonExtension.js +12 -12
- package/glTF/1.0/index.js +5 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +8 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +3 -3
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +1 -5
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +5 -21
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.js +2 -2
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +8 -4
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +9 -8
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +2 -2
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +30 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +46 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +1 -2
- package/glTF/2.0/Extensions/KHR_materials_ior.js +3 -4
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +3 -4
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +0 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +3 -4
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +1 -2
- package/glTF/2.0/Extensions/KHR_materials_specular.js +12 -6
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +6 -6
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +93 -84
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +3 -3
- package/glTF/2.0/Extensions/KHR_materials_variants.js +70 -5
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +31 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js +79 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +1 -2
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +3 -4
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js +2 -2
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +2 -2
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +6 -3
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +6 -7
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +2 -1
- package/glTF/2.0/Extensions/MSFT_lod.js +48 -8
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +2 -2
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +2 -2
- package/glTF/2.0/Extensions/index.d.ts +2 -0
- package/glTF/2.0/Extensions/index.js +26 -24
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/glTFLoader.d.ts +6 -11
- package/glTF/2.0/glTFLoader.js +129 -95
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +4 -2
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.d.ts +1 -1
- package/glTF/2.0/index.js +4 -4
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +15 -9
- package/glTF/glTFFileLoader.js +62 -76
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.js +1 -1
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.d.ts +2 -2
- package/glTF/index.js +4 -4
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.js +4 -4
- package/legacy/legacy-glTF1.d.ts +1 -1
- package/legacy/legacy-glTF1.js +1 -1
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.js +2 -2
- package/legacy/legacy-glTF2.d.ts +1 -1
- package/legacy/legacy-glTF2.js +3 -3
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.js +2 -2
- package/legacy/legacy-glTFFileLoader.js +3 -3
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +2 -2
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +2 -2
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.js +6 -6
- package/package.json +16 -4
package/OBJ/objFileLoader.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"objFileLoader.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/OBJ/objFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,WAAW,EAA8H,MAAM,qCAAqC,CAAC;AAE9L,OAAO,EAAE,cAAc,EAAE,MAAM,gC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;OAEG;IACW,4BAAc,GAAG,KAAK,CAAC;IAErC;;;;OAIG;IACW,6CAA+B,GAAG,IAAI,CAAC;IAy8BzD,oBAAC;CAAA,AAz/BD,IAy/BC;SAz/BY,aAAa;AA2/B1B,IAAI,WAAW,EAAE;IACb,0CAA0C;IAC1C,WAAW,CAAC,cAAc,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;CACnD","sourcesContent":["import { FloatArray, IndicesArray } from \"@babylonjs/core/types\";\nimport { Vector3, Vector2 } from \"@babylonjs/core/Maths/math.vector\";\nimport { Color4 } from '@babylonjs/core/Maths/math.color';\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\nimport { SceneLoader, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderAsyncResult } from \"@babylonjs/core/Loading/sceneLoader\";\n\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\nimport { Scene } from \"@babylonjs/core/scene\";\nimport { WebRequest } from '@babylonjs/core/Misc/webRequest';\nimport { MTLFileLoader } from './mtlFileLoader';\nimport { VertexBuffer } from \"@babylonjs/core/Meshes/buffer\";\n\ntype MeshObject = {\n name: string;\n indices?: Array<number>;\n positions?: Array<number>;\n normals?: Array<number>;\n colors?: Array<number>;\n uvs?: Array<number>;\n materialName: string;\n};\n\n/**\n * Options for loading OBJ/MTL files\n */\ntype MeshLoadOptions = {\n /**\n * Defines if UVs are optimized by default during load.\n */\n OptimizeWithUV: boolean,\n /**\n * Defines custom scaling of UV coordinates of loaded meshes.\n */\n UVScaling: Vector2;\n /**\n * Invert model on y-axis (does a model scaling inversion)\n */\n InvertY: boolean,\n /**\n * Invert Y-Axis of referenced textures on load\n */\n InvertTextureY: boolean;\n /**\n * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.\n */\n ImportVertexColors: boolean,\n /**\n * Compute the normals for the model, even if normals are present in the file.\n */\n ComputeNormals: boolean,\n /**\n * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.\n * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.\n */\n OptimizeNormals: boolean,\n /**\n * Skip loading the materials even if defined in the OBJ file (materials are ignored).\n */\n SkipMaterials: boolean,\n /**\n * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.\n */\n MaterialLoadingFailsSilently: boolean\n};\n\n/**\n * OBJ file type loader.\n * This is a babylon scene loader plugin.\n */\nexport class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\n\n /**\n * Defines if UVs are optimized by default during load.\n */\n public static OPTIMIZE_WITH_UV = true;\n /**\n * Invert model on y-axis (does a model scaling inversion)\n */\n public static INVERT_Y = false;\n /**\n * Invert Y-Axis of referenced textures on load\n */\n public static get INVERT_TEXTURE_Y() {\n return MTLFileLoader.INVERT_TEXTURE_Y;\n }\n\n public static set INVERT_TEXTURE_Y(value: boolean) {\n MTLFileLoader.INVERT_TEXTURE_Y = value;\n }\n\n /**\n * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.\n */\n public static IMPORT_VERTEX_COLORS = false;\n /**\n * Compute the normals for the model, even if normals are present in the file.\n */\n public static COMPUTE_NORMALS = false;\n /**\n * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.\n * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.\n */\n public static OPTIMIZE_NORMALS = false;\n /**\n * Defines custom scaling of UV coordinates of loaded meshes.\n */\n public static UV_SCALING = new Vector2(1, 1);\n /**\n * Skip loading the materials even if defined in the OBJ file (materials are ignored).\n */\n public static SKIP_MATERIALS = false;\n\n /**\n * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.\n *\n * Defaults to true for backwards compatibility.\n */\n public static MATERIAL_LOADING_FAILS_SILENTLY = true;\n /**\n * Defines the name of the plugin.\n */\n public name = \"obj\";\n /**\n * Defines the extension the plugin is able to load.\n */\n public extensions = \".obj\";\n /** @hidden */\n public obj = /^o/;\n /** @hidden */\n public group = /^g/;\n /** @hidden */\n public mtllib = /^mtllib /;\n /** @hidden */\n public usemtl = /^usemtl /;\n /** @hidden */\n public smooth = /^s /;\n /** @hidden */\n public vertexPattern = /v(\\s+[\\d|\\.|\\+|\\-|e|E]+){3,7}/;\n // vn float float float\n /** @hidden */\n public normalPattern = /vn(\\s+[\\d|\\.|\\+|\\-|e|E]+)( +[\\d|\\.|\\+|\\-|e|E]+)( +[\\d|\\.|\\+|\\-|e|E]+)/;\n // vt float float\n /** @hidden */\n public uvPattern = /vt(\\s+[\\d|\\.|\\+|\\-|e|E]+)( +[\\d|\\.|\\+|\\-|e|E]+)/;\n // f vertex vertex vertex ...\n /** @hidden */\n public facePattern1 = /f\\s+(([\\d]{1,}[\\s]?){3,})+/;\n // f vertex/uvs vertex/uvs vertex/uvs ...\n /** @hidden */\n public facePattern2 = /f\\s+((([\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\n // f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal ...\n /** @hidden */\n public facePattern3 = /f\\s+((([\\d]{1,}\\/[\\d]{1,}\\/[\\d]{1,}[\\s]?){3,})+)/;\n // f vertex//normal vertex//normal vertex//normal ...\n /** @hidden */\n public facePattern4 = /f\\s+((([\\d]{1,}\\/\\/[\\d]{1,}[\\s]?){3,})+)/;\n // f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal ...\n /** @hidden */\n public facePattern5 = /f\\s+(((-[\\d]{1,}\\/-[\\d]{1,}\\/-[\\d]{1,}[\\s]?){3,})+)/;\n\n private _forAssetContainer = false;\n\n private _meshLoadOptions: MeshLoadOptions;\n\n /**\n * Creates loader for .OBJ files\n *\n * @param meshLoadOptions options for loading and parsing OBJ/MTL files.\n */\n constructor(meshLoadOptions?: MeshLoadOptions) {\n this._meshLoadOptions = meshLoadOptions || OBJFileLoader.currentMeshLoadOptions;\n }\n\n private static get currentMeshLoadOptions(): MeshLoadOptions {\n return {\n ComputeNormals: OBJFileLoader.COMPUTE_NORMALS,\n OptimizeNormals: OBJFileLoader.OPTIMIZE_NORMALS,\n ImportVertexColors: OBJFileLoader.IMPORT_VERTEX_COLORS,\n InvertY: OBJFileLoader.INVERT_Y,\n InvertTextureY: OBJFileLoader.INVERT_TEXTURE_Y,\n UVScaling: OBJFileLoader.UV_SCALING,\n MaterialLoadingFailsSilently: OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY,\n OptimizeWithUV: OBJFileLoader.OPTIMIZE_WITH_UV,\n SkipMaterials: OBJFileLoader.SKIP_MATERIALS\n };\n }\n\n /**\n * Calls synchronously the MTL file attached to this obj.\n * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.\n * Without this function materials are not displayed in the first frame (but displayed after).\n * In consequence it is impossible to get material information in your HTML file\n *\n * @param url The URL of the MTL file\n * @param rootUrl\n * @param onSuccess Callback function to be called when the MTL file is loaded\n * @private\n */\n private _loadMTL(url: string, rootUrl: string, onSuccess: (response: string | ArrayBuffer, responseUrl?: string) => any, onFailure: (pathOfFile: string, exception?: any) => void) {\n //The complete path to the mtl file\n var pathOfFile = Tools.BaseUrl + rootUrl + url;\n\n // Loads through the babylon tools to allow fileInput search.\n Tools.LoadFile(\n pathOfFile,\n onSuccess,\n undefined,\n undefined,\n false,\n (request?: WebRequest | undefined, exception?: any) => {\n onFailure(pathOfFile, exception);\n }\n );\n }\n\n /**\n * Instantiates a OBJ file loader plugin.\n * @returns the created plugin\n */\n createPlugin(): ISceneLoaderPluginAsync | ISceneLoaderPlugin {\n return new OBJFileLoader(OBJFileLoader.currentMeshLoadOptions);\n }\n\n /**\n * If the data string can be loaded directly.\n *\n * @param data string containing the file data\n * @returns if the data can be loaded directly\n */\n public canDirectLoad(data: string): boolean {\n return false;\n }\n\n /**\n * Imports one or more meshes from the loaded OBJ data and adds them to the scene\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\n * @param scene the scene the meshes should be added to\n * @param data the OBJ data to load\n * @param rootUrl root url to load from\n * @param onProgress event that fires when loading progress has occured\n * @param fileName Defines the name of the file to load\n * @returns a promise containg the loaded meshes, particles, skeletons and animations\n */\n public importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult> {\n //get the meshes from OBJ file\n return this._parseSolid(meshesNames, scene, data, rootUrl).then((meshes) => {\n return {\n meshes: meshes,\n particleSystems: [],\n skeletons: [],\n animationGroups: [],\n transformNodes: [],\n geometries: [],\n lights: []\n };\n });\n }\n\n /**\n * Imports all objects from the loaded OBJ data and adds them to the scene\n * @param scene the scene the objects should be added to\n * @param data the OBJ data to load\n * @param rootUrl root url to load from\n * @param onProgress event that fires when loading progress has occured\n * @param fileName Defines the name of the file to load\n * @returns a promise which completes when objects have been loaded to the scene\n */\n public loadAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\n //Get the 3D model\n return this.importMeshAsync(null, scene, data, rootUrl, onProgress).then(() => {\n // return void\n });\n }\n\n /**\n * Load into an asset container.\n * @param scene The scene to load into\n * @param data The data to import\n * @param rootUrl The root url for scene and resources\n * @param onProgress The callback when the load progresses\n * @param fileName Defines the name of the file to load\n * @returns The loaded asset container\n */\n public loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer> {\n this._forAssetContainer = true;\n\n return this.importMeshAsync(null, scene, data, rootUrl).then((result) => {\n var container = new AssetContainer(scene);\n result.meshes.forEach((mesh) => container.meshes.push(mesh));\n result.meshes.forEach((mesh) => {\n var material = mesh.material;\n if (material) {\n // Materials\n if (container.materials.indexOf(material) == -1) {\n container.materials.push(material);\n\n // Textures\n var textures = material.getActiveTextures();\n textures.forEach((t) => {\n if (container.textures.indexOf(t) == -1) {\n container.textures.push(t);\n }\n });\n }\n }\n });\n this._forAssetContainer = false;\n return container;\n }).catch((ex) => {\n this._forAssetContainer = false;\n throw ex;\n });\n }\n\n private _optimizeNormals(mesh: AbstractMesh): void {\n const positions = mesh.getVerticesData(VertexBuffer.PositionKind);\n const normals = mesh.getVerticesData(VertexBuffer.NormalKind);\n const mapVertices: { [key: string]: number[] } = {};\n\n if (!positions || !normals) {\n return;\n }\n\n for (let i = 0; i < positions.length / 3; i++) {\n const x = positions[i * 3 + 0];\n const y = positions[i * 3 + 1];\n const z = positions[i * 3 + 2];\n const key = x + \"_\" + y + \"_\" + z;\n\n let lst = mapVertices[key];\n if (!lst) {\n lst = [];\n mapVertices[key] = lst;\n }\n lst.push(i);\n }\n\n const normal = new Vector3();\n for (const key in mapVertices) {\n const lst = mapVertices[key];\n if (lst.length < 2) {\n continue;\n }\n\n const v0Idx = lst[0];\n for (let i = 1; i < lst.length; ++i) {\n const vIdx = lst[i];\n normals[v0Idx * 3 + 0] += normals[vIdx * 3 + 0];\n normals[v0Idx * 3 + 1] += normals[vIdx * 3 + 1];\n normals[v0Idx * 3 + 2] += normals[vIdx * 3 + 2];\n }\n\n normal.copyFromFloats(normals[v0Idx * 3 + 0], normals[v0Idx * 3 + 1], normals[v0Idx * 3 + 2]);\n normal.normalize();\n\n for (let i = 0; i < lst.length; ++i) {\n const vIdx = lst[i];\n normals[vIdx * 3 + 0] = normal.x;\n normals[vIdx * 3 + 1] = normal.y;\n normals[vIdx * 3 + 2] = normal.z;\n }\n }\n mesh.setVerticesData(VertexBuffer.NormalKind, normals);\n }\n\n /**\n * Read the OBJ file and create an Array of meshes.\n * Each mesh contains all information given by the OBJ and the MTL file.\n * i.e. vertices positions and indices, optional normals values, optional UV values, optional material\n *\n * @param meshesNames\n * @param scene Scene The scene where are displayed the data\n * @param data String The content of the obj file\n * @param rootUrl String The path to the folder\n * @returns Array<AbstractMesh>\n * @private\n */\n private _parseSolid(meshesNames: any, scene: Scene, data: string, rootUrl: string): Promise<Array<AbstractMesh>> {\n var positions: Array<Vector3> = []; //values for the positions of vertices\n var normals: Array<Vector3> = []; //Values for the normals\n var uvs: Array<Vector2> = []; //Values for the textures\n var colors: Array<Color4> = [];\n var meshesFromObj: Array<MeshObject> = []; //[mesh] Contains all the obj meshes\n var handledMesh: MeshObject; //The current mesh of meshes array\n var indicesForBabylon: Array<number> = []; //The list of indices for VertexData\n var wrappedPositionForBabylon: Array<Vector3> = []; //The list of position in vectors\n var wrappedUvsForBabylon: Array<Vector2> = []; //Array with all value of uvs to match with the indices\n var wrappedColorsForBabylon: Array<Color4> = []; // Array with all color values to match with the indices\n var wrappedNormalsForBabylon: Array<Vector3> = []; //Array with all value of normals to match with the indices\n var tuplePosNorm: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }> = []; //Create a tuple with indice of Position, Normal, UV [pos, norm, uvs]\n var curPositionInIndices = 0;\n var hasMeshes: Boolean = false; //Meshes are defined in the file\n var unwrappedPositionsForBabylon: Array<number> = []; //Value of positionForBabylon w/o Vector3() [x,y,z]\n var unwrappedColorsForBabylon: Array<number> = []; // Value of colorForBabylon w/o Color4() [r,g,b,a]\n var unwrappedNormalsForBabylon: Array<number> = []; //Value of normalsForBabylon w/o Vector3() [x,y,z]\n var unwrappedUVForBabylon: Array<number> = []; //Value of uvsForBabylon w/o Vector3() [x,y,z]\n var triangles: Array<string> = []; //Indices from new triangles coming from polygons\n var materialNameFromObj: string = \"\"; //The name of the current material\n var fileToLoad: string = \"\"; //The name of the mtlFile to load\n var materialsFromMTLFile: MTLFileLoader = new MTLFileLoader();\n var objMeshName: string = \"\"; //The name of the current obj mesh\n var increment: number = 1; //Id for meshes created by the multimaterial\n var isFirstMaterial: boolean = true;\n var grayColor = new Color4(0.5, 0.5, 0.5, 1);\n\n /**\n * Search for obj in the given array.\n * This function is called to check if a couple of data already exists in an array.\n *\n * If found, returns the index of the founded tuple index. Returns -1 if not found\n * @param arr Array<{ normals: Array<number>, idx: Array<number> }>\n * @param obj Array<number>\n * @returns {boolean}\n */\n var isInArray = (arr: Array<{ normals: Array<number>; idx: Array<number> }>, obj: Array<number>) => {\n if (!arr[obj[0]]) { arr[obj[0]] = { normals: [], idx: [] }; }\n var idx = arr[obj[0]].normals.indexOf(obj[1]);\n\n return idx === -1 ? -1 : arr[obj[0]].idx[idx];\n };\n var isInArrayUV = (arr: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }>, obj: Array<number>) => {\n if (!arr[obj[0]]) { arr[obj[0]] = { normals: [], idx: [], uv: [] }; }\n var idx = arr[obj[0]].normals.indexOf(obj[1]);\n\n if (idx != 1 && (obj[2] === arr[obj[0]].uv[idx])) {\n return arr[obj[0]].idx[idx];\n }\n return -1;\n };\n\n /**\n * This function set the data for each triangle.\n * Data are position, normals and uvs\n * If a tuple of (position, normal) is not set, add the data into the corresponding array\n * If the tuple already exist, add only their indice\n *\n * @param indicePositionFromObj Integer The index in positions array\n * @param indiceUvsFromObj Integer The index in uvs array\n * @param indiceNormalFromObj Integer The index in normals array\n * @param positionVectorFromOBJ Vector3 The value of position at index objIndice\n * @param textureVectorFromOBJ Vector3 The value of uvs\n * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale\n */\n var setData = (indicePositionFromObj: number, indiceUvsFromObj: number, indiceNormalFromObj: number, positionVectorFromOBJ: Vector3, textureVectorFromOBJ: Vector2, normalsVectorFromOBJ: Vector3, positionColorsFromOBJ?: Color4) => {\n //Check if this tuple already exists in the list of tuples\n var _index: number;\n if (this._meshLoadOptions.OptimizeWithUV) {\n _index = isInArrayUV(\n tuplePosNorm,\n [\n indicePositionFromObj,\n indiceNormalFromObj,\n indiceUvsFromObj\n ]\n );\n }\n else {\n _index = isInArray(\n tuplePosNorm,\n [\n indicePositionFromObj,\n indiceNormalFromObj\n ]\n );\n }\n\n //If it not exists\n if (_index === -1) {\n //Add an new indice.\n //The array of indices is only an array with his length equal to the number of triangles - 1.\n //We add vertices data in this order\n indicesForBabylon.push(wrappedPositionForBabylon.length);\n //Push the position of vertice for Babylon\n //Each element is a Vector3(x,y,z)\n wrappedPositionForBabylon.push(positionVectorFromOBJ);\n //Push the uvs for Babylon\n //Each element is a Vector3(u,v)\n wrappedUvsForBabylon.push(textureVectorFromOBJ);\n //Push the normals for Babylon\n //Each element is a Vector3(x,y,z)\n wrappedNormalsForBabylon.push(normalsVectorFromOBJ);\n\n if (positionColorsFromOBJ !== undefined) {\n //Push the colors for Babylon\n //Each element is a BABYLON.Color4(r,g,b,a)\n wrappedColorsForBabylon.push(positionColorsFromOBJ);\n }\n\n //Add the tuple in the comparison list\n tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);\n tuplePosNorm[indicePositionFromObj].idx.push(curPositionInIndices++);\n if (this._meshLoadOptions.OptimizeWithUV) { tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj); }\n } else {\n //The tuple already exists\n //Add the index of the already existing tuple\n //At this index we can get the value of position, normal, color and uvs of vertex\n indicesForBabylon.push(_index);\n }\n };\n\n /**\n * Transform Vector() and BABYLON.Color() objects into numbers in an array\n */\n var unwrapData = () => {\n //Every array has the same length\n for (var l = 0; l < wrappedPositionForBabylon.length; l++) {\n //Push the x, y, z values of each element in the unwrapped array\n unwrappedPositionsForBabylon.push(wrappedPositionForBabylon[l].x, wrappedPositionForBabylon[l].y, wrappedPositionForBabylon[l].z);\n unwrappedNormalsForBabylon.push(wrappedNormalsForBabylon[l].x, wrappedNormalsForBabylon[l].y, wrappedNormalsForBabylon[l].z);\n unwrappedUVForBabylon.push(wrappedUvsForBabylon[l].x, wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON\n if (this._meshLoadOptions.ImportVertexColors === true) {\n //Push the r, g, b, a values of each element in the unwrapped array\n unwrappedColorsForBabylon.push(wrappedColorsForBabylon[l].r, wrappedColorsForBabylon[l].g, wrappedColorsForBabylon[l].b, wrappedColorsForBabylon[l].a);\n }\n }\n // Reset arrays for the next new meshes\n wrappedPositionForBabylon = [];\n wrappedNormalsForBabylon = [];\n wrappedUvsForBabylon = [];\n wrappedColorsForBabylon = [];\n tuplePosNorm = [];\n curPositionInIndices = 0;\n };\n\n /**\n * Create triangles from polygons\n * It is important to notice that a triangle is a polygon\n * We get 5 patterns of face defined in OBJ File :\n * facePattern1 = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]\n * facePattern2 = [\"1/1\",\"2/2\",\"3/3\",\"4/4\",\"5/5\",\"6/6\"]\n * facePattern3 = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"4/4/4\",\"5/5/5\",\"6/6/6\"]\n * facePattern4 = [\"1//1\",\"2//2\",\"3//3\",\"4//4\",\"5//5\",\"6//6\"]\n * facePattern5 = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-4/-4/-4\",\"-5/-5/-5\",\"-6/-6/-6\"]\n * Each pattern is divided by the same method\n * @param face Array[String] The indices of elements\n * @param v Integer The variable to increment\n */\n var getTriangles = (faces: Array<string>, v: number) => {\n //Work for each element of the array\n for (var faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {\n //Add on the triangle variable the indexes to obtain triangles\n triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);\n }\n\n //Result obtained after 2 iterations:\n //Pattern1 => triangle = [\"1\",\"2\",\"3\",\"1\",\"3\",\"4\"];\n //Pattern2 => triangle = [\"1/1\",\"2/2\",\"3/3\",\"1/1\",\"3/3\",\"4/4\"];\n //Pattern3 => triangle = [\"1/1/1\",\"2/2/2\",\"3/3/3\",\"1/1/1\",\"3/3/3\",\"4/4/4\"];\n //Pattern4 => triangle = [\"1//1\",\"2//2\",\"3//3\",\"1//1\",\"3//3\",\"4//4\"];\n //Pattern5 => triangle = [\"-1/-1/-1\",\"-2/-2/-2\",\"-3/-3/-3\",\"-1/-1/-1\",\"-3/-3/-3\",\"-4/-4/-4\"];\n };\n\n /**\n * Create triangles and push the data for each polygon for the pattern 1\n * In this pattern we get vertice positions\n * @param face\n * @param v\n */\n var setDataForCurrentFaceWithPattern1 = (face: Array<string>, v: number) => {\n //Get the indices of triangles for each polygon\n getTriangles(face, v);\n //For each element in the triangles array.\n //This var could contains 1 to an infinity of triangles\n for (var k = 0; k < triangles.length; k++) {\n // Set position indice\n var indicePositionFromObj = parseInt(triangles[k]) - 1;\n\n setData(\n indicePositionFromObj,\n 0, 0, //In the pattern 1, normals and uvs are not defined\n positions[indicePositionFromObj], //Get the vectors data\n Vector2.Zero(), Vector3.Up(), //Create default vectors\n this._meshLoadOptions.ImportVertexColors === true ? colors[indicePositionFromObj] : undefined\n );\n }\n //Reset variable for the next line\n triangles = [];\n };\n\n /**\n * Create triangles and push the data for each polygon for the pattern 2\n * In this pattern we get vertice positions and uvsu\n * @param face\n * @param v\n */\n var setDataForCurrentFaceWithPattern2 = (face: Array<string>, v: number) => {\n //Get the indices of triangles for each polygon\n getTriangles(face, v);\n for (var k = 0; k < triangles.length; k++) {\n //triangle[k] = \"1/1\"\n //Split the data for getting position and uv\n var point = triangles[k].split(\"/\"); // [\"1\", \"1\"]\n //Set position indice\n var indicePositionFromObj = parseInt(point[0]) - 1;\n //Set uv indice\n var indiceUvsFromObj = parseInt(point[1]) - 1;\n\n setData(\n indicePositionFromObj,\n indiceUvsFromObj,\n 0, //Default value for normals\n positions[indicePositionFromObj], //Get the values for each element\n uvs[indiceUvsFromObj],\n Vector3.Up(), //Default value for normals\n this._meshLoadOptions.ImportVertexColors === true ? colors[indicePositionFromObj] : undefined\n );\n }\n\n //Reset variable for the next line\n triangles = [];\n };\n\n /**\n * Create triangles and push the data for each polygon for the pattern 3\n * In this pattern we get vertice positions, uvs and normals\n * @param face\n * @param v\n */\n var setDataForCurrentFaceWithPattern3 = (face: Array<string>, v: number) => {\n //Get the indices of triangles for each polygon\n getTriangles(face, v);\n\n for (var k = 0; k < triangles.length; k++) {\n //triangle[k] = \"1/1/1\"\n //Split the data for getting position, uv, and normals\n var point = triangles[k].split(\"/\"); // [\"1\", \"1\", \"1\"]\n // Set position indice\n var indicePositionFromObj = parseInt(point[0]) - 1;\n // Set uv indice\n var indiceUvsFromObj = parseInt(point[1]) - 1;\n // Set normal indice\n var indiceNormalFromObj = parseInt(point[2]) - 1;\n\n setData(\n indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj,\n positions[indicePositionFromObj], uvs[indiceUvsFromObj], normals[indiceNormalFromObj] //Set the vector for each component\n );\n\n }\n //Reset variable for the next line\n triangles = [];\n };\n\n /**\n * Create triangles and push the data for each polygon for the pattern 4\n * In this pattern we get vertice positions and normals\n * @param face\n * @param v\n */\n var setDataForCurrentFaceWithPattern4 = (face: Array<string>, v: number) => {\n getTriangles(face, v);\n\n for (var k = 0; k < triangles.length; k++) {\n //triangle[k] = \"1//1\"\n //Split the data for getting position and normals\n var point = triangles[k].split(\"//\"); // [\"1\", \"1\"]\n // We check indices, and normals\n var indicePositionFromObj = parseInt(point[0]) - 1;\n var indiceNormalFromObj = parseInt(point[1]) - 1;\n\n setData(\n indicePositionFromObj,\n 1, //Default value for uv\n indiceNormalFromObj,\n positions[indicePositionFromObj], //Get each vector of data\n Vector2.Zero(),\n normals[indiceNormalFromObj],\n this._meshLoadOptions.ImportVertexColors === true ? colors[indicePositionFromObj] : undefined\n );\n }\n //Reset variable for the next line\n triangles = [];\n };\n\n /**\n * Create triangles and push the data for each polygon for the pattern 3\n * In this pattern we get vertice positions, uvs and normals\n * @param face\n * @param v\n */\n var setDataForCurrentFaceWithPattern5 = (face: Array<string>, v: number) => {\n //Get the indices of triangles for each polygon\n getTriangles(face, v);\n\n for (var k = 0; k < triangles.length; k++) {\n //triangle[k] = \"-1/-1/-1\"\n //Split the data for getting position, uv, and normals\n var point = triangles[k].split(\"/\"); // [\"-1\", \"-1\", \"-1\"]\n // Set position indice\n var indicePositionFromObj = positions.length + parseInt(point[0]);\n // Set uv indice\n var indiceUvsFromObj = uvs.length + parseInt(point[1]);\n // Set normal indice\n var indiceNormalFromObj = normals.length + parseInt(point[2]);\n\n setData(\n indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj,\n positions[indicePositionFromObj], uvs[indiceUvsFromObj], normals[indiceNormalFromObj], //Set the vector for each component\n this._meshLoadOptions.ImportVertexColors === true ? colors[indicePositionFromObj] : undefined\n );\n\n }\n //Reset variable for the next line\n triangles = [];\n };\n\n var addPreviousObjMesh = () => {\n\n //Check if it is not the first mesh. Otherwise we don't have data.\n if (meshesFromObj.length > 0) {\n //Get the previous mesh for applying the data about the faces\n //=> in obj file, faces definition append after the name of the mesh\n handledMesh = meshesFromObj[meshesFromObj.length - 1];\n\n //Set the data into Array for the mesh\n unwrapData();\n\n // Reverse tab. Otherwise face are displayed in the wrong sens\n indicesForBabylon.reverse();\n //Set the information for the mesh\n //Slice the array to avoid rewriting because of the fact this is the same var which be rewrited\n handledMesh.indices = indicesForBabylon.slice();\n handledMesh.positions = unwrappedPositionsForBabylon.slice();\n handledMesh.normals = unwrappedNormalsForBabylon.slice();\n handledMesh.uvs = unwrappedUVForBabylon.slice();\n\n if (this._meshLoadOptions.ImportVertexColors === true) {\n handledMesh.colors = unwrappedColorsForBabylon.slice();\n }\n\n //Reset the array for the next mesh\n indicesForBabylon = [];\n unwrappedPositionsForBabylon = [];\n unwrappedColorsForBabylon = [];\n unwrappedNormalsForBabylon = [];\n unwrappedUVForBabylon = [];\n }\n };\n //Main function\n\n //Split the file into lines\n var lines = data.split('\\n');\n //Look at each line\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i].trim().replace(/\\s\\s/g, \" \");\n var result;\n\n //Comment or newLine\n if (line.length === 0 || line.charAt(0) === '#') {\n continue;\n\n //Get information about one position possible for the vertices\n } else if (this.vertexPattern.test(line)) {\n result = line.match(/[^ ]+/g)!; // match will return non-null due to passing regex pattern\n\n // Value of result with line: \"v 1.0 2.0 3.0\"\n // [\"v\", \"1.0\", \"2.0\", \"3.0\"]\n // Create a Vector3 with the position x, y, z\n positions.push(new Vector3(\n parseFloat(result[1]),\n parseFloat(result[2]),\n parseFloat(result[3])\n ));\n\n if (this._meshLoadOptions.ImportVertexColors === true) {\n if (result.length >= 7) {\n // TODO: if these numbers are > 1 we can use Color4.FromInts(r,g,b,a)\n colors.push(new Color4(\n parseFloat(result[4]),\n parseFloat(result[5]),\n parseFloat(result[6]),\n (result.length === 7 || result[7] === undefined) ? 1 : parseFloat(result[7])\n ));\n } else {\n // TODO: maybe push NULL and if all are NULL to skip (and remove grayColor var).\n colors.push(grayColor);\n }\n }\n\n } else if ((result = this.normalPattern.exec(line)) !== null) {\n //Create a Vector3 with the normals x, y, z\n //Value of result\n // [\"vn 1.0 2.0 3.0\", \"1.0\", \"2.0\", \"3.0\"]\n //Add the Vector in the list of normals\n normals.push(new Vector3(\n parseFloat(result[1]),\n parseFloat(result[2]),\n parseFloat(result[3])\n ));\n\n } else if ((result = this.uvPattern.exec(line)) !== null) {\n //Create a Vector2 with the normals u, v\n //Value of result\n // [\"vt 0.1 0.2 0.3\", \"0.1\", \"0.2\"]\n //Add the Vector in the list of uvs\n uvs.push(new Vector2(\n parseFloat(result[1]) * OBJFileLoader.UV_SCALING.x,\n parseFloat(result[2]) * OBJFileLoader.UV_SCALING.y\n ));\n\n //Identify patterns of faces\n //Face could be defined in different type of pattern\n } else if ((result = this.facePattern3.exec(line)) !== null) {\n //Value of result:\n //[\"f 1/1/1 2/2/2 3/3/3\", \"1/1/1 2/2/2 3/3/3\"...]\n\n //Set the data for this face\n setDataForCurrentFaceWithPattern3(\n result[1].trim().split(\" \"), // [\"1/1/1\", \"2/2/2\", \"3/3/3\"]\n 1\n );\n\n } else if ((result = this.facePattern4.exec(line)) !== null) {\n //Value of result:\n //[\"f 1//1 2//2 3//3\", \"1//1 2//2 3//3\"...]\n\n //Set the data for this face\n setDataForCurrentFaceWithPattern4(\n result[1].trim().split(\" \"), // [\"1//1\", \"2//2\", \"3//3\"]\n 1\n );\n\n } else if ((result = this.facePattern5.exec(line)) !== null) {\n //Value of result:\n //[\"f -1/-1/-1 -2/-2/-2 -3/-3/-3\", \"-1/-1/-1 -2/-2/-2 -3/-3/-3\"...]\n\n //Set the data for this face\n setDataForCurrentFaceWithPattern5(\n result[1].trim().split(\" \"), // [\"-1/-1/-1\", \"-2/-2/-2\", \"-3/-3/-3\"]\n 1\n );\n\n } else if ((result = this.facePattern2.exec(line)) !== null) {\n //Value of result:\n //[\"f 1/1 2/2 3/3\", \"1/1 2/2 3/3\"...]\n\n //Set the data for this face\n setDataForCurrentFaceWithPattern2(\n result[1].trim().split(\" \"), // [\"1/1\", \"2/2\", \"3/3\"]\n 1\n );\n\n } else if ((result = this.facePattern1.exec(line)) !== null) {\n //Value of result\n //[\"f 1 2 3\", \"1 2 3\"...]\n\n //Set the data for this face\n setDataForCurrentFaceWithPattern1(\n result[1].trim().split(\" \"), // [\"1\", \"2\", \"3\"]\n 1\n );\n\n //Define a mesh or an object\n //Each time this keyword is analysed, create a new Object with all data for creating a babylonMesh\n } else if (this.group.test(line) || this.obj.test(line)) {\n //Create a new mesh corresponding to the name of the group.\n //Definition of the mesh\n var objMesh: MeshObject = {\n name: line.substring(2).trim(), //Set the name of the current obj mesh\n indices: undefined,\n positions: undefined,\n normals: undefined,\n uvs: undefined,\n colors: undefined,\n materialName: \"\"\n };\n addPreviousObjMesh();\n\n //Push the last mesh created with only the name\n meshesFromObj.push(objMesh);\n\n //Set this variable to indicate that now meshesFromObj has objects defined inside\n hasMeshes = true;\n isFirstMaterial = true;\n increment = 1;\n //Keyword for applying a material\n } else if (this.usemtl.test(line)) {\n //Get the name of the material\n materialNameFromObj = line.substring(7).trim();\n\n //If this new material is in the same mesh\n\n if (!isFirstMaterial || !hasMeshes) {\n //Set the data for the previous mesh\n addPreviousObjMesh();\n //Create a new mesh\n var objMesh: MeshObject =\n //Set the name of the current obj mesh\n {\n name: (objMeshName || \"mesh\") + \"_mm\" + increment.toString(), //Set the name of the current obj mesh\n indices: undefined,\n positions: undefined,\n normals: undefined,\n uvs: undefined,\n colors: undefined,\n materialName: materialNameFromObj\n };\n increment++;\n //If meshes are already defined\n meshesFromObj.push(objMesh);\n hasMeshes = true;\n }\n //Set the material name if the previous line define a mesh\n\n if (hasMeshes && isFirstMaterial) {\n //Set the material name to the previous mesh (1 material per mesh)\n meshesFromObj[meshesFromObj.length - 1].materialName = materialNameFromObj;\n isFirstMaterial = false;\n }\n //Keyword for loading the mtl file\n } else if (this.mtllib.test(line)) {\n //Get the name of mtl file\n fileToLoad = line.substring(7).trim();\n\n //Apply smoothing\n } else if (this.smooth.test(line)) {\n // smooth shading => apply smoothing\n //Today I don't know it work with babylon and with obj.\n //With the obj file an integer is set\n } else {\n //If there is another possibility\n console.log(\"Unhandled expression at line : \" + line);\n }\n }\n\n //At the end of the file, add the last mesh into the meshesFromObj array\n if (hasMeshes) {\n //Set the data for the last mesh\n handledMesh = meshesFromObj[meshesFromObj.length - 1];\n\n //Reverse indices for displaying faces in the good sense\n indicesForBabylon.reverse();\n //Get the good array\n unwrapData();\n //Set array\n handledMesh.indices = indicesForBabylon;\n handledMesh.positions = unwrappedPositionsForBabylon;\n handledMesh.normals = unwrappedNormalsForBabylon;\n handledMesh.uvs = unwrappedUVForBabylon;\n\n if (this._meshLoadOptions.ImportVertexColors === true) {\n handledMesh.colors = unwrappedColorsForBabylon;\n }\n }\n\n //If any o or g keyword found, create a mesh with a random id\n if (!hasMeshes) {\n // reverse tab of indices\n indicesForBabylon.reverse();\n //Get positions normals uvs\n unwrapData();\n //Set data for one mesh\n meshesFromObj.push({\n name: Geometry.RandomId(),\n indices: indicesForBabylon,\n positions: unwrappedPositionsForBabylon,\n colors: unwrappedColorsForBabylon,\n normals: unwrappedNormalsForBabylon,\n uvs: unwrappedUVForBabylon,\n materialName: materialNameFromObj\n });\n }\n\n //Create a Mesh list\n var babylonMeshesArray: Array<Mesh> = []; //The mesh for babylon\n var materialToUse = new Array<string>();\n\n //Set data for each mesh\n for (var j = 0; j < meshesFromObj.length; j++) {\n\n //check meshesNames (stlFileLoader)\n if (meshesNames && meshesFromObj[j].name) {\n if (meshesNames instanceof Array) {\n if (meshesNames.indexOf(meshesFromObj[j].name) === -1) {\n continue;\n }\n }\n else {\n if (meshesFromObj[j].name !== meshesNames) {\n continue;\n }\n }\n }\n\n //Get the current mesh\n //Set the data with VertexBuffer for each mesh\n handledMesh = meshesFromObj[j];\n //Create a Mesh with the name of the obj mesh\n\n scene._blockEntityCollection = this._forAssetContainer;\n var babylonMesh = new Mesh(meshesFromObj[j].name, scene);\n scene._blockEntityCollection = false;\n\n //Push the name of the material to an array\n //This is indispensable for the importMesh function\n materialToUse.push(meshesFromObj[j].materialName);\n\n var vertexData: VertexData = new VertexData(); //The container for the values\n //Set the data for the babylonMesh\n vertexData.uvs = handledMesh.uvs as FloatArray;\n vertexData.indices = handledMesh.indices as IndicesArray;\n vertexData.positions = handledMesh.positions as FloatArray;\n if (this._meshLoadOptions.ComputeNormals === true) {\n let normals: Array<number> = new Array<number>();\n VertexData.ComputeNormals(handledMesh.positions, handledMesh.indices, normals);\n vertexData.normals = normals;\n } else {\n vertexData.normals = handledMesh.normals as FloatArray;\n }\n if (this._meshLoadOptions.ImportVertexColors === true) {\n vertexData.colors = handledMesh.colors as FloatArray;\n }\n //Set the data from the VertexBuffer to the current Mesh\n vertexData.applyToMesh(babylonMesh);\n if (this._meshLoadOptions.InvertY) {\n babylonMesh.scaling.y *= -1;\n }\n if (this._meshLoadOptions.OptimizeNormals === true) {\n this._optimizeNormals(babylonMesh);\n }\n\n //Push the mesh into an array\n babylonMeshesArray.push(babylonMesh);\n }\n\n let mtlPromises: Array<Promise<void>> = [];\n //load the materials\n //Check if we have a file to load\n if (fileToLoad !== \"\" && this._meshLoadOptions.SkipMaterials === false) {\n //Load the file synchronously\n mtlPromises.push(new Promise((resolve, reject) => {\n this._loadMTL(fileToLoad, rootUrl, (dataLoaded) => {\n try {\n //Create materials thanks MTLLoader function\n materialsFromMTLFile.parseMTL(scene, dataLoaded, rootUrl, this._forAssetContainer);\n //Look at each material loaded in the mtl file\n for (var n = 0; n < materialsFromMTLFile.materials.length; n++) {\n //Three variables to get all meshes with the same material\n var startIndex = 0;\n var _indices = [];\n var _index;\n\n //The material from MTL file is used in the meshes loaded\n //Push the indice in an array\n //Check if the material is not used for another mesh\n while ((_index = materialToUse.indexOf(materialsFromMTLFile.materials[n].name, startIndex)) > -1) {\n _indices.push(_index);\n startIndex = _index + 1;\n }\n //If the material is not used dispose it\n if (_index === -1 && _indices.length === 0) {\n //If the material is not needed, remove it\n materialsFromMTLFile.materials[n].dispose();\n } else {\n for (var o = 0; o < _indices.length; o++) {\n //Apply the material to the Mesh for each mesh with the material\n babylonMeshesArray[_indices[o]].material = materialsFromMTLFile.materials[n];\n }\n }\n }\n resolve();\n } catch (e) {\n Tools.Warn(`Error processing MTL file: '${fileToLoad}'`);\n if (this._meshLoadOptions.MaterialLoadingFailsSilently) {\n resolve();\n } else {\n reject(e);\n }\n }\n }, (pathOfFile: string, exception?: any) => {\n Tools.Warn(`Error downloading MTL file: '${fileToLoad}'`);\n if (this._meshLoadOptions.MaterialLoadingFailsSilently) {\n resolve();\n } else {\n reject(exception);\n }\n });\n }));\n\n }\n //Return an array with all Mesh\n return Promise.all(mtlPromises).then(() => {\n return babylonMeshesArray;\n });\n }\n\n}\n\nif (SceneLoader) {\n //Add this loader into the register plugin\n SceneLoader.RegisterPlugin(new OBJFileLoader());\n}"]}
|
1
|
+
{"version":3,"file":"objFileLoader.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/OBJ/objFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD,OAAO,EAAE,WAAW,EAA8H,MAAM,qCAAqC,CAAC;A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UAAC,UAAkB,EAAE,SAAe;oBACnC,KAAK,CAAC,IAAI,CAAC,kCAAgC,UAAU,MAAG,CAAC,CAAC;oBAC1D,IAAI,KAAI,CAAC,eAAe,CAAC,4BAA4B,EAAE;wBACnD,OAAO,EAAE,CAAC;qBACb;yBAAM;wBACH,MAAM,CAAC,SAAS,CAAC,CAAC;qBACrB;gBACL,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC,CAAC;SAEP;QACD,+BAA+B;QAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;YACjC,OAAO,kBAAkB,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IA1SD;;OAEG;IACW,8BAAgB,GAAG,IAAI,CAAC;IACtC;;OAEG;IACW,sBAAQ,GAAG,KAAK,CAAC;IAY/B;;OAEG;IACW,kCAAoB,GAAG,KAAK,CAAC;IAC3C;;OAEG;IACW,6BAAe,GAAG,KAAK,CAAC;IACtC;;;OAGG;IACW,8BAAgB,GAAG,KAAK,CAAC;IACvC;;OAEG;IACW,wBAAU,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7C;;OAEG;IACW,4BAAc,GAAG,KAAK,CAAC;IAErC;;;;OAIG;IACW,6CAA+B,GAAG,IAAI,CAAC;IA8PzD,oBAAC;CAAA,AA9SD,IA8SC;SA9SY,aAAa;AAgT1B,IAAI,WAAW,EAAE;IACb,0CAA0C;IAC1C,WAAW,CAAC,cAAc,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;CACnD","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { Vector2 } from \"@babylonjs/core/Maths/math.vector\";\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\nimport { SceneLoader, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderAsyncResult } from \"@babylonjs/core/Loading/sceneLoader\";\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\nimport { Scene } from \"@babylonjs/core/scene\";\nimport { WebRequest } from '@babylonjs/core/Misc/webRequest';\nimport { MTLFileLoader } from './mtlFileLoader';\nimport { OBJLoadingOptions } from \"./objLoadingOptions\";\nimport { SolidParser } from \"./solidParser\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\n\n/**\n * OBJ file type loader.\n * This is a babylon scene loader plugin.\n */\nexport class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\n\n /**\n * Defines if UVs are optimized by default during load.\n */\n public static OPTIMIZE_WITH_UV = true;\n /**\n * Invert model on y-axis (does a model scaling inversion)\n */\n public static INVERT_Y = false;\n /**\n * Invert Y-Axis of referenced textures on load\n */\n public static get INVERT_TEXTURE_Y() {\n return MTLFileLoader.INVERT_TEXTURE_Y;\n }\n\n public static set INVERT_TEXTURE_Y(value: boolean) {\n MTLFileLoader.INVERT_TEXTURE_Y = value;\n }\n\n /**\n * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.\n */\n public static IMPORT_VERTEX_COLORS = false;\n /**\n * Compute the normals for the model, even if normals are present in the file.\n */\n public static COMPUTE_NORMALS = false;\n /**\n * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.\n * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.\n */\n public static OPTIMIZE_NORMALS = false;\n /**\n * Defines custom scaling of UV coordinates of loaded meshes.\n */\n public static UV_SCALING = new Vector2(1, 1);\n /**\n * Skip loading the materials even if defined in the OBJ file (materials are ignored).\n */\n public static SKIP_MATERIALS = false;\n\n /**\n * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.\n *\n * Defaults to true for backwards compatibility.\n */\n public static MATERIAL_LOADING_FAILS_SILENTLY = true;\n /**\n * Defines the name of the plugin.\n */\n public name = \"obj\";\n /**\n * Defines the extension the plugin is able to load.\n */\n public extensions = \".obj\";\n\n private _assetContainer: Nullable<AssetContainer> = null;\n\n private _loadingOptions: OBJLoadingOptions;\n\n /**\n * Creates loader for .OBJ files\n *\n * @param loadingOptions options for loading and parsing OBJ/MTL files.\n */\n constructor(loadingOptions?: OBJLoadingOptions) {\n this._loadingOptions = loadingOptions || OBJFileLoader.DefaultLoadingOptions;\n }\n\n private static get DefaultLoadingOptions(): OBJLoadingOptions {\n return {\n computeNormals: OBJFileLoader.COMPUTE_NORMALS,\n optimizeNormals: OBJFileLoader.OPTIMIZE_NORMALS,\n importVertexColors: OBJFileLoader.IMPORT_VERTEX_COLORS,\n invertY: OBJFileLoader.INVERT_Y,\n invertTextureY: OBJFileLoader.INVERT_TEXTURE_Y,\n UVScaling: OBJFileLoader.UV_SCALING,\n materialLoadingFailsSilently: OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY,\n optimizeWithUV: OBJFileLoader.OPTIMIZE_WITH_UV,\n skipMaterials: OBJFileLoader.SKIP_MATERIALS\n };\n }\n\n /**\n * Calls synchronously the MTL file attached to this obj.\n * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.\n * Without this function materials are not displayed in the first frame (but displayed after).\n * In consequence it is impossible to get material information in your HTML file\n *\n * @param url The URL of the MTL file\n * @param rootUrl defines where to load data from\n * @param onSuccess Callback function to be called when the MTL file is loaded\n */\n private _loadMTL(url: string, rootUrl: string, onSuccess: (response: string | ArrayBuffer, responseUrl?: string) => any, onFailure: (pathOfFile: string, exception?: any) => void) {\n //The complete path to the mtl file\n var pathOfFile = rootUrl + url;\n\n // Loads through the babylon tools to allow fileInput search.\n Tools.LoadFile(\n pathOfFile,\n onSuccess,\n undefined,\n undefined,\n false,\n (request?: WebRequest | undefined, exception?: any) => {\n onFailure(pathOfFile, exception);\n }\n );\n }\n\n /**\n * Instantiates a OBJ file loader plugin.\n * @returns the created plugin\n */\n createPlugin(): ISceneLoaderPluginAsync | ISceneLoaderPlugin {\n return new OBJFileLoader(OBJFileLoader.DefaultLoadingOptions);\n }\n\n /**\n * If the data string can be loaded directly.\n *\n * @param data string containing the file data\n * @returns if the data can be loaded directly\n */\n public canDirectLoad(data: string): boolean {\n return false;\n }\n\n /**\n * Imports one or more meshes from the loaded OBJ data and adds them to the scene\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\n * @param scene the scene the meshes should be added to\n * @param data the OBJ data to load\n * @param rootUrl root url to load from\n * @param onProgress event that fires when loading progress has occured\n * @param fileName Defines the name of the file to load\n * @returns a promise containg the loaded meshes, particles, skeletons and animations\n */\n public importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult> {\n //get the meshes from OBJ file\n return this._parseSolid(meshesNames, scene, data, rootUrl).then((meshes) => {\n return {\n meshes: meshes,\n particleSystems: [],\n skeletons: [],\n animationGroups: [],\n transformNodes: [],\n geometries: [],\n lights: []\n };\n });\n }\n\n /**\n * Imports all objects from the loaded OBJ data and adds them to the scene\n * @param scene the scene the objects should be added to\n * @param data the OBJ data to load\n * @param rootUrl root url to load from\n * @param onProgress event that fires when loading progress has occured\n * @param fileName Defines the name of the file to load\n * @returns a promise which completes when objects have been loaded to the scene\n */\n public loadAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\n //Get the 3D model\n return this.importMeshAsync(null, scene, data, rootUrl, onProgress).then(() => {\n // return void\n });\n }\n\n /**\n * Load into an asset container.\n * @param scene The scene to load into\n * @param data The data to import\n * @param rootUrl The root url for scene and resources\n * @param onProgress The callback when the load progresses\n * @param fileName Defines the name of the file to load\n * @returns The loaded asset container\n */\n public loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer> {\n var container = new AssetContainer(scene);\n this._assetContainer = container;\n\n return this.importMeshAsync(null, scene, data, rootUrl).then((result) => {\n result.meshes.forEach((mesh) => container.meshes.push(mesh));\n result.meshes.forEach((mesh) => {\n var material = mesh.material;\n if (material) {\n // Materials\n if (container.materials.indexOf(material) == -1) {\n container.materials.push(material);\n\n // Textures\n var textures = material.getActiveTextures();\n textures.forEach((t) => {\n if (container.textures.indexOf(t) == -1) {\n container.textures.push(t);\n }\n });\n }\n }\n });\n this._assetContainer = null;\n return container;\n }).catch((ex) => {\n this._assetContainer = null;\n throw ex;\n });\n }\n\n /**\n * Read the OBJ file and create an Array of meshes.\n * Each mesh contains all information given by the OBJ and the MTL file.\n * i.e. vertices positions and indices, optional normals values, optional UV values, optional material\n * @param meshesNames defines a string or array of strings of the mesh names that should be loaded from the file\n * @param scene defines the scene where are displayed the data\n * @param data defines the content of the obj file\n * @param rootUrl defines the path to the folder\n * @returns the list of loaded meshes\n */\n private _parseSolid(meshesNames: any, scene: Scene, data: string, rootUrl: string): Promise<Array<AbstractMesh>> {\n var fileToLoad: string = \"\"; //The name of the mtlFile to load\n var materialsFromMTLFile: MTLFileLoader = new MTLFileLoader();\n var materialToUse = new Array<string>();\n var babylonMeshesArray: Array<Mesh> = []; //The mesh for babylon\n\n // Main function\n const solidParser = new SolidParser(materialToUse, babylonMeshesArray, this._loadingOptions);\n\n solidParser.parse(meshesNames, data, scene, this._assetContainer, (fileName: string) => {\n fileToLoad = fileName;\n });\n\n // load the materials\n let mtlPromises: Array<Promise<void>> = [];\n // Check if we have a file to load\n if (fileToLoad !== \"\" && !this._loadingOptions.skipMaterials) {\n //Load the file synchronously\n mtlPromises.push(new Promise((resolve, reject) => {\n this._loadMTL(fileToLoad, rootUrl, (dataLoaded) => {\n try {\n //Create materials thanks MTLLoader function\n materialsFromMTLFile.parseMTL(scene, dataLoaded, rootUrl, this._assetContainer);\n //Look at each material loaded in the mtl file\n for (var n = 0; n < materialsFromMTLFile.materials.length; n++) {\n //Three variables to get all meshes with the same material\n var startIndex = 0;\n var _indices = [];\n var _index;\n\n //The material from MTL file is used in the meshes loaded\n //Push the indice in an array\n //Check if the material is not used for another mesh\n while ((_index = materialToUse.indexOf(materialsFromMTLFile.materials[n].name, startIndex)) > -1) {\n _indices.push(_index);\n startIndex = _index + 1;\n }\n //If the material is not used dispose it\n if (_index === -1 && _indices.length === 0) {\n //If the material is not needed, remove it\n materialsFromMTLFile.materials[n].dispose();\n } else {\n for (var o = 0; o < _indices.length; o++) {\n //Apply the material to the Mesh for each mesh with the material\n const mesh = babylonMeshesArray[_indices[o]];\n const material = materialsFromMTLFile.materials[n];\n mesh.material = material;\n\n if (!mesh.getTotalIndices()) {\n // No indices, we need to turn on point cloud\n material.pointsCloud = true;\n }\n }\n }\n }\n resolve();\n } catch (e) {\n Tools.Warn(`Error processing MTL file: '${fileToLoad}'`);\n if (this._loadingOptions.materialLoadingFailsSilently) {\n resolve();\n } else {\n reject(e);\n }\n }\n }, (pathOfFile: string, exception?: any) => {\n Tools.Warn(`Error downloading MTL file: '${fileToLoad}'`);\n if (this._loadingOptions.materialLoadingFailsSilently) {\n resolve();\n } else {\n reject(exception);\n }\n });\n }));\n\n }\n //Return an array with all Mesh\n return Promise.all(mtlPromises).then(() => {\n return babylonMeshesArray;\n });\n }\n\n}\n\nif (SceneLoader) {\n //Add this loader into the register plugin\n SceneLoader.RegisterPlugin(new OBJFileLoader());\n}"]}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Vector2 } from "@babylonjs/core/Maths/math.vector";
|
2
|
+
/**
|
3
|
+
* Options for loading OBJ/MTL files
|
4
|
+
*/
|
5
|
+
export declare type OBJLoadingOptions = {
|
6
|
+
/**
|
7
|
+
* Defines if UVs are optimized by default during load.
|
8
|
+
*/
|
9
|
+
optimizeWithUV: boolean;
|
10
|
+
/**
|
11
|
+
* Defines custom scaling of UV coordinates of loaded meshes.
|
12
|
+
*/
|
13
|
+
UVScaling: Vector2;
|
14
|
+
/**
|
15
|
+
* Invert model on y-axis (does a model scaling inversion)
|
16
|
+
*/
|
17
|
+
invertY: boolean;
|
18
|
+
/**
|
19
|
+
* Invert Y-Axis of referenced textures on load
|
20
|
+
*/
|
21
|
+
invertTextureY: boolean;
|
22
|
+
/**
|
23
|
+
* Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
|
24
|
+
*/
|
25
|
+
importVertexColors: boolean;
|
26
|
+
/**
|
27
|
+
* Compute the normals for the model, even if normals are present in the file.
|
28
|
+
*/
|
29
|
+
computeNormals: boolean;
|
30
|
+
/**
|
31
|
+
* Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.
|
32
|
+
* Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.
|
33
|
+
*/
|
34
|
+
optimizeNormals: boolean;
|
35
|
+
/**
|
36
|
+
* Skip loading the materials even if defined in the OBJ file (materials are ignored).
|
37
|
+
*/
|
38
|
+
skipMaterials: boolean;
|
39
|
+
/**
|
40
|
+
* When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
|
41
|
+
*/
|
42
|
+
materialLoadingFailsSilently: boolean;
|
43
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"objLoadingOptions.js","sourceRoot":"","sources":["../../../sourceES6/loaders/src/OBJ/objLoadingOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { Vector2 } from \"@babylonjs/core/Maths/math.vector\";\r\n\r\n/**\r\n * Options for loading OBJ/MTL files\r\n */\r\nexport type OBJLoadingOptions = {\r\n /**\r\n * Defines if UVs are optimized by default during load.\r\n */\r\n optimizeWithUV: boolean,\r\n /**\r\n * Defines custom scaling of UV coordinates of loaded meshes.\r\n */\r\n UVScaling: Vector2;\r\n /**\r\n * Invert model on y-axis (does a model scaling inversion)\r\n */\r\n invertY: boolean,\r\n /**\r\n * Invert Y-Axis of referenced textures on load\r\n */\r\n invertTextureY: boolean;\r\n /**\r\n * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.\r\n */\r\n importVertexColors: boolean,\r\n /**\r\n * Compute the normals for the model, even if normals are present in the file.\r\n */\r\n computeNormals: boolean,\r\n /**\r\n * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.\r\n * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.\r\n */\r\n optimizeNormals: boolean,\r\n /**\r\n * Skip loading the materials even if defined in the OBJ file (materials are ignored).\r\n */\r\n skipMaterials: boolean,\r\n /**\r\n * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.\r\n */\r\n materialLoadingFailsSilently: boolean\r\n};\r\n"]}
|
@@ -0,0 +1,153 @@
|
|
1
|
+
import { AssetContainer } from "@babylonjs/core/assetContainer";
|
2
|
+
import { Mesh } from "@babylonjs/core/Meshes/mesh";
|
3
|
+
import { Scene } from "@babylonjs/core/scene";
|
4
|
+
import { Nullable } from "@babylonjs/core/types";
|
5
|
+
import { OBJLoadingOptions } from "./objLoadingOptions";
|
6
|
+
/**
|
7
|
+
* Class used to load mesh data from OBJ content
|
8
|
+
*/
|
9
|
+
export declare class SolidParser {
|
10
|
+
/** Object descriptor */
|
11
|
+
static ObjectDescriptor: RegExp;
|
12
|
+
/** Group descriptor */
|
13
|
+
static GroupDescriptor: RegExp;
|
14
|
+
/** Material lib descriptor */
|
15
|
+
static MtlLibGroupDescriptor: RegExp;
|
16
|
+
/** Use a material descriptor */
|
17
|
+
static UseMtlDescriptor: RegExp;
|
18
|
+
/** Smooth descriptor */
|
19
|
+
static SmoothDescriptor: RegExp;
|
20
|
+
/** Pattern used to detect a vertex */
|
21
|
+
static VertexPattern: RegExp;
|
22
|
+
/** Pattern used to detect a normal */
|
23
|
+
static NormalPattern: RegExp;
|
24
|
+
/** Pattern used to detect a UV set */
|
25
|
+
static UVPattern: RegExp;
|
26
|
+
/** Pattern used to detect a first kind of face (f vertex vertex vertex) */
|
27
|
+
static FacePattern1: RegExp;
|
28
|
+
/** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */
|
29
|
+
static FacePattern2: RegExp;
|
30
|
+
/** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */
|
31
|
+
static FacePattern3: RegExp;
|
32
|
+
/** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/
|
33
|
+
static FacePattern4: RegExp;
|
34
|
+
/** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */
|
35
|
+
static FacePattern5: RegExp;
|
36
|
+
private _loadingOptions;
|
37
|
+
private _positions;
|
38
|
+
private _normals;
|
39
|
+
private _uvs;
|
40
|
+
private _colors;
|
41
|
+
private _meshesFromObj;
|
42
|
+
private _handledMesh;
|
43
|
+
private _indicesForBabylon;
|
44
|
+
private _wrappedPositionForBabylon;
|
45
|
+
private _wrappedUvsForBabylon;
|
46
|
+
private _wrappedColorsForBabylon;
|
47
|
+
private _wrappedNormalsForBabylon;
|
48
|
+
private _tuplePosNorm;
|
49
|
+
private _curPositionInIndices;
|
50
|
+
private _hasMeshes;
|
51
|
+
private _unwrappedPositionsForBabylon;
|
52
|
+
private _unwrappedColorsForBabylon;
|
53
|
+
private _unwrappedNormalsForBabylon;
|
54
|
+
private _unwrappedUVForBabylon;
|
55
|
+
private _triangles;
|
56
|
+
private _materialNameFromObj;
|
57
|
+
private _objMeshName;
|
58
|
+
private _increment;
|
59
|
+
private _isFirstMaterial;
|
60
|
+
private _grayColor;
|
61
|
+
private _materialToUse;
|
62
|
+
private _babylonMeshesArray;
|
63
|
+
/**
|
64
|
+
* Creates a new SolidParser
|
65
|
+
* @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)
|
66
|
+
* @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)
|
67
|
+
* @param loadingOptions defines the loading options to use
|
68
|
+
*/
|
69
|
+
constructor(materialToUse: string[], babylonMeshesArray: Array<Mesh>, loadingOptions: OBJLoadingOptions);
|
70
|
+
/**
|
71
|
+
* Search for obj in the given array.
|
72
|
+
* This function is called to check if a couple of data already exists in an array.
|
73
|
+
*
|
74
|
+
* If found, returns the index of the founded tuple index. Returns -1 if not found
|
75
|
+
* @param arr Array<{ normals: Array<number>, idx: Array<number> }>
|
76
|
+
* @param obj Array<number>
|
77
|
+
* @returns {boolean}
|
78
|
+
*/
|
79
|
+
private _isInArray;
|
80
|
+
private _isInArrayUV;
|
81
|
+
/**
|
82
|
+
* This function set the data for each triangle.
|
83
|
+
* Data are position, normals and uvs
|
84
|
+
* If a tuple of (position, normal) is not set, add the data into the corresponding array
|
85
|
+
* If the tuple already exist, add only their indice
|
86
|
+
*
|
87
|
+
* @param indicePositionFromObj Integer The index in positions array
|
88
|
+
* @param indiceUvsFromObj Integer The index in uvs array
|
89
|
+
* @param indiceNormalFromObj Integer The index in normals array
|
90
|
+
* @param positionVectorFromOBJ Vector3 The value of position at index objIndice
|
91
|
+
* @param textureVectorFromOBJ Vector3 The value of uvs
|
92
|
+
* @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale
|
93
|
+
*/
|
94
|
+
private _setData;
|
95
|
+
/**
|
96
|
+
* Transform Vector() and BABYLON.Color() objects into numbers in an array
|
97
|
+
*/
|
98
|
+
private _unwrapData;
|
99
|
+
/**
|
100
|
+
* Create triangles from polygons
|
101
|
+
* It is important to notice that a triangle is a polygon
|
102
|
+
* We get 5 patterns of face defined in OBJ File :
|
103
|
+
* facePattern1 = ["1","2","3","4","5","6"]
|
104
|
+
* facePattern2 = ["1/1","2/2","3/3","4/4","5/5","6/6"]
|
105
|
+
* facePattern3 = ["1/1/1","2/2/2","3/3/3","4/4/4","5/5/5","6/6/6"]
|
106
|
+
* facePattern4 = ["1//1","2//2","3//3","4//4","5//5","6//6"]
|
107
|
+
* facePattern5 = ["-1/-1/-1","-2/-2/-2","-3/-3/-3","-4/-4/-4","-5/-5/-5","-6/-6/-6"]
|
108
|
+
* Each pattern is divided by the same method
|
109
|
+
* @param face Array[String] The indices of elements
|
110
|
+
* @param v Integer The variable to increment
|
111
|
+
*/
|
112
|
+
private _getTriangles;
|
113
|
+
/**
|
114
|
+
* Create triangles and push the data for each polygon for the pattern 1
|
115
|
+
* In this pattern we get vertice positions
|
116
|
+
* @param face
|
117
|
+
* @param v
|
118
|
+
*/
|
119
|
+
private _setDataForCurrentFaceWithPattern1;
|
120
|
+
/**
|
121
|
+
* Create triangles and push the data for each polygon for the pattern 2
|
122
|
+
* In this pattern we get vertice positions and uvsu
|
123
|
+
* @param face
|
124
|
+
* @param v
|
125
|
+
*/
|
126
|
+
private _setDataForCurrentFaceWithPattern2;
|
127
|
+
/**
|
128
|
+
* Create triangles and push the data for each polygon for the pattern 3
|
129
|
+
* In this pattern we get vertice positions, uvs and normals
|
130
|
+
* @param face
|
131
|
+
* @param v
|
132
|
+
*/
|
133
|
+
private _setDataForCurrentFaceWithPattern3;
|
134
|
+
/**
|
135
|
+
* Create triangles and push the data for each polygon for the pattern 4
|
136
|
+
* In this pattern we get vertice positions and normals
|
137
|
+
* @param face
|
138
|
+
* @param v
|
139
|
+
*/
|
140
|
+
private _setDataForCurrentFaceWithPattern4;
|
141
|
+
private _setDataForCurrentFaceWithPattern5;
|
142
|
+
private _addPreviousObjMesh;
|
143
|
+
private _optimizeNormals;
|
144
|
+
/**
|
145
|
+
* Function used to parse an OBJ string
|
146
|
+
* @param meshesNames defines the list of meshes to load (all if not defined)
|
147
|
+
* @param data defines the OBJ string
|
148
|
+
* @param scene defines the hosting scene
|
149
|
+
* @param assetContainer defines the asset container to load data in
|
150
|
+
* @param onFileToLoadFound defines a callback that will be called if a MTL file is found
|
151
|
+
*/
|
152
|
+
parse(meshesNames: any, data: string, scene: Scene, assetContainer: Nullable<AssetContainer>, onFileToLoadFound: (fileToLoad: string) => void): void;
|
153
|
+
}
|