Due: Monday 5/13 10:00am
GitHub link: https://classroom.github.com/a/CbqitX5C
Implement the Phong Reflection model with flat shading. (Note: if you look up information online, do not confuse this with Phong Shading).
- You should be calculating
I
once per polygon. - Remember to limit
I
to be in the range [0, 255]. You may not want to do this all at once at the end. - There are a lot of user-defined values in lighting calculation, eventually, we will to be able to set them in our scripts. For now, pass them around to the necessary functions, and set them in either your main or parser functions. This is modeled in the provided source code.
- For those working in c:
- Types are important. The
color
struct usesunsigned char
values to represent each color value. This can be a problem if in the process of one of the lighting calculations, you end up with a value outside of [0, 255]. - The straightforward solution is to have each lighting function return an array of 3
double
values (double *
). I’ve included a function that you should use at the end to take adouble *
and return acolor
.
- Types are important. The