X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=csgray;a=blobdiff_plain;f=src%2Fcsgimpl.h;fp=src%2Fcsgimpl.h;h=d6cb7a4f031f34d18c2ca9952afb8ad4d64f2cd1;hp=0000000000000000000000000000000000000000;hb=07ca36e28aa10804ba5a544276eb5a25f8105e0f;hpb=40a4c5772ab19e7f27c62768d40f697bf5d80a12 diff --git a/src/csgimpl.h b/src/csgimpl.h new file mode 100644 index 0000000..d6cb7a4 --- /dev/null +++ b/src/csgimpl.h @@ -0,0 +1,67 @@ +#ifndef CSGIMPL_H_ +#define CSGIMPL_H_ + +#include "csgray.h" + +enum { + OB_NULL, + OB_SPHERE, + OB_CYLINDER, + OB_PLANE, + OB_BOX, + OB_UNION, + OB_INTERSECTION, + OB_SUBTRACTION +}; + +struct object { + int type; + + float r, g, b; + float emr, emg, emb; + float roughness; + float opacity; + + float xform[16], inv_xform[16]; + + csg_object *next; + + void (*destroy)(csg_object*); +}; + +struct sphere { + struct object ob; + float rad; +}; + +struct cylinder { + struct object ob; + float rad; +}; + +struct plane { + struct object ob; + float nx, ny, nz; + float d; +}; + +struct csgop { + struct object ob; + csg_object *a, *b; +}; + +union csg_object { + struct object ob; + struct sphere sph; + struct cylinder cyl; + struct plane plane; + struct csgop un, isect, sub; +}; + +struct camera { + float x, y, z; + float tx, ty, tz; + float fov; +}; + +#endif /* CSGIMPL_H_ */