For this assignment, you will add code to your assignment 3 application to load a character model files in a subset of the common obj format.
Loading an obj model
The subset of obj format you need to implement consists of:
- vertex lines in the format "v %f %f %f"
- texture coordinate lines in the format "vt %f %f"
- normal lines in the format "vn %f %f %f"
- face lines starting with "f" with three vertices with the format v#/vt#/vn#
- v# is an integer vertex line number starting with 1
- vt# is an integer texture coordinate line number starting with 1
- vn# is a normal line number starting with 1
- Ignore any lines you do not support.
The obj format has separate indices for each of v, vt and vn. You will need a unique element in the GPU vertex array if any of the v, vt or vn indices differ, but should share the same vertex array element if all three indices are the same. Compute a mapping from v/vt/vn to vertex-array index using the std::map data structure.
Since you are ignoring the material definition lines, use the same shader as the terrain, but with the texture defined at model load.
Load the "olano.obj" model, using the "olano.ppm" texture file (both pushed to the GLapp/data directory in your repository. You may need to scale and/or rotate the model to fit with the scale and orientation of the terrain.
Render this model at the character position, using the character translation and pan rotation (but not tilt). Change your view to use a third person control (just add an additional translation on the other side of the camera rotations).
Prevent the third person view from passing through the terrain.
For up to 25 points of extra credit, add make whatever additional changes are necessary to load and display the "mini.obj" model. You will at least need to parse some aspects of the mtl file. Make a shader corresponding to the material declaration, supporting at least Ka and Kd. You will also need to load multiple object parts from the one file, one part for each material.
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.
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 where the sample code was provided.
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.
Commit along the way with useful commit messages. We will be looking at your development process, so a complete and perfectly working ray tracer 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, assn4.txt, and updated .gitignore file, but no build files, log files, generated images, zip files, libraries, or other non-code content.