loadAsync method

  1. @override
dynamic loadAsync(
  1. dynamic url
)
override

Implementation

@override
loadAsync(url) async {
  var scope = this;

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

  var loader = FileLoader(manager);
  loader.setPath(this.path);
  loader.setRequestHeader(requestHeader);
  loader.setWithCredentials(withCredentials);

  var text = await loader.loadAsync(url);

  var json = convert.jsonDecode(text);

  var metadata = json.metadata;

  if (metadata == null || metadata.type == null || metadata.type.toLowerCase() == 'geometry') {
    throw ('three.ObjectLoader: Can\'t load $url');
  }

  return await scope.parseAsync(json);
}