aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-03-10 11:57:41 +0100
committerJulian T <julian@jtle.dk>2020-03-10 11:57:41 +0100
commit6f7f4b6fcb1ebc9243df515c838dde198b636bc1 (patch)
tree36b32f835cda18cccbe6c05251683d698073d43f
parent6ee08c8370f578e59dd4c6bb5f542b469f0d3748 (diff)
Initial with a link to resources
-rw-r--r--ray.c7
-rw-r--r--scene.h6
2 files changed, 13 insertions, 0 deletions
diff --git a/ray.c b/ray.c
index e91d7e1..e776893 100644
--- a/ray.c
+++ b/ray.c
@@ -187,6 +187,13 @@ static void ray_calc_light(space_t *s, color_t *dest, object_t *o, vector_t *N,
}
}
+// Calculates the environmental light. Pretty slow
+// https://www.scratchapixel.com/lessons/3d-basic-rendering/global-illumination-path-tracing
+static void light_environment(space_t *s, color_t *dest, object_t *o, vector_t *N, vector_t *eye, vector_t *point)
+{
+
+}
+
int ray_trace_recur(space_t *s, color_t *dest, ray_t *ray, unsigned hop, COORD_T scale)
{
COORD_T dist;
diff --git a/scene.h b/scene.h
index 90e5ebb..7eef588 100644
--- a/scene.h
+++ b/scene.h
@@ -62,6 +62,12 @@ typedef struct {
color_t ambient;
color_t back;
+
+ // Environment light
+ // TODO make more general
+ // Slows things down alot
+ bool env_enabled;
+ color_t env_color;
} space_t;
object_t *add_sphere(space_t *s, vector_t *c, COORD_T r, material_t *m);