CS 351: Assignment #6

Title image Spring 2017

Hierarchical Modeling System

Due Thursday, 30 March 2017

In this assignment you'll implement a hierachical modeling system and learn how to build scene graphs using primitives and matrix transforms.


Tasks

Read the entire assignment before starting. If you don't, bad things will happen.

The Graphics System Specification outlines the functions required for a 2D/3D hierarchical modeling system that allows you to create modules and draw them. You will create a new set of functions for inserting graphics primitives, transforms, and other attributes into an open module. Each function will do approximately the same thing: put an instance of the object, transform, or attribute on the module's list.

As indicated in the graphics spec, the only required visual objects for the modeling system will be points, lines, polylines, and polygons. All of these primitives are described by one or more Point types. The important thing to remember about the insert function for these items is that graphics primitives need to be copied into the module so that the module has a local copy of the points constituting the object. If you do not copy the data into the module, bad things will happen.

The exception to the copy rule is inserting one module into another. In that case, a pointer to the sub-module needs to be stored in the parent. Modules should not be copied when they are inserted into another module. If you make copies of modules, bad things will happen.

The only tricky function to write is the function that actually traverses a Module's list and draws the scene onto the screen. The lecture notes include an algorithm for proper traversal of the scene graph. The most important aspect of the algorithm is how to organize the matrices.


Required Images

  1. Use the first test program to test out your system. It does not require any 3D functions module functions. The list of functions required is given at the top of the C file. Get those functions working first, before going on to anything else.

    My system prints out the vtm, the element type, and the point and line locations it is drawing from within Module_draw. here is my printout.

    Get this required picture done first before writing any more of the module functions. It will help you debug your basic module system.

  2. The second required picture is an image of a blue cube outline, made using your module_cube function.
  3. The third required image is a scene that contains a model with at least 3 layers of modules, where each higher module contains at least 3 instances of a lower module. For example, create a spaceship model, then a formation of 3 spaceships, then a scene with 3 formations. At the scene level, have each formation doing something different. You can put four or five things in your groups. Three is just the minimum. This is your required creative image. If you are working with a partner, you each need to make your own scene. (Oh, and this is a great scene in which to do animations).
  4. The last required image is based on this test code, which produces the image below.


Extensions


Writeup

Make a wiki page and give it the label cs351s17project6. Put up your required and portfolio images along with brief descriptions and relevant information.


Handin

Put your code on the handin server in a project 6 directory in your Private folder.