diff --git a/src/Color.h b/src/Color.h index 8e9b6e571..0eacc0c59 100644 --- a/src/Color.h +++ b/src/Color.h @@ -164,7 +164,12 @@ template class BasicColor3: public Math::Vector3 { * floating-point underlying type equivalent to @ref Vector3::xAxis(). * @see @ref green(), @ref blue(), @ref cyan() */ - constexpr static BasicColor3 red(T red = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor3 red(T red = Implementation::fullChannel()) + #else + constexpr static BasicColor3 red(T red = fullChannel()) + #endif + { return Math::Vector3::xAxis(red); } @@ -175,7 +180,12 @@ template class BasicColor3: public Math::Vector3 { * floating-point underlying type equivalent to @ref Vector3::yAxis(). * @see @ref red(), @ref blue(), @ref magenta() */ - constexpr static BasicColor3 green(T green = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor3 green(T green = Implementation::fullChannel()) + #else + constexpr static BasicColor3 green(T green = fullChannel()) + #endif + { return Math::Vector3::yAxis(green); } @@ -186,7 +196,12 @@ template class BasicColor3: public Math::Vector3 { * floating-point underlying type equivalent to @ref Vector3::zAxis(). * @see @ref red(), @ref green(), @ref yellow() */ - constexpr static BasicColor3 blue(T blue = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor3 blue(T blue = Implementation::fullChannel()) + #else + constexpr static BasicColor3 blue(T blue = fullChannel()) + #endif + { return Math::Vector3::zAxis(blue); } @@ -327,6 +342,12 @@ template class BasicColor3: public Math::Vector3 { } MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(3, BasicColor3) + + #ifdef CORRADE_MSVC2013_COMPATIBILITY + private: + template::value, T>::type> constexpr static T fullChannel() { return T(1); } + template::value, T>::type> constexpr static T fullChannel() { return std::numeric_limits::max(); } + #endif }; /** @brief Three-component (RGB) float color */ @@ -361,7 +382,12 @@ class BasicColor4: public Math::Vector4 { * Convenience alternative to e.g. `%Color4(red, 0.0f, 0.0f, alpha)`. * @see @ref green(), @ref blue(), @ref cyan() */ - constexpr static BasicColor4 red(T red = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor4 red(T red = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) + #else + constexpr static BasicColor4 red(T red = fullChannel(), T alpha = fullChannel()) + #endif + { return {red, T(0), T(0), alpha}; } @@ -371,7 +397,12 @@ class BasicColor4: public Math::Vector4 { * Convenience alternative to e.g. `%Color4(0.0f, green, 0.0f, alpha)`. * @see @ref red(), @ref blue(), @ref magenta() */ - constexpr static BasicColor4 green(T green = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor4 green(T green = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) + #else + constexpr static BasicColor4 green(T green = fullChannel(), T alpha = fullChannel()) + #endif + { return {T(0), green, T(0), alpha}; } @@ -381,7 +412,12 @@ class BasicColor4: public Math::Vector4 { * Convenience alternative to e.g. `%Color4(0.0f, 0.0f, blue, alpha)`. * @see @ref red(), @ref green(), @ref yellow() */ - constexpr static BasicColor4 blue(T blue = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor4 blue(T blue = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) + #else + constexpr static BasicColor4 blue(T blue = fullChannel(), T alpha = fullChannel()) + #endif + { return {T(0), T(0), blue, alpha}; } @@ -391,7 +427,12 @@ class BasicColor4: public Math::Vector4 { * Convenience alternative to e.g. `%Color4(red, 1.0f, 1.0f, alpha)`. * @see @ref magenta(), @ref yellow(), @ref red() */ - constexpr static BasicColor4 cyan(T red = T(0), T alpha = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor4 cyan(T red = T(0), T alpha = Implementation::fullChannel()) + #else + constexpr static BasicColor4 cyan(T red = T(0), T alpha = fullChannel()) + #endif + { return {red, Implementation::fullChannel(), Implementation::fullChannel(), alpha}; } @@ -401,7 +442,12 @@ class BasicColor4: public Math::Vector4 { * Convenience alternative to e.g. `%Color4(1.0f, green, 1.0f, alpha)`. * @see @ref cyan(), @ref yellow(), @ref green() */ - constexpr static BasicColor4 magenta(T green = T(0), T alpha = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor4 magenta(T green = T(0), T alpha = Implementation::fullChannel()) + #else + constexpr static BasicColor4 magenta(T green = T(0), T alpha = fullChannel()) + #endif + { return {Implementation::fullChannel(), green, Implementation::fullChannel(), alpha}; } @@ -411,7 +457,12 @@ class BasicColor4: public Math::Vector4 { * Convenience alternative to e.g. `%Color4(1.0f, 1.0f, blue, alpha)`. * @see @ref cyan(), @ref magenta(), @ref red() */ - constexpr static BasicColor4 yellow(T blue = T(0), T alpha = Implementation::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor4 yellow(T blue = T(0), T alpha = Implementation::fullChannel()) + #else + constexpr static BasicColor4 yellow(T blue = T(0), T alpha = fullChannel()) + #endif + { return {Implementation::fullChannel(), Implementation::fullChannel(), blue, alpha}; } @@ -420,7 +471,12 @@ 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::fullChannel()) { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + constexpr static BasicColor4 fromHSV(HSV hsv, T a = Implementation::fullChannel()) + #else + constexpr static BasicColor4 fromHSV(HSV hsv, T a = fullChannel()) + #endif + { return BasicColor4(Implementation::fromHSV(hsv), a); } /** @overload */ @@ -444,8 +500,7 @@ class BasicColor4: public Math::Vector4 { #ifndef CORRADE_MSVC2013_COMPATIBILITY constexpr explicit BasicColor4(T rgb, T alpha = Implementation::fullChannel()): Math::Vector4(rgb, rgb, rgb, alpha) {} #else - template::value, T>::type> constexpr explicit BasicColor4(T rgb, T alpha = T(1)): Math::Vector4(rgb, rgb, rgb, alpha) {} - template::value, T>::type> constexpr explicit BasicColor4(T rgb, T alpha = std::numeric_limits::max()): Math::Vector4(rgb, rgb, rgb, alpha) {} + constexpr explicit BasicColor4(T rgb, T alpha = fullChannel()): Math::Vector4(rgb, rgb, rgb, alpha) {} #endif /** @@ -459,8 +514,7 @@ class BasicColor4: public Math::Vector4 { #ifndef CORRADE_MSVC2013_COMPATIBILITY constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = Implementation::fullChannel()): Math::Vector4(r, g, b, a) {} #else - template::value, T>::type> constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = T(1)): Math::Vector4(r, g, b, a) {} - template::value, T>::type> constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = std::numeric_limits::max()): Math::Vector4(r, g, b, a) {} + constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = fullChannel()): Math::Vector4(r, g, b, a) {} #endif /** @@ -473,8 +527,7 @@ class BasicColor4: public Math::Vector4 { #ifndef CORRADE_MSVC2013_COMPATIBILITY constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = Implementation::fullChannel()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} #else - template::value, T>::type> constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = T(1)): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} - template::value, T>::type> constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = std::numeric_limits::max()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} + constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = fullChannel()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} #endif /** @@ -510,6 +563,12 @@ class BasicColor4: public Math::Vector4 { } MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(4, BasicColor4) + + #ifdef CORRADE_MSVC2013_COMPATIBILITY + private: + template::value, T>::type> constexpr static T fullChannel() { return T(1); } + template::value, T>::type> constexpr static T fullChannel() { return std::numeric_limits::max(); } + #endif }; /** @brief Four-component (RGBA) float color */