
#ifndef TYPES_H

/* Maximum number of sides an object can have */
#define MAXSIDES 6

/* Number of object types */
#define OBJECTTYPES 5

/* The object types */
#define LIGHT  -1
#define SPHERE 0
#define WALL   1
#define TUBE   2
#define PIPE   3
#define CONE   4


/*             *
 *    Types    *
 *             */

/* Boolean type */
typedef int bool;

/* Information common to all object types */
struct objinfostruct
{
    color col[MAXSIDES];  /* Colors of object, one per side, some may
                             be unused */
    scalar amb;		  /* Ambient-reflection coefficient, [0,1] */
    scalar diff;          /* Diffuse-reflection coefficient, [0,1] */
    scalar fspre;	  /* Fraction of specular reflection, [0,1] */
    scalar refl;	  /* Specular-reflection exponent, any positive */
};
typedef struct objinfostruct objinfo;

/* Intersection point, returned by the xxxintersect() functions */
struct intersectionstruct
{
  vector p;             /* Point of intersection */
  int side;             /* The number of the side where the intersection
                           occurred. -1=no intersection */
};
typedef struct intersectionstruct intersection;

/* The sphere object */
struct spherestruct
{
    vector c;  		/* Center of sphere */
    scalar r;  		/* Radius of sphere */
    objinfo oi;         /* Other info */
};
typedef struct spherestruct sphere;

/* The wall (an infinite plane) object */
struct wallstruct
{
    plane pl;
    objinfo oi;
};
typedef struct wallstruct wall;

/* The tube (cylinder with endpoint sides) object

A tube is determined like this:

        ------------           -
       |    li.k    |           |
side 1 |----------->| side 2    |2r
       |            |           |
        ------------           -
li.p is the center of side 1 and li.p+li.k is the center of side 2.
Side 1 has color col[1] and side 2 has color col[2].
*/
struct tubestruct
{
  line li;
  scalar r;
  objinfo oi;
};
typedef struct tubestruct tube;

/* The pipe (cylinder without endpoint sides) object

A pipe is determined like this:

 ------------     -
     li.k          |
 ----------->      |2r
                   |
 ------------     -
li.p is the center of the left end and li.p+li.k is the center of the right
end.
*/
struct pipestruct
{
  line li;
  scalar r;
  objinfo oi;
};
typedef struct pipestruct pipe;

/* The cone object */
struct conestruct
{
  line li;
  scalar r;
  objinfo oi;
};
typedef struct conestruct cone;

/* The lightsource object
Currently, just a direction and a color */
struct lightstruct
{
	vector dir;	/* Direction of lightsource */
	color col;	/* Color of lightsource */
};
typedef struct lightstruct light;

#define TYPES_H
#endif









