aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-02-23 22:34:43 +0100
committerJulian T <julian@jtle.dk>2020-02-23 22:34:43 +0100
commitaa6bcd1c813a17d57083d79c4b27a65eccd960ce (patch)
tree6e5e84898493350769f6afa03c1bcc44c6086163 /main.c
parentf2386856f2739df397617b92edd52cfc687bb14b (diff)
Added reflections
Diffstat (limited to 'main.c')
-rw-r--r--main.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/main.c b/main.c
index f0d495a..e86a995 100644
--- a/main.c
+++ b/main.c
@@ -10,7 +10,7 @@
#define TESTW 1000
#define TESTH 1000
-color_t back = {0, 0, 0};
+color_t back = {255, 255, 255};
int print = 0;
int main()
@@ -19,22 +19,31 @@ int main()
space_t s;
s.objects = NULL;
s.lights = NULL;
- color_set(&s.ambient, 30, 30, 30);
+ color_set(&s.ambient, 25, 25, 25);
material_t m;
- vector_set(&m.color, 0, 1, 0);
- m.defuse = 1;
- m.specular = 0.3;
- m.shine = 20;
+ vector_set(&m.color, 1, 1, 1);
+ m.defuse = 0.0;
+ m.specular = 0.0;
+ m.shine = 40;
+ m.reflective = 0.5;
+
+ material_t m2;
+ vector_set(&m2.color, 0.1, 1, 0.7);
+ m2.defuse = 1;
+ m2.specular = 0.0;
+ m2.shine = 40;
+ m2.reflective = 0.0;
material_t mpl;
//vector_set(&mpl.color, 0, 0.396, 0.7019);
vector_set(&mpl.color, 1, 1, 1);
mpl.defuse = 1;
- mpl.specular = 0.3;
- mpl.shine = 20;
+ mpl.specular = 0.0;
+ mpl.shine = 50;
+ mpl.reflective = 0;
- vector_set(&s.view.position, 0, 15, 8);
+ vector_set(&s.view.position, 0, 14, 8);
vector_set(&s.view.target, 0, 0, 0);
s.view.width = TESTW;
s.view.height = TESTH;
@@ -42,11 +51,11 @@ int main()
viewpoint_init(&s.view);
// Setup plane
- add_sphere(&s, vector_set(NULL, 3, 0, 5), 5, &m);
- add_sphere(&s, vector_set(NULL, -6, -3, 7), 3, &m);
- //add_sphere(&s, vector_set(NULL, 10, 0, 5), 5);
+ add_sphere(&s, vector_set(NULL, 3, -1, 5), 5, &m);
+ add_sphere(&s, vector_set(NULL, 3, 7, 3), 2, &m2);
add_plane(&s, vector_set(NULL, 0, 0, 2), vector_set(NULL, 0, 0, 1), &mpl);
- add_light(&s, vector_set(NULL, 10, 0, 20), color_set(NULL, 255, 255, 255), color_set(NULL, 150, 150, 150));
+ add_plane(&s, vector_set(NULL, 0, -20, 0), vector_set(NULL, 0, 1, 0), &mpl);
+ add_light(&s, vector_set(NULL, 20, 0, 20), color_set(NULL, 255, 255, 255), color_set(NULL, 150, 150, 150));
//add_light(&s, vector_set(NULL, 0, 10, 20), color_set(NULL, 255, 255, 255), color_set(NULL, 150, 150, 150));
pgm_write_header(stdout, TESTW, TESTH);