/* * WiVRn VR streaming * Copyright (C) 2024 Guillaume Meunier * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include // /usr/include/fmt/chrono.h:2017 template struct fmt::formatter, Char> //: fmt::formatter { // auto parse(basic_format_parse_context& ctx) const -> decltype(ctx.begin()) // { // auto begin = ctx.begin(), end = ctx.end(); // // if (begin != end && *begin == 'L') { // // ++begin; // // localized = true; // // } // return begin; // } auto parse(basic_format_parse_context & ctx) const // -> decltype(ctx.begin()) { return ctx.begin(); } template auto format(const glm::vec & v, FormatContext & ctx) const -> decltype(ctx.out()) { if constexpr (L == 1) { return fmt::format_to(ctx.out(), "[ {} ]", v.x); } if constexpr (L == 2) { return fmt::format_to(ctx.out(), "[ {}, {} ]", v.x, v.y); } if constexpr (L == 3) { return fmt::format_to(ctx.out(), "[ {}, {}, {} ]", v.x, v.y, v.z); } if constexpr (L == 4) { return fmt::format_to(ctx.out(), "[ {}, {}, {}, {} ]", v.x, v.y, v.z, v.w); } // return formatter( // auto time = std::tm(); // time.tm_wday = static_cast(wd.c_encoding()); // detail::get_locale loc(localized, ctx.locale()); // auto w = detail::tm_writer(loc, ctx.out(), time); // w.on_abbr_weekday(); // return w.out(); } }; template struct fmt::formatter, Char> { auto parse(basic_format_parse_context & ctx) const // -> decltype(ctx.begin()) { return ctx.begin(); } template auto format(const glm::qua & q, FormatContext & ctx) const -> decltype(ctx.out()) { return fmt::format_to(ctx.out(), "[ {}, {}, {}, {} ]", q.w, q.x, q.y, q.z); } }; /* template struct fmt::formatter> : fmt::formatter { }; template struct fmt::formatter> : fmt::formatter { };*/