summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pineapple.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/pineapple.c b/pineapple.c
index 5137534..eeb112b 100644
--- a/pineapple.c
+++ b/pineapple.c
@@ -165,17 +165,14 @@ main(int argc, char *argv[])
float brightness = 0.0;
if (shortest != INFINITY) {
float light_angle = acosf(dot(shortest_norm, light) / magnitude(shortest_norm) / magnitude(light));
- brightness = 1 - light_angle / PI;
+ brightness = light_angle / PI;
}
if (mode == ASCII) {
printf("%c", ASCII_CHARS[strlen(ASCII_CHARS) - 1 - (int)(brightness * strlen(ASCII_CHARS))]);
} else if (mode == FARBFELD) {
uint16_t x = htobe16((uint16_t)(brightness * 0xffff));
- uint16_t a = htobe16(0xffff);
- fwrite(&x, 1, 2, stdout);
- fwrite(&x, 1, 2, stdout);
- fwrite(&x, 1, 2, stdout);
- fwrite(&a, 1, 2, stdout);
+ uint16_t pixel[4] = { x, x, x, htobe16(0xffff) };
+ fwrite(&pixel, 2, 4, stdout);
}
}
if (mode == ASCII) printf("\n");