/* ray.h */ #include #include #include #include #include #include class view_t { private: int win_x_size; int win_y_size; double world_x_size; double world_y_size; double viewpt[3]; } view_t; /* Object types */ #define FIRST_TYPE 10 #define LIGHT 10 #define SPHERE 11 #define PLANE 12 #define CYL 13 #define ELLIPSE 14 #define TILED_PLANE 15 #define SPOTLIGHT 16 #define LAST_TYPE 16 typedef struct obj_type { struct obj_type *next; int objid; int objtype; double (*hits)(); void (*uninorm)(); /* Optional plugins for retrieval of reflectivity */ /* useful for the ever-popular tiled floor */ void (*getamb)(); void (*getdiff)(); void (*getspec)(); double ambient[3]; /* Reflectivity for materials */ double diffuse[3]; double specular[3]; double emissivity[3]; /* For lights */ void *priv; /* Private type-dependent data */ double hitloc[3]; /* Last hit point */ double normal[3]; /* Normal at hit point */ } obj_t; typedef struct sphere_type { double center[3]; double radius; } sphere_t; typedef struct light_type { double center[3]; double radius; double direction[3]; /* For spot lights */ double costheta; /* Half-width of spot cone */ } light_t; typedef struct ellipse_type { double center[3]; double scale[3]; double radius; } ellipse_t; typedef struct cyl_type { double center[3]; double centerline[3]; double radius; double height; } cyl_t; typedef struct plane_type { double normal[3]; double point[3]; double gridsize; /* for tiled planes */ double ambient[3]; /* Reflectivity for materials */ double diffuse[3]; /* for dark side */ double specular[3]; } plane_t; typedef struct list_type { obj_t *head; obj_t *tail; } list_t; #include "rayhdrs.h" #include "veclib3d.h"