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::VertexBatch Class Reference

A group of vertices for multiple renderables batched together. More...

#include <VertexBatch.hpp>

+ Collaboration diagram for galaxy::VertexBatch:

Public Member Functions

 VertexBatch (const int max, const int vertex_count, const int index_count) noexcept
 Constructor.
 
 VertexBatch (VertexBatch &&) noexcept
 Move constructor.
 
VertexBatchoperator= (VertexBatch &&) noexcept
 Move assignment operator.
 
 ~VertexBatch () noexcept
 Destructor.
 
void push (const std::vector< Vertex > &vertices, const std::vector< unsigned int > &indices) noexcept
 Add vertex and index data to batch.
 
void flush () noexcept
 Copy all data to GPU.
 
void bind () const noexcept
 Bind this batchs vertex array object.
 
int count () const noexcept
 Get the index count.
 
void * offset () noexcept
 Gets index offset.
 
VertexArrayvao () noexcept
 Gets internal VAO.
 

Private Member Functions

 VertexBatch ()=delete
 Constructor.
 
 VertexBatch (const VertexBatch &)=delete
 Copy constructor.
 
VertexBatchoperator= (const VertexBatch &)=delete
 Copy assignment operator.
 

Private Attributes

int m_vertex_count
 Amount of vertices to flush.
 
int m_index_count
 Amount of indices to flush.
 
int m_count
 Index count after flushing.
 
int m_vertex_length
 Total number of vertices.
 
int m_index_length
 Total number of indices.
 
std::vector< Vertexm_vertices
 CPU side reserved vertices.
 
std::vector< unsigned int > m_indices
 CPU side reserved indices.
 
VertexArray m_vao
 VAO object for GPU data.
 

Detailed Description

A group of vertices for multiple renderables batched together.

Definition at line 18 of file VertexBatch.hpp.

Constructor & Destructor Documentation

◆ VertexBatch() [1/4]

galaxy::VertexBatch::VertexBatch ( const int max,
const int vertex_count,
const int index_count )
noexcept

Constructor.

Template Parameters
maxMax renderable objects.
vertex_countNumber of vertices in a single object.
index_countNumber of indices in a single object.

Definition at line 12 of file VertexBatch.cpp.

◆ VertexBatch() [2/4]

galaxy::VertexBatch::VertexBatch ( VertexBatch && vb)
noexcept

Move constructor.

Definition at line 26 of file VertexBatch.cpp.

◆ ~VertexBatch()

galaxy::VertexBatch::~VertexBatch ( )
noexcept

Destructor.

Definition at line 55 of file VertexBatch.cpp.

◆ VertexBatch() [3/4]

galaxy::VertexBatch::VertexBatch ( )
privatedelete

Constructor.

◆ VertexBatch() [4/4]

galaxy::VertexBatch::VertexBatch ( const VertexBatch & )
privatedelete

Copy constructor.

Deleted.

Member Function Documentation

◆ operator=() [1/2]

VertexBatch & galaxy::VertexBatch::operator= ( VertexBatch && vb)
noexcept

Move assignment operator.

Definition at line 38 of file VertexBatch.cpp.

◆ push()

void galaxy::VertexBatch::push ( const std::vector< Vertex > & vertices,
const std::vector< unsigned int > & indices )
noexcept

Add vertex and index data to batch.

Parameters
verticesList of vertices.
indicesList of indices.

Definition at line 59 of file VertexBatch.cpp.

◆ flush()

void galaxy::VertexBatch::flush ( )
noexcept

Copy all data to GPU.

Definition at line 77 of file VertexBatch.cpp.

+ Here is the call graph for this function:

◆ bind()

void galaxy::VertexBatch::bind ( ) const
noexcept

Bind this batchs vertex array object.

Definition at line 88 of file VertexBatch.cpp.

+ Here is the call graph for this function:

◆ count()

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

Get the index count.

Returns
Integer.

Definition at line 93 of file VertexBatch.cpp.

◆ offset()

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

Gets index offset.

Returns
Integer as void pointer for opengl shenanigans.

Definition at line 98 of file VertexBatch.cpp.

+ Here is the call graph for this function:

◆ vao()

VertexArray & galaxy::VertexBatch::vao ( )
nodiscardnoexcept

Gets internal VAO.

Returns
Reference to VertexArray.

Definition at line 103 of file VertexBatch.cpp.

◆ operator=() [2/2]

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

Copy assignment operator.

Deleted.

Member Data Documentation

◆ m_vertex_count

int galaxy::VertexBatch::m_vertex_count
private

Amount of vertices to flush.

Definition at line 111 of file VertexBatch.hpp.

◆ m_index_count

int galaxy::VertexBatch::m_index_count
private

Amount of indices to flush.

Definition at line 116 of file VertexBatch.hpp.

◆ m_count

int galaxy::VertexBatch::m_count
private

Index count after flushing.

Definition at line 121 of file VertexBatch.hpp.

◆ m_vertex_length

int galaxy::VertexBatch::m_vertex_length
private

Total number of vertices.

Definition at line 126 of file VertexBatch.hpp.

◆ m_index_length

int galaxy::VertexBatch::m_index_length
private

Total number of indices.

Definition at line 131 of file VertexBatch.hpp.

◆ m_vertices

std::vector<Vertex> galaxy::VertexBatch::m_vertices
private

CPU side reserved vertices.

Definition at line 136 of file VertexBatch.hpp.

◆ m_indices

std::vector<unsigned int> galaxy::VertexBatch::m_indices
private

CPU side reserved indices.

Definition at line 141 of file VertexBatch.hpp.

◆ m_vao

VertexArray galaxy::VertexBatch::m_vao
private

VAO object for GPU data.

Definition at line 146 of file VertexBatch.hpp.


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