A loader for loading an .mtl resource, used internaly by OBJLoader.
The Material Template Library format (MTL) or .MTL File Format is a companion file format to .OBJ that describes surface shading (material) properties of objects within one or more .OBJ files.


MTLLoader(loadingManager : LoadingManager)

loadingManager — LoadingManager to use. Defaults to DefaultLoadingManager

Creates a new MTLLoader.



.load (url : String, onLoad : Function, onProgress : Function, onError : Function) : null

url — A string containing the path/URL of the .mtl file.
onLoad — (optional) A function to be called after the loading is successfully completed. The function receives the loaded MTLLoader.MaterialCreator instance.
onProgress — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains total and loaded bytes.
onError — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.

Begin loading from url and return the loaded material.

.setPath (path : String) : MTLLoader

path — required

Set base path for MTL file.

.setResourcePath (path : String) : MTLLoader

path — required

Set base path for additional resources like textures. If set, this path will be used as the base path.

.setCrossOrigin (value : String) : MTLLoader

value — required

If set, assigns the crossOrigin attribute of the image to the value of crossOrigin, prior to starting the load. Default is "anonymous".

.setMaterialOptions (options : Object) : MTLLoader

options — required

Set of options on how to construct the materials

.parse ([param:String text, param:String path]) : MTLLoaderMaterialCreator

text — The textual mtl structure to parse. path — The path to the MTL file.

Parse a mtl text structure and return a MTLLoaderMaterialCreator instance.


For more info on how to obtain the source code of this module see this page.