Please find our code in the nelson-phan folder. File: handin_project6.zip.
Hieu Phan & Dan Nelson
In this project, we built a hierarchical modeling system for our graphics engine. The skeleton of our modeling system are modules, which are implemented as linked lists in which each node is an graphic element. A graphic element can hold graphic primitives and matrices. A graphic element can also hold a module. This means that a module can be included in a module as well, which creates the hierarchies for our modeling system.
This modeling system is useful for systematically storing graphic primitives in groups, ready to be reused or transformed. The modeling system makes the graphic design process more approachable and extensible, allowing users to draw in parts and modify each part of the picture individually.
Explanations of algorithms
Drawing a module is the most important aspect of this project. To draw a scene, we recursively traverse the scene graph and depending on the type of the found data structures, different actions are taken. If a graphic primitive is found, the graphic system will draw it, taking into account the VTM, GTM and LTM. If the node is a module, recursively the system will look into the module for its child nodes and take action accordingly.
DrawState is a new data structure in this project. The name says it all: A DrawState structure is a like the hand of the painter, which decides which color is being used, whether we are using Z-Buffer or not, etc.
A scene with at least 3 layers of module
Our scene consists of 3 formations of wind power generators. Each formation is made up of 3 generators. To create the distance effect, we scale each formation differently and place them appropriately on the screen so that it looks like there are 3 rows of generators from near to far.
We made an animated picture from the required 3 module layer picture by rotating the wings around. It looks like the generators are producing electricity. Yay!