Open earonesty opened 11 months ago
Try passing textureLoader.load
the asset
instead of asset.localUri
I had this problem today with the latest expo-asset.
Try this:
class LocalIconMesh extends Mesh {
constructor() {
super();
this.geometry = new BoxGeometry(1, 1, 1);
const loader = new TextureLoader();
Asset.loadAsync(require('../assets/icon.png')).then(([{ localUri }]) => {
try {
loader.load(localUri, (texture) => {
this.material = new MeshBasicMaterial({ map: texture });
});
} catch (error) {
console.error(error);
}
});
}
}
@markrickert Thanks for your work. BTW, I think your code is for loading texture from its own package. How can I load a texture from FileSystem? (ex: pick an image from gallery)
Hi @orange4glace, sorry for the late reply. I just added an example in my updated fork. Everything is up to date in my implementation with three 0.166.0 and expo sdk 51.
I added a demo of how to use local file paths via an image picker to the "bouncing balls" demo of my fork. You can check it out here: https://github.com/expo/expo-three/pull/301/commits/e9f0a1d6504f737d703647dd6dec1dc64b562af8
followed this documentation:
https://github.com/expo/expo-three#loading-assets
texture based on remote image won't load:
i believe this has already been fixed in dependent libs, so you just have to update deps