The Assignment

This assignment will build your assignment 3 OpenGL code (or mine, if yours was not working). You will modify your program to interactively walk over the landscape using typical game keyboard and mouse controls. Motion should use four keys: holding 'w' should move you in whatever direction you are currently pointing, 's' should move you backwards, 'a' and 'd' should move you to the left and right. Moving the mouse left, right, up and down should rotate your view and motion direction around your current position. All motions should be computed in terms of rates (per second or per millisecond), then scaled by the elapsed time between frames. This is the typical first-person keyboard and mouse motion control scheme.

During any motion, the view should remain a constant height above the landscape. To figure out the height of your viewpoint, consider just your horizontal (x,y) position. From that position, find your triangle and your 2D barycentric position within that triangle. Use barycentric interpolation of the vertex elevations to compute the surface height at your position, then add a constant offset to place your viewpoint above the surface.

You should stop the motion if you reach the edge of the terrain, and would no longer be above any terrain triangle

634 only

Also align the view with a barycentric interpolation of the surface normal.

Extra credit

The simplest way to do this assignment is to check every triangle for the current position. For up to 20 points of extra credit, use the half-edge data structure to directly track the view position. Using this data structure, when you leave one triangle through one edge, you should immediately know exactly which triangle to check next.

Extra credit is only available if you submit by the original deadline or use your free late. If you submit late with the late penalty, you will not be eligible for any extra credit points.

You are also only eligible for extra credit if you tell us you did the extra credit in your assn4.txt and where to find the mesh data structure definitions and code.

Strategy

Plan ahead first. Know how you are going to find the position and view vector. Once you have a plan, implement in stages that each produce a visible, testable result. While it is not part of the assignment, it may be useful to add extra keys for debugging. For example, a key that switches between the perspective view and a top-down view with a simple object at the current position could help debug your position code.

What to turn in

Turn in this assignment electronically by pushing your source code to your class git repository by 11:59 PM on the day of the deadline and tagging the commit assn4. Do your development in the GLapp directory, continuing to modify the code there. It is not necessary to make a copy. Version control allows us to check out the assignment 3 version for grading while you work on assignment 4, even if you commit and push along the way.

Also include an assn4.txt file telling us about your assignment. Include your name and campus ID at the top of this file. Do not forget to tell us what (if any) help you received from books, web sites or people other than the instructor and TA.

Check in along the way with useful checkin messages. We will be looking at your development process, so a complete and perfectly working assignment submitted in a single checkin one minute before the deadline will NOT get full credit. Individual checkins of complete files one at a time just before the deadline will also NOT get full credit. Do be sure to check in all of your source code, Makefile, README, and updated .gitignore file, but no build files, log files, generated images, zip files, libraries, or other non-code content.

Be sure to include the details of the system you used for the assignment in your README in case we have problems.