load method

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

Implementation

load(url, onLoad, [onProgress, onError]) {
  var onLoadCallback = (texture, texData) {
    switch (texture.type) {
      case UnsignedByteType:
        texture.encoding = RGBEEncoding;
        texture.minFilter = NearestFilter;
        texture.magFilter = NearestFilter;
        texture.generateMipmaps = false;
        texture.flipY = true;
        break;

      case FloatType:
        texture.encoding = LinearEncoding;
        texture.minFilter = LinearFilter;
        texture.magFilter = LinearFilter;
        texture.generateMipmaps = false;
        texture.flipY = true;
        break;

      case HalfFloatType:
        texture.encoding = LinearEncoding;
        texture.minFilter = LinearFilter;
        texture.magFilter = LinearFilter;
        texture.generateMipmaps = false;
        texture.flipY = true;
        break;
    }

    if (onLoad != null) onLoad(texture);
  };

  return super.load(url, onLoadCallback, onProgress, onError);
}