Add color_3f & color_4f type aliases

This commit is contained in:
Nikita Lisitsa 2020-10-02 19:12:11 +03:00
parent 8348feac9e
commit 9e79bd1c40

View file

@ -8,6 +8,9 @@
namespace psemek::gfx namespace psemek::gfx
{ {
using color_3f = geom::vector<float, 3>;
using color_4f = geom::vector<float, 4>;
using color_rgb = geom::vector<std::uint8_t, 3>; using color_rgb = geom::vector<std::uint8_t, 3>;
using color_rgba = geom::vector<std::uint8_t, 4>; using color_rgba = geom::vector<std::uint8_t, 4>;
@ -37,7 +40,7 @@ namespace psemek::gfx
struct generic_color struct generic_color
{ {
geom::vector<float, 4> c; color_4f c;
auto as_color_rgb() const auto as_color_rgb() const
{ {
@ -59,12 +62,12 @@ namespace psemek::gfx
return as_color_rgba(); return as_color_rgba();
} }
operator geom::vector<float, 3>() const operator color_3f() const
{ {
return geom::vector{c[0], c[1], c[2]}; return color_3f{c[0], c[1], c[2]};
} }
operator geom::vector<float, 4>() const operator color_4f() const
{ {
return c; return c;
} }