X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=erebus2020;a=blobdiff_plain;f=liberebus%2Fsrc%2Ferebus.h;fp=liberebus%2Fsrc%2Ferebus.h;h=c439e439e30a5e5f62c2b43ed504e8524b358444;hp=0000000000000000000000000000000000000000;hb=b5cff57ff6e83f7660e31636a986d2fcedf786e5;hpb=c8b13dff969d8104c178d9362aa21cefb9d61fe8 diff --git a/liberebus/src/erebus.h b/liberebus/src/erebus.h new file mode 100644 index 0000000..c439e43 --- /dev/null +++ b/liberebus/src/erebus.h @@ -0,0 +1,44 @@ +#ifndef RENDLIB_H_ +#define RENDLIB_H_ + +#include + +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_ */