RenderQueue class
#include <nCine/Graphics/RenderQueue.h>
Sorts and issues the render commands collected during a scene graph visit.
Drawable nodes append their commands during the visit phase. SortAndCommit() then separates opaque from transparent commands, sorts each group, builds batches and uploads their data, and Draw() finally issues them to OpenGL in the proper order.
Public types
- struct Part
- Commands of a range of layers, a part of a queue drawn in parts (see NextPart()).
Public static variables
-
static std::
uint32_t NoSplitKey constexpr - Split key that ends the last part, a part up to it holds the rest of the queue.
Constructors, destructors, conversion operators
Public functions
- auto IsEmpty() const -> bool
- Returns
trueif the queue does not contain any render commands. - void AddCommand(RenderCommand* command)
- Adds a draw command to the queue.
-
void SortAndCommit(ArrayView<const std::
uint32_t> splitKeys = {}) - Sorts the queues, builds batches and commits the commands.
- auto StartPart() const -> Part
- Returns the empty part the first one follows, to start NextPart() with.
-
auto NextPart(const Part& previous,
std::
uint32_t endKey) const -> Part - Returns the part that follows
previous. - void Draw(const Part& part)
- Issues the render commands of the given part in order.
- void Draw()
- Issues all the render commands in order.
- void Clear()
- Clears all the queues and resets the render batcher.
Function documentation
void nCine:: RenderQueue:: SortAndCommit(ArrayView<const std:: uint32_t> splitKeys = {})
Sorts the queues, builds batches and commits the commands.
No batch spans any of splitKeys (layer sort keys in ascending order, see RenderCommand::
Part nCine:: RenderQueue:: NextPart(const Part& previous,
std:: uint32_t endKey) const
Returns the part that follows previous.
Contains the commands from where previous ends up to (but not including) the layer sort key endKey, the rest of the queue with NoSplitKey. Only what previous left is searched, so the parts have to be taken in order.