Search code examples
c++stdstringassimp

Import mesh as std::string using assimp


I am trying to load a mesh in assimp, which I don't provide as a file, rather an std::string read by using pointers provided by the linker, so that I can compile everything into one executable. I am basically searching for a fitting function returning aiScene*. But the only one I found in the manual is ReadFile.


Solution

  • I'm not sure what you mean by storing a file in an std::string, but there is a function called ReadFileFromMemory() that does exactly what you want.

    If for some reason you don't like this option, you can always do a workaround and generate a temporary file from your string and then read it with ReadFile().