liberebus: moved public header to src/
[erebus2020] / liberebus / src / erebus.h
diff --git a/liberebus/src/erebus.h b/liberebus/src/erebus.h
new file mode 100644 (file)
index 0000000..c439e43
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef RENDLIB_H_
+#define RENDLIB_H_
+
+#include <cgmath/cgmath.h>
+
+struct erb_node;
+struct erb_surf;
+struct erb_ray;
+struct erb_hit;
+
+typedef int (*erb_intersect_func)(struct erb_surf *surf, struct erb_ray *ray, struct erb_hit *hit);
+typedef void (*erb_sample_func)(struct erb_surf *surf, cgm_vec3 *pos);
+
+struct erb_node {
+       struct erb_node *par;                                           /* parent node */
+       struct erb_node *clist;                                         /* child nodes */
+       struct erb_surf *surflist;                                      /* surfaces in this node */
+       float xform[16], inv_xform[16];                         /* global transformation */
+       float node_xform[16], inv_node_xform[16];       /* local transformation */
+};
+
+struct erb_surf {
+       struct erb_node *node;          /* transformation node for this surface */
+
+       erb_intersect_func isect;       /* intersection routine */
+       erb_sample_func sample;         /* random sample generation */
+};
+
+struct erb_ray {
+       cgm_vec3 o, d;          /* origin and direction */
+       float tmin, tmax;       /* segment bounds */
+       float ior;                      /* IOR of the medium through which this ray travels */
+       float total_dist;       /* travel distance accumulator */
+};
+
+struct erb_hit {
+       float t, err;
+       struct erb_surf *surf;
+};
+
+int erb_init(void);
+void erb_cleanup(void);
+
+#endif /* RENDLIB_H_ */