Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::RenderQueue Class Reference

Batches drawables into sorted geometry, primitive, and custom execution passes for GPURenderer. More...

#include <flint/graphics/render-queue.h>

+ Collaboration diagram for Flint::RenderQueue:

Public Member Functions

 RenderQueue (FrameData &frame, const FloatRect &cameraView)
 Construct a render queue bound to a specific frame stage and camera view.
 
FLINT_API void deferUpload (UploadCallbackFn fn)
 Defer a resource upload operation to execute prior to render pass submission.
 
FLINT_API void quad (GPUTexture *texture, const FloatRect &dst, const FloatRect &srcUV, Color tint, float rotation=0.f, Vec2f origin={0.f, 0.f})
 Emit a textured world-space quad into the ordered geometry stream.
 
FLINT_API void solidQuad (const FloatRect &dst, Color tint, float rotation=0.f, Vec2f origin={0.f, 0.f})
 Emit an untextured, solid-colored world-space quad.
 
FLINT_API void circle (GPUTexture *texture, Vec2f center, float radius, Color tint, float rotation=0.f, float innerRadius=0.f)
 Emit a circular or ring-shape primitive.
 
FLINT_API void lines (std::span< const PrimitiveVertex > verts, PrimitiveType type)
 Emit world-space colored point or line primitives.
 
FLINT_API void custom (CustomDrawFn fn)
 Enqueue a custom rendering callback directly into the execution stream.
 
FloatRect getCameraView () const
 Get the active camera view rectangle bound to this queue.
 

Detailed Description

Batches drawables into sorted geometry, primitive, and custom execution passes for GPURenderer.

Note
A RenderQueue is created for one frame-construction phase and borrows its FrameData and camera view for that phase only.
Warning
Texture and sampler resources referenced by emitted work must remain valid until the frame's GPU commands have completed.
See also
Drawable::emit
GPURenderer::draw

Definition at line 29 of file render-queue.h.

Constructor & Destructor Documentation

◆ RenderQueue()

Flint::RenderQueue::RenderQueue ( FrameData & frame,
const FloatRect & cameraView )
inlineexplicit

Construct a render queue bound to a specific frame stage and camera view.

Parameters
frameDestination frame data storage. Must remain valid for the duration of this queue's construction phase.
cameraViewActive camera view rectangle used for coordinate transforms.

Definition at line 38 of file render-queue.h.

Member Function Documentation

◆ circle()

FLINT_API void Flint::RenderQueue::circle ( GPUTexture * texture,
Vec2f center,
float radius,
Color tint,
float rotation = 0.f,
float innerRadius = 0.f )

Emit a circular or ring-shape primitive.

Generates a bounding quad configured for procedural or textured circle rendering.

Parameters
textureOptional texture mapped across circle bounds. May be nullptr.
centerWorld-space center point of the circle.
radiusOuter radius in world-space units.
tintRGBA color tint applied to the circle.
rotationClockwise rotation in radians.
innerRadiusinnerRadius Inner cutout radius in world-space units. A value of 0.f produces a filled circle; values greater than 0.f produce a hollow ring.

◆ custom()

FLINT_API void Flint::RenderQueue::custom ( CustomDrawFn fn)

Enqueue a custom rendering callback directly into the execution stream.

Custom GPU commands execute in the exact submission sequence relative to surrounding draw commands. Invoking this breaks active batch runs.

Parameters
fnCallback receiving active command buffer handles at render time.

◆ deferUpload()

FLINT_API void Flint::RenderQueue::deferUpload ( UploadCallbackFn fn)

Defer a resource upload operation to execute prior to render pass submission.

Callbacks are batched and invoked during the frame's pre-render transfer phase before any draw commands in this queue are issued.

Parameters
fnCallback executing GPU buffer or texture upload operations.

◆ getCameraView()

FloatRect Flint::RenderQueue::getCameraView ( ) const
inline

Get the active camera view rectangle bound to this queue.

Returns
FloatRect Camera bounds in world-space units.

Definition at line 132 of file render-queue.h.

◆ lines()

FLINT_API void Flint::RenderQueue::lines ( std::span< const PrimitiveVertex > verts,
PrimitiveType type )

Emit world-space colored point or line primitives.

Vertex positions are transformed to normalized device coordinates using the camera view associated with this queue.

Parameters
vertsVertices copied into the current frame's line stream.
typeTopology used to interpret the supplied vertices.
Note
Consecutive point or independent-line submissions with matching topology may share a draw run.
Warning
Separate LineStrip submissions intentionally remain separate; combining them would introduce a segment between unrelated strips.

◆ quad()

FLINT_API void Flint::RenderQueue::quad ( GPUTexture * texture,
const FloatRect & dst,
const FloatRect & srcUV,
Color tint,
float rotation = 0.f,
Vec2f origin = {0.f, 0.f} )

Emit a textured world-space quad into the ordered geometry stream.

Consecutive quads using the same texture and sampler may share one indexed draw run. Geometry is never reordered solely to improve batching.

Parameters
textureNon-owning GPUTexture pointer. Must be valid and contain a usable GPU texture through frame execution.
dstDestination rectangle in world-space units.
srcUVNormalized texture rectangle; values are expected in [0, 1].
tintRGBA color multiplied with the sampled texture.
rotationClockwise rotation in radians.
originRotation pivot measured from dst position in world-space units.
Note
The queue copies the generated vertex data immediately; it does not retain references to dst or srcUV.
Warning
The destination position is not automatically adjusted for origin. Higher-level callers such as Sprite perform that adjustment before calling this method.

◆ solidQuad()

FLINT_API void Flint::RenderQueue::solidQuad ( const FloatRect & dst,
Color tint,
float rotation = 0.f,
Vec2f origin = {0.f, 0.f} )

Emit an untextured, solid-colored world-space quad.

Parameters
dstDestination rectangle in world-space units.
tintSolid RGBA color assigned to vertices.
rotationClockwise rotation in radians
originRotation pivot measured from dst position in world-space units.

The documentation for this class was generated from the following file: