Due: Thursday, September 30th, 2010 (before lab session starts)
Utilize your base code from the previous lab and homework assignments, bezier and tvehicle. The goal of this program is to integrate your vehicle into the bezier curve builder such that your vehicle will travel along the curve specified using the bezier program. This, in effect, is like building a rollercoaster where the curve is the track and your vehicle is the ride car.
To make building the track easier, you should allow the user to read in a set of control points from a file. That means you should able to run your program as follows:
$ ./rollercoaster <datafile>
The points should just be a tuple of x y z, where each point is on one line:
Controls 0.0 1.0 1.0 0.0 2.0 3.0 ...
Note that the program starts with the sentinel Controls to mark that the following coordinates correspond to control points.
Once the rollercoaster track is loaded the user should be able to manipulate the curve as normal. To allow the user to save the modified track or restore the original one, you provide a key binding to allow for saving the current track and or to reload the original datafile. For instance, if the user presses F1, it should save the current track and if the user presses F2 it will restore it.
The secret to Disneyland's success is not the quality of the rides, but in the magical atmosphere it provides (that's what it's a theme park and not just an amusement park). To augment the drab scene, you should allow the user to place additional objects into the scene. These can be anything from basic primitives such as cubes and spheres, to more sophisticated objects such as trees and buildings.
To allow for switching between items, you should replace the the middle-click mouse binding. Currently, it is used to delete an control point. Instead, you should simply add a key binding such as d or DELETE that deletes the currently selected control point. With the middle-click mouse binding free, you can then bind a menu that allows the user to select what type of objection to place: a control point, a cube, a cone, etc. This means middle clicking will bring up a menu or palette of objects to place. You should allow the user to switch between a control point and at least two other objects.
The other binding you will need to modify is the wheel up and wheel down controls. Currently, if a control point is selected, the wheel controls will adjust the height of the object. You should modify it so if you have selected a non-control object then scrolling the wheel will adjust the scale of the object. If you wish, you may want to add key bindings to allow the user to modify the orientation of your objects (ex. [, ]).
The data file format should then be:
Controls x, y, z Cubes x, y, z, scale, orientation Spheres x, y, z, scale, orientation
Of course, you can replace Cubes and Spheres with whatever objects you wish and you only have to include scale and orientation if you allow the user to modify those properties.
Once a track is in place and the scene is set, the user should be able to press a key to start the vehicle in motion (ex. F3). The vehicle should precisely follow the trajectory of the curve and have the appropriate orientation (tilt up when going up hill, tilt down when going downhill, etc). To animate the vehicle, you will probably want to update its location using a timer callback.
Note
When your vehicle reaches the end of the track, you can either have it turn around and come back the opposite direction, or simply jump to the beginning of the track.
During the animation of your rollercoaster, you should divide the window into 4 viewports with the following displays:
Your program should have the following command line interface:
usage: rollercoaster [options] <datafile> Options: -h Show this help message
An example invocation would be:
$ ./rollercoaster datafile
Feel free to add additional flags and options to modify your programs behavior at runtime.
Note
Your program must read in the input file from command line arguments.
Grading for this assignment is out of 45 points:
Points | Requirements |
---|---|
10 | Rollercoaster track designer:
|
10 | Decor et milieu:
|
10 | Rollercoaster vehicle animation:
|
10 | Camera views: During rollercoaster animation the window is split into four viewports:
|
5 | Submission builds and runs properly and includes the appropriate files:
|
Submit your source code, Makefile, and README to your course dropbox:
/afs/nd.edu/coursefa.10/cse/cse40166.01/dropbox/<afsid>/pgm5