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
VertexArray.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_GRAPHICS_GL_VERTEXARRAY_HPP_
9#define GALAXY_GRAPHICS_GL_VERTEXARRAY_HPP_
10
12
13namespace galaxy
14{
18 class VertexArray final
19 {
20 public:
25
29 VertexArray(VertexArray&&) noexcept;
30
35
40
47 void buffer(std::span<Vertex> vertices, std::span<unsigned int> indices);
48
55 void reserve(const int vertex_count, const int index_count);
56
67 void
68 sub_buffer(const unsigned int vi, const int vertex_size, const std::span<Vertex> vertices, const unsigned int ei, const int index_size, std::span<unsigned int> indices);
69
77 void sub_buffer_vertices(const unsigned int vi, const int vertex_size, const std::span<Vertex> vertices) const;
78
86 void sub_buffer_indices(const unsigned int ei, const int index_size, std::span<unsigned int> indices) const;
87
96 void erase(const unsigned int vi, const int vertex_count, const unsigned int ei, const int index_count);
97
101 void clear();
102
106 void bind() const;
107
111 void unbind() const;
112
118 [[nodiscard]]
119 int count() const noexcept;
120
126 [[nodiscard]]
127 void* offset() noexcept;
128
134 [[nodiscard]]
135 VertexBuffer& vbo() noexcept;
136
142 [[nodiscard]]
143 unsigned int id() const noexcept;
144
145 private:
149 VertexArray(const VertexArray&) = delete;
150
155
156 private:
160 unsigned int m_id;
161
166 };
167} // namespace galaxy
168
169#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.
VertexArray()
Constructor.
void bind() const
Bind this vertex array.
~VertexArray()
Destructor.
VertexBuffer m_vbo
Vertex buffer.
VertexArray(const VertexArray &)=delete
Copy constructor.
VertexBuffer & vbo() noexcept
Get vertex buffer.
void buffer(std::span< Vertex > vertices, std::span< unsigned int > indices)
Create vertex buffer.
void sub_buffer(const unsigned int vi, const int vertex_size, const std::span< Vertex > vertices, const unsigned int ei, const int index_size, std::span< unsigned int > indices)
Sub-buffer vertex buffer.
int count() const noexcept
Get the index count.
void sub_buffer_indices(const unsigned int ei, const int index_size, std::span< unsigned int > indices) const
Sub-buffer element/index buffer.
VertexArray & operator=(VertexArray &&) noexcept
Move assignment operator.
void erase(const unsigned int vi, const int vertex_count, const unsigned int ei, const int index_count)
Erase a specfic segment of data.
void unbind() const
Unbind this vertex array.
unsigned int m_id
VAO object.
unsigned int id() const noexcept
Get vertex array handle.
void * offset() noexcept
Gets index offset.
void clear()
Clear buffer data.
void reserve(const int vertex_count, const int index_count)
Create vertex buffer without uploading.
void sub_buffer_vertices(const unsigned int vi, const int vertex_size, const std::span< Vertex > vertices) const
Sub-buffer vertex buffer.
VertexArray & operator=(const VertexArray &)=delete
Copy assignment operator.
Abstraction for OpenGL vertex buffer objects.
Animated.cpp galaxy.
Definition Animated.cpp:16