Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
render-queue.h
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2025-2026 Manuel Osorio
3#pragma once
4#include "flint/graphics/types/custom-draw-fn.h"
5#include "flint/graphics/types/primitive-types.h"
6#include "flint/math/types.h"
7
8#include <span>
9
10namespace Flint {
11 class GPUTexture;
12 struct FrameData;
13
29 public:
37 explicit RenderQueue(FrameData &frame, const FloatRect &cameraView)
38 : m_frame(frame),
39 m_cameraView(cameraView) {
40 }
41
50 void deferUpload(UploadCallbackFn fn);
51
72 void quad(GPUTexture *texture, const FloatRect &dst, const FloatRect &srcUV, Color tint,
73 float rotation = 0.f, Vec2f origin = {0.f, 0.f});
81 void solidQuad(const FloatRect &dst, Color tint, float rotation = 0.f,
82 Vec2f origin = {0.f, 0.f});
97 void circle(GPUTexture *texture, Vec2f center, float radius, Color tint, float rotation = 0.f,
98 float innerRadius = 0.f);
99
114 void lines(std::span<const PrimitiveVertex> verts, PrimitiveType type);
115
124 void custom(CustomDrawFn fn);
125
132 return m_cameraView;
133 }
134
135 private:
136 FrameData &m_frame;
137 const FloatRect &m_cameraView;
138
139 void pushQuad(SDL_GPUTexture *texture, SDL_GPUSampler *sampler, const FloatRect &dst,
140 const FloatRect &srcUV, Color tint, float rotation, Vec2f origin,
141 Vec2f shapeParams = {0.f, 0.f});
142 };
143}
Owns an SDL GPU texture and its associated sampler.
Definition gpu-texture.h:20
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.
void lines(std::span< const PrimitiveVertex > verts, PrimitiveType type)
Emit world-space colored point or line primitives.
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.
FloatRect getCameraView() const
Get the active camera view rectangle bound to this queue.
RenderQueue(FrameData &frame, const FloatRect &cameraView)
Construct a render queue bound to a specific frame stage and camera view.
void custom(CustomDrawFn fn)
Enqueue a custom rendering callback directly into the execution stream.
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.
void deferUpload(UploadCallbackFn fn)
Defer a resource upload operation to execute prior to render pass submission.
Batches drawables into sorted geometry, primitive, and custom execution passes for GPURenderer.
RGBA color with 8-bit unsigned components.
Definition color.h:13