Should my rendering engine be structured so that it contains a list / queue which is iterated over and renderer
This is not a simple question. There are many components that need to work together and several ways to store objects that need to be rendered.
A model is a collection of meshes, and each mesh has one “sub-mesh” per material (per render pass).
Your game scene (scene manager—keeps track of all objects in your scene, from lights to players to grass, sky, etc.) has a list of models probably stored in a linear array, but also inside an octree for frustum culling etc.
#1: Scene manager culls the world objects for those in view, using the octree. Each in-view mesh adds to a render-queue all of its sub-meshes (each render-queue item corresponds to 1 draw call, since its whole purpose is to sort for efficient rendering).
#2: The render-queue is a linear list of sub-meshes that need to be drawn. It contains things such as shader keys, texture keys, vertex-buffer keys, etc. All the information necessary for sorting.
Opaque sorts are largely based on render state, and when 2 objects have the same render state they are sorted front-to-back.
Translucent objects are sorted back-to-front.
#3: The sorted render-queue is used for rendering sub-meshes in order.
This is heavily discussed
here.
i went straight for the fastest possible sort: bucketsort.
Insertion sort paired with temporal coherence is O(n) most frames, which is the fastest you should be able to achieve since sorting is actually a rare occurrence (a slower sort that runs in linear time for already-sorted items outperforms any faster sort that does not take advantage of already-sorted items).
L. Spiro