3#include "structure/graphics/painter/spk_mesh_painter.hpp"
4#include "structure/graphics/spk_color.hpp"
5#include "structure/math/spk_vector2.hpp"
6#include "structure/opengl/spk_vertex_buffer_object.hpp"
65 std::vector<Polygon> _polygons;
107 Builder &
insertQuad(
const Vector2Int &p_a,
const Vector2Int &p_b,
const Vector2Int &p_c,
const Vector2Int &p_d,
const Color &p_color, PolygonOrder p_order = PolygonOrder::TriangleFanFromFirst)
122 const Vector2Int a = p_anchor;
123 const Vector2Int b = {p_anchor.
x, p_anchor.
y +
static_cast<int>(p_size.
y)};
124 const Vector2Int c = {p_anchor.
x +
static_cast<int>(p_size.
x), p_anchor.
y +
static_cast<int>(p_size.
y)};
125 const Vector2Int d = {p_anchor.
x +
static_cast<int>(p_size.
x), p_anchor.
y};
127 return insertQuad(a, b, c, d, p_color, PolygonOrder::TriangleFanFromFirst);
137 for (
const auto &poly : _polygons)
153 layout.addAttribute({0, Attribute::Type::Vector2Int});
154 layout.addAttribute({1, Attribute::Type::Color});
172 OpenGL::UBO &_modelData;
185 void setLayer(
const float &p_layer);
190 const float &
layer()
const;
Builder & insertQuad(const Vector2Int &p_a, const Vector2Int &p_b, const Vector2Int &p_c, const Vector2Int &p_d, const Color &p_color, PolygonOrder p_order=PolygonOrder::TriangleFanFromFirst)
Inserts a colored quad.
Definition spk_color_painter.hpp:107
ColorMesh construct()
Builds a ColorMesh from stored polygons.
Definition spk_color_painter.hpp:134
Builder()=default
Builds an empty builder.
Builder & insertRectangle(const Vector2Int &p_anchor, const Vector2UInt &p_size, const Color &p_color)
Inserts an axis-aligned rectangle.
Definition spk_color_painter.hpp:120
Builder & insertTriangle(const Vector2Int &p_a, const Vector2Int &p_b, const Vector2Int &p_c, const Color &p_color)
Inserts a colored triangle.
Definition spk_color_painter.hpp:91
Builder & clear()
Clears all stored polygons.
Definition spk_color_painter.hpp:77
Mesh specialization for colored vertices.
Definition spk_color_painter.hpp:41
void _configureBufferSet() const override
Configures the vertex buffer layout for colored vertices.
Definition spk_color_painter.hpp:149
IMesh< ColorVertex > Base
Base mesh type.
Definition spk_color_painter.hpp:46
Base::Polygon Polygon
Polygon type for colored vertices.
Definition spk_color_painter.hpp:50
const float & layer() const
Returns the current layer value.
Definition spk_color_painter.cpp:28
ColorPainter()
Builds a color painter with its rendering pipeline.
Definition spk_color_painter.cpp:14
void setLayer(const float &p_layer)
Sets the layer value used during rendering.
Definition spk_color_painter.cpp:22
const std::shared_ptr< spk::OpenGL::BufferSetObject > & bufferSet() const
Definition spk_mesh.hpp:338
IMesh()
Definition spk_mesh.hpp:170
void append(const Polygon &p_shape)
Appends a polygon and notifies subscribers.
Definition spk_mesh.hpp:270
IPolygon< ColorVertex > Polygon
Definition spk_mesh.hpp:34
Loads shader artifacts and orchestrates draw calls with strongly typed constants and attributes.
Definition spk_pipeline.hpp:38
MeshPainter(Lumina::Pipeline &p_pipeline)
Definition spk_mesh_painter.hpp:41
VertexBufferObject & vbo()
Access mutable VBO.
Definition spk_buffer_set_object.cpp:76
Layout & layout()
Access layout descriptor.
Definition spk_vertex_buffer_object.cpp:253
RGBA color utility storing normalized floating components.
Definition spk_color.hpp:18
Vertex containing a position and color.
Definition spk_color_painter.hpp:19
Vector2Int pos
Vertex position in integer coordinates.
Definition spk_color_painter.hpp:23
Color color
Vertex color value.
Definition spk_color_painter.hpp:27
static IPolygon< TVertex > makeTriangle(const TVertex &p_a, const TVertex &p_b, const TVertex &p_c)
Creates a triangle polygon.
Definition spk_polygon.hpp:46
static IPolygon< TVertex > makeQuad(const TVertex &p_a, const TVertex &p_b, const TVertex &p_c, const TVertex &p_d, const PolygonOrder p_order=PolygonOrder::TriangleFanFromFirst)
Creates a quad polygon.
Definition spk_polygon.hpp:60
TType x
X component.
Definition spk_vector2.hpp:44
TType y
Y component.
Definition spk_vector2.hpp:48
Describes a vertex attribute entry in the layout.
Definition spk_vertex_buffer_object.hpp:38