Re: [AD] Remove the P3D code please! |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
What you guys keep forgetting is that qsort hates already sorted data, and
that if you are creating a scene based renderer then its not a good idea
to not take advantage of scene coherency (that means that the same
polygons will most likely be in the next frame, so why waste time setting
them up again?). If you take advantage of scene coherency, then they
polygons will already be mostly sorted, and qsort will completely suck at
putting new polygons in the correct spots. At this point, a smart bubble
sort will work better. But since bubble sorts have a bad rep (almost as
bad as 'goto'), no one even considers them. However, this completely
ignores that P3D is not sorting polygons.
But in the context of P3D scenes, 'sorting' is not occuring (as least not
per polygon), so suggesting a radix or qsort or bubble sort is beside the
point. P3D is adding and splitting scan lines in a list, not polygons.
By the time P3D renders its completed scene, there are no polygons
anymore, just a list of segments. It does not sort (at least, I don't
think it does), it puts the segments in the correct position. This is a
searching problem, not a sorting problem.
Forgive me if I'm wrong about the specifics of P3D, I understand that it
is a scan line renderer, and I know how those work in general.
I brought up scene coherency and being careful about singing the praises
of the quick sort because so many people think that refilling the same
data structures with unsorted data which is almost the very same unsorted
data they used last frame, then sorting them again every single frame with
a 'fast' sort into a sorted list that is almost the same as the last
frame is a good idea.
You may be using a fast sort, but its only needed because you are being
bone headed about everything else ^_^
I'm not applying this to anyone in particular, I'm just tired of hearing
how great qsort is for polygons, its a sign that the rest of your grpahics
pipeline is not as fast as it could be. Of course, sometimes you may
actually need to use qsort. I'm just saying use the tool thats best for
the job.