loadTexture method

dynamic loadTexture(
  1. dynamic url,
  2. dynamic mapping,
  3. dynamic onLoad,
  4. dynamic onProgress,
  5. dynamic onError,
)

Implementation

loadTexture(url, mapping, onLoad, onProgress, onError) async {
  var manager = (this.manager != null) ? this.manager : DefaultLoadingManager;
  var loader = manager.getHandler(url);

  if (loader == null) {
    loader = new TextureLoader(manager);
  }

  if (loader.setCrossOrigin != null) loader.setCrossOrigin(this.crossOrigin);

  // var texture = loader.load( url, onLoad, onProgress, onError );
  var texture = await loader.loadAsync(url, null);

  if (mapping != null) texture.mapping = mapping;

  return texture;
}