CS 450/550 -- Fall Quarter 2022

Project #2

100 Points

Due: October 11

Animate James Bond's Cessna!


This page was last updated: September 10, 2022


Introduction

James Bond has a very special Vertical Take Off and Landing (VTOL) Cessna that is custom-fitted with helicopter-ish propellers to halp him get away from the Spectre bad guys without needing to have a runway. This project is to animate it and look at it in two different 3D views.

Requirements:

  1. Draw a Cessna airplane. (Don't worry -- this won't be as hard as it sounds.)

  2. The Cessna's 3 propellers must be positioned properly.
    The Cessna's 3 propellers must be scaled properly.
    The Cessna's 3 propellers must be oriented properly.
    The Cessna's 3 propellers must be rotating properly.

  3. Allow two views: an "Outside" view of the entire scene and an "Inside" view from the Cessna cockpit. Be able to switch between them in your video. (You could use a pop-up menu or keyboard hits.) For each view, use a different call to gluLookAt( ) to position the eye.
    Hint: A good eye poition for your Inside View is (0., 1.2, 1.) .
    Hint: A good look-at position for your Inside View is (0., 5., 10.) .
    Feel free to change these as long as you can show us that a view out the front (+Z) of the cockpit works.

  4. Keep the same Xrot, Yrot, and Scale features as we've used before, but only in the Outside View. Do not use Xrot, Yrot, and Scale in the Inside View.

  5. Use gluPerspective( ), not glOrtho( ).

  6. Put some sort of 3D scene for your Inside view to see, looking outside the Cessna (off in the +Z direction). One or more GLUT wireframe objects might work well. Or, whatever you did in the first project. Or some sort of colored grid. Or, all of these things.

  7. Use the graphics programming strategy where the Display( ) function looks at a collection of global variables and draws the scene correctly. The other parts of the program simply set the global variables and post a redisplay.

  8. The code for creating the Cessna geometry is shown below in the Geometry section. The Cessna body extends along the Z axis. The cockpit points in +Z.

  9. There must be three propellers drawn on the Cessna body:
    1. A large propeller in the front, oriented in the X-Y plane. This should be located at (0.,0.,7.5) and have a radius of 5.
    2. A smaller propeller on the top of the left wing, oriented in the X-Z plane. This should be located at (-10.f, 3.f, 0.) and have a radius of 3. It is OK to leave out the axle that connects this propeller to the wing.
    3. A smaller propeller on the top of the right wing, oriented in the X-Z plane. This should be located at (10.f, 3.f, 0.) and have a radius of 3. It is OK to leave out the axle that connects this propeller to the wing.

    The smaller propellers must rotate twice as fast as the front propeller.

    The two smaller propellers must rotate in opposite directions.

  10. Create a single propeller display list and then transform and instance it three times to get the three propellers in the scene. The code for creating the single propeller geometry is shown below in the Geometry section. The single propeller is in the X-Y plane, centered at (0.,0.,0.), with a radius of 1.0.

  11. Pay close attention to the overall transformation sequence. You can re-use some of the transformations that you have already created by using glPushMatrix( ) and glPopMatrix( ).

  12. Parameterize your scene as much as you can with #define's or const's, It makes it easier to make changes later.

  13. Use GLUT pop-up menus for all options.

Positioning Everything:

Supplying the Geometry

Getting Started:

Not sure where to start? Read on!

  1. Draw the Cessna at the origin.

  2. Draw at least one other scene element somewhere out along +Z. This is where the Inside View will be looking.

  3. Start by using the stationary Outside View to view the scene. Give gluLookAt( ) some good values.

    Play with these so that when your program starts up, your are seeing the Cessna and your whole scene from a good angle.

  4. Pay careful attention to:

  5. After that works, designate Animate( ) as the Idle Function in InitGraphics( ). Have a global variable, say BladeAngle, that gets incremented in Animate( ). Use that variable in Display( ) to rotate the propellers. Be sure that Animate( ) posts a re-display.

  6. A way that I really like to do the animation is to put this code in Animate( ):
    float Time;
    #define MS_IN_THE_ANIMATION_CYCLE	10000
    . . .
    int ms = glutGet( GLUT_ELAPSED_TIME );	// milliseconds
    ms  %=  MS_IN_THE_ANIMATION_CYCLE;
    Time = (float)ms  /  (float)MS_IN_THE_ANIMATION_CYCLE;        // [ 0., 1. )
    
    where Time is a global floating-point variable and MS_IN_THE_ANIMATION_CYCLE is how many milliseconds are in the animation cycle. This sets Time to be between 0. and 1., which you can then use to set animation parameters. The advantage of this is that you will get the same number of milliseconds in the animation cycle regardless of how fast or slow a system you run this on.

  7. After that works, add the Inside View by testing what view mode you are in and then using a different call to gluLookAt( ). Don't use Xrot, Yrot, and Scale if you are in the Inside Mode.

Those Vector-Manipulation Functions

The lighting of the Cessna surfaces uses two functions, Cross( ) and Unit( ). They are in your sample code already.

A Debugging Suggestion:

Turn-in:

Use the Teach system to turn in:

  1. Your .cpp file
  2. A one-page PDF with a title, your name, your email address, a couple of nice screen shots from your program, and the link to the video demonstrating that your project does what the requirements ask for. You can use any video capture tool you want. Kaltura and Zoom work well. There are others. If you can, narrate your video so that you can tell us what it is doing. Be sure your video demonstrates all the items in the grading rubric below. If you use Kaltura, be sure your video status is changed to Unlisted so that we can get access to it to grade it.

Grading:

FeaturePoints
Correctly draw the Cessna body15
Correctly scale the propellers15
Correctly position the propellers15
Correctly orient the propellers15
Correctly rotate the propellers15
Recognizable Inside View25
Potential Total100

Acknowledgement:

Thanks to free3d.com for the Cessna model!