almost there
[csgray] / src / csgimpl.h
1 #ifndef CSGIMPL_H_
2 #define CSGIMPL_H_
3
4 #include "csgray.h"
5
6 enum {
7         OB_NULL,
8         OB_SPHERE,
9         OB_CYLINDER,
10         OB_PLANE,
11         OB_BOX,
12         OB_UNION,
13         OB_INTERSECTION,
14         OB_SUBTRACTION
15 };
16
17 struct object {
18         int type;
19
20         float r, g, b;
21         float emr, emg, emb;
22         float roughness;
23         float opacity;
24
25         float xform[16], inv_xform[16];
26
27         csg_object *next;
28
29         void (*destroy)(csg_object*);
30 };
31
32 struct sphere {
33         struct object ob;
34         float rad;
35 };
36
37 struct cylinder {
38         struct object ob;
39         float rad;
40 };
41
42 struct plane {
43         struct object ob;
44         float nx, ny, nz;
45         float d;
46 };
47
48 struct csgop {
49         struct object ob;
50         csg_object *a, *b;
51 };
52
53 union csg_object {
54         struct object ob;
55         struct sphere sph;
56         struct cylinder cyl;
57         struct plane plane;
58         struct csgop un, isect, sub;
59 };
60
61 struct camera {
62         float x, y, z;
63         float tx, ty, tz;
64         float fov;
65 };
66
67 #endif  /* CSGIMPL_H_ */