Modelling-Viewing Pipeline - Modelling

Deadline: September 12, 23:59:59 IST

Overview

This is the first part of a two part assignment on exploring the modelling-viewing pipeline. This part deals with modelling. You will create your models in a 3D voxel grid with a cube primitive.

Preparation

  1. The assignment is to be maintained and submitted via github.com.
  2. Make sure you have a github.com account and have access to it before proceeding.
  3. Read these instructions about how to get started with assignments on github.
  4. Click on the assignment invitation link sent on the mailing list to begin.

To Do :

  1. Create a model of a 10x10x10 cube. Create a grid of 256x256x256 cells. The cube will serve as a drawing primitive and can be positioned at any of the grid cells and be used to fill it up. The set of filled grid cells forms the complete model.

  2. You have to make a (cubified) model of any two structures/buildings. Make sure your overall structure is not just a cube. The models cannot be entirely of a single colour.

  3. You must make the models from scratch. You cannot use any external modelling tools. The models must be coloured. OpenGL 3.3+ has to be used. The fixed function pipeline cannot be used.

  4. Your program must have a modelling mode (activated by pressing M) and an inspection mode (activated by pressing I). Print the current mode active in the terminal at every mode change.

  5. In the modelling mode, the following should be enabled:

    1. In the beginning, draw an empty grid with light grey lines. Create a VBO/VAO for this.
    2. There is a cursor cube that is always displayed in bright green. Create a separate VBO/VAO for the cursor cube.
    3. The x/X keys move the cursor cube one grid cell to the left/right along the X-axis.
    4. The y/Y keys move the cursor cube one grid cell to the down/up along the Y-axis.
    5. The z/Z keys move the cursor cube one grid cell to the back/forward along the Z-axis.
    6. Let the left-bottom-back grid cell be the origin (0,0,0).
    7. Let the X,Y,Z coordinates change by one as the cursor cube moves across grid.
    8. Do proper bounds checking - the cursor cube should not move out of the grid.
    9. If the cursor cube is at an empty grid cell, pressing the p/P key fills that grid cell by placing a cube there with current drawing colour.
    10. If the cursor cube is at a filled grid cell, pressing the d/D key deletes the grid cell.
    11. Pressing the c/C key, changes current drawing color by prompting to enter R/G/B values on the terminal. R,G,B values are float values from 0.0 to 1.0. Everything that is drawn subsequently is drawn with this color.
    12. Pressing the r/R key resets the grid by clearing all grid cells.
    13. Pressing the s/S key saves the current state of the grid cells. Save the coordinates of the filled cells along with the (R,G,B) value for each cell. Each line in the file has one X,Y,Z coordinate and its corresponding R,G,B colour (i.e., six float values on a line). The 3D grid needs to be traversed in a particular order and the coordinates of the filled cells are written to the file. This order must be in ascending lexicographical order of the (X,Y,Z) coordinates, starting from the origin. Save the file with name like .raw.
    14. Pressing the K key clears the current grid, loads a file into the grid. Filename with full path can be input from the terminal. The extension (.raw) should be a part of the filename input.
    15. The model (made of cubes) should be contained in a separate VBO/VAO.
  6. In the inspection mode the following should be enabled:

    1. The left/right arrows should allow the model to be rotated about the Y-Axis, the up/down arrows about the X-axis and [ / ] keys about the Z-axis. The pivot for all these rotations should be the centroid of the grid.
    2. The navigation keys can be made available in the modelling mode too, but implementing them to work in the inspection mode is must.
  7. Write a pdf report explaining the design of your code and how you implemented the above mentioned features. Also include rendered screenshots of the two models your created in your report. Name this report file submit.pdf. Make sure you include the names of both members of your group in the report. Put the report in a doc folder in the assignment folder tree.

  8. Make sure all your sources (both .cpp and .hpp) go into a src folder, the compiled binary goes into a bin folder. Also ensure that you have a top level Makefile present that generates the executable binary in bin folder on typing make. The executable binary must be called a1model.

  9. Also, add a clean target to the Makefile that cleans all files generated during compilation, including the binary and temporary files, if any.

  10. The vertex and fragment shaders that you write must be stored in the src folder as well.

  11. Create two models. Save them in files named model01.raw and model02.raw and save them in a top level folder called data.

  12. At the time of submission make sure your repository only contains the src, doc and data folders, with all the sources in the src folder, the report in the doc folder, the models in the data folder. In addition there should be the Makefile and a README in the top level folder. There should be no other file in the repository.

Do NOT do the following:

  1. Write untidy or unorganized code. This will be penalized.
  2. Submit a repository that does not conform to the expected structure or has extra files.

Marking

  1. Drawing the grid: 50 marks
  2. Drawing and moving the cursor: 100 marks
  3. Filling a grid cell with a cube of current drawing colour: 50 marks
  4. Deleting a grid cell: 50 marks
  5. Changing the current drawing colour: 30 marks
  6. Resetting the grid: 30 marks
  7. Saving the model: 100 marks
  8. Loading the model: 100 marks
  9. Mode change: 30 marks
  10. Correct model rotation: 50 marks
  11. PDF report included with submission: 20 marks
  12. Two models: 100 marks
  13. Correct repository structure: 20 marks
  14. Total: 730 marks
  15. Deductions: Inconsistently written code: 10 marks
  16. Deductions: Submitting an unclean archive: 20 marks.

Important Note

Please do not put your solution code and report anywhere public. It should not be available online.

To Submit

  1. Regularly check-in the code into your teams' github repository.
  2. The last checkin before the deadline will be considered for marking.
  3. Modify the README.md file in the repository root folder stating the names and roll numbers of your partner for the assignment, and a declaration in your own words that the assignment is your own work and that you have not copied it from anywhere. Also cite any sources that you may have used to complete it.
Previous