Add color_3f & color_4f type aliases
This commit is contained in:
parent
8348feac9e
commit
9e79bd1c40
1 changed files with 7 additions and 4 deletions
|
|
@ -8,6 +8,9 @@
|
|||
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_rgba = geom::vector<std::uint8_t, 4>;
|
||||
|
||||
|
|
@ -37,7 +40,7 @@ namespace psemek::gfx
|
|||
|
||||
struct generic_color
|
||||
{
|
||||
geom::vector<float, 4> c;
|
||||
color_4f c;
|
||||
|
||||
auto as_color_rgb() const
|
||||
{
|
||||
|
|
@ -59,12 +62,12 @@ namespace psemek::gfx
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue