13namespace engine::graphics {
63 void draw_triangle(
const Eigen::Vector2f &p1,
const Eigen::Vector2f &p2,
64 const Eigen::Vector2f &p3);
74 void draw_quad(
const Eigen::Vector2f &p1,
const Eigen::Vector2f &p2,
75 const Eigen::Vector2f &p3,
const Eigen::Vector2f &p4);
84 void draw_line(
const Eigen::Vector2f &p1,
const Eigen::Vector2f &p2,
92 void draw_text(
const Eigen::Vector2f &position,
const std::string &text);
96 Eigen::Vector2f position;
97 Eigen::Vector3f color;
100 shader program_{
"src/engine/graphics/shaders/generic.vert",
101 "src/engine/graphics/shaders/generic.frag"};
102 std::vector<vertex> vertices_{};
103 Eigen::Vector3f color_{};
107 static constexpr auto MAX_VERTICES{100000};
OpenGL renderer that uses batch rendering.
Definition renderer.h:18
void draw_line(const Eigen::Vector2f &p1, const Eigen::Vector2f &p2, float thickness)
Buffers a line to be drawn when the frame ends.
Definition renderer.cpp:71
void end_frame()
Ends a frame by clearing what is currently drawn and drawing the vertices.
Definition renderer.cpp:43
void draw_text(const Eigen::Vector2f &position, const std::string &text)
Buffers text to be drawn when the frame ends.
Definition renderer.cpp:78
~renderer()
Destructor that cleans up the VAO and VBO.
Definition renderer.cpp:34
void draw_triangle(const Eigen::Vector2f &p1, const Eigen::Vector2f &p2, const Eigen::Vector2f &p3)
Buffers a triangle to be drawn when the frame ends.
Definition renderer.cpp:57
void set_color(const Eigen::Vector3f &color)
Sets the current color used when buffering shapes to be drawn.
Definition renderer.h:52
void draw_quad(const Eigen::Vector2f &p1, const Eigen::Vector2f &p2, const Eigen::Vector2f &p3, const Eigen::Vector2f &p4)
Buffers a quad to be drawn when the frame ends.
Definition renderer.cpp:65
renderer()
Constructs the renderer; reserves memory in the vertices vector.
Definition renderer.cpp:9
void begin_frame()
Begins a frame by clearing the vertices buffer.
Definition renderer.cpp:39