aboutsummaryrefslogtreecommitdiff
path: root/scene.h
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.h
parent9b40029e42f994aeff59ecc44a6d3b8fba93071d (diff)
Added phong light model and fixed sphere intersect
Diffstat (limited to 'scene.h')
-rw-r--r--scene.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/scene.h b/scene.h
index 7efb5cd..489aece 100644
--- a/scene.h
+++ b/scene.h
@@ -24,12 +24,17 @@ typedef struct {
typedef struct light_s{
vector_t *pos;
color_t *defuse;
+ color_t *specular;
struct light_s *next;
} light_t;
typedef struct {
vector_t color;
+
+ COORD_T defuse;
+ COORD_T specular;
+ unsigned int shine;
} material_t;
// General object structure
@@ -50,11 +55,13 @@ typedef struct {
viewpoint_t view;
object_t *objects;
light_t *lights;
+
+ color_t ambient;
} space_t;
object_t *add_sphere(space_t *s, vector_t *c, COORD_T r, material_t *m);
-object_t *add_plane(space_t *s, vector_t *start, vector_t *dir);
-light_t *add_light(space_t *s, vector_t *pos, color_t *defuse);
+object_t *add_plane(space_t *s, vector_t *start, vector_t *dir, material_t *m);
+light_t *add_light(space_t *s, vector_t *pos, color_t *defuse, color_t *specular);
void obj_norm_at(object_t *o, vector_t *dest, vector_t *point);