X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=model.cpp;h=107fda0b321317ab54a145d7e1249c08f340abde;hp=efc7f222b9db70856e362cf50b15549b5d5c4d27;hb=d0c631f46c6db417e013b1bc0edec24cb9c2824a;hpb=610bb8ddab4ec871cadfed0a0b66695b8fea41a4 diff --git a/model.cpp b/model.cpp index efc7f22..107fda0 100644 --- a/model.cpp +++ b/model.cpp @@ -314,7 +314,7 @@ Model::Model(const std::string &path, Program p): program(p) { // TODO: handle default material inserted at the end by assimp for (unsigned int i = 0; i < scene->mNumMaterials - 1; i++) { const aiMaterial &material = *scene->mMaterials[i]; - materials.push_back(Material(material, p.progId)); + materials.push_back(Material(material, *scene, p.progId)); } AnimMap *animMap = new AnimMap(); @@ -343,22 +343,22 @@ Model::Model(const std::string &path, Program p): program(p) { root = new Node(*(scene->mRootNode), p.progId, animMap); } -void Model::calcBoneTransforms(aiNode &node, glm::mat4 parentTrans = glm::mat4(1), BoneTransforms boneTrans = BoneTransforms()) { - glm::mat4 animTrans(1.f); - if (animMap->count(std::string(ai.mName.C_Str()))) { - for (const Animation anim: animMap->at(std::string(ai.mName.C_Str()))) { - float t = fmod(tick, anim.duration); - for (const aiNodeAnim *nodeAnim: anim.nodeAnims) { - animTrans *= lerpPosition(nodeAnim, t); - animTrans *= lerpRotation(nodeAnim, t); - animTrans *= lerpScaling(nodeAnim, t); - } - } - } +/* void Model::calcBoneTransforms(aiNode &node, glm::mat4 parentTrans = glm::mat4(1), BoneTransforms boneTrans = BoneTransforms()) { */ +/* glm::mat4 animTrans(1.f); */ +/* if (animMap->count(std::string(ai.mName.C_Str()))) { */ +/* for (const Animation anim: animMap->at(std::string(ai.mName.C_Str()))) { */ +/* float t = fmod(tick, anim.duration); */ +/* for (const aiNodeAnim *nodeAnim: anim.nodeAnims) { */ +/* animTrans *= lerpPosition(nodeAnim, t); */ +/* animTrans *= lerpRotation(nodeAnim, t); */ +/* animTrans *= lerpScaling(nodeAnim, t); */ +/* } */ +/* } */ +/* } */ - glm::mat4 m = parentTrans * animTrans * aiMatrixToMat4(ai.mTransformation) * model; -} +/* glm::mat4 m = parentTrans * animTrans * aiMatrixToMat4(ai.mTransformation) * model; */ +/* } */ void Model::draw(Skybox skybox, const float tick) const { glUseProgram(program.progId);