about summary refs log tree commit diff stats
path: root/apps/raytracing/color.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/raytracing/color.h')
-rw-r--r--apps/raytracing/color.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/raytracing/color.h b/apps/raytracing/color.h
new file mode 100644
index 00000000..a8a34b26
--- /dev/null
+++ b/apps/raytracing/color.h
@@ -0,0 +1,15 @@
+#ifndef COLOR_H
+#define COLOR_H
+
+#include "vec3.h"
+
+#include <iostream>
+
+void write_color(std::ostream &out, color pixel_color) {
+    // Write the translated [0,255] value of each color component.
+    out << static_cast<int>(255.999 * pixel_color.x()) << ' '
+        << static_cast<int>(255.999 * pixel_color.y()) << ' '
+        << static_cast<int>(255.999 * pixel_color.z()) << '\n';
+}
+
+#endif