JMU
Programming Assignment 5


1 Overview: For this assignment you must improve your 3-D rasterizer from programming assignment 4. Specifically, you must add the ability to fill triangles (accounting for hidden lines/surfaces). This will require you to write ZBuffer class.

This assignment is about 3-D computer graphics. The only new aspects of C++ that you will use are virtual methods and pure virtual methods (you will only use them in classes that have been provded to you).

2 Getting Started: You will have to make changes to your Rasterizer3D class so you should probably make a copy in a new directory/folder.
3 Existing Classes: In the next assignment, we will use a Colorizer to determine the color of a pixel given information about the colors of the vertices. For this assignment, we will use one color for all of the pixels in the face. However, so that we won't have to modify the code in the future, we will use a Colorizer in this assignment. To that end, an abstract Colorizer class and a concrete DefaultColorizer class have already been written. They should be self-explanatory.

Colorizer ( Header , Implementation )

DefaultColorizer ( Header , Implementation )

The default colorizer will be used to calculate the color used in any call to the Rasterizer2D object's drawPoint() method.

4 Detailed Specification: You must implement the following ZBuffer class.

ZBuffer ( Header )

In addition, your Rasterizer3D class must now have the following constructor:

   /**
    * Explicit Value Constructor
    *
    * @param fb        The FrameBuffer containing the pixels
    * @param colorizer The Colorizer to use to calculate the Color of a pixel
    */
    Rasterizer3D(FrameBuffer* fb, Colorizer* colorizer);    
  

the following new private method:

   /**
    * Fill a single triangle (i.e., face of a triangular mesh)
    *
    * Note: The vertices are 3D in homogeneous coordinates so have four
    * components. They have not been projected so the z-values are available.
    * 
    * @param triangle   A pointer to the Triangle to fill
    */
   void fillTriangle(Triangle* triangle);
  

and the following new public method:

    /**
     * Fill the given "triangular mesh"
     *
     * @param triangles   The "triangular mesh"
     */
    void fill(list<Triangle*> triangles);
  
5 Integration Testing: You must perform integration testing using the data files from programming assignment 4.
6 Submission: In addition to the normal materials, your submission must include: hardcopies (of screenshots) of the integration tests.
7 Grading: Your implementation must work correctly for you to receive credit for this assignment.

Copyright 2014