|
University of California EECS Dept, CS Division |
||
|
TA: Laura Downs TA: Jordan Smith |
CS184: Foundations of Computer Graphics |
Prof. Carlo H. Séquin Spring 1998 |
for each polygon {
for each pair of successive vertices {
generate an edge pointing from top to bottom;
if (y_top > y_bottom) {
for each edge attribute
calculate d_attribute/dy;
}
insert edge into edgeList sorted by y_top;
}
for scanline := max_y downto min_y {
/* Add new edges to active edge list */
for each edge on edgeList {
if (edge.y_top > scanline) {
for each edge attribute
compute attribute at scanline;
remove edge from edgeList;
add edge to activeEdgeList;
}
}
/* Remove defunct edges from active edge list */
for each edge on activeEdgeList {
if (edge.y_bottom > scanline)
remove edge from activeEdgeList;
}
sort active edges on current x-value;
/* Calculate pixel values for each span (adjacent pair of edges) */
for each pair of edges in activeEdgeList {
for each span attribute {
calculate d_attribute/dx;
}
for pixel = ceiling(edge_left.current_x) to ceiling(edge_right.current_x) - 1 {
set pixel to correspond to attributes;
for each span attribute
span.attribute = span.attribute + d_attribute/dx;
}
}
/* Calculate attribute values for the next scanline */
for each edge on activeEdgeList {
for each edge attribute
edge.attribute = edge.attribute - d_attribute/dy;
}
}
}
}
Last modified: Fri Mar 3 14:25:50 2000