I'm having a bit of a hard time constructing a tree like structure ussing assimp and openGL
This is called recursively and it should give me this:
parent Model -> child Model (this one should contain a Mesh)
but at the end of the process the parent model contains a child model but the child model in question does not have a mesh
(I checked and the function addMesh is called)
Thanks,
void Model::parseNodes(aiNode* node, const aiScene* scene, Model& parent) {
Model model;
for (size_t i = 0; i < node->mNumMeshes; i++)
{
...
Mesh mesh = createMesh(scene->mMeshes[currentMesh], scene);
model.addMesh(mesh);
}
model.m_localTransform = node->mTransformation * parent.m_localTransform;
parent.addChild(model);
for (size_t i = 0; i < node->mNumChildren; i++)
{
parseNodes(node->mChildren[i], scene, model);
}
}
the signature of the important functions
void addChild(Model& child);
void addMesh(Mesh mesh);