Information of the .gltf file that already exists. Information of the .gltf file that already exists. . . .
"buffers" : [
{
"byteLength" : 472360,
"uri" : "non-existent-file.bin"
}
]
This is my code that I want to change the Buffer URI of this file after loading it first.
> var loader = new GLTFLoader();
>
> loader.load(
> exist_gltf_file_path,
> (gltf) => {
> gltf.buffers[0].uri = gltf.buffers[0].uri.replace("non-existent file.bin", "new_file.bin");
> },
> (xhr) => {
> console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
> },
> (error) => {
> console.log("An error happened");
> } );
Here an error occurs in load because the uri path of the buffer does not exist. I'd like to change my URI before LOAD, what should I do?
You could replace with regex