Add math::trs formatter

This commit is contained in:
Nikita Lisitsa 2026-08-14 16:34:00 +03:00
parent 305d1556c2
commit c96766659c

View file

@ -4,6 +4,8 @@
#include <psemek/math/rotation.hpp>
#include <psemek/math/translation.hpp>
#include <format>
namespace psemek::math
{
@ -86,3 +88,24 @@ namespace psemek::math
};
}
namespace std
{
template <typename T, typename Char>
struct formatter<::psemek::math::trs<T, 3>, Char>
{
template <typename FormatContext>
constexpr auto parse(FormatContext & ctx) const
{
return ctx.begin();
}
template <typename FormatContext>
auto format(::psemek::math::trs<T, 3> const & trs, FormatContext & ctx) const
{
return std::format_to(ctx.out(), "translation: {}\nrotation: {}\nscale: {}", trs.translation, trs.rotation, trs.scale);
}
};
}