limit RGB output to 0-255

This commit is contained in:
Andreas Engberg
2024-06-28 10:38:39 +02:00
parent 15b4cd3085
commit f0399395de
@@ -154,6 +154,10 @@ namespace {
ppmFile << r << ' ' << g << ' ' << b << ' ';
}
else {
r = std::min(r, 1.0);
g = std::min(g, 1.0);
b = std::min(b, 1.0);
ppmFile
<< static_cast<unsigned int>(r * 255) << ' '
<< static_cast<unsigned int>(g * 255) << ' '