declare module BABYLON { /** * Class reading and parsing the MTL file bundled with the obj file. */ class MTLFileLoader { materials: BABYLON.StandardMaterial[]; /** * This function will read the mtl file and create each material described inside * This function could be improve by adding : * -some component missing (Ni, Tf...) * -including the specific options available * * @param scene * @param data * @param rootUrl */ parseMTL(scene: BABYLON.Scene, data: string | ArrayBuffer, rootUrl: string): void; /** * Gets the texture for the material. * * If the material is imported from input file, * We sanitize the url to ensure it takes the textre from aside the material. * * @param rootUrl The root url to load from * @param value The value stored in the mtl * @return The Texture */ private static _getTexture; } class OBJFileLoader implements ISceneLoaderPluginAsync { static OPTIMIZE_WITH_UV: boolean; /** * Invert model on y-axis (does a model scaling inversion) */ static INVERT_Y: boolean; /** * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard. */ static IMPORT_VERTEX_COLORS: boolean; /** * Compute the normals for the model, even if normals are present in the file */ static COMPUTE_NORMALS: boolean; name: string; extensions: string; obj: RegExp; group: RegExp; mtllib: RegExp; usemtl: RegExp; smooth: RegExp; vertexPattern: RegExp; normalPattern: RegExp; uvPattern: RegExp; facePattern1: RegExp; facePattern2: RegExp; facePattern3: RegExp; facePattern4: RegExp; facePattern5: RegExp; /** * Calls synchronously the MTL file attached to this obj. * Load function or importMesh function don't enable to load 2 files in the same time asynchronously. * Without this function materials are not displayed in the first frame (but displayed after). * In consequence it is impossible to get material information in your HTML file * * @param url The URL of the MTL file * @param rootUrl * @param onSuccess Callback function to be called when the MTL file is loaded * @private */ private _loadMTL; /** * Imports one or more meshes from the loaded OBJ data and adds them to the scene * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file * @param scene the scene the meshes should be added to * @param data the OBJ data to load * @param rootUrl root url to load from * @param onProgress event that fires when loading progress has occured * @param fileName Defines the name of the file to load * @returns a promise containg the loaded meshes, particles, skeletons and animations */ importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{ meshes: AbstractMesh[]; particleSystems: IParticleSystem[]; skeletons: Skeleton[]; animationGroups: AnimationGroup[]; }>; /** * Imports all objects from the loaded OBJ data and adds them to the scene * * @param scene the scene the objects should be added to * @param data the OBJ data to load * @param rootUrl root url to load from * @param onProgress event that fires when loading progress has occured * @param fileName Defines the name of the file to load * @returns a promise which completes when objects have been loaded to the scene */ loadAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise; /** * Load into an asset container. * @param scene The scene to load into * @param data The data to import * @param rootUrl The root url for scene and resources * @param onProgress The callback when the load progresses * @param fileName Defines the name of the file to load * @returns The loaded asset container */ loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise; /** * Read the OBJ file and create an Array of meshes. * Each mesh contains all information given by the OBJ and the MTL file. * i.e. vertices positions and indices, optional normals values, optional UV values, optional material * * @param meshesNames * @param scene BABYLON.Scene The scene where are displayed the data * @param data String The content of the obj file * @param rootUrl String The path to the folder * @returns Array * @private */ private _parseSolid; } }