Arnold Engine
 
Loading...
Searching...
No Matches
AE::Graphics::Renderer::BufferLayout Class Reference

Manages the layout of vertex attributes in a GPU buffer. More...

#include <Buffer.h>

Public Member Functions

 BufferLayout (const std::initializer_list< BufferElement > &elements)
 
uint32_t GetStride () const
 Gets the stride between vertices in bytes.
 
const std::vector< BufferElement > & GetElements () const
 Gets the list of buffer elements.
 
std::vector< BufferElement >::iterator begin ()
 
std::vector< BufferElement >::iterator end ()
 
std::vector< BufferElement >::const_iterator begin () const
 
std::vector< BufferElement >::const_iterator end () const
 

Detailed Description

Manages the layout of vertex attributes in a GPU buffer.

The BufferLayout class provides a way to describe how vertex data is organized in memory, enabling proper interpretation of vertex buffer data by the graphics pipeline. It:

  • Tracks the size and offset of each vertex attribute
  • Calculates stride between vertices
  • Supports iteration over buffer elements

Example usage:

BufferLayout layout = {
{ShaderDataType::Float3, "a_Position"},
{ShaderDataType::Float4, "a_Color"}
};
vertexBuffer->SetLayout(layout);

Member Function Documentation

◆ GetElements()

const std::vector< BufferElement > & AE::Graphics::Renderer::BufferLayout::GetElements ( ) const
inlinenodiscard

Gets the list of buffer elements.

Returns
Const reference to the vector of buffer elements

◆ GetStride()

uint32_t AE::Graphics::Renderer::BufferLayout::GetStride ( ) const
inlinenodiscard

Gets the stride between vertices in bytes.

Returns
Total size of one vertex in bytes

The stride is the total size of all elements in the layout, representing the distance in bytes between consecutive vertices.


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