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).
Rasterizer3D
class so you should probably make a copy in a new directory/folder.
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.
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);
Copyright 2014