Class: MTLLoader

MTLLoader


new MTLLoader()

Loads a Wavefront .mtl file specifying materials

Author:
  • angelxuanchang
Source:

Methods


load(url [, onLoad] [, onProgress] [, onError])

Loads and parses a MTL asset from a URL.

Parameters:
Name Type Argument Description
url String

URL to the MTL file.

onLoad function <optional>

Callback invoked with the loaded object.

onProgress function <optional>

Callback for download progress.

onError function <optional>

Callback for download errors.

Source:
See:
  • setPath setTexturePath

setPath(path)

Set base path for resolving references. If set this path will be prepended to each loaded and found reference.

Parameters:
Name Type Description
path String
Source:
See:
  • setTexturePath
Example
mtlLoader.setPath( 'assets/obj/' );
    mtlLoader.load( 'my.mtl', ... );

setTexturePath(path)

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.

Parameters:
Name Type Description
path String
Source:
See:
  • setPath
Example
mtlLoader.setPath( 'assets/obj/' );
    mtlLoader.setTexturePath( 'assets/textures/' );
    mtlLoader.load( 'my.mtl', ... );

parse(text)

Parses a MTL file.

Parameters:
Name Type Description
text String

Content of MTL file

Source:
See:
  • setPath setTexturePath
Returns:
Type
THREE.MTLLoader.MaterialCreator

<static> MaterialCreator(baseUrl, options)

Create a new THREE-MTLLoader.MaterialCreator

Parameters:
Name Type Description
baseUrl

Url relative to which textures are loaded

options

Set of options on how to construct the materials 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

Source: