loadTexture2 method

dynamic loadTexture2(
  1. dynamic textureIndex
)

Implementation

loadTexture2(textureIndex) {
  var parser = this.parser;
  Map<String, dynamic> json = parser.json;

  Map<String, dynamic> textureDef = json["textures"][textureIndex];

  if (textureDef["extensions"] == null || textureDef["extensions"][name] == null) {
    return null;
  }

  var extension = textureDef["extensions"][name];
  var loader = parser.options["ktx2Loader"];

  if (loader == null) {
    if (json["extensionsRequired"] != null && json["extensionsRequired"].indexOf(name) >= 0) {
      throw ('THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures');
    } else {
      // Assumes that the extension is optional and that a fallback texture is present
      return null;
    }
  }

  return parser.loadTextureImage(textureIndex, extension.source, loader);
}