1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

DEBUGGERY

This commit is contained in:
Lars Mueller 2025-01-20 22:45:17 +01:00
parent 19ea7c8e50
commit 87213f1591
3 changed files with 23 additions and 1 deletions

View file

@ -111,7 +111,7 @@ core.register_entity("testentities:cool_guy", {
}, },
}, },
on_activate = function(self) 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, end,
}) })

View file

@ -12,6 +12,8 @@
#include "aabbox3d.h" #include "aabbox3d.h"
#include "rect.h" #include "rect.h"
#include <cassert> #include <cassert>
#include "IrrCompileConfig.h" // for IRRLICHT_API
#include <ostream>
namespace irr namespace irr
{ {
@ -87,6 +89,20 @@ public:
{ {
return M[index]; return M[index];
} }
//! Debug print the matrix
friend std::ostream& operator<<(std::ostream& os, const CMatrix4<T>& 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. //! Simple operator for linearly accessing every element of the matrix.
const T &operator[](u32 index) const { return M[index]; } const T &operator[](u32 index) const { return M[index]; }

View file

@ -17,6 +17,7 @@
#include <cassert> #include <cassert>
#include <cstddef> #include <cstddef>
#include <variant> #include <variant>
#include <iostream>
#include <vector> #include <vector>
#include <cassert> #include <cassert>
@ -467,6 +468,7 @@ SkinnedMesh *SkinnedMeshBuilder::finalize()
else else
matrices.push_back(std::get<core::Transform>(joint->transform).buildMatrix()); matrices.push_back(std::get<core::Transform>(joint->transform).buildMatrix());
} }
auto local_matrices = matrices;
calculateGlobalMatrices(matrices); calculateGlobalMatrices(matrices);
@ -481,6 +483,10 @@ SkinnedMesh *SkinnedMeshBuilder::finalize()
SSkinMeshBuffer *Buffer = (*SkinningBuffers)[attachedMeshIdx]; SSkinMeshBuffer *Buffer = (*SkinningBuffers)[attachedMeshIdx];
Buffer->Transformation = matrices[i]; 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(); recalculateBaseBoundingBoxes();