From dbba33fcd07c9e81e3ca9bc4f5e8185d364fb792 Mon Sep 17 00:00:00 2001 From: Julian T Date: Sat, 25 Jul 2020 00:09:53 +0200 Subject: Further experimentation with pathtracing Probably starting over in cpp --- pgm.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pgm.c') diff --git a/pgm.c b/pgm.c index 4280486..910a148 100644 --- a/pgm.c +++ b/pgm.c @@ -2,6 +2,7 @@ #include #include +#include #define COLOR_MAX 255 @@ -39,9 +40,15 @@ void color_clamp(color_t *c) int pgm_write_pixel(FILE *fp, color_t *c) { + //color_gamma_correct(c); return fprintf(fp, "%.0lf %.0lf %.0lf\n", c->r * COLOR_MAX, c->g * COLOR_MAX, c->b * COLOR_MAX); } +void color_gamma_correct(color_t *c) { + c->r = sqrt(c->r); + c->g = sqrt(c->g); + c->b = sqrt(c->b); +} color_t *color_set(color_t *c, COORD_T r, COORD_T g, COORD_T b) { c->r = r; -- cgit v1.2.3