load method

  1. @override
dynamic load(
  1. dynamic url,
  2. Function onLoad, [
  3. Function? onProgress,
  4. Function? onError,
])
override

Loads and parses a MTL asset from a URL.

@param {String} url - URL to the MTL file. @param {Function} onLoad - Callback invoked with the loaded object. @param {Function} onProgress - Callback for download progress. @param {Function} onError - Callback for download errors.

@see setPath setResourcePath

@note In order for relative texture references to resolve correctly you must call setResourcePath() explicitly prior to load.

Implementation

@override
load(url, onLoad, [onProgress, onError]) {
  var scope = this;

  var path = (this.path == '') ? LoaderUtils.extractUrlBase(url) : this.path;

  var loader = FileLoader(manager);
  loader.setPath(this.path);
  loader.setRequestHeader(requestHeader);
  loader.setWithCredentials(withCredentials);
  loader.load(url, (text) {
    // try {

    onLoad(scope.parse(text, path));

    // } catch ( e ) {

    // 	if ( onError != null ) {

    // 		onError( e );

    // 	} else {

    // 		print( e );

    // 	}

    // 	scope.manager.itemError( url );

    // }
  }, onProgress, onError);
}