Good day.
Have code.
const loadingManager = new THREE.LoadingManager();
loadingManager.setURLModifier(loadAssets);
function loadAssets(url) {
return url;
}
let loader = new THREE.GLTFLoader(loadingManager);
loader.load('img/metal/scene.gltf', handle_load);
function handle_load(gltf){
scene.add( gltf.scene );
}
let gallery = ['img/metal/textures/initialShadingGroup_baseColor.jpeg','img/metal/textures-1/initialShadingGroup_baseColor.jpeg','img/metal/textures-2/initialShadingGroup_baseColor.jpeg'];
let current = 0;
document.addEventListener('click', function () {
current++
current = current % gallery.length;
loadingManager.setURLModifier(loadAssets);
function loadAssets(url) {
if ( url === 'img/metal/textures/initialShadingGroup_baseColor.jpeg' ) {
url = gallery[current]
}
return url;
}
loader.load('img/metal/scene.gltf', handle_load);
})
I have a model with changing textures. Everything is fine, everything works.
The question is, is it possible to change not the textures themselves as I did, but the path to them?
'img/metal/textures/ and 'img/metal/textures-1/
because the textures themselves can have 2 or 3 files.