input file | input file |
input file | input file |
command | action |
---|---|
# | Ignore all text up to the end-of-line |
camera <x> <y> <z> <cx> <cy> <cz> <angle> <aspect> <hither> <yon> <tilt> <xres_i> <yres_i> | Record the camera parameters: position, center-of-interest, vertical half angle of view, aspect ratio, hither and yon clipping distances, tilt (rotation around viewing direction from 'up', x and y image resolution (integers). |
ambient <a> | Record the ambient value. |
background <r> <g> <b> | Record the background color. |
output <filename_s> | Record the output filename. |
identity | Set the current matrix to the identity. |
rotate [x|y|z] <degrees> | Form the appropriate rotation matrix and multiply the current matrix on the left |
translate <tx> <ty> <tz> | Form the appropriate translation matrix and multiply the current matrix on the left |
scale <x> <y> <z> | Form the appropriate uniform scale matrix (for this lab, you can just use the 'x' parameter) and multiply the current matrix on the left |
sphere <r> <g> <b> <texture-name_s> <kd> <ks> <n_i> <kr> <gl> <kt> <n1> <tr> | Create an additional sphere in the scene data structure, transforming it according the current transformation matrix and record its parameters: color, ignore the texture name text string, diffuse coefficient, specular coefficient, specular power and for this lab, ignoring the last five parameters. |
light <x> <y> <z> <intensity> <size> | Create an additional light in the scene data structure and record its parameters: position, intensity, and, ignored in this lab, size. |
Submit the source code for your program. For example:
submit c681aa lab2 lab2.c makefileOf course, you can break it up into multiple source files and submit those. For example:
submit c681aa lab2 main.cpp camera.cpp sphere.cpp light.cpp makefile- just as long as the grader can make and execute your program using whatever input file the grader wants to as an argument to lab1:
make lab2 <input filename>and the ppm file should be found in whatever output filename is specified in the input file (or 'output.ppm' if none is give).
Under UNIX, the ppm file, output.ppm in this example, should be able to be viewed using:
convert output.ppm output.jpg display output.jpg
backgroundFile <filename>
c = kd*(ambient + ∑(N⋅Li)*Ii)*object_color + ks*∑Ii*(Ri⋅E)n*(1,1,1)where the summation is over the light sources that the surface of intersection is oriented towards (i.e., N⋅Li > 0).