Fix gfx::light/dark: shouldn't affect color alpha
This commit is contained in:
parent
4f0b804656
commit
e558799702
1 changed files with 4 additions and 2 deletions
|
|
@ -105,7 +105,8 @@ namespace psemek::gfx
|
|||
template <std::size_t N>
|
||||
geom::vector<float, N> light(geom::vector<float, N> c, float lightness = 0.5f)
|
||||
{
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
static_assert(N == 3 || N == 4);
|
||||
for (std::size_t i = 0; i < 3; ++i)
|
||||
c[i] = geom::lerp(c[i], 1.f, lightness);
|
||||
return c;
|
||||
}
|
||||
|
|
@ -113,7 +114,8 @@ namespace psemek::gfx
|
|||
template <std::size_t N>
|
||||
geom::vector<float, N> dark(geom::vector<float, N> c, float darkness = 0.5f)
|
||||
{
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
static_assert(N == 3 || N == 4);
|
||||
for (std::size_t i = 0; i < 3; ++i)
|
||||
c[i] = geom::lerp(c[i], 0.f, darkness);
|
||||
return c;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue