[name]
A loader for loading an .mtl resource, used internaly by [page:OBJLoader] and [page:UTF8Loader].
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.
Constructor
[name]( [param:LoadingManager loadingManager] )
[page:LoadingManager loadingManager] — LoadingManager to use. Defaults to [page:DefaultLoadingManager DefaultLoadingManager]
Creates a new [name].
Properties
Methods
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
[page:String url] — A string containing the path/URL of the .mtl file.
[page:Function onLoad] — (optional) A function to be called after the loading is successfully completed. The function receives the loaded [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator] instance.
[page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains [page:Integer total] and [page:Integer loaded] bytes.
[page:Function 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.
[method:null setPath]( [param:String path] )
[page:String path] — required
Set base path for resolving references. If set this path will be prepended to each loaded and found reference.
[method:null setTexturePath]( [param:String path] )
[page:String path] — required
Set base path for resolving texture references. If set this path will be prepended found texture reference. If not set and setPath is, it will be used as texture base path.
[method:null setCrossOrigin]( [param:boolean useCrossOrigin] )
[page:boolean useCrossOrigin] — required
Set to true if you need to load textures from a different origin.
[method:null setMaterialOptions]( [param:Object options] )
[page:Object options] — required
- side: Which side to apply the material. THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide
- wrap: What type of wrapping to apply for textures. THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping
- normalizeRGB: RGBs need to be normalized to 0-1 from 0-255. Default: false, assumed to be already normalized
- ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. Default: false
- invertTrProperty: Use values 1 of Tr field for fully opaque. This option is useful for obj exported from 3ds MAX, vcglib or meshlab. Default: false
Set of options on how to construct the materials
[method:MTLLoaderMaterialCreator parse]( [param:String text] )
[page:String text] — The textual mtl structure to parse.
Parse a mtl text structure and return a [page:MTLLoaderMaterialCreator] instance.
Source
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/[name].js examples/js/loaders/[name].js]