Computer Science 102 Short Program 5 Due 29 March 11:59PM For this program the ONLY authorized source of assistance is Dr. Westall or the TA's. ANY OTHER DISCUSSION of the program no matter how "high level" or "peripheral" (e.g. Have you started/finished it yet?) is STRICTLY FORBIDDEN. Any student who observes improper behavior is encouraged to report it to Dr. Westall. Reports that can be verified will be rewarded with a 20 point bonus on the assignment for the student doing the reporting and an F for the course for the student being reported!! Adhere to the following programming standards. Violations will lead to deductions. (1) no function should be longer than 30 lines code + whitespace. (2) the maximum nesting level in any function is ONE (3) code lines should not extend beyond column 72 (4) no more that one statement may be written on a single line (5) use reasonably descriptive names for variables and functions (6) package all functions into a single source code module named camera.c (7) your program should compile without any warnings with gcc -Wall (8) indenting should be consistent with logical nesting (9) diagnostic / debug prints should be disabled/deleted in your submission. In this assignment you will implement diffuse illumination in your C++ raytracer. Use the following class definition. class light_t { public: light_t(){}; light_t(FILE *in, model_t *model, int attrmax); virtual ~light_t(){}; virtual void illuminate(model_t *, object_t *, drgb_t *); inline void light_item_dump(FILE *); protected: vec_t location; drgb_t emissivity; char name[NAME_LEN]; private: int cookie; }; I recommend that you follow the procedures in the notes for doing this VERY CAREFULLY. If you don't read and follow the notes you will become massively confused and an ugly mess will result. Here is the order in which I recommend that you complete the various tasks that are necessary: 1 - Add the light_t class to ray.h 2 - Modify the model.cpp function so that its parser recognizes the light entity and creates a new light_t class. 3 - Modify the dump() method of the model_t class to invoke the light_dump() function. 4 - Write the light_t constructor light_t(FILE *in, model_t *model, int attrmax); which parses the attributes and puts the new light_t structure on the end of the light list. 5 - Write the light_dump() C function which processes the light list and invokes light_item_dump() for each light. Add its prototype to rayhdrs.h 6 - Write light_item_dump() 7 - STOP WRITING AND TEST THIS MUCH. DON"T WRITE ANOTHER LINE UNTIL THIS MUCH WORKS. ----------------------------------------------------------------------- 8 - Modify the raytrace.c module adding in the add_diffuse() function given in the notes. 9 - Make the additional mods suggested in the notes to cause raytrace() to call add_diffuse 10 - Write the illuminate method of the light_t class. ---------------------------------------------------------------------- It is very likely you will need to have optional debug code that will allow you to print: the vector from the hitpoint to the light the cosine of the angle the distance from the hitpoint to the light the diffuse reflectivity of the material the final diffuse illumination occlusion data such as: #ifdef DBG_OCCLUDE fprintf(stderr, "%-10s occ by %-10s at (%4.1lf, %4.1lf, %4.1lf) (%4.1lf, %4.1lf, %4.1lf)", light->name, obj->objname, hitobj->hitloc.x, hitobj->hitloc.y, hitobj->hitloc.z, obj->hitloc.x, obj->hitloc.y, obj->hitloc.z); #endif