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 std::vector< unsigned int > &indices) noexcept
 Constructor.
 
 VertexBatch (VertexBatch &&) noexcept
 Move constructor.
 
VertexBatchoperator= (VertexBatch &&) noexcept
 Move assignment operator.
 
 ~VertexBatch () noexcept
 Destructor.
 
void prepare () noexcept
 Sets up counters to begin pushing vertices.
 
void push (const std::vector< Vertex > &vertices) 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 per renderable.
 
int m_count
 Amount of renderables to draw.
 
int m_vertex_length
 Total number of vertices.
 
int m_index_length
 Total number of indices.
 
std::vector< Vertexm_vertices
 CPU side reserved vertices.
 
VertexArray m_vao
 VAO object for GPU data.
 

Detailed Description

A group of vertices for multiple renderables batched together.

Call: prepare() -> push() -> flush() -> bind(), and repeat.

Definition at line 20 of file VertexBatch.hpp.

Constructor & Destructor Documentation

◆ VertexBatch() [1/4]

galaxy::VertexBatch::VertexBatch ( const int max,
const int vertex_count,
const std::vector< unsigned int > & indices )
noexcept

Constructor.

Parameters
maxMax renderable objects.
vertex_countNumber of vertices in a single object.
indicesDefault indices to use for each renderable.

Definition at line 12 of file VertexBatch.cpp.

◆ VertexBatch() [2/4]

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

Move constructor.

Definition at line 43 of file VertexBatch.cpp.

◆ ~VertexBatch()

galaxy::VertexBatch::~VertexBatch ( )
noexcept

Destructor.

Definition at line 70 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 54 of file VertexBatch.cpp.

◆ prepare()

void galaxy::VertexBatch::prepare ( )
noexcept

Sets up counters to begin pushing vertices.

Definition at line 74 of file VertexBatch.cpp.

+ Here is the caller graph for this function:

◆ push()

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

Add vertex and index data to batch.

Parameters
verticesList of vertices.

Definition at line 80 of file VertexBatch.cpp.

+ Here is the caller graph for this function:

◆ flush()

void galaxy::VertexBatch::flush ( )
noexcept

Copy all data to GPU.

Definition at line 93 of file VertexBatch.cpp.

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

◆ bind()

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

Bind this batchs vertex array object.

Definition at line 98 of file VertexBatch.cpp.

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

◆ count()

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

Get the index count.

Returns
Integer.

Definition at line 103 of file VertexBatch.cpp.

+ Here is the caller graph for this function:

◆ offset()

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

Gets index offset.

Returns
Integer as void pointer for opengl shenanigans.

Definition at line 108 of file VertexBatch.cpp.

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

◆ vao()

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

Gets internal VAO.

Returns
Reference to VertexArray.

Definition at line 113 of file VertexBatch.cpp.

+ Here is the caller graph for this function:

◆ 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 117 of file VertexBatch.hpp.

◆ m_index_count

int galaxy::VertexBatch::m_index_count
private

Amount of indices per renderable.

Definition at line 122 of file VertexBatch.hpp.

◆ m_count

int galaxy::VertexBatch::m_count
private

Amount of renderables to draw.

Definition at line 127 of file VertexBatch.hpp.

◆ m_vertex_length

int galaxy::VertexBatch::m_vertex_length
private

Total number of vertices.

Definition at line 132 of file VertexBatch.hpp.

◆ m_index_length

int galaxy::VertexBatch::m_index_length
private

Total number of indices.

Definition at line 137 of file VertexBatch.hpp.

◆ m_vertices

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

CPU side reserved vertices.

Definition at line 142 of file VertexBatch.hpp.

◆ m_vao

VertexArray galaxy::VertexBatch::m_vao
private

VAO object for GPU data.

Definition at line 147 of file VertexBatch.hpp.


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