/******************************************************************/ /* Raytracer declarations, Project 5, CS354 */ /******************************************************************/ /* constants */ #define TRUE 1 #define FALSE 0 /* data structures */ typedef struct point { GLfloat x; GLfloat y; GLfloat z; GLfloat w; } point; /* a vector is just a point */ typedef point vector; /* a line segment */ typedef struct segment { point* start; point* end; } segment; /* a ray is just a segment with an endpoint at infinity */ typedef segment ray; typedef struct color { GLfloat r; GLfloat g; GLfloat b; /* these should be between 0 and 1 */ } color; typedef struct material { /* color */ color c; /* ambient reflectivity */ GLfloat amb; } material; typedef struct sphere { point* c; /* center */ GLfloat r; /* radius */ material* m; } sphere; /* functions in tracer.c */ void trace (ray*, point*, vector*, material**); /* functions in shader.c */ material* makeMaterial(GLfloat, GLfloat, GLfloat, GLfloat); void shade(point*,vector*,material*, color*); /* global variables */ extern int width; extern int height; /* the scene: so far, just one sphere */ sphere* s1;