loadTexture method
dynamic
loadTexture(
- dynamic textureNode,
- dynamic images
Implementation
loadTexture(textureNode, images) async {
var fileName;
var currentPath = this.textureLoader.path;
var children = connections[textureNode["id"]]["children"];
if (children != null &&
children.length > 0 &&
images[children[0]["ID"]] != null) {
fileName = images[children[0]["ID"]];
if (fileName.indexOf('blob:') == 0 || fileName.indexOf('data:') == 0) {
this.textureLoader.setPath('');
}
}
var texture;
String nodeFileName = textureNode["FileName"];
var extension =
nodeFileName.substring(nodeFileName.length - 3).toLowerCase();
if (extension == 'tga') {
var loader = this.manager.getHandler('.tga');
if (loader == null) {
print(
'FBXLoader: TGA loader not found, creating placeholder texture for ${textureNode["RelativeFilename"]}');
texture = new Texture();
} else {
loader.setPath(this.textureLoader.path);
texture = loader.load(fileName);
}
} else if (extension == 'psd') {
print(
'FBXLoader: PSD textures are not supported, creating placeholder texture for ${textureNode["RelativeFilename"]}');
texture = new Texture();
} else {
texture = await this.textureLoader.loadAsync(fileName);
}
this.textureLoader.setPath(currentPath);
return texture;
}