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/core/api.h"
5#include "flint/graphics/types/custom-draw-fn.h"
6#include "flint/graphics/types/primitive-types.h"
7#include "flint/math/types.h"
8
9#include <span>
10
11namespace Flint {
12 class GPUTexture;
13 struct FrameData;
14
30 public:
38 explicit RenderQueue(FrameData &frame, const FloatRect &cameraView)
39 : m_frame(frame),
40 m_cameraView(cameraView) {
41 }
42
51 FLINT_API void deferUpload(UploadCallbackFn fn);
52
73 FLINT_API void quad(GPUTexture *texture, const FloatRect &dst, const FloatRect &srcUV,
74 Color tint, float rotation = 0.f, Vec2f origin = {0.f, 0.f});
82 FLINT_API void solidQuad(const FloatRect &dst, Color tint, float rotation = 0.f,
83 Vec2f origin = {0.f, 0.f});
98 FLINT_API void circle(GPUTexture *texture, Vec2f center, float radius, Color tint,
99 float rotation = 0.f, float innerRadius = 0.f);
100
115 FLINT_API void lines(std::span<const PrimitiveVertex> verts, PrimitiveType type);
116
125 FLINT_API void custom(CustomDrawFn fn);
126
133 return m_cameraView;
134 }
135
136 private:
137 FrameData &m_frame;
138 const FloatRect &m_cameraView;
139
140 void pushQuad(SDL_GPUTexture *texture, SDL_GPUSampler *sampler, const FloatRect &dst,
141 const FloatRect &srcUV, Color tint, float rotation, Vec2f origin,
142 Vec2f shapeParams = {0.f, 0.f});
143 };
144}
Owns an SDL GPU texture and its associated sampler.
Definition gpu-texture.h:21
Batches drawables into sorted geometry, primitive, and custom execution passes for GPURenderer.
FLINT_API void custom(CustomDrawFn fn)
Enqueue a custom rendering callback directly into the execution stream.
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.
FloatRect getCameraView() const
Get the active camera view rectangle bound to this queue.
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.
RenderQueue(FrameData &frame, const FloatRect &cameraView)
Construct a render queue bound to a specific frame stage and camera view.
FLINT_API void lines(std::span< const PrimitiveVertex > verts, PrimitiveType type)
Emit world-space colored point or line primitives.
FLINT_API void deferUpload(UploadCallbackFn fn)
Defer a resource upload operation to execute prior to render pass submission.
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.
RGBA color with 8-bit unsigned components.
Definition color.h:13