+std::map<std::string, glm::mat4> Model::calcBoneTransforms(const Node &n, const float tick, const std::set<std::string> bones, const glm::mat4 parentTrans = glm::mat4(1)) const {
+ std::string name = std::string(n.ai.mName.C_Str());
+
+ glm::mat4 m = n.totalTrans(parentTrans, tick);
+
+ BoneTransforms res;
+ if (bones.count(name) > 0)
+ res[std::string(n.ai.mName.C_Str())] = m; // take part in hierarchy
+ else
+ m = glm::mat4(1); // ignore this node transformation
+ for (const auto child: n.getChildren())
+ res.merge(calcBoneTransforms(*child, tick, bones, m));
+ return res;