From b0079eaa628a1f2fd99014cd12e6baac17f4d17a Mon Sep 17 00:00:00 2001 From: Julian T Date: Sun, 23 Feb 2020 18:30:21 +0100 Subject: Added phong light model and fixed sphere intersect --- scene.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scene.c') diff --git a/scene.c b/scene.c index 99ae0e8..5a41041 100644 --- a/scene.c +++ b/scene.c @@ -27,11 +27,13 @@ object_t *add_sphere(space_t *s, vector_t *c, COORD_T r, material_t *m) return o; } -object_t *add_plane(space_t *s, vector_t *start, vector_t *dir) +object_t *add_plane(space_t *s, vector_t *start, vector_t *dir, material_t *m) { object_t *o = (object_t *) malloc(sizeof(object_t)); o->type = TYPE_PLANE; + o->m = m; + o->pl.start = start; o->pl.norm = dir; @@ -40,12 +42,13 @@ object_t *add_plane(space_t *s, vector_t *start, vector_t *dir) return o; } -light_t *add_light(space_t *s, vector_t *pos, color_t *defuse) +light_t *add_light(space_t *s, vector_t *pos, color_t *defuse, color_t *specular) { light_t *o = (light_t *) malloc(sizeof(light_t)); o->pos = pos; o->defuse = defuse; + o->specular = specular; if (s) { o->next = s->lights; -- cgit v1.2.3