aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-03-21 00:12:55 +0100
committerJulian T <julian@jtle.dk>2020-03-21 00:15:49 +0100
commit7b907dc033ab10e8e1737f25b4b4cd42c71e9b1c (patch)
tree2b1b36437fbdd0c8e072bfd9e05dcb437a639d11 /main.c
parent6f7f4b6fcb1ebc9243df515c838dde198b636bc1 (diff)
Added enviromental lighting and progress counter
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/main.c b/main.c
index dcc824b..3b7218c 100644
--- a/main.c
+++ b/main.c
@@ -19,7 +19,9 @@ int main()
color_set(&s.ambient, 0.09, 0.09, 0.09);
// Currently havin issues with white background
// color_set(&s.back, 255, 255, 255);
- color_set(&s.back, 0, 0, 0);
+ color_set(&s.back, 0.8, 0.8, 0.8);
+ color_set(&s.env_color, 0.1, 0.1, 0.1);
+ s.env_samples = 256;
material_t m;
vector_set(&m.color, 1, 1, 1);
@@ -59,6 +61,11 @@ int main()
add_light(&s, vector_set(NULL, 0, 10, 20), color_set(NULL, 0.5, 0.5, 0.5), color_set(NULL, 0.5, 0.5, 0.5));
pgm_write_header(stdout, TESTW, TESTH);
+
+ // Height percentage
+ unsigned percentstep = TESTH / 100;
+ unsigned percent = 0;
+
for (int y = TESTH; y; y--) {
for (int x = TESTW; x; x--) {
color_t *c = ray_trace(&s, x, y, 2);
@@ -67,6 +74,11 @@ int main()
pgm_write_pixel(stdout, c);
}
free(c);
+
+ }
+
+ if (y % percentstep == 0) {
+ fprintf(stderr, "%d%\n", percent++);
}
}