Add math::trs formatter
This commit is contained in:
parent
305d1556c2
commit
c96766659c
1 changed files with 23 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue