With much of the render pipeline already done from
before, a large section of this lab was spent adapting to the new
operating system and patner. We did add some functionality with alpha
blending and ellipses, but on the whole nothing earth shattering.
Who did you work with on this assignment, and what tasks did each of you do?
This time I have a partner... Wow. Unfortunately this
means that I am now working on unix and the going is slower. Evan
Moses, my partner, added alpha blending and corrected my circle drawing
algorithm to account for it. He was also invaluable in bug tracking and
adaptation to solaris. I added the routines to support arbitrary
ellipses.
Describe your model structure data type.
The GraphicsObject currently contains an enumeration
to specify its type, a void pointer to hold the data, as well as a
color value, an alpha level, and a filled boolean. It also contains a
pointer to another GraphicsObject, so that they can be made into a
linked list. This allows them to have hierarchies of GraphicsObjects,
where the an element of one is a pointer to another.
Describe the operation of your DrawStructure routine.
DrawGraphicsObject iterates through the linked
list that is a GraphicsObject. As long as the GraphicsObjects are of
the type matrixType, it multiplies the global transformation matrix by
them. When it encounters a drawable type it then builds the
transformation matrix from the series of matrices that follow it. After
it has drawn the object, it resets the current transformation matrix to
the identity. Since Prof. Maxwell suggested that this approach is
unituitive, this format will change in the next lab to have the
matrices precede the objects and the transformation matrix will persist
beyond the drawing of a single object.
Describe how you made use of hierarchical modeling when you made your starship. Somehow show a representation of the final structure graph.
The code to create the starship looks like:
StartGraphicsObject();
addGraphicsObject(unitOct);
addScale2D(1.5,.7);
addTranslate2D(-2.5,-.35);
addGraphicsObject(unitSquare);
addScale2D(.2,.5);
addTranslate2D(-2,.35);
addGraphicsObject(unitSquare);
addScale2D(.2,.5);
addTranslate2D(-2,-.85);
addGraphicsObject(unitSquare);
addScale2D(2,.4);
addTranslate2D(-3.5,.85);
addGraphicsObject(unitSquare);
addScale2D(2,.4);
addTranslate2D(-3.5,-1.25);
addGraphicsObject(unitSquare);
GraphicsObject *starShip = EndGraphicsObject();
As you can see already created GraphicsObjects can be inserted into a
new one. The program uses a global stack of matrices so when another
GraphicsObject is encountered the current transformation is pushed onto
the stack, DrawGraphicsObject is called recursively, and then the
global stack is popped.
What extensions did you do for this assignment, how did you do them, and how well did they work?
Yes, our system allows arbitrary ellipses. When the ellipses happen to be on axis (after the transformations), they are draw normally. Otherwise they are quitely converted into a 32-gon... As you can see by our fleet circling an asteroid. |
This fleet was, of course, designed using our enterprise
from before: |
Meanwhile, we "creatively" made use of our features and our knoweldge of what happens behind the curtains to create an interesting scene. If you look closely at the bubbles, you will also notice the alpha blending involved, unfortunately it did not translate well to 8-bit color.
![]() |
Last modified 2003-10-07 22:15 EST
