Computational Form Week 10 Assignment Problem 1. Add the OpenGL lighting code to your project. This code may be placed in the init() function or in the displayFunc(), if you want to move or change the light. Problem 2. Add a function called calculateNormal() to the Mesh class that calculates and stores a normal vector for every point in the mesh. This normal vector should be based upon the normal vectors of the faces surrounding the point. Problem 3. Add a function called drawShadedSolid2 that draws the mesh as a solid form and utilizes the per-point normal vectors. This function does not need to calculate the shading, since that is now done by the OpenGL lighting system. Problem 4. Add a function called makeExtrusionOnPath. This function should take as inputs an array of points that define the extrusion shape and an array of points that define the extrusion path. For this to work correctly, the number of point in the extrusion shape should equal width of the Mesh. Likewise, the number of points in the extrusion path should equal the height of the Mesh. Problem 5. Add a function called makeScaledExtrusionOnPath. This function should be identical to the makeExtrusionOnPath function, but should also take as an input an array of scaling parameters. The array should have as many scaling parameters as the extrusion path (which is also equal to the height of the Mesh.) Each scaling parameter should be used to scale the extruded shape at each point along the path. Problem 6. Utilizing the makeScaledExtrusionOnPath function, create a cornucopia. Problem 7. Optionally, utilizing the makeExtrusionOnPath function, make some or all of the squashes shown in the cornucopia.
|