diff options
author | hop311 <hop3114@gmail.com> | 2024-01-17 23:24:39 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-01-18 23:29:40 +0100 |
commit | e33a330129364b4bd632b2fd531a996b8c57cefb (patch) | |
tree | 88365260addebee9d3ac798d484e02ab18f56692 /src/openvic-simulation/types/Colour.hpp | |
parent | b5783116f67c9f7aa9d8d9653e6bda0227f67cd2 (diff) |
Parse missing variables, Logger counting, misc cleanup
Diffstat (limited to 'src/openvic-simulation/types/Colour.hpp')
-rw-r--r-- | src/openvic-simulation/types/Colour.hpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/openvic-simulation/types/Colour.hpp b/src/openvic-simulation/types/Colour.hpp index 38c7b1e..06a6b36 100644 --- a/src/openvic-simulation/types/Colour.hpp +++ b/src/openvic-simulation/types/Colour.hpp @@ -147,15 +147,19 @@ namespace OpenVic { static constexpr basic_colour_t from_integer(integer_type integer) { if constexpr (colour_traits::has_alpha) { - return { colour_traits::red_from_integer(integer), colour_traits::green_from_integer(integer), - colour_traits::blue_from_integer(integer), colour_traits::alpha_from_integer(integer) }; + return { + colour_traits::red_from_integer(integer), colour_traits::green_from_integer(integer), + colour_traits::blue_from_integer(integer), colour_traits::alpha_from_integer(integer) + }; } else { assert( colour_traits::alpha_from_integer(integer) == colour_traits::null || colour_traits::alpha_from_integer(integer) == max_value ); - return { colour_traits::red_from_integer(integer), colour_traits::green_from_integer(integer), - colour_traits::blue_from_integer(integer) }; + return { + colour_traits::red_from_integer(integer), colour_traits::green_from_integer(integer), + colour_traits::blue_from_integer(integer) + }; } } @@ -163,8 +167,10 @@ namespace OpenVic { from_floats(float r, float g, float b, float a = colour_traits::alpha_to_float(max_value)) requires(colour_traits::has_alpha) { - return { colour_traits::red_from_float(r), colour_traits::green_from_float(g), colour_traits::blue_from_float(b), - colour_traits::alpha_from_float(a) }; + return { + colour_traits::red_from_float(r), colour_traits::green_from_float(g), colour_traits::blue_from_float(b), + colour_traits::alpha_from_float(a) + }; } static constexpr basic_colour_t from_floats(float r, float g, float b) @@ -192,13 +198,19 @@ namespace OpenVic { : red(r), green(g), blue(b) {} template<typename _ColourTraits> - requires(_ColourTraits::has_alpha && std::same_as<typename _ColourTraits::value_type, value_type> && std::same_as<typename _ColourTraits::integer_type, integer_type>) + requires( + _ColourTraits::has_alpha && std::same_as<typename _ColourTraits::value_type, value_type> && + std::same_as<typename _ColourTraits::integer_type, integer_type> + ) explicit constexpr basic_colour_t(basic_colour_t<value_type, integer_type, _ColourTraits> const& colour) requires(colour_traits::has_alpha) : basic_colour_t { colour.red, colour.green, colour.blue, colour.alpha } {} template<typename _ColourTraits> - requires(!_ColourTraits::has_alpha && std::same_as<typename _ColourTraits::value_type, value_type> && std::same_as<typename _ColourTraits::integer_type, integer_type>) + requires( + !_ColourTraits::has_alpha && std::same_as<typename _ColourTraits::value_type, value_type> && + std::same_as<typename _ColourTraits::integer_type, integer_type> + ) explicit constexpr basic_colour_t( basic_colour_t<value_type, integer_type, _ColourTraits> const& colour, value_type a = max_value ) @@ -206,7 +218,10 @@ namespace OpenVic { : basic_colour_t { colour.red, colour.green, colour.blue, a } {} template<typename _ColourTraits> - requires(std::same_as<typename _ColourTraits::value_type, value_type> && std::same_as<typename _ColourTraits::integer_type, integer_type>) + requires( + std::same_as<typename _ColourTraits::value_type, value_type> && + std::same_as<typename _ColourTraits::integer_type, integer_type> + ) explicit constexpr basic_colour_t(basic_colour_t<value_type, integer_type, _ColourTraits> const& colour) requires(!colour_traits::has_alpha) : basic_colour_t { colour.red, colour.green, colour.blue } {} |