aboutsummaryrefslogtreecommitdiff
path: root/ray.h
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-02-21 06:55:27 +0100
committerJulian T <julian@jtle.dk>2020-02-21 06:55:27 +0100
commit623fee395425ab33f14fb9cd8ffa790e362f59d7 (patch)
treec70b64e13fd5e00c2317fa40ee4b8cd786e635d5 /ray.h
parent63a84080f9f0e3d719d5470e370584a5eff18a47 (diff)
Added pgm drawing and got light ray tracing working
Still needs correct light simulation and reflections
Diffstat (limited to 'ray.h')
-rw-r--r--ray.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/ray.h b/ray.h
index 999923a..208dcfc 100644
--- a/ray.h
+++ b/ray.h
@@ -1,28 +1,22 @@
#ifndef RAY_H
#define RAY_H
+#include <stdbool.h>
+#include <stdint.h>
#include "vector.h"
+#include "scene.h"
typedef struct {
// Start is not unique so it's a pointer to save copying time
vector_t *start;
-
- vector_t direction;
+ vector_t *direction;
} ray_t;
-typedef struct {
- vector_t *center;
- COORD_T radius;
-} sphere_t;
-
-// TODO make this less inconsistent
-typedef struct {
- vector_t *start;
- vector_t norm;
-} plane_t;
-
+COORD_T ray_intersect(object_t *o, ray_t *ray, bool skip_dist);
+COORD_T ray_intersect_sphere(sphere_t *s, ray_t *ray, bool skip_dist);
+COORD_T ray_intersect_plane(plane_t *p, ray_t *ray, bool skip_dist);
-COORD_T ray_intersect_sphere(sphere_t *s, ray_t *ray);
-COORD_T ray_intersect_plane(plane_t *p, ray_t *ray);
+object_t *ray_cast(space_t *s, ray_t *r, COORD_T *dist_ret, bool chk, COORD_T chk_dist);
+color_t *ray_trace(space_t *s, unsigned int x, unsigned int y);
#endif