From 842c263d51f0874ca6d3f576d6fd615bc373c466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Nov 2013 20:31:31 +0100 Subject: [PATCH] Color: internal helper function renaming. Will be used also elsewhere than for alpha only. --- src/Color.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Color.h b/src/Color.h index 2cc4e2ba1..08ded9936 100644 --- a/src/Color.h +++ b/src/Color.h @@ -123,11 +123,11 @@ template inline typename BasicColor3::HSV toHSV(typename std::enable return toHSV::FloatingPointType>(Math::normalize::FloatingPointType>>(color)); } -/* Default alpha value */ -template inline constexpr typename std::enable_if::value, T>::type defaultAlpha() { +/* Value for full channel (1.0f for floats, 255 for unsigned byte) */ +template inline constexpr typename std::enable_if::value, T>::type fullChannel() { return T(1); } -template inline constexpr typename std::enable_if::value, T>::type defaultAlpha() { +template inline constexpr typename std::enable_if::value, T>::type fullChannel() { return std::numeric_limits::max(); } @@ -281,7 +281,7 @@ class BasicColor4: public Math::Vector4 { * @param a Alpha value, defaults to 1.0 for floating-point types * and maximum positive value for integral types. */ - constexpr static BasicColor4 fromHSV(HSV hsv, T a = Implementation::defaultAlpha()) { + constexpr static BasicColor4 fromHSV(HSV hsv, T a = Implementation::fullChannel()) { return BasicColor4(Implementation::fromHSV(hsv), a); } /** @overload */ @@ -295,14 +295,14 @@ class BasicColor4: public Math::Vector4 { * RGB components are set to zero, A component is set to 1.0 for * floating-point types and maximum positive value for integral types. */ - constexpr /*implicit*/ BasicColor4(): Math::Vector4(T(0), T(0), T(0), Implementation::defaultAlpha()) {} + constexpr /*implicit*/ BasicColor4(): Math::Vector4(T(0), T(0), T(0), Implementation::fullChannel()) {} /** * @copydoc BasicColor3::BasicColor3(T) * @param alpha Alpha value, defaults to 1.0 for floating-point types * and maximum positive value for integral types. */ - constexpr explicit BasicColor4(T rgb, T alpha = Implementation::defaultAlpha()): Math::Vector4(rgb, rgb, rgb, alpha) {} + constexpr explicit BasicColor4(T rgb, T alpha = Implementation::fullChannel()): Math::Vector4(rgb, rgb, rgb, alpha) {} /** * @brief Constructor @@ -312,7 +312,7 @@ class BasicColor4: public Math::Vector4 { * @param a A value, defaults to 1.0 for floating-point types and * maximum positive value for integral types. */ - constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = Implementation::defaultAlpha()): Math::Vector4(r, g, b, a) {} + constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = Implementation::fullChannel()): Math::Vector4(r, g, b, a) {} /** * @brief Constructor @@ -321,7 +321,7 @@ class BasicColor4: public Math::Vector4 { */ /* Not marked as explicit, because conversion from BasicColor3 to BasicColor4 is fairly common, nearly always with A set to 1 */ - constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = Implementation::defaultAlpha()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} + constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = Implementation::fullChannel()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} /** @copydoc Math::Vector::Vector(const Vector&) */ template constexpr explicit BasicColor4(const Math::Vector<4, U>& other): Math::Vector4(other) {}