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::BufferElement Struct Reference

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

#include <Buffer.h>

Public Member Functions

 BufferElement ()
 BufferElement (ShaderDataType type, const std::string &name, bool normalized=false)
 Constructs a BufferElement with the given type, name, and normalization flag.
uint32_t GetComponentCount () const
 Returns the number of components in the buffer element based on its ShaderDataType.

Public Attributes

std::string Name
 The name of the buffer element.
ShaderDataType Type
 The data type of the buffer element.
uint32_t Size
 The size in bytes of the buffer element.
uint32_t Offset
 The offset in bytes of the buffer element from the start of the buffer.
bool Normalized
 Whether the buffer element is normalized.

Detailed Description

Represents a single element in a buffer layout.

Constructor & Destructor Documentation

◆ BufferElement() [1/2]

Vesper::BufferElement::BufferElement ( )
inline
51{}

◆ BufferElement() [2/2]

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

Constructs a BufferElement with the given type, name, and normalization flag.

Parameters
typeThe ShaderDataType of the buffer element.
nameThe name of the buffer element.
normalizedWhether the buffer element is normalized.
58 : Name(name), Type(type), Size(ShaderDataTypeSize(type)), Offset(0), Normalized(normalized)
59 {
60 }
static uint32_t ShaderDataTypeSize(ShaderDataType type)
Returns the size in bytes of the given ShaderDataType.
Definition Buffer.h:19
ShaderDataType Type
The data type of the buffer element.
Definition Buffer.h:43
std::string Name
The name of the buffer element.
Definition Buffer.h:41
uint32_t Size
The size in bytes of the buffer element.
Definition Buffer.h:45
uint32_t Offset
The offset in bytes of the buffer element from the start of the buffer.
Definition Buffer.h:47
bool Normalized
Whether the buffer element is normalized.
Definition Buffer.h:49

References BufferElement(), Normalized, Offset, Vesper::ShaderDataTypeSize(), Size, and Type.

Referenced by BufferElement().

Member Function Documentation

◆ GetComponentCount()

uint32_t Vesper::BufferElement::GetComponentCount ( ) const
inline

Returns the number of components in the buffer element based on its ShaderDataType.

63 {
64 switch (Type) {
65 case ShaderDataType::Float: return 1;
66 case ShaderDataType::Float2: return 2;
67 case ShaderDataType::Float3: return 3;
68 case ShaderDataType::Float4: return 4;
69 case ShaderDataType::Mat3: return 3 * 3;
70 case ShaderDataType::Mat4: return 4 * 4;
71 case ShaderDataType::Int: return 1;
72 case ShaderDataType::Int2: return 2;
73 case ShaderDataType::Int3: return 3;
74 case ShaderDataType::Int4: return 4;
75 case ShaderDataType::Bool: return 1;
76 }
77 VZ_CORE_ASSERT(false, "Unknown ShaderDataType!");
78 return 0;
79 }
#define VZ_CORE_ASSERT(x,...)
Definition Asserts.h:20
@ Int
Definition Buffer.h:10
@ Int4
Definition Buffer.h:10
@ Float
Definition Buffer.h:8
@ Mat3
Definition Buffer.h:9
@ Float4
Definition Buffer.h:8
@ Int2
Definition Buffer.h:10
@ Int3
Definition Buffer.h:10
@ Float2
Definition Buffer.h:8
@ Mat4
Definition Buffer.h:9
@ Float3
Definition Buffer.h:8
@ Bool
Definition Buffer.h:11

References Vesper::Bool, Vesper::Float, Vesper::Float2, Vesper::Float3, Vesper::Float4, Vesper::Int, Vesper::Int2, Vesper::Int3, Vesper::Int4, Vesper::Mat3, Vesper::Mat4, and Type.

Member Data Documentation

◆ Name

std::string Vesper::BufferElement::Name

The name of the buffer element.

◆ Normalized

bool Vesper::BufferElement::Normalized

Whether the buffer element is normalized.

Referenced by BufferElement().

◆ Offset

uint32_t Vesper::BufferElement::Offset

The offset in bytes of the buffer element from the start of the buffer.

Referenced by BufferElement().

◆ Size

uint32_t Vesper::BufferElement::Size

The size in bytes of the buffer element.

Referenced by BufferElement().

◆ Type

ShaderDataType Vesper::BufferElement::Type

The data type of the buffer element.

Referenced by BufferElement(), and GetComponentCount().


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