Add gfx::lerp for float colors
This commit is contained in:
parent
437714288b
commit
441db52e71
1 changed files with 8 additions and 2 deletions
|
|
@ -71,10 +71,16 @@ namespace psemek::gfx
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <std::size_t N>
|
||||||
|
auto lerp(geom::vector<float, N> const & c0, geom::vector<float, N> const & c1, float t)
|
||||||
|
{
|
||||||
|
return geom::lerp(c0, c1, t);
|
||||||
|
}
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
auto lerp(geom::vector<std::uint8_t, N> const & c0, geom::vector<std::uint8_t, N> const & c1, float t)
|
auto lerp(geom::vector<std::uint8_t, N> const & c0, geom::vector<std::uint8_t, N> const & c1, float t)
|
||||||
{
|
{
|
||||||
return to_coloru8(geom::lerp(to_colorf(c0), to_colorf(c1), t));
|
return to_coloru8(lerp(to_colorf(c0), to_colorf(c1), t));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
|
|
@ -237,7 +243,7 @@ namespace psemek::gfx
|
||||||
|
|
||||||
inline generic_color lerp(generic_color const & c0, generic_color const & c1, float t)
|
inline generic_color lerp(generic_color const & c0, generic_color const & c1, float t)
|
||||||
{
|
{
|
||||||
return generic_color{geom::lerp(c0.c, c1.c, t)};
|
return generic_color{lerp(c0.c, c1.c, t)};
|
||||||
}
|
}
|
||||||
|
|
||||||
static const generic_color white {{1.f, 1.f, 1.f, 1.f}};
|
static const generic_color white {{1.f, 1.f, 1.f, 1.f}};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue