I've got a problem with returning this const pointer. Using the debugger showed me that the scene is correctly imported and stored in variable scene. After returning scene, the content pointed by scene is lost and cannot be accessed by the class calling loadData().
const aiScene* IOHandler::loadData(const std::string& pFile){
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(pFile,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType);
return scene;
}
(Importer
and aiScene(struct)
are part of the assimp library and cannot be modified)
I assume that the scene is stored on the stack, the return call resets the stackpointer and the content is lost. How to handle such a problem in c++?