Clamp color arguments to [0, 1] in cases where we don’t support values outside of that range internally.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-03-09 21:15:56 -04:00
parent 1a9262dda9
commit a8e4db8e1e
5 changed files with 47 additions and 24 deletions
+9
View File
@@ -719,6 +719,15 @@ love::Vector ParticleSystem::getOffset() const
void ParticleSystem::setColor(const std::vector<Colorf> &newColors)
{
colors = newColors;
// We don't support colors outside of [0,1] when drawing the ParticleSystem.
for (auto &c : colors)
{
c.r = std::min(std::max(c.r, 0.0f), 1.0f);
c.g = std::min(std::max(c.g, 0.0f), 1.0f);
c.b = std::min(std::max(c.b, 0.0f), 1.0f);
c.a = std::min(std::max(c.a, 0.0f), 1.0f);
}
}
std::vector<Colorf> ParticleSystem::getColor() const