Texture load duplicate requested

when loading different gltf (separateTextures), it seems to make each load request without sharing textures.

below is the network column of chrome developer tools.

you see multiple load requests with the same request URL.

i think this makes loading slower.

the gltf resources are put together in one folder.

Also, it seems that when Database.IDBStorageEnabled = true, cache files are created and loaded respectively.

Each gltf handles SceneLoader.ImportMeshAsync() as Promise.all().

is it possible to apply a texture already requested in glTFLoader.ts _createTextureAsync(). without calling loadImageAsync()?

please confirm. thank you

Welcome aboard!

cc @bghgary

We retrieve existing textures from an internal cache based on the texture url. I’m not sure that the url passed to the Texture constructor is the same if it comes from different glTF files, even if they point to the same file…

I can’t help for the database storage question, maybe someone else will have the answer.

1 Like

adding @RaananW for the database.

1 Like

The glTF loader doesn’t know about each other, so it only de-dupe requests within the same glTF loader instance. I suppose it’s possible to do this if you want to file a feature request.

I think the loader will certainly use more memory. I don’t know if it will be slower. The browser should be caching to not redownload the urls.

2 Likes

If I understand correctly, the database is actually working as expected?