Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

GLTF importer with C++ Qt



  • Hi !
    I have started writing a GLTF parser with Qt for my pet project (a multi plateform game engine) and so I initially used the Json system : https://github.com/this-engine/this/blob/qt-this/src/extra/gltf_importer.cpp
    But I've noticed Qt already has a GLTF parser in the Qt3D module. Unfortunately I don't see how to use it without using Qt3D as my renderer.
    Anyway I'm stuck at trying to read a data URI :

      "uri" : "data:application/gltf-buffer;base64,AAAIAAcAAAABAAgAAQAJAAgAAQACAAkAAgAKAAkAAgADAAoAAwALAAoAAwAEAAsABAAMAAsABAAFAAwABQANAAwABQAGAA0AAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAQAAAAAAAAAAAAABAQAAAAAAAAAAAAACAQAAAAAAAAAAAAACgQAAAAAAAAAAAAADAQAAAAAAAAAAAAAAAAAAAgD8AAAAAAACAPwAAgD8AAAAAAAAAQAAAgD8AAAAAAABAQAAAgD8AAAAAAACAQAAAgD8AAAAAAACgQAAAgD8AAAAAAADAQAAAgD8AAAAACAAKAAwAAAAAAIA/AAAAQAAAAAAAAEBAAABAQAAAAAAAAKBAAACAQAAAAAA=",
    

    for now, I've detected the type, the base, but how to interpret that long string and convert it to a QByteArray

    Did anyone tried doing gltf import? Did you succeed? Am I missing an obviously simple solution?

    Thank you in advance !


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    As the string suggests, it's base64 encoded. Therefore you can use QByteArray::fromBase64 to load the data that is available after the "base64,".


Log in to reply