4#include "flint/graphics/drawable.h"
5#include "flint/graphics/renderer.h"
6#include "flint/graphics/types/color.h"
7#include "flint/graphics/types/primitive-types.h"
8#include "flint/math/types.h"
51 void init(SDL_GPUDevice *device) {
63 m_vertices.resize(count);
70 return m_vertices.size();
102 return m_transformedVerts.data();
109 return m_transformedVerts.size() *
sizeof(GPULineVertex);
116 return m_transformedVerts.size();
128 PrimitiveType m_type;
129 std::vector<PrimitiveVertex> m_vertices;
130 SDL_GPUDevice *m_device =
nullptr;
132 mutable std::vector<GPULineVertex> m_transformedVerts;
134 mutable SDL_GPUBuffer *m_vertexBuffer =
nullptr;
135 mutable Uint32 m_vertexBufferSize = 0;
Interface for objects that contribute ordered work to a rendered frame.
void setPrimitiveType(PrimitiveType type)
Change the primitive topology.
size_t getVertexCount() const
Return the number of transformed vertices ready for upload.
const PrimitiveVertex & operator[](std::size_t i) const
Const element access.
SDL_GPUPrimitiveType getSDLPrimitiveType() const
Map the engine PrimitiveType to the corresponding SDL GPU primitive type.
std::size_t size() const
Return the current number of vertices.
PrimitiveArray(PrimitiveType type)
Construct a PrimitiveArray with the given topology.
void emit(RenderQueue &queue) const override
Emit this drawable's rendering work for the current frame.
PrimitiveVertex & operator[](std::size_t i)
Non-const element access.
void resize(std::size_t count)
Resize the vertex array to count entries.
size_t getTransformedSize() const
Return the byte size of the transformed vertex buffer.
void init(SDL_GPUDevice *device)
Associate a GPU device (required before draw() is called by the renderer).
const void * getTransformedData() const
Return a pointer to the most recently transformed vertex data.
A CPU-side collection of colored 2-D vertices that can be drawn as primitives.
Batches drawables into sorted geometry, primitive, and custom execution passes for GPURenderer.
Internal vertex structure sent directly to line/point primitive shaders.
Public user-facing vertex representation for point and line primitives.