


#define rayNONE 0.0
#define rayEPSILON 0.000001
#define rayINF 1000000.0
#define rayNEGINF -1000000.0

/* Feel free to read and write this data structure's members. Usually they are 
written by a getIntersection function and only read after that. */
typedef struct rayIntersection rayIntersection;
struct rayIntersection {
	/* The earliest time at which the ray is inside the object. Can be rayNEGINF 
	or rayNONE (or a regular value). */
    double start;
	/* The latest time at which the ray is inside the object. Can be rayINF or 
	rayNONE (or a regular value). */
    double end;
	/* If start >= rayEPSILON, then this field holds the texture coordinates at 
	the point corresponding to the start time. */
    double texCoords[2];
	/* If start >= rayEPSILON, then this field holds the unit outward-pointing 
	normal vector, in world coordinates, at the point corresponding to the start 
	time. */
    double normal[3];
};

/* Feel free to read and write this data structure's members. Usually they are 
written by a getMaterial function and only read after that. */
typedef struct rayMaterial rayMaterial;
struct rayMaterial {
    /* Phong lighting model in three terms: ambient, diffuse, specular. */
    int hasAmbient, hasDiffuse, hasSpecular;
    double cDiffuse[3], cSpecular[3], shininess;
    /* If hasMirror, then there is a term equal to the reflected ray color 
    modulated by cMirror. */
    int hasMirror;
    double cMirror[3];
    /* If hasTransmission, then there is a term equal to the ray color, that 
    entered the body, modulated by (cTransmission raised to the in-body travel 
    time). */
    int hasTransmission;
    double cTransmission[3], indexRefr;
};

/* Feel free to read and write this struct's members. Usually they are written 
by a getLighting function and only read after that. */
typedef struct rayLighting rayLighting;
struct rayLighting {
	/* cLight is the color of the light that arrives at a specified point x in 
	the world. It can be as simple as a constant light color. In more 
	complicated examples, it can incorporate spot light angle, attenuation, 
	textured light, etc. */
	double cLight[3];
	/* uLight is the unit vector in world coordinates pointing from x toward the 
	light. */
	double uLight[3];
	/* distance is the distance from x to the light. It can be rayINFINITY to 
	signal a directional light source. */
	double distance;
};


