diff --git a/games/devtest/mods/testentities/visuals.lua b/games/devtest/mods/testentities/visuals.lua index 26b538e7f..11b330b9a 100644 --- a/games/devtest/mods/testentities/visuals.lua +++ b/games/devtest/mods/testentities/visuals.lua @@ -111,7 +111,7 @@ core.register_entity("testentities:cool_guy", { }, }, on_activate = function(self) - self.object:set_animation({x = 0, y = 29}, 30, 0, true) + self.object:set_animation({x = 15, y = 15}, 0, 0, true) end, }) diff --git a/irr/include/matrix4.h b/irr/include/matrix4.h index 7d9a11ca5..a78784b9c 100644 --- a/irr/include/matrix4.h +++ b/irr/include/matrix4.h @@ -12,6 +12,8 @@ #include "aabbox3d.h" #include "rect.h" #include +#include "IrrCompileConfig.h" // for IRRLICHT_API +#include namespace irr { @@ -87,6 +89,20 @@ public: { return M[index]; } + //! Debug print the matrix + friend std::ostream& operator<<(std::ostream& os, const CMatrix4& matrix) + { + os << "Matrix4:" << std::endl; + for (int row = 0; row < 4; ++row) + { + for (int col = 0; col < 4; ++col) + { + os << matrix(row, col) << " "; + } + os << std::endl; + } + return os; + } //! Simple operator for linearly accessing every element of the matrix. const T &operator[](u32 index) const { return M[index]; } diff --git a/irr/src/SkinnedMesh.cpp b/irr/src/SkinnedMesh.cpp index e9dcc40f5..83f37c869 100644 --- a/irr/src/SkinnedMesh.cpp +++ b/irr/src/SkinnedMesh.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -467,6 +468,7 @@ SkinnedMesh *SkinnedMeshBuilder::finalize() else matrices.push_back(std::get(joint->transform).buildMatrix()); } + auto local_matrices = matrices; calculateGlobalMatrices(matrices); @@ -481,6 +483,10 @@ SkinnedMesh *SkinnedMeshBuilder::finalize() SSkinMeshBuffer *Buffer = (*SkinningBuffers)[attachedMeshIdx]; Buffer->Transformation = matrices[i]; } + std::cout << "Joint Name: " << joint->Name.value_or("unnamed") << std::endl; + std::cout << "Local: " << local_matrices[i] << std::endl; + std::cout << "Global: " << matrices[i] << std::endl; + std::cout << "Global Inverse: " << joint->GlobalInversedMatrix.value() << std::endl; } recalculateBaseBoundingBoxes();