Add common generic colors
This commit is contained in:
parent
aaf6ce7652
commit
4e37e7a54f
1 changed files with 46 additions and 0 deletions
|
|
@ -35,4 +35,50 @@ namespace psemek::gfx
|
||||||
return to_coloru8(geom::lerp(to_colorf(c0), to_colorf(c1), t));
|
return to_coloru8(geom::lerp(to_colorf(c0), to_colorf(c1), t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct generic_color
|
||||||
|
{
|
||||||
|
geom::vector<float, 4> c;
|
||||||
|
|
||||||
|
auto as_color_rgb() const
|
||||||
|
{
|
||||||
|
return to_coloru8(geom::vector{c[0], c[1], c[2]});
|
||||||
|
}
|
||||||
|
|
||||||
|
auto as_color_rgba() const
|
||||||
|
{
|
||||||
|
return to_coloru8(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
operator color_rgb() const
|
||||||
|
{
|
||||||
|
return as_color_rgb();
|
||||||
|
}
|
||||||
|
|
||||||
|
operator color_rgba() const
|
||||||
|
{
|
||||||
|
return as_color_rgba();
|
||||||
|
}
|
||||||
|
|
||||||
|
operator geom::vector<float, 3>() const
|
||||||
|
{
|
||||||
|
return geom::vector{c[0], c[1], c[2]};
|
||||||
|
}
|
||||||
|
|
||||||
|
operator geom::vector<float, 4>() const
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const generic_color white {{1.f, 1.f, 1.f, 1.f}};
|
||||||
|
static const generic_color black {{0.f, 0.f, 0.f, 1.f}};
|
||||||
|
|
||||||
|
static const generic_color red {{1.f, 0.f, 0.f, 1.f}};
|
||||||
|
static const generic_color green {{0.f, 1.f, 0.f, 1.f}};
|
||||||
|
static const generic_color blue {{0.f, 0.f, 1.f, 1.f}};
|
||||||
|
|
||||||
|
static const generic_color cyan {{0.f, 1.f, 1.f, 1.f}};
|
||||||
|
static const generic_color magenta{{1.f, 0.f, 1.f, 1.f}};
|
||||||
|
static const generic_color yellow {{1.f, 1.f, 0.f, 1.f}};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue