aboutsummaryrefslogtreecommitdiff
path: root/scene.c
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-02-23 18:30:21 +0100
committerJulian T <julian@jtle.dk>2020-02-23 18:30:21 +0100
commitb0079eaa628a1f2fd99014cd12e6baac17f4d17a (patch)
tree5925033b7d27a7f0263c19b7babc97fbeb700a93 /scene.c
parent9b40029e42f994aeff59ecc44a6d3b8fba93071d (diff)
Added phong light model and fixed sphere intersect
Diffstat (limited to 'scene.c')
-rw-r--r--scene.c7
1 files changed, 5 insertions, 2 deletions
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;