lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::renderer::BufferLayout Class Reference

Defines the layout of a buffer, consisting of multiple buffer elements. More...

#include <buffer.hpp>

Public Member Functions

 BufferLayout ()
 Default constructor.
 
 BufferLayout (const std::initializer_list< BufferElement > &elements)
 Parameterized constructor.
 
unsigned int get_stride () const
 Get the stride of the buffer layout.
 
const std::vector< BufferElement > & get_elements () const
 Get the elements of the buffer layout.
 
std::vector< BufferElement >::iterator begin ()
 Iterator support for the buffer layout elements.
 
std::vector< BufferElement >::iterator end ()
 End iterator for mutable access.
 
std::vector< BufferElement >::const_iterator begin () const
 Constant iterator support for the buffer layout elements.
 
std::vector< BufferElement >::const_iterator end () const
 Constant end iterator.
 

Detailed Description

Defines the layout of a buffer, consisting of multiple buffer elements.

This class manages a collection of BufferElement instances, calculating their offsets and the overall stride of the buffer. It provides methods to access the elements and their properties.

Note
The stride is the total size of all elements in the layout.

Constructor & Destructor Documentation

◆ BufferLayout()

lmgl::renderer::BufferLayout::BufferLayout ( const std::initializer_list< BufferElement > & elements)

Parameterized constructor.

Initializes the BufferLayout with a list of BufferElement instances. Calculates offsets and stride based on the provided elements.

Parameters
elementsInitializer list of BufferElement instances.

Member Function Documentation

◆ begin() [1/2]

std::vector< BufferElement >::iterator lmgl::renderer::BufferLayout::begin ( )

Iterator support for the buffer layout elements.

Provides begin and end iterators for both mutable and constant access to the BufferElement instances in the layout.

Returns
Iterators to the beginning and end of the elements vector.

◆ begin() [2/2]

std::vector< BufferElement >::const_iterator lmgl::renderer::BufferLayout::begin ( ) const

Constant iterator support for the buffer layout elements.

Provides begin and end iterators for constant access to the BufferElement instances in the layout.

Returns
Constant iterators to the beginning and end of the elements vector.

◆ end() [1/2]

std::vector< BufferElement >::iterator lmgl::renderer::BufferLayout::end ( )

End iterator for mutable access.

Provides an iterator to the end of the BufferElement instances in the layout.

Returns
End iterator for the elements vector.

◆ end() [2/2]

std::vector< BufferElement >::const_iterator lmgl::renderer::BufferLayout::end ( ) const

Constant end iterator.

Provides a constant iterator to the end of the BufferElement instances in the layout.

Returns
Constant end iterator for the elements vector.

◆ get_elements()

const std::vector< BufferElement > & lmgl::renderer::BufferLayout::get_elements ( ) const
inline

Get the elements of the buffer layout.

Returns a constant reference to the vector of BufferElement instances that make up the layout.

Returns
Constant reference to the vector of BufferElement instances.

◆ get_stride()

unsigned int lmgl::renderer::BufferLayout::get_stride ( ) const
inline

Get the stride of the buffer layout.

The stride represents the total size in bytes of all elements in the layout.

Returns
Stride of the buffer layout in bytes.

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