color.c (342B)
1 2 #include "../include/color.h" 3 4 void 5 write_color(FILE *out, color pixel_color) 6 { 7 double r = vec3_getx(pixel_color); 8 double g = vec3_gety(pixel_color); 9 double b = vec3_getz(pixel_color); 10 11 int rbyte = (int)(255.999 * r); 12 int gbyte = (int)(255.999 * g); 13 int bbyte = (int)(255.999 * b); 14 15 fprintf(out, "%i %i %i\n", rbyte, gbyte, bbyte); 16 }