MaterialLoader
A loader for loading a
Material in JSON format.
Constructor
MaterialLoader( manager )
Creates a new MaterialLoader.
Methods
url — required
onLoad — Will be called when load completes. The argument will be the loaded
Material.
onProgress — Will be called while load progresses. The argument will be the progress event.
onError — Will be called when load errors.
Begin loading from url and return the
Material object that will contain the data.
json — The json object containing the parameters of the Material.
Parse a
JSON structure and create a new
Material of the type
json.type with parameters defined in the json object.
Example
// instantiate a loader var loader = new THREE.MaterialLoader(); // load a resource loader.load( // resource URL 'path/to/material.json', // Function when resource is loaded function ( material ) { object.material = material; }, // Function called when download progresses function ( xhr ) { console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); }, // Function called when download errors function ( xhr ) { console.log( 'An error happened' ); } );
Source
src/loaders/MaterialLoader.js
Edit