mirror of
https://github.com/Manoj-HV30/multithreaded-raytracer.git
synced 2026-05-16 19:35:24 +00:00
refactor color.h
This commit is contained in:
+3
-3
@@ -19,18 +19,18 @@ inline void write_color(std::ostream& out, const color& pixel_color) {
|
||||
auto g = pixel_color.y();
|
||||
auto b = pixel_color.z();
|
||||
|
||||
// Apply a linear to gamma transform for gamma 2
|
||||
|
||||
r = linear_to_gamma(r);
|
||||
g = linear_to_gamma(g);
|
||||
b = linear_to_gamma(b);
|
||||
|
||||
// Translate the [0,1] component values to the byte range [0,255].
|
||||
|
||||
static const interval intensity(0.000, 0.999);
|
||||
int rbyte = int(256 * intensity.clamp(r));
|
||||
int gbyte = int(256 * intensity.clamp(g));
|
||||
int bbyte = int(256 * intensity.clamp(b));
|
||||
|
||||
// Write out the pixel color components.
|
||||
|
||||
out << rbyte << ' ' << gbyte << ' ' << bbyte << '\n';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user