From 1e3536e0602d7c7c2abc68f2b25618d328f3e3f6 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 15 Oct 2015 12:45:58 +0200 Subject: [PATCH] Taking the root node transform into account when loading model formats containing scene graph information. Needs more work. --- src/game/Core/Model.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/game/Core/Model.cpp b/src/game/Core/Model.cpp index 0d7cea8..84b4261 100755 --- a/src/game/Core/Model.cpp +++ b/src/game/Core/Model.cpp @@ -29,6 +29,15 @@ dd::Model::Model(std::string fileName) LOG_ERROR("Assimp error: %s", importer.GetErrorString()); return; } + + auto m = scene->mRootNode->mTransformation; + m_Matrix = glm::mat4( + m.a1, m.a2, m.a3, m.a4, + m.b1, m.b2, m.b3, m.b4, + m.c1, m.c2, m.c3, m.c4, + m.d1, m.d2, m.d3, m.d4 + ); + m_Matrix = glm::transpose(m_Matrix); auto meshes = scene->mMeshes;