glbFileList = Array.from((event as DragEvent).dataTransfer.files);
fileListStore = glbFileList.reduce((acc, file) => {
return [...acc, {
name: file.name,
url: URL.createObjectURL(file)
}]
}, []);
console.log(fileListStore.name);
//console.log(fileListStore);
const glbFileNameList = fileListStore.reduce((nameList, glbFile) => ([...nameList, glbFile.name]), []);
console.log(glbFileNameList);
const glbFileURL = fileListStore.reduce((nameList, glbFile)=>([...nameList, glbFile.url]), []);
console.log(glbFileURL);
const fileName = fileListStore[0].name;
const extension = fileName.split('.').pop().toLowerCase();
case 'gltf':
{
gltfCreator(fileListStore[0].url);
break;
}
function gltfCreator(url) {
const loader = new GLTFLoader()
.setCrossOrigin('anonymous');
console.log('gltf', url);
loader.load(
url, (gltf) => {
// called when the resource is loaded
scene.add(gltf.scene);
console.log(url.forEach(URL.revokeObjectURL));
//url.forEach(URL.revokeObjectURL);
},
(xhr) => {
// called while loading is progressing
console.log(`${(xhr.loaded / xhr.total * 100)}% loaded`);
},
(error) => {
// called when loading has errors
console.error('An error happened', error);
},
);
}
with the above code it gives me following error -
where is the issue?