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
galaxy::VertexArray Class Referencefinal

Abstraction for OpenGL vertex array objects. More...

#include <VertexArray.hpp>

+ Collaboration diagram for galaxy::VertexArray:

Public Member Functions

 VertexArray ()
 Constructor.
 
 VertexArray (VertexArray &&) noexcept
 Move constructor.
 
VertexArrayoperator= (VertexArray &&) noexcept
 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 bind () const
 Bind this vertex array.
 
void unbind () const
 Unbind this vertex array.
 
int count () const noexcept
 Get the index count.
 
void * offset () noexcept
 Gets index offset.
 
VertexBuffervbo () noexcept
 Get vertex buffer.
 
unsigned int id () const noexcept
 Get vertex array handle.
 

Private Member Functions

 VertexArray (const VertexArray &)=delete
 Copy constructor.
 
VertexArrayoperator= (const VertexArray &)=delete
 Copy assignment operator.
 

Private Attributes

unsigned int m_id
 VAO object.
 
VertexBuffer m_vbo
 Vertex buffer.
 

Detailed Description

Abstraction for OpenGL vertex array objects.

Definition at line 18 of file VertexArray.hpp.

Constructor & Destructor Documentation

◆ VertexArray() [1/3]

galaxy::VertexArray::VertexArray ( )

Constructor.

Definition at line 17 of file VertexArray.cpp.

◆ VertexArray() [2/3]

galaxy::VertexArray::VertexArray ( VertexArray && v)
noexcept

Move constructor.

Definition at line 23 of file VertexArray.cpp.

◆ ~VertexArray()

galaxy::VertexArray::~VertexArray ( )

Destructor.

Definition at line 54 of file VertexArray.cpp.

◆ VertexArray() [3/3]

galaxy::VertexArray::VertexArray ( const VertexArray & )
privatedelete

Copy constructor.

Member Function Documentation

◆ operator=() [1/2]

VertexArray & galaxy::VertexArray::operator= ( VertexArray && v)
noexcept

Move assignment operator.

Definition at line 36 of file VertexArray.cpp.

◆ buffer() [1/2]

void galaxy::VertexArray::buffer ( std::span< Vertex > vertices,
std::span< unsigned int > indicies )

Create vertex array object.

Parameters
verticesVertices to assign.
indiciesIndices for vertex buffer.

Definition at line 63 of file VertexArray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buffer() [2/2]

void galaxy::VertexArray::buffer ( const int vertex_count,
std::span< unsigned int > indicies )

Create vertex array without uploading data.

Parameters
vertex_countSize of vertices.
indiciesIndices for vertex buffer.

Definition at line 83 of file VertexArray.cpp.

+ Here is the call graph for this function:

◆ sub_buffer()

void galaxy::VertexArray::sub_buffer ( const unsigned int index,
std::span< Vertex > vertices )

Sub-buffer vertex array.

Parameters
indexOffset to start at from initial vertices. 0 = first element.
verticesVertices to assign.

Definition at line 103 of file VertexArray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bind()

void galaxy::VertexArray::bind ( ) const

Bind this vertex array.

Definition at line 108 of file VertexArray.cpp.

+ Here is the caller graph for this function:

◆ unbind()

void galaxy::VertexArray::unbind ( ) const

Unbind this vertex array.

Definition at line 113 of file VertexArray.cpp.

+ Here is the caller graph for this function:

◆ count()

int galaxy::VertexArray::count ( ) const
nodiscardnoexcept

Get the index count.

Returns
Integer.

Definition at line 118 of file VertexArray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offset()

void * galaxy::VertexArray::offset ( )
nodiscardnoexcept

Gets index offset.

Returns
Integer as void pointer for opengl shenanigans.

Definition at line 123 of file VertexArray.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vbo()

VertexBuffer & galaxy::VertexArray::vbo ( )
nodiscardnoexcept

Get vertex buffer.

Returns
Reference to vertex buffer object.

Definition at line 128 of file VertexArray.cpp.

+ Here is the caller graph for this function:

◆ id()

unsigned int galaxy::VertexArray::id ( ) const
nodiscardnoexcept

Get vertex array handle.

Returns
Unsigned int.

Definition at line 133 of file VertexArray.cpp.

+ Here is the caller graph for this function:

◆ operator=() [2/2]

VertexArray & galaxy::VertexArray::operator= ( const VertexArray & )
privatedelete

Copy assignment operator.

Member Data Documentation

◆ m_id

unsigned int galaxy::VertexArray::m_id
private

VAO object.

Definition at line 122 of file VertexArray.hpp.

◆ m_vbo

VertexBuffer galaxy::VertexArray::m_vbo
private

Vertex buffer.

Definition at line 127 of file VertexArray.hpp.


The documentation for this class was generated from the following files: