]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/color.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / core / color.h
index e57689bffe559d8f411670f910cceaa2ed94ead0..999960ed7179147c8f8cefb293ee6d57720e336d 100644 (file)
@@ -14,12 +14,16 @@ inline float to_linear(float c)
 
 struct Color
 {
-       float r, g, b, a;
-
-       Color(): r(1), g(1), b(1), a(1) { }
-       Color(float v): r(v), g(v), b(v), a(1) { }
-       Color(float r_, float g_, float b_): r(r_), g(g_), b(b_), a(1) { }
+       float r = 1.0f;
+       float g = 1.0f;
+       float b = 1.0f;
+       float a = 1.0f;
+
+       Color() = default;
+       Color(float v): r(v), g(v), b(v) { }
+       Color(float r_, float g_, float b_): r(r_), g(g_), b(b_) { }
        Color(float r_, float g_, float b_, float a_): r(r_), g(g_), b(b_), a(a_) { }
+
        Color operator*(float f) const { return Color(r*f, g*f, b*f, a); }
        Color operator+(const Color &c) const { return Color(r+c.r, g+c.g, b+c.b, 1-(1-a)*(1-c.a)); }
        bool operator==(const Color &c) const { return (r==c.r && g==c.g && b==c.b && a==c.a); }