VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Member Functions | Public Attributes | List of all members

A list of vertex attributes. More...

Public Member Functions

 AttributeSet ()
 Constructs an empty attribute set. More...
 
 AttributeSet (std::initializer_list< Attribute > list)
 Constructs an attribute set from an initializer list. More...
 
 AttributeSet (const std::vector< Attribute > &list)
 Constructs an attribute set from a vector of attributes. More...
 
void computeAttributeOffsets ()
 Computes and fills in this attribute set's attribute offsets and vertex stride. More...
 

Public Attributes

std::vector< Attributeattributes
 List of attribute definitions. More...
 
int vertexStride = 0
 Number of bytes between vertices. More...
 
std::vector< int > attributeOffsets
 Number of bytes from the beginning of a vertex for each attribute. More...
 

Detailed Description

A list of vertex attributes.

Used by shaders and meshes. The attributes of a mesh determine what data it stores in its vertices. The attributes of a shader describe which attributes it reads as inputs.

Note
This class also stores additional information including the offsets of each attribute. These are computed automatically by the constructors taking lists. To compute these manually, call computeAttributeOffsets().

Constructor & Destructor Documentation

AttributeSet::AttributeSet ( )

Constructs an empty attribute set.

AttributeSet::AttributeSet ( std::initializer_list< Attribute list)
explicit

Constructs an attribute set from an initializer list.

This constructor calls computeAttributeOffsets() to compute this object's metadata.

Parameters
listInitializer list containing attributes to add to this set
AttributeSet::AttributeSet ( const std::vector< Attribute > &  list)
explicit

Constructs an attribute set from a vector of attributes.

This constructor calls computeAttributeOffsets() to compute this object's metadata.

Parameters
listList of attributes to add to this set

Member Function Documentation

void AttributeSet::computeAttributeOffsets ( )

Computes and fills in this attribute set's attribute offsets and vertex stride.

Member Data Documentation

std::vector<int> AttributeSet::attributeOffsets

Number of bytes from the beginning of a vertex for each attribute.

This is computed by computeAttributeOffsets().

std::vector<Attribute> AttributeSet::attributes

List of attribute definitions.

int AttributeSet::vertexStride = 0

Number of bytes between vertices.

This is computed by computeAttributeOffsets().