8#include "../../engine/components/transform_component.hpp"
10#include "../../shapes/shapes.hpp"
12#include "../../types/types.hpp"
14#include "../../util/color.hpp"
15#include "../../util/position.hpp"
20#include "../shader.hpp"
21#include "../texture.hpp"
Wraps an OpenGL Element Buffer Object (index buffer).
Definition ebo.hpp:12
Batched renderer for textured quads (rectangles).
Definition quad_renderer.hpp:33
static QuadRenderer * instance
Singleton instance.
Definition quad_renderer.hpp:37
void setTexture(Texture *t, bool mono=false)
Binds a texture for subsequent quads, flushing if it changes.
Definition quad_renderer.cpp:191
VBO vbo
Vertex buffer holding the batched data.
Definition quad_renderer.hpp:47
void draw(const Transform &transform, const Rectangle &r, bool normalize=true)
Adds a transformed rectangle to the current batch.
Definition quad_renderer.cpp:85
Shader * shader
Shader used to draw the quads.
Definition quad_renderer.hpp:49
EBO ebo
Index buffer for the quads.
Definition quad_renderer.hpp:48
VAO vao
Vertex array describing the layout.
Definition quad_renderer.hpp:46
Texture * currentTexture
Currently bound texture, if any.
Definition quad_renderer.hpp:38
std::vector< Vertex > vertices
Accumulated vertices for the current batch.
Definition quad_renderer.hpp:43
static constexpr uint32_t MAX_VERTICES
Vertex capacity (4 per quad).
Definition quad_renderer.hpp:40
static constexpr uint32_t MAX_QUADS
Maximum quads per batch.
Definition quad_renderer.hpp:39
void flush()
Submits the accumulated batch to the GPU.
Definition quad_renderer.cpp:154
uint32_t quadCount
Number of quads in the current batch.
Definition quad_renderer.hpp:44
void beginFrame()
Resets the batch at the start of a frame.
Definition quad_renderer.cpp:80
void setShader(Shader *shader)
Replaces the shader used for drawing.
Definition quad_renderer.cpp:205
static constexpr uint32_t MAX_INDICES
Index capacity (6 per quad).
Definition quad_renderer.hpp:41
bool currentMono
Whether the bound texture is single-channel.
Definition quad_renderer.hpp:35
Wraps a compiled and linked OpenGL shader program.
Definition shader.hpp:61
Wraps an OpenGL texture object.
Definition texture.hpp:12
Wraps an OpenGL Vertex Array Object.
Definition vao.hpp:12
Wraps an OpenGL Vertex Buffer Object.
Definition vbo.hpp:11
Definition audiomanager.cpp:4
An axis-aligned rectangle with a position, size and color.
Definition rectangle.hpp:21