diff --git a/openVulkanoCpp/Extensions/FmtFormatter.hpp b/openVulkanoCpp/Extensions/FmtFormatter.hpp index 085a5bc..2c3b9d2 100644 --- a/openVulkanoCpp/Extensions/FmtFormatter.hpp +++ b/openVulkanoCpp/Extensions/FmtFormatter.hpp @@ -14,6 +14,9 @@ #error "Failed to find fmt include" #endif #include "Math/ByteSize.hpp" +#include "Math/Math.hpp" +#include "Math/Range.hpp" +#include "Base/UUID.hpp" #include template<> struct fmt::formatter @@ -42,4 +45,150 @@ template<> struct fmt::formatter : fmt::formatter::format(path.string(), ctx); } +}; + +template +struct fmt::formatter> +{ + template constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const glm::vec<2, T, Q>& v, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "({}, {})", v.x, v.y); + } +}; + +template +struct fmt::formatter> +{ + template constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const glm::vec<3, T, Q>& v, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "({}, {}, {})", v.x, v.y, v.z); + } +}; + +template +struct fmt::formatter> +{ + template constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const glm::vec<4, T, Q>& v, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "({}, {}, {}, {})", v.x, v.y, v.z, v.w); + } +}; + +template +struct fmt::formatter> +{ + template constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const glm::mat<2, 2, T, Q>& m, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "[[{}, {}], [{}, {}]]", + m[0][0], m[1][0], + m[0][1], m[1][1]); + } +}; + +template +struct fmt::formatter> +{ + template constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const glm::mat<3, 3, T, Q>& m, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "[[{}, {}, {}], [{}, {}, {}], [{}, {}, {}]]", + m[0][0], m[1][0], m[2][0], + m[0][1], m[1][1], m[2][1], + m[0][2], m[1][2], m[2][2]); + } +}; + +template +struct fmt::formatter> +{ + template constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const glm::mat<4, 4, T, Q>& m, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "[[{}, {}, {}, {}], [{}, {}, {}, {}], [{}, {}, {}, {}], [{}, {}, {}, {}]]", + m[0][0], m[1][0], m[2][0], m[3][0], + m[0][1], m[1][1], m[2][1], m[3][1], + m[0][2], m[1][2], m[2][2], m[3][2], + m[0][3], m[1][3], m[2][3], m[3][3]); + } +}; + +template +struct fmt::formatter> +{ + template constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const glm::qua& q, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "({}, {}, {}, {})", q.w, q.x, q.y, q.z); + } +}; + +template +struct fmt::formatter> : fmt::formatter +{ + template + constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const OpenVulkano::Math::Range& range, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "[{}, {}]", range.min, range.max); + } +}; + +template<> +struct fmt::formatter : fmt::formatter +{ + template + constexpr auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const OpenVulkano::UUID& uuid, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "{}", uuid.string()); + } }; \ No newline at end of file