cpp-raytracer/color.hpp
2021-08-20 23:27:59 +02:00

18 lines
368 B
C++

#ifndef COLOR_H
#define COLOR_H
#include "vec3.hpp"
#include <stdio.h>
#include <stdint.h>
/* Writes color components as a space-delimited string of numbers in the range [0,255] */
void write_color(FILE *fp, color c)
{
fprintf(fp, "%d %d %d\n",
(uint8_t) (255 * c.x),
(uint8_t) (255 * c.y),
(uint8_t) (255 * c.z));
}
#endif