$29
This project is about smooth surface creation using the Loop subdivision technique. You will write a program in Processing that reads in polyhedral models and subdivides them. Your program will also be able to toggle between displaying the surface using flat and smooth shading. All of the mesh objects that you create and modify will be made of only triangles.
Your finished program will be able to read a mesh from a file and display that mesh. More importantly, with a keystroke your program will create a subdivided version of the mesh, replacing the old mesh in memory. Your program should also allow toggling between flat shading (per-polygon normals) and smooth shading (per-vertex normals). Your program should obey the following keystroke commands:
1-5: Read in a mesh file (tetrahedron, octahedron, icosahedron, star, torus).
s: Subdivide the current mesh (you should be able to subdivide more than once).
n: Toggle between per-face and per-vertex normals.
r: Toggle between white and randomly colored faces.
space: Toggle automatic rotation on and off.
A large part of this project is being able to subdivide the surface more than once, so make sure your program can do this. You should use the Loop Subdivision rules to produce the subdivided mesh.
To display your mesh using per-vertex normals, you will first need to calculate per-vertex normals. Each per-vertex normal is calculated from the average of the normals from the faces adjacent to a given vertex. Make sure each such normal is unit length.
When random colors are turned on, the faces of your model should be colored at random. These random colors should not flicker, but instead should remain steady from one frame to the next.