Hello, I am trying to export a gltf File but the goal is to have only one file without the .bin
BABYLON.GLTF2Export.GLTFAsync(scene, "newName").then((gltf) => {
let blob = gltf.glTFFiles["myGltf" + ".gltf"];
let bin = gltf.glTFFiles["myGltf" + ".bin"];
gltf.downloadFiles();
}
It is possible to download the bin and the gltf file and both can be used together. My goal is to make only one file by encoding the bin and putting it into uri-field in the gltf file. It has probably to be a data:application/octet-stream;base64, encoding. I don’t know how to approach or solve it after few failed attemps. I tried btoa() for encoding.
We don’t have an option for base64 encoded single-file glTF. It probably can be added. Why do you want this? It’s much less efficient than using a GLB.
The reason for it is so you can change the rest of the properties (sans the base64) data, while keeping it all bundled together. I’d say that’s quite useful in many scenarios.
It might be slightly easier to use, but it is not efficient. If the binary part is very small, I suppose it’s okay to use. Generally, if you want a single file for a glTF asset, use glTF-Binary (GLB). Using tools like glTF Tools for vscode, you can easily convert back and forth between .gltf and .glb.