|
This assignment can be
completed using OpenGL and glut. Your program will accept one
command line argument, the name of the data file. The data
contained in this file is a list of control points for a spline that
will be generated according to the Bezier, B-spline, and Hermite
standards. This spline will be rendered as a curve on the
floor of a simple cubic room you will construct using OpenGL
primitives. The walls, floor, and ceiling of this room will be
texture mapped. A character of your creation will "walk" along
the spline from beginning to end and the user will be able to view
the animation either through a camera that he or she controls or an
automated camera that follows the character.
There are five key portions:
Input File
The first line of the input
file will consist of a character equal to 'h', 'b', or 'z' followed
by a space and then an integer corresponding to the number of
control points that will follow. The list of control points
begins on the next line with one control point per line. The
control point is represented as a pair (or triple if you want to
extend your system to a character that "flies" instead of "walks")
of comma-separated values. The h-b-z indicate whether the
spline to be generated is Hermitian, B-spline, or Bezier.
Generate the spline
We presented in class a
recursive algorithm that renders Bezier splines. You should
implement this algorithm and convert the control points of the input
file to the Bezier basis for rendering by this one recursive
algorithm.
Generate the texture
mapped room
OpenGL makes it relatively
easy to load images as texture maps that you can apply to squares
and triangles. Fortunately, the geometry you create to
represent the walls of the room will be simple (12 triangles) and
assigning texture coordinates should go quickly.
Animate the character
To keep production time
down, the character you animate can be anything of your choosing.
It should have a distinct shape that permits one to judge which way
it is facing because when the character slides along the spline, it
should also rotate so it is facing the tangent to the curve.
Create the camera
controller
You have two choices for the
camera controller. One choice is to implement a simulated
"trackball" interface where the user can rotate the world and zoom
in. An example for how to create the trackball interface can
be found at the end of the lecture on
Bezier splines.
A second candidate for a
camera is to create an automatic camera that tracks the character
over its shoulder. The camera should be a small amount
behind the character and it should rotate in unison with the
character.
Extra Credit:
There are lots of fun things
you can add to this assignment
-
Make the memory allocation
dynamic so the input file no longer needs to specify the exact
number of control points.
-
Make the room more realistic
than a simple box. You've got a poly loader from assignment
one that you could use to insert other objects in the room.
-
Apply more advanced texture
techniques
-
Create a more realistic
character (I've got motion capture data of a walking person if you
want it)
|