diff options
Diffstat (limited to 'serialize/magnum-color.hpp')
-rw-r--r-- | serialize/magnum-color.hpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/serialize/magnum-color.hpp b/serialize/magnum-color.hpp index 863eb711..0b94e421 100644 --- a/serialize/magnum-color.hpp +++ b/serialize/magnum-color.hpp @@ -1,27 +1,14 @@ #pragma once +#include "magnum-vector.hpp" #include <Magnum/Math/Math.h> #include <nlohmann/json_fwd.hpp> -template<> -struct nlohmann::adl_serializer<Magnum::Color3> { - static void to_json(json& j, const Magnum::Color3& val); - static void from_json(const json& j, Magnum::Color3& val); -}; +namespace nlohmann { -template<> -struct nlohmann::adl_serializer<Magnum::Color4> { - static void to_json(json& j, const Magnum::Color4& val); - static void from_json(const json& j, Magnum::Color4& val); -}; +template<> struct adl_serializer<Magnum::Color3> : nlohmann::adl_serializer<Magnum::Math::Vector<3, float>> {}; +template<> struct adl_serializer<Magnum::Color4> : nlohmann::adl_serializer<Magnum::Math::Vector<4, float>> {}; -template<> -struct nlohmann::adl_serializer<Magnum::Color3ub> { - static void to_json(json& j, const Magnum::Color3ub& val); - static void from_json(const json& j, Magnum::Color3ub& val); -}; +template<> struct adl_serializer<Magnum::Color3ub> : nlohmann::adl_serializer<Magnum::Math::Vector<3, std::uint8_t>> {}; +template<> struct adl_serializer<Magnum::Color4ub> : nlohmann::adl_serializer<Magnum::Math::Vector<4, std::uint8_t>> {}; -template<> -struct nlohmann::adl_serializer<Magnum::Color4ub> { - static void to_json(json& j, const Magnum::Color4ub& val); - static void from_json(const json& j, Magnum::Color4ub& val); -}; +} // namespace nlohmann |