I am working on implementing a website that the users cloud be upload their 3d models. And they see it. When i am uploading obj-mtl-texture the force me to use blob url. I have the all textures blob urls one bye one but i dont have parent url. I want load textures to mtl loader how can i do it without setTexturePath() func.
I am trying the export obj model to gltf from three.js.
mtlLoader.setTexturePath(URL.createObjectURL(textureFolder));
mtlLoader.load(URL.createObjectURL(mtlFile), (materials) => {
materials.preload();
objLoader.setMaterials(materials);
objLoader.load(URL.createObjectURL(objFile),
// called when resource is loaded
(object) => {
scene.add(object);
exporter.parse(scene, (gltf) => {
console.log(gltf);
gltfFile = gltf2file(gltf, file.name);
resolve(gltfFile);
});
},
// called when loading is in progresses
(xhr) => {
console.log(`${(xhr.loaded / xhr.total) * 100}% loaded`);
},
// called when loading has errors
(error) => {
console.log(error);
reject(new Error('Error occurred when converting file to gltf'));
});
},
// called when loading is in progresses
(xhr) => {
console.log(`${(xhr.loaded / xhr.total) * 100}% loaded`);
},
// called when loading has errors
(error) => {
console.log('mtl error');
console.log(error);
reject(new Error('Error occurred when converting file to gltf'));
});
});
Is there anyone can show me the way loading textures one bye one without using setTexturePath()
thanks in advence