mirror of
https://github.com/love2d/love.git
synced 2026-08-13 17:10:54 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user