almost there
[csgray] / src / geom.h
1 #ifndef GEOM_H_
2 #define GEOM_H_
3
4 #include "csgray.h"
5 #include "csgimpl.h"
6
7 struct ray {
8         float x, y, z;
9         float dx, dy, dz;
10 };
11
12 struct hit {
13         float t;
14         float x, y, z;
15         float nx, ny, nz;
16         csg_object *o;
17
18         struct hit *next;
19 };
20
21 struct hit *alloc_hit(void);
22 void free_hit(struct hit *hit);
23 void free_hit_list(struct hit *hit);
24
25 struct hit *ray_intersect(struct ray *ray, csg_object *o);
26
27 struct hit *ray_sphere(struct ray *ray, csg_object *o);
28 struct hit *ray_cylinder(struct ray *ray, csg_object *o);
29 struct hit *ray_plane(struct ray *ray, csg_object *o);
30 struct hit *ray_csg_un(struct ray *ray, csg_object *o);
31 struct hit *ray_csg_isect(struct ray *ray, csg_object *o);
32 struct hit *ray_csg_sub(struct ray *ray, csg_object *o);
33
34 void xform_ray(struct ray *ray, float *mat);
35
36 #endif  /* GEOM_H_ */