As everyone knows, transparent objects need to be drawn last, sorted for depth, front to back. My problem, is that when emitting a transparent batch, I don't know, whether more batches might be emitted and hence I can't sort while batches are still emitted. The sort must be done when all the other (non-transparent) batches are sorted. I have 2 solutions to this problem:
a) a separate list of transparent batches, with a separate sort made on it
b) pairs (link to transparent batch in batch queue, depth) are kept when the transparent batches are emitted, then before doing the main sort, these are sorted based on depth and their key is the batch queue is updated, based on the results of the sort.
I don't really know if these are the only 2 options, nor which one is better. Maybe you can help me with advice, before I change half of my project?
I personally think option a) is best, since the sort on the non-transparent queue is then faster, since there are less objects in it and 2 sorts need to be made, no matter which option is chosen.