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
13
14namespace galaxy
15{
16 namespace graphics
17 {
21 class VertexArray final
22 {
23 public:
28
33
38
43
50 void buffer(std::span<Vertex> vertices, std::span<unsigned int> indicies);
51
58 void buffer(const int vertex_count, std::span<unsigned int> indicies);
59
66 void sub_buffer(const unsigned int index, std::span<Vertex> vertices);
67
73 void set_instanced(const InstanceBuffer& ib);
74
78 void bind();
79
83 void unbind();
84
90 [[nodiscard]]
91 int count() const;
92
98 [[nodiscard]]
99 void* offset();
100
106 [[nodiscard]]
107 int instances() const;
108
114 [[nodiscard]]
115 VertexBuffer& vbo();
116
122 [[nodiscard]]
123 unsigned int id() const;
124
125 private:
129 VertexArray(const VertexArray&) = delete;
130
135
136 private:
140 unsigned int m_id;
141
146
151 };
152 } // namespace graphics
153} // namespace galaxy
154
155#endif
thread_local const float vertices[]
Video.cpp galaxy.
Definition Video.cpp:19
Abstraction for OpenGL vertex buffer objects.
Abstraction for OpenGL vertex array objects.
VertexArray & operator=(VertexArray &&)
Move assignment operator.
VertexBuffer m_vbo
Vertex buffer.
int m_instances
Number of instances.
void buffer(std::span< Vertex > vertices, std::span< unsigned int > indicies)
Create vertex array object.
VertexArray & operator=(const VertexArray &)=delete
Copy assignment operator.
VertexArray(const VertexArray &)=delete
Copy constructor.
unsigned int m_id
VAO object.
int count() const
Get the index count.
void * offset()
Gets index offset.
int instances() const
Number of instances to render.
void unbind()
Unbind this vertex array.
void set_instanced(const InstanceBuffer &ib)
Set this vertex array to use a specific instance buffer.
void bind()
Bind this vertex array.
void sub_buffer(const unsigned int index, std::span< Vertex > vertices)
Sub-buffer vertex array.
VertexBuffer & vbo()
Get vertex buffer.
unsigned int id() const
Get vertex array handle.
Abstraction for OpenGL vertex buffer objects.
Animated.cpp galaxy.
Definition Animated.cpp:16