home *** CD-ROM | disk | FTP | other *** search
- /*
- * objects.h --type definitions for primitives and nonprimitives.
- */
-
- /* quadric equation coefficients */
- struct quadric_data {
- double xx,
- yy,
- zz,
- xy,
- yz,
- xz,
- x0,
- y0,
- z0,
- a;
- bool isclosed; /* closed surface, with finite inside? */
- };
-
- /* the sphere structure */
- struct sphere_data {
- vector center;
- double
- radius,
- rsq; /* radius squared */
- };
-
- /* finite cone */
- /* not used, really... Some day maybe... */
- struct cone_data {
- vector p1,
- p2;
- double r1,
- r2;
- };
-
- struct extrusion_data {
- object *shape; /* the shape to be extruded */
- double height; /* height of the extrusion */
- bool locap,
- hicap; /* are bottom/top to be capped ? */
- };
-
- /* convex polygon */
- struct polygon_data {
- int no_vertices;/* number of vertices */
- vector *vertices; /* vertices themselves */
- vector *clips; /* inward facing normals */
- vector normal; /* normal of the polygon */
- double mov; /* mov (see plane_data) */
- bool convex;
- char project_to;
- };
-
- struct triangle_data {
- vector n; /* normal of plane defined by vertices */
- double mov; /* translate of plane */
- char project_to;
- vector vertices[3];/* vertices of the triangle */
- vector *normals; /* normals; if allocated, then they exist. */
- vector linfunc1,
- linfunc2; /* linear functionals, which compute the
- * components of a vector in the basis
- * formed by vert[0]-vert[2], vert[1] -
- * vert[2] */
- };
-
- /* plane info */
- struct plane_data {
- vector n; /* the normal */
- double mov; /* translation parallel to normal */
- };
-
- struct disc_data {
- vector n; /* the normal */
- double mov; /* translation parallel to normal */
- vector center;
- double R,
- r;
- };
-
- /* a PoV box */
- struct box_data {
- vector p1,
- p2; /* point with minimum/maximum coordinates */
- };
-
- /* light source info */
- struct light_data {
- vector org, /* the place at which the light is. */
- direction;
-
- color lcolor; /* color of the light */
-
- bool spotlight;
-
- double attenuation_exp, /* exponent E for intensity =
- * 1/ldist^E */
- tightness, /* for spotlights */
- radius; /* radius, used for falloff and penumbra */
-
- object *scache[MAXCACHE]; /* the shadowcache */
- };
-
- struct torus_data { /* for a torus. */
- double
- Rad,
- rad; /* major/minor radius */
- bool
- use_sturm; /* sturm seqs? */
- };
-
- struct superq_data {
- vector powvect;
- };
-
- struct algebraic_data {
- struct poly_instruction *code; /* code needed to generate the
- * one-var polynomial */
- int codesize;
- bool usesturm, /* calculate using sturm seqs? */
- isclosed; /* closed + finite? */
- };
-
-
- /* types of optimisation */
- enum {
- NONE,
- BSP,
- SEADS,
- ABVH,
- OCTTREE,
- };
-
- struct composite_data {
- object *contents; /* linked list of the elements */
- /*
- * union { } optidata
- */
- bool (*all_intersections_method) (dqueue * q, object *op, struct ray * r, int flags, bool *b);
- int optitype;
- };
-
-
- /* for the shape->type variable */
- enum {
- NOSHAPE, SPHERE, QUADRIC, PLANE, LIGHTSOURCE, BOX,
- TORUS, CSGUNION, CSGINTER, COMPOSITE, ALGEBRAIC, SUPERQ,
- POLYGON, EXTRUSION, TRIANGLE, DISC
- };
-
- /* entry for stack of polynomial operations */
- struct poly_instruction {
- int type; /* what kind of instruction */
- union {
- double factor; /* numeric factor */
- char op; /* operator */
- }
- data;
- };
-
- /* polynomial operations */
- enum {
- POLY_CONS, /* push constant */
- POLY_OP, /* do operation on stack */
- POLY_X, /* push X */
- POLY_Y, /* push Y */
- POLY_Z, /* push Z */
- };
-