galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
VertexBatch.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_GRAPHICS_VERTEXBATCH_HPP_
9#define GALAXY_GRAPHICS_VERTEXBATCH_HPP_
10
12
13namespace galaxy
14{
21 {
22 public:
30 VertexBatch(const int max, const int vertex_count, const std::vector<unsigned int>& indices) noexcept;
31
35 VertexBatch(VertexBatch&&) noexcept;
36
41
45 ~VertexBatch() noexcept;
46
50 void prepare() noexcept;
51
57 void push(const std::vector<Vertex>& vertices) noexcept;
58
62 void flush() noexcept;
63
67 void bind() const noexcept;
68
74 [[nodiscard]]
75 int count() const noexcept;
76
82 [[nodiscard]]
83 void* offset() noexcept;
84
90 [[nodiscard]]
91 VertexArray& vao() noexcept;
92
93 private:
97 VertexBatch() = delete;
98
104 VertexBatch(const VertexBatch&) = delete;
105
112
113 private:
118
123
128
133
138
142 std::vector<Vertex> m_vertices;
143
148 };
149} // namespace galaxy
150
151#endif
thread_local const float vertices[]
Video.cpp galaxy.
Definition Video.cpp:19
thread_local const unsigned int indices[]
Definition Video.cpp:21
Abstraction for OpenGL vertex array objects.
A group of vertices for multiple renderables batched together.
int m_vertex_length
Total number of vertices.
int m_vertex_count
Amount of vertices to flush.
void bind() const noexcept
Bind this batchs vertex array object.
VertexBatch()=delete
Constructor.
int m_index_count
Amount of indices per renderable.
int m_index_length
Total number of indices.
std::vector< Vertex > m_vertices
CPU side reserved vertices.
VertexArray m_vao
VAO object for GPU data.
void push(const std::vector< Vertex > &vertices) noexcept
Add vertex and index data to batch.
VertexBatch & operator=(VertexBatch &&) noexcept
Move assignment operator.
void flush() noexcept
Copy all data to GPU.
VertexBatch(const VertexBatch &)=delete
Copy constructor.
int count() const noexcept
Get the index count.
void prepare() noexcept
Sets up counters to begin pushing vertices.
~VertexBatch() noexcept
Destructor.
int m_count
Amount of renderables to draw.
void * offset() noexcept
Gets index offset.
VertexArray & vao() noexcept
Gets internal VAO.
VertexBatch & operator=(const VertexBatch &)=delete
Copy assignment operator.
Animated.cpp galaxy.
Definition Animated.cpp:16