This assignment
extends Assignments 01 and 02 by incorporating parallel projections
and 3D clipping. Your task is to develop a graphics package that
reads an input file and displays the parallel projection of the
objects. All objects should be properly clipped. Additionally, all
commands from the previous assignments should remain
functional.
When you start your
program, it should automatically read a file called "cameras.txt",
which contains the camera's viewing parameters. This file should be
read only once at startup and should not be read again when loading
input files.
Load (Open) Input File This command loads all the data and
parameters from the input text file and displays the objects using
parallel projection. All objects should be clipped in 3-d and
displayed in the viewport.
Fly
Camera This command moves the VRP (View
Reference Point) from Point A to Point B in 100 incremental steps,
while keeping VPN (View Plane Normal), VUP (View Up Vector), PRP
(Projection Reference Point), and all other viewing parameters
constant. The intermediate results should be displayed. The user
must specify the coordinates of points A and B.
Notes:
Multiple cameras may be defined in
the cameras.txt file.
Each c line marks the start of a new
camera definition.
For this assignment, only process the
viewing parameters for the first camera.
In future assignments, views from
multiple cameras will be displayed simultaneously.
The set of r, n, u, p, w, and s lines
defines the viewing parameters and viewport.
If any parameters are missing, use
the default values.
Detail format of the cameras.txt
file::
c
// Start the definition of a new
camera.
i
camera_name //Name of the camera.
Default=""
t Parallel /
Perspective // Define camera type. Default=
parallel
Read the
"cameras.txt" file and calculate the composite matrix for parallel
projection.
Read the
input file and process each face:
For each
vertex, apply the sequence of transforms to convert the vertices
from object space to world space (as specified by the user in
Assignment 02).
Apply
the composite matrix for parallel projection.
3D
Clipping:
Clip
each side of a face against the standard parallel volume bounded by
the planes x = -1, x = 1, y = -1, y = 1, z = 0, z = 1.
If the
result is not rejected after clipping:
Drop the
z value (as in Assignment 01, now you have 2D data).
Map from
window to viewport and draw the line on the screen (this is from
Assignment 01).
Use the
bounds xwmin = -1, ywmin = -1, xwmax = 1, ywmax = 1.