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

Represents a single element in a buffer layout. More...

#include <buffer.hpp>

Public Member Functions

 BufferElement ()=default
 Default constructor.
 
 BufferElement (ShaderDataType type, const std::string &name, bool normalized=false)
 Parameterized constructor.
 
unsigned int get_component_count () const
 Get the number of components in the buffer element.
 

Public Attributes

std::string name
 Name of the buffer element.
 
ShaderDataType type
 Data type of the buffer element.
 
unsigned int size
 Size of the buffer element in bytes.
 
size_t offset
 Offset of the buffer element within the buffer.
 
bool normalized
 Indicates if the data is normalized.
 

Detailed Description

Represents a single element in a buffer layout.

This structure defines the properties of a buffer element, including its name, data type, size, offset within the buffer, and whether it is normalized. It is used to describe the layout of vertex attributes in a vertex buffer.

Note
The size and offset are calculated based on the ShaderDataType.

Constructor & Destructor Documentation

◆ BufferElement()

lmgl::renderer::BufferElement::BufferElement ( ShaderDataType type,
const std::string & name,
bool normalized = false )

Parameterized constructor.

Initializes a BufferElement with the specified type, name, and normalization flag. Calculates the size based on the ShaderDataType.

Parameters
typeData type of the buffer element.
nameName of the buffer element.
normalizedIndicates if the data is normalized (default is false).

Member Function Documentation

◆ get_component_count()

unsigned int lmgl::renderer::BufferElement::get_component_count ( ) const

Get the number of components in the buffer element.

This method returns the number of individual components that make up the buffer element based on its ShaderDataType.

Returns
Number of components in the buffer element.

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