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::VertexBuffer Class Referencefinal

Abstraction for OpenGL vertex buffer objects. More...

#include <VertexBuffer.hpp>

+ Collaboration diagram for galaxy::VertexBuffer:

Public Member Functions

 VertexBuffer ()
 Constructor.
 
 VertexBuffer (VertexBuffer &&) noexcept
 Move constructor.
 
VertexBufferoperator= (VertexBuffer &&) noexcept
 Move assignment operator.
 
 ~VertexBuffer ()
 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) const
 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) const
 Erase a specfic segment of data.
 
void clear () const
 Clear buffer data.
 
int count () const noexcept
 Get the index count.
 
void * offset () noexcept
 Gets index offset.
 
unsigned int id () const noexcept
 Get OpenGL handle.
 

Private Member Functions

 VertexBuffer (const VertexBuffer &)=delete
 Copy constructor.
 
VertexBufferoperator= (const VertexBuffer &)=delete
 Copy assignment operator.
 

Private Attributes

unsigned int m_id
 ID returned by OpenGL when generating buffer.
 
std::size_t m_offset
 Index buffer offset.
 
int m_count
 Index buffer count.
 

Detailed Description

Abstraction for OpenGL vertex buffer objects.

Definition at line 20 of file VertexBuffer.hpp.

Constructor & Destructor Documentation

◆ VertexBuffer() [1/3]

galaxy::VertexBuffer::VertexBuffer ( )

Constructor.

Definition at line 14 of file VertexBuffer.cpp.

◆ VertexBuffer() [2/3]

galaxy::VertexBuffer::VertexBuffer ( VertexBuffer && v)
noexcept

Move constructor.

Definition at line 22 of file VertexBuffer.cpp.

◆ ~VertexBuffer()

galaxy::VertexBuffer::~VertexBuffer ( )

Destructor.

Definition at line 55 of file VertexBuffer.cpp.

◆ VertexBuffer() [3/3]

galaxy::VertexBuffer::VertexBuffer ( const VertexBuffer & )
privatedelete

Copy constructor.

Member Function Documentation

◆ operator=() [1/2]

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

Move assignment operator.

Definition at line 36 of file VertexBuffer.cpp.

◆ buffer()

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

Create vertex buffer.

Parameters
verticesVertices to assign.
indicesIndices for vertex buffer.

Definition at line 63 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ reserve()

void galaxy::VertexBuffer::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 74 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ sub_buffer()

void galaxy::VertexBuffer::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 ) 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.
eiOffset to start at from initial indices. 0 = first.
index_sizeAmount of index data to sub buffer.
indicesIndices to assign.

Definition at line 85 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ sub_buffer_vertices()

void galaxy::VertexBuffer::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 98 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ sub_buffer_indices()

void galaxy::VertexBuffer::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 103 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ erase()

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

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 108 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ clear()

void galaxy::VertexBuffer::clear ( ) const

Clear buffer data.

Definition at line 114 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ count()

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

Get the index count.

Returns
Integer.

Definition at line 122 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ offset()

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

Gets index offset.

Returns
Integer as void pointer for opengl shenanigans.

Definition at line 127 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ id()

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

Get OpenGL handle.

Returns
Unsigned integer.

Definition at line 132 of file VertexBuffer.cpp.

+ Here is the caller graph for this function:

◆ operator=() [2/2]

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

Copy assignment operator.

Member Data Documentation

◆ m_id

unsigned int galaxy::VertexBuffer::m_id
private

ID returned by OpenGL when generating buffer.

Definition at line 149 of file VertexBuffer.hpp.

◆ m_offset

std::size_t galaxy::VertexBuffer::m_offset
private

Index buffer offset.

Definition at line 154 of file VertexBuffer.hpp.

◆ m_count

int galaxy::VertexBuffer::m_count
private

Index buffer count.

Definition at line 159 of file VertexBuffer.hpp.


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