-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Description
Description
Currently, all these 3 classes use the THREE.Cache
data structure to store their caches. However, whilst all of them return different values, they all key by URL & it means loading the same URL the second time through a different loader will produce an incorrect result.
Reproduction steps
- Load a file using
FileLoader
- Load a file using
ImageBitmapLoader
- The returned value from
ImageBitmapLoader
will be the value fromFileLoader
, instead of anImageBitmap
Code
import * as THREE from 'three';
THREE.Cache.enabled = true;
const fileLoader = new THREE.FileLoader();
file = await (new Promise((resolve) => {
fileLoader.load(url, (v) => {
resolve(v);
});
}));
const imageBitmapLoader = new THREE.ImageBitmapLoader();
imageBitmap = await (new Promise((resolve) => {
imageBitmapLoader.load(url, (v) => {
resolve(v);
});
}));
if (file === imageBitmap) throw new Error('Incorrect cached data!');
Live example
When on the page, press Enable cache
to see the incorrect result.
Sorry, I'm not familiar with JSFiddle!
Screenshots
No response
Version
r159
Device
No response
Browser
No response
OS
No response