Capítulo 185 de 859
Class for loading materials. The files are internally loaded via FileLoader.
This loader does not support node materials. Use NodeMaterialLoader instead.
const loader = new THREE.MaterialLoader();
const material = await loader.loadAsync( 'material.json' );
Constructor
| Signature |
|---|
new MaterialLoader( manager : LoadingManager ) |
Properties
| Property | Description |
|---|---|
.textures : Object.<string, Texture> | A dictionary holding textures used by the material. |
Methods
| Method | Description |
|---|---|
.createMaterialFromType( type : string ) : Material | Creates a material for the given type. |
.load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) | Starts loading from the given URL and pass the loaded material to the onLoad() callback. |
.parse( json : Object ) : Material | Parses the given JSON object and returns a material. |
.setTextures( value : Object ) : MaterialLoader | Textures are not embedded in the material JSON so they have to be injected before the loading process starts. |