Write a triangle rasterizer. The triangles are given to you in a wavefront obj format file (obj reader will be provided) In addition, there is a camera file, that lists nine floats representing a point of projection, a normal to the projection plane and an up vector followed by two integers the horizontal and the vertical window resolutions, respectively. Assume a horizontal field of view of 60 degrees and a vertical field of view to fit the aspect ratio of the screen. No explicit clipping is needed: simply ignore parts of the triangle not on-screen. Ignore lighting. Color should come from perspective correct texture mapping with bi-linear interpolation. Perform nX-supersampling if requested: use the triangle (bartlet) filter and choose n samples randomly on a 16x16 regular grid: but only for pixels that are intersected by a polygon edge.
You should output the produced image into a file in TGA format. (TGA library will be provided.)
Name your program rasterize, which should take in two required parameters. The
first is the the name of the obj file and the second is the name of the camera file.
The output should always be in image.tga. If a third parameter is provided, perform
anti-aliasing.
rasterize <inputobjfilename> <inputcamerafilename> [n]
n is an integer between 1 and 16 (inclusive, default is 1),
specifying the number of samples per pixel.
Additionally produce a log (in a file named "raster.log"), which stores one line for each pixel processed. The line contains the pixel's row and column number, the polygon number (starting at 1 for the first polygon in the input file) being processed, the number of samples chosen and the depth of each sample.
Do not use openGL etc.