Posted: Wed Oct 29
Due: Monday 11/10 10:00am
- 4th Period: https://classroom.github.com/a/_lcb5Sqf
- 5th Period: https://classroom.github.com/a/SpLyGi41
For testing & submission purposes, please use the shape testing script from the previous assignment.__
Background:
Read up on moving to a polygon based framework in the online book. Focus on the introduction and Section 7.1. You should start working on this in code. If you think you’ve gotten a working polygon list framework, try turning your add_box code to a polygon based version (chapter 7.2.1). Then go from there
The Drawing:
- Create new functions to add a polygon to a matrix, and go through the matrix 3 points at a time to draw triangles.
- You should have a new triangle matrix that exists alongside the edge matrix. The edge matrix should be used for the shapes that are exclusively 2d (lines, circles, splines), and the triangle matrix for our 3d shapes.
- Anything aside from shape drawing that modifies/uses the edge matrix (apply, clear, display, save) should now modify/use the triangle matrix as well.
- Modify
add_box,add_sphereandadd_torusto add triangles to the new triangle matrix instead of points. - Make sure the parser calls the
draw_polygonsfunctions when needed. - Once all this is working, modify
draw_polygonsto correctly implement backface culling.
New Addition
Reading in mesh files, both .obj and .stl.
- New command:
mesh FILENAMEFILENAMEshould either be anobjor an ASCIIstlfile.- Parse the files correctly, and add the triangles represented in each file to your triangle list.
- You only need to be able to parse vertices/triangles. Both file types have potentially more information, which you can ignore.
- You can find sample mesh files here: https://github.com/mks66/resources
Specific Submission Guidelines
- All your code should be in the root directory of your repository.
- You should have 5 script files:
- The provided testing script.
- Your custom script from the pre-mesh version of the assignment.
- A script that correctly displays teapot.obj. (scaling by 75 will enlarge the teapot well)
- A script that correctly displays teapot_ascii.stl.
- A script that correctly displays whatever mesh file you have found.
- Include a comment (line starting with
#) with a link to your mesh file source.
- Include a comment (line starting with
- Place your mesh files in a directory called mesh_files, that is one directory up from your repository (and thus not committed to github).
- This means in your scripts, you would have:
mesh ../mesh_files/teapot.obj
- This means in your scripts, you would have:
- Your makefile should include the following:
- A default target that runs the test script.
- A
customtarget that runs your original custom code. - A
teapot-objtarget that displaysteapot.obj. - A
teapot-stltarget that displaysteapot_ascii.stl. - A
custom-meshtarget that displays your custom mesh file.