diff --git a/Utilities/geometry.h b/Utilities/geometry.h index 73bb502cd2..e287a7dd68 100644 --- a/Utilities/geometry.h +++ b/Utilities/geometry.h @@ -856,7 +856,7 @@ struct color4_base { } - constexpr color4_base(T x, T y = {}, T z = {}, T w = {}) + constexpr color4_base(T x, T y, T z, T w) : x(x) , y(y) , z(z) @@ -864,6 +864,14 @@ struct color4_base { } + constexpr color4_base(T value) + : x(value) + , y(value) + , z(value) + , w(value) + { + } + constexpr bool operator == (const color4_base& rhs) const { return r == rhs.r && g == rhs.g && b == rhs.b && a == rhs.a; @@ -874,6 +882,37 @@ struct color4_base return !(*this == rhs); } + void operator *= (const color4_base& rhs) + { + r *= rhs.r; + g *= rhs.g; + b *= rhs.b; + a *= rhs.a; + } + + void operator *= (const T& rhs) + { + r *= rhs; + g *= rhs; + b *= rhs; + a *= rhs; + } + + constexpr color4_base operator * (const color4_base& rhs) const + { + return { r * rhs.r, g * rhs.g, b * rhs.b, a * rhs.a }; + } + + constexpr color4_base operator * (const T& rhs) const + { + return { r * rhs, g * rhs, b * rhs, a * rhs }; + } + + constexpr color4_base operator + (const color4_base& rhs) const + { + return { r + rhs.r, g + rhs.g, b + rhs.b, a + rhs.a }; + } + template constexpr operator color4_base() const {