Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::BufferElement Struct Reference

Describes a single element in a vertex buffer layout. More...

#include <Buffer.h>

Public Member Functions

 BufferElement ()=default
 BufferElement (ShaderDataType type, std::string name, bool normalized=false)
 Constructs a BufferElement with type, name, and optional normalization.
u32 GetComponentCount () const
 Returns the number of components in the element's type.

Public Attributes

std::string Name
 Name of the element (e.g., "position").
ShaderDataType Type
 Data type of the element.
u32 Size {}
 Size in bytes of the element.
usize Offset {}
 Byte offset from start of vertex.
bool Normalized {}
 Whether the data should be normalized.

Detailed Description

Describes a single element in a vertex buffer layout.

Contains the element's name, type, size, offset within the buffer, and normalization flag.

The size is automatically computed from the ShaderDataType. The offset is computed when the layout calculates the buffer stride.

Constructor & Destructor Documentation

◆ BufferElement() [1/2]

Raven::BufferElement::BufferElement ( )
default

◆ BufferElement() [2/2]

Raven::BufferElement::BufferElement ( ShaderDataType type,
std::string name,
bool normalized = false )
inline

Constructs a BufferElement with type, name, and optional normalization.

The size is determined by the ShaderDataTypeSize function.

Member Function Documentation

◆ GetComponentCount()

u32 Raven::BufferElement::GetComponentCount ( ) const
inlinenodiscard

Returns the number of components in the element's type.

For example, Float3 has 3 components, Mat4 has 4. Used for setting up vertex attributes in rendering APIs.

Logs an error and returns 0 if the type is unknown.

Member Data Documentation

◆ Name

std::string Raven::BufferElement::Name

Name of the element (e.g., "position").

◆ Normalized

bool Raven::BufferElement::Normalized {}

Whether the data should be normalized.

◆ Offset

usize Raven::BufferElement::Offset {}

Byte offset from start of vertex.

◆ Size

u32 Raven::BufferElement::Size {}

Size in bytes of the element.

◆ Type

ShaderDataType Raven::BufferElement::Type

Data type of the element.


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