X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=model.cpp;h=3c1ecf4830c2ce95989a09bfb4935cfb7d21d767;hp=a11a0745dd9d4b8d41da1c8a3809fa34384e1037;hb=83eb84c159c8ec75cda9fbeb05e3d5746b54ad53;hpb=fbe4b82329e3fea129cb50141e382e77df04f46b diff --git a/model.cpp b/model.cpp index a11a074..3c1ecf4 100644 --- a/model.cpp +++ b/model.cpp @@ -241,6 +241,9 @@ void Model::Node::draw( const std::vector &meshes, for (std::pair> pair: mesh.boneMap) { std::string nodeName = pair.first; + + if (animMap->count(nodeName) <= 0) break; + unsigned int boneId = pair.second.first; // This is actually an inverse-bind matrix // i.e. position of the mesh in bone space @@ -301,7 +304,7 @@ Model::Model(const aiScene *scene, Program p): program(p) { } // TODO: handle default material inserted at the end by assimp - for (unsigned int i = 0; i < scene->mNumMaterials - 1; i++) { + for (unsigned int i = 0; i < scene->mNumMaterials; i++) { const aiMaterial &material = *scene->mMaterials[i]; materials.push_back(Material(material, *scene, p.progId)); }