aboutsummaryrefslogtreecommitdiff
path: root/ray.h
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-02-19 22:35:48 +0100
committerJulian T <julian@jtle.dk>2020-02-19 22:35:48 +0100
commit63a84080f9f0e3d719d5470e370584a5eff18a47 (patch)
tree58264ab5ee632218ab898f70a8a0170b29e595bf /ray.h
Viewpoint system and share/ray intersection working
Diffstat (limited to 'ray.h')
-rw-r--r--ray.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/ray.h b/ray.h
new file mode 100644
index 0000000..999923a
--- /dev/null
+++ b/ray.h
@@ -0,0 +1,28 @@
+#ifndef RAY_H
+#define RAY_H
+
+#include "vector.h"
+
+typedef struct {
+ // Start is not unique so it's a pointer to save copying time
+ vector_t *start;
+
+ 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_sphere(sphere_t *s, ray_t *ray);
+COORD_T ray_intersect_plane(plane_t *p, ray_t *ray);
+
+#endif