Mail Archives: djgpp/2000/01/03/13:11:40
First of all, let me point out that this is not the right place to
have asked this question in. There is no link to DJGPP in it. This
question belongs to the comp.graphics.algorithms newsgroup.
Snowman (idzy AT friko5 DOT onet DOT pl) wrote:
[...]
> I dont know how to sort the faces (I'm using qsort( )) in the correct order.
There *is* no correct order, in the general case. Your scene must
follow special rules for it to be displayable correctly by simple
z-sorting, also called (the naive version of) Painter's algorithm. If
it doesn't follow those rules, you'll get display errors.
Frequently, debates turn up in c.g.algorithms about how to properly
z-sort, what quantity to sort by (max, min or mean z? something
else?), and so on. Such debate is useless: the whole idea of painters
algorithm is limited to a special type of scenes.
For general scenes, you have to apply more involved algorithms, which
turn the sorting into a mere preprocessing trick to help speed up the
real algorithm, which consists of a combined sorting and *splitting*
loop over all polygons in the scene.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -