loadTexture method
dynamic
loadTexture(
- dynamic textureNode,
- dynamic images
Implementation
loadTexture(textureNode, images) async {
var fileName;
var currentPath = 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) {
textureLoader.setPath(null);
}
}
var texture;
String nodeFileName = textureNode["FileName"];
var extension = nodeFileName.substring(nodeFileName.length - 3).toLowerCase();
if (extension == 'tga') {
var loader = manager.getHandler('.tga');
if (loader == null) {
print('FBXLoader: TGA loader not found, creating placeholder texture for ${textureNode["RelativeFilename"]}');
texture = Texture();
} else {
loader.setPath(textureLoader.path);
texture = loader.load(fileName);
}
} else if (extension == 'psd') {
print(
'FBXLoader: PSD textures are not supported, creating placeholder texture for ${textureNode["RelativeFilename"]}');
texture = Texture();
} else {
texture = await textureLoader.loadAsync(fileName);
}
textureLoader.setPath(currentPath);
return texture;
}