Normally, the file references in GLTF are stored in JSON
In GLTF specification there is the possibility to embed the buffers via a base64 like this sample:
“buffers” : [
“uri” : “data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA=”,
“byteLength” : 44
As far as I understand, the base64 is mirroring the contents of the file referenced (here Ellipse.bin).
Because I want to load the model in one step via WebSocket I have to build a data representation of the model in one data stream, so I have to embed any binary files into the GLTF file.
But when I’m reading the binary file and convert it by WIN32 function
CryptBinaryToString with flags CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF
(which I normally use to make base64 of png’s) and replace the value of uri by data:application/octet-stream;base64,[b64string]
the model is always invalid and cannot be loaded.
So please give me some informations to properly build the base64 uri from bin file. Do I have to call a Babylon function to make it work?