ivscan by Andreas Sundquist (asundqui)

Please note the extra features that I have implemented at the cost of
a significant amount of sleep.

1) Transparency - My program handles transparency correctly, i.e. the
   transparent pixels are always rendered back-to-front to ensure the
   correct blending. To do this I came up with a new algorithm that
   is analogous to Z-Buffering but it can maintain maintain lists of multiple
   pixels/spans so that we can determine how to render that pixel. I first
   do all the Z-buffering, without doing any pixel color calculations, Then
   when I am done I have determined exactly what sets of spans contribute to
   each pixel, and in what order. This cuts down on some wasted over-draw
   time of Z-buffering as well as provides improved functionality.
2) Clipping - My program clips all polygons to the view frustum. Making
   it do this was incredibly cumbersome due to the idiosyncracies of
   Inventor that I had no idea about. I think I got it figured out though,
   it appears to clip correctly (otherwise it would butcher unknown memory
   locations and probably have very bad effects). I will admit, however,
   that there sometimes appear problems when clipping to the near plane.
   I believe this has something to do with the lack of a canonical eye space
   clipping volume in Inventor. Although I could probably fix it, it
   won't happen in the next 15 minutes.
3) Extra buttons - The (Cu) button toggles backface culling - the current
   setting is outputed to the standard output. The (Li) button toggles
   between per-pixel and per-vertex lighting. You may want to disable
   backface culling for certain data sets that contain polygons that are
   visible from both sides but only one-sided.
4) Per-Pixel lighting - not a trivial amount of work with the framework
   we were initially given. In hindsight, I should have had a more
   consistent way of containing all the material parameters in a structure
   or class. In any case, it was a lot of work, but it works correctly.
5) Perspective correct everything - no interpolation of quantities that
   are not linear in X and Y. Everything is interpolated with a factor
   of 1/Z, which corrects the linearity.
6) Interpolation of all material properties across polygons. This is could
   produce some really neat effects but I have no example files to play
   with.
7) Specular lighting - added in that nice highlight to make it look more
   like it was intended. Note that my speculr highlight may not appear
   at the same position as Inventor/OpenGL thinks it should be. I used
   the half-vector and the normal to compute the highlight.
8) Cleaned up some messy code! Got rid of the polygon edge-sort dependence,
   reduced memory allocation for each rendered frame, replaced bubble sort
   with insertion sort...
9) Made it draw a nice background :) Could be varied

I wanted to add texturing but I wasn't able to find the right information
on how to access the data in Inventor, etc... Anyways i didn't have time...


