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 > indices)
 Create vertex buffer.
 
void reserve (const int vertex_count, const int index_count)
 Create vertex buffer without uploading.
 
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.
 
void sub_buffer_vertices (const unsigned int vi, const int vertex_size, const std::span< Vertex > vertices) const
 Sub-buffer vertex buffer.
 
void sub_buffer_indices (const unsigned int ei, const int index_size, std::span< unsigned int > indices) const
 Sub-buffer element/index buffer.
 
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 clear ()
 Clear buffer data.
 
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.

+ Here is the call graph for this function:

◆ VertexArray() [2/3]

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

Move constructor.

Definition at line 44 of file VertexArray.cpp.

◆ ~VertexArray()

galaxy::VertexArray::~VertexArray ( )

Destructor.

Definition at line 75 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 57 of file VertexArray.cpp.

◆ buffer()

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

Create vertex buffer.

Parameters
verticesVertices to assign.
indicesIndices for vertex buffer.

Definition at line 83 of file VertexArray.cpp.

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

◆ reserve()

void galaxy::VertexArray::reserve ( const int vertex_count,
const int index_count )

Create vertex buffer without uploading.

Parameters
vertex_countNumber of vertices.
index_countNumber of indices.

Definition at line 88 of file VertexArray.cpp.

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

◆ sub_buffer()

void galaxy::VertexArray::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.

Parameters
viOffset to start at from initial vertices. 0 = first.
vertex_sizeAmount of vertex data to sub buffer.
verticesVertices to assign.
eiOffset to start at from initial indices. 0 = first.
index_sizeAmount of index data to sub buffer.
indicesIndices to assign.

Definition at line 93 of file VertexArray.cpp.

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

◆ sub_buffer_vertices()

void galaxy::VertexArray::sub_buffer_vertices ( const unsigned int vi,
const int vertex_size,
const std::span< Vertex > vertices ) const

Sub-buffer vertex buffer.

Parameters
viOffset to start at from initial vertices. 0 = first.
vertex_sizeAmount of vertex data to sub buffer.
verticesVertices to assign.

Definition at line 105 of file VertexArray.cpp.

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

◆ sub_buffer_indices()

void galaxy::VertexArray::sub_buffer_indices ( const unsigned int ei,
const int index_size,
std::span< unsigned int > indices ) const

Sub-buffer element/index buffer.

Parameters
eiOffset to start at from initial indices. 0 = first.
index_sizeAmount of index data to sub buffer.
indicesIndices to assign.

Definition at line 110 of file VertexArray.cpp.

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

◆ erase()

void galaxy::VertexArray::erase ( const unsigned int vi,
const int vertex_count,
const unsigned int ei,
const int index_count )

Erase a specfic segment of data.

Parameters
viOffset to start at from initial vertices. 0 = first.
vertex_countNumber of vertices.
eiOffset to start at from initial indices. 0 = first.
index_countNumber of indices.

Definition at line 115 of file VertexArray.cpp.

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

◆ clear()

void galaxy::VertexArray::clear ( )

Clear buffer data.

Definition at line 120 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 125 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 130 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 135 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 140 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 145 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 150 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 160 of file VertexArray.hpp.

◆ m_vbo

VertexBuffer galaxy::VertexArray::m_vbo
private

Vertex buffer.

Definition at line 165 of file VertexArray.hpp.


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