Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine.
GitHub | Vesper Updates | Creator
Loading...
Searching...
No Matches
Vesper::BufferLayout Class Reference

Represents the layout of a buffer, consisting of multiple BufferElements. More...

#include <Buffer.h>

Public Member Functions

 BufferLayout ()
 BufferLayout (const std::initializer_list< BufferElement > &elements)
 Constructs a BufferLayout with the given list of BufferElements.
const std::vector< BufferElement > & GetElements () const
 Returns the list of BufferElements in the layout.
uint32_t GetStride () const
 Returns the stride (total size in bytes) of the buffer layout.
std::vector< BufferElement >::iterator begin ()
std::vector< BufferElement >::const_iterator begin () const
std::vector< BufferElement >::iterator end ()
std::vector< BufferElement >::const_iterator end () const

Private Member Functions

void CalculateOffsetsAndStride ()
 Calculates the offsets and stride for the buffer layout based on its elements.

Private Attributes

std::vector< BufferElementm_Elements
uint32_t m_Stride = 0

Detailed Description

Represents the layout of a buffer, consisting of multiple BufferElements.

Constructor & Destructor Documentation

◆ BufferLayout() [1/2]

Vesper::BufferLayout::BufferLayout ( )
inline
86{}

◆ BufferLayout() [2/2]

Vesper::BufferLayout::BufferLayout ( const std::initializer_list< BufferElement > & elements)
inline

Constructs a BufferLayout with the given list of BufferElements.

Parameters
elementsThe list of BufferElements that make up the layout. Automatically calculates offsets and stride.
93 : m_Elements(elements), m_Stride(0)
94 {
96 }
void CalculateOffsetsAndStride()
Calculates the offsets and stride for the buffer layout based on its elements.
Definition Buffer.h:113
uint32_t m_Stride
Definition Buffer.h:125
std::vector< BufferElement > m_Elements
Definition Buffer.h:124

References BufferLayout(), and m_Stride.

Referenced by BufferLayout().

Member Function Documentation

◆ begin() [1/2]

std::vector< BufferElement >::iterator Vesper::BufferLayout::begin ( )
inline
104{ return m_Elements.begin(); }

◆ begin() [2/2]

std::vector< BufferElement >::const_iterator Vesper::BufferLayout::begin ( ) const
inline
105{ return m_Elements.begin(); }

◆ CalculateOffsetsAndStride()

void Vesper::BufferLayout::CalculateOffsetsAndStride ( )
inlineprivate

Calculates the offsets and stride for the buffer layout based on its elements.

113 {
114 uint32_t offset = 0;
115 m_Stride = 0;
116 for (auto& element : m_Elements) {
117 element.Offset = offset;
118 offset += element.Size;
119 m_Stride += element.Size;
120 }
121 }

◆ end() [1/2]

std::vector< BufferElement >::iterator Vesper::BufferLayout::end ( )
inline
106{ return m_Elements.end(); }

◆ end() [2/2]

std::vector< BufferElement >::const_iterator Vesper::BufferLayout::end ( ) const
inline
107{ return m_Elements.end(); }

◆ GetElements()

const std::vector< BufferElement > & Vesper::BufferLayout::GetElements ( ) const
inline

Returns the list of BufferElements in the layout.

100{ return m_Elements; }

◆ GetStride()

uint32_t Vesper::BufferLayout::GetStride ( ) const
inline

Returns the stride (total size in bytes) of the buffer layout.

102{ return m_Stride; }

References m_Stride.

Member Data Documentation

◆ m_Elements

std::vector<BufferElement> Vesper::BufferLayout::m_Elements
private

◆ m_Stride

uint32_t Vesper::BufferLayout::m_Stride = 0
private

Referenced by BufferLayout(), and GetStride().


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