Loading gltf, bin and png from the backend

Hello,

I would like to ask help with the following issue: I store my data in a bucket in minio, a folder per each object of visualisation (gltf, bin and optionally png in a folder).

I’d like to render the gltf using relevant files, but it’s not clear to me how to do it without having a folder structure? The data the frontend receives is in form of a byte array encoding a dictionary. The dictionary’s values are gltf, bin, png as byte arrays.

Is there any way to read in all three files?
I use React and .NET
Thank you in advance

If you have the option of packing those files into a single .glb this will be much easier:

npm i -g @gltf-transform/cli

gltf-transform input.gltf output.glb

If that’s not possible for your project, you could look at how I’ve handled loading resources out of ZIP archives here:

2 Likes

Thank you for your prompt response!
Could you please tell me what is the rootPath here?

Is rootFile the zip file?
view(rootFile, rootPath, fileMap)

Thank you in advance

The viewer searches the ZIP for a .glb or .gltf file. If it finds a .gltf file in a subfolder of the zip like path/to/scene.gltf then the rootPath would be something like path/to/, and it resolves links to textures and .bin files relative to that.