loadTexture2 method
dynamic
loadTexture2(
- dynamic textureIndex
Implementation
loadTexture2(textureIndex) {
var name = this.name;
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 exten = textureDef["extensions"][name];
var source = json["images"][exten["source"]];
var loader = source.uri
? parser.options.manager.getHandler(source.uri)
: parser.textureLoader;
final isSupported = this.detectSupport();
if (isSupported)
return parser.loadTextureImage(textureIndex, source, loader);
if (json["extensionsRequired"] != null &&
json["extensionsRequired"].indexOf(name) >= 0) {
throw ('THREE.GLTFLoader: WebP required by asset but unsupported.');
}
// Fall back to PNG or JPEG.
return parser.loadTexture(textureIndex);
}