![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Abstraction for OpenGL vertex array objects. More...
#include <VertexArray.hpp>
Public Member Functions | |
VertexArray () | |
Constructor. | |
VertexArray (VertexArray &&) | |
Move constructor. | |
VertexArray & | operator= (VertexArray &&) |
Move assignment operator. | |
~VertexArray () | |
Destructor. | |
void | buffer (std::span< Vertex > vertices, std::span< unsigned int > indicies) |
Create vertex array object. | |
void | buffer (const int vertex_count, std::span< unsigned int > indicies) |
Create vertex array without uploading data. | |
void | sub_buffer (const unsigned int index, std::span< Vertex > vertices) |
Sub-buffer 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 | unbind () |
Unbind this vertex array. | |
int | count () const |
Get the index count. | |
void * | offset () |
Gets index offset. | |
int | instances () const |
Number of instances to render. | |
VertexBuffer & | vbo () |
Get vertex buffer. | |
unsigned int | id () const |
Get vertex array handle. | |
Private Member Functions | |
VertexArray (const VertexArray &)=delete | |
Copy constructor. | |
VertexArray & | operator= (const VertexArray &)=delete |
Copy assignment operator. | |
Private Attributes | |
unsigned int | m_id |
VAO object. | |
VertexBuffer | m_vbo |
Vertex buffer. | |
int | m_instances |
Number of instances. | |
Abstraction for OpenGL vertex array objects.
Definition at line 21 of file VertexArray.hpp.
galaxy::graphics::VertexArray::VertexArray | ( | ) |
Constructor.
Definition at line 18 of file VertexArray.cpp.
galaxy::graphics::VertexArray::VertexArray | ( | VertexArray && | v | ) |
Move constructor.
Definition at line 25 of file VertexArray.cpp.
galaxy::graphics::VertexArray::~VertexArray | ( | ) |
Destructor.
Definition at line 58 of file VertexArray.cpp.
|
privatedelete |
Copy constructor.
VertexArray & galaxy::graphics::VertexArray::operator= | ( | VertexArray && | v | ) |
Move assignment operator.
Definition at line 39 of file VertexArray.cpp.
void galaxy::graphics::VertexArray::buffer | ( | std::span< Vertex > | vertices, |
std::span< unsigned int > | indicies ) |
Create vertex array object.
vertices | Vertices to assign. |
indicies | Indices for vertex buffer. |
Definition at line 66 of file VertexArray.cpp.
void galaxy::graphics::VertexArray::buffer | ( | const int | vertex_count, |
std::span< unsigned int > | indicies ) |
Create vertex array without uploading data.
vertex_count | Size of vertices. |
indicies | Indices for vertex buffer. |
Definition at line 86 of file VertexArray.cpp.
void galaxy::graphics::VertexArray::sub_buffer | ( | const unsigned int | index, |
std::span< Vertex > | vertices ) |
Sub-buffer vertex array.
index | Offset to start at from initial vertices. 0 = first element. |
vertices | Vertices to assign. |
Definition at line 106 of file VertexArray.cpp.
void galaxy::graphics::VertexArray::set_instanced | ( | const InstanceBuffer & | ib | ) |
Set this vertex array to use a specific instance buffer.
ib | Instance buffer to use. Does not take ownership, you need to keep it around. |
Definition at line 111 of file VertexArray.cpp.
void galaxy::graphics::VertexArray::bind | ( | ) |
Bind this vertex array.
Definition at line 138 of file VertexArray.cpp.
void galaxy::graphics::VertexArray::unbind | ( | ) |
Unbind this vertex array.
Definition at line 143 of file VertexArray.cpp.
|
nodiscard |
Get the index count.
Definition at line 148 of file VertexArray.cpp.
|
nodiscard |
Gets index offset.
Definition at line 153 of file VertexArray.cpp.
|
nodiscard |
Number of instances to render.
Definition at line 158 of file VertexArray.cpp.
|
nodiscard |
Get vertex buffer.
Definition at line 163 of file VertexArray.cpp.
|
nodiscard |
Get vertex array handle.
Definition at line 168 of file VertexArray.cpp.
|
privatedelete |
Copy assignment operator.
|
private |
VAO object.
Definition at line 140 of file VertexArray.hpp.
|
private |
Vertex buffer.
Definition at line 145 of file VertexArray.hpp.
|
private |
Number of instances.
Definition at line 150 of file VertexArray.hpp.