aboutsummaryrefslogtreecommitdiff
path: root/pgm.c
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-07-25 00:09:53 +0200
committerJulian T <julian@jtle.dk>2020-07-25 00:09:53 +0200
commitdbba33fcd07c9e81e3ca9bc4f5e8185d364fb792 (patch)
tree7e3b570853a18c7f7670c870f8bc6a09bb287a4f /pgm.c
parentef684a7d2ad2934af872cb19a413c95d1005c4b6 (diff)
Further experimentation with pathtracingpath_tracing
Probably starting over in cpp
Diffstat (limited to 'pgm.c')
-rw-r--r--pgm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pgm.c b/pgm.c
index 4280486..910a148 100644
--- a/pgm.c
+++ b/pgm.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <math.h>
#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;