Programming assignment 2 - Moving Menger Sponge

CS 354 - Introduction to Computer Graphics
Spring, 2007
Don Fussell

DUE Wednesday February 21 at Midnight

Now that you have created your Menger Sponge, you are going to navigate around it using keyboard and mouse input. In order to keep track of where you are in the scene, you should place a large polygon "below" the sponge so that you can use it as a reference. Below means perpendicular to the y axis and intersecting it at a value of y smaller than any y value of any point in the sponge. Larger means at least 10 times the length of the cube from which the sponge is created.

Your motion controls should work as follows. Use the IJKL keys to move your viewpoint around the scene. Input from the I key should move you forward, that is, in the direction from your eye to the lookat point. You will move your viewpoint by changing the eye position and lookat point an equal amount in the given direction in the GLULookat() call. The amount of motion. should be controlled by the S key to speed up and the A key to slow down. The K key should move you backwards the same amount you would have moved forward using the I key, and the J and L keys should move you left and right the same amounts, respectively. Remember in each case to move both the eye position and the lookat point the same amount in the same direction.

You should change directions of motion using the mouse. Holding the left mouse button down should allow you to turn your head to the left when you move the mouse to the left, right when you move the mouse to the right, up when you move the mouse forward, and down when you move the mouse back. In each case, you will move only the lookat point to change the direction. The amount of direction change should be proportional to the amount of mouse movement in a given direction.

For extra credit, try one or more of these: