diff --git a/games/devtest/mods/testentities/models/testentities_cool_guy.png b/games/devtest/mods/testentities/models/testentities_cool_guy.png old mode 100755 new mode 100644 index fcc219ac7..84cc12e44 Binary files a/games/devtest/mods/testentities/models/testentities_cool_guy.png and b/games/devtest/mods/testentities/models/testentities_cool_guy.png differ diff --git a/irr/include/SkinnedMesh.h b/irr/include/SkinnedMesh.h index b4283dbaf..41e726946 100644 --- a/irr/include/SkinnedMesh.h +++ b/irr/include/SkinnedMesh.h @@ -10,6 +10,7 @@ #include "SSkinMeshBuffer.h" #include "aabbox3d.h" #include "irrMath.h" +#include "irrTypes.h" #include "matrix4.h" #include "quaternion.h" #include "vector3d.h" @@ -70,8 +71,11 @@ public: void setAnimationSpeed(f32 fps) override; //! **Must not be called**. - //! TODO refactor Irrlicht so that we need not implement this. - IMesh *getMesh(f32) override { assert(false); }; + IMesh *getMesh(f32) override { + // TODO refactor Irrlicht so that we need not implement this. + _IRR_DEBUG_BREAK_IF(true); + return nullptr; + }; //! Turns the given array of local matrices into an array of global matrices //! by multiplying with respective parent matrices. diff --git a/irr/src/CAnimatedMeshSceneNode.cpp b/irr/src/CAnimatedMeshSceneNode.cpp index 7073d04ef..422875aaa 100644 --- a/irr/src/CAnimatedMeshSceneNode.cpp +++ b/irr/src/CAnimatedMeshSceneNode.cpp @@ -9,6 +9,7 @@ #include "ISceneManager.h" #include "S3DVertex.h" #include "Transform.h" +#include "irrTypes.h" #include "matrix4.h" #include "os.h" #include "SkinnedMesh.h" @@ -549,7 +550,7 @@ void CAnimatedMeshSceneNode::addJoints() ISceneNode *parent = this; if (joint->ParentJointID) parent = PerJoint.SceneNodes.at(*joint->ParentJointID); // exists because of topo. order - assert(parent); + _IRR_DEBUG_BREAK_IF(!parent); const auto *matrix = std::get_if(&joint->transform); PerJoint.SceneNodes.push_back(new CBoneSceneNode( parent, SceneManager, 0, i, joint->Name, diff --git a/irr/src/CXMeshFileLoader.cpp b/irr/src/CXMeshFileLoader.cpp index 90a376134..f2c4e94e6 100644 --- a/irr/src/CXMeshFileLoader.cpp +++ b/irr/src/CXMeshFileLoader.cpp @@ -555,13 +555,7 @@ bool CXMeshFileLoader::parseDataObjectFrame(SkinnedMesh::SJoint *Parent) core::matrix4 matrix; if (!parseDataObjectTransformationMatrix(matrix)) return false; - auto transform = core::Transform::decompose(matrix); - // Try to decompose. If the recomposed matrix equals the old one with a liberal tolerance, use that. - if (transform.buildMatrix().equals(matrix, 1e-5)) { - joint->transform = transform; - } else { - joint->transform = matrix; - } + joint->transform = matrix; } else if (objectName == "Mesh") { /* frame.Meshes.push_back(SXMesh()); diff --git a/irr/src/SkinnedMesh.cpp b/irr/src/SkinnedMesh.cpp index 83a2c0788..cf58121ba 100644 --- a/irr/src/SkinnedMesh.cpp +++ b/irr/src/SkinnedMesh.cpp @@ -412,7 +412,7 @@ void SkinnedMesh::topoSortJoints() { size_t n = AllJoints.size(); - std::vector new_to_old_id; // new id -> old id + std::vector new_to_old_id; std::vector> children(n); for (u16 i = 0; i < n; ++i) { @@ -429,7 +429,6 @@ void SkinnedMesh::topoSortJoints() children[new_to_old_id[i]].end()); } - // old id -> new id std::vector old_to_new_id(n); for (u16 i = 0; i < n; ++i) old_to_new_id[new_to_old_id[i]] = i; diff --git a/src/unittest/test_irr_gltf_mesh_loader.cpp b/src/unittest/test_irr_gltf_mesh_loader.cpp index 6884fe0fe..6cd6f0f1d 100644 --- a/src/unittest/test_irr_gltf_mesh_loader.cpp +++ b/src/unittest/test_irr_gltf_mesh_loader.cpp @@ -394,22 +394,20 @@ SECTION("simple skin") const auto joints = csm->getAllJoints(); REQUIRE(joints.size() == 3); - const auto findJoint = [&](const std::function &predicate) { - for (std::size_t i = 0; i < joints.size(); ++i) { - if (predicate(joints[i])) { - return joints[i]; + const auto findJoint = [&](const std::function &predicate) { + for (const auto *joint : joints) { + if (predicate(joint)) { + return joint; } } throw std::runtime_error("joint not found"); }; // Check the node hierarchy - const auto *parent = findJoint([](auto *joint) { - return !joint->ParentJointID; - }); const auto child = findJoint([&](auto *joint) { - return joint->ParentJointID && *joint->ParentJointID == parent->JointID; + return !!joint->ParentJointID; }); + const auto *parent = joints.at(*child->ParentJointID); SECTION("transformations are correct") {