My basis texture is storaged in something like database, but is not served as a static .basis file, the only thing i can get is the arraybuffer or blob of the file.
How could it be loaded and trancoded in BJS?
I tried as below but it doesn’t work.
let imageData = await fetch( `${ BASIS_DATA }` ).then( res => res.arrayBuffer() );
let texture = new InternalTexture( engine );
let loader = new _BasisTextureLoader();
let loadBasisAsync = () => {
return new Promise( ( resolve, reject ) => {
loader.loadData( imageData, texture, () => {
resolve();
});
});
};
await loadBasisAsync();
UPDATE:
I try it again, by setting up a local static .basis file, but BJS show a black texture and pop up a tip [.WebGL-00000271CCED6DD0] GL_INVALID_OPERATION: Invalid compressed image size.
At a first glance I am not sure that three supports uploading mip levels and here it looks like some of the mip maps data might be in a inconsistent state. I am digging more
Basically for the LODs of the texture the size needs to be a multiple of the compressed block size which is not the case with some of the lods for this particular textures. Let me know if that helps.