class VertexElement

Describes a single vertex element in a vertex declaration.

Public

Constructors

VertexElement

VertexElement() = default

VertexElement

VertexElement(VertexElementType type, VertexElementSemantic semantic, u16 semanticIndex = 0, u32 streamIndex = 0, u32 instanceStepRate = 0, u32 offset = 0)

Methods

GetStreamIndex

u16 GetStreamIndex() const

Returns index of the vertex buffer from which this element is stored.

GetOffset

u32 GetOffset() const

Returns an offset into the buffer where this vertex is stored.

This value might be in bytes but doesn't have to be, it's likely to be render API specific.

GetType

VertexElementType GetType() const

Gets the base data type of this element.

GetSemantic

VertexElementSemantic GetSemantic() const

Gets a semantic that describes what this element contains.

GetSemanticIndex

u16 GetSemanticIndex() const

Gets an index of this element.

Only relevant when you have multiple elements with the same semantic, for example uv0, uv1.

GetSize

u32 GetSize() const

Returns the size of this element in bytes.

GetInstanceStepRate

u32 GetInstanceStepRate() const

Returns at what rate do the vertex elements advance during instanced rendering.

Provide zero for default behaviour where each vertex receives the next value from the vertex buffer. Provide a value larger than zero to ensure vertex data is advanced with every instance, instead of every vertex (for example a value of 1 means each instance will retrieve a new value from the vertex buffer, a value of 2 means each second instance will, etc.).

staticGetSizeForType

static u32 GetSizeForType(VertexElementType type)

Returns the size of a base element type.

staticGetComponentCountForType

static u16 GetComponentCountForType(VertexElementType type)

Returns the number of values in the provided base element type.

For example float4 has four values.

staticGetBestColorVertexElementType

static VertexElementType GetBestColorVertexElementType()

Gets packed color vertex element type used by the active render system.

Operators

operator==

bool operator==(const VertexElement &rhs) const

operator!=

bool operator!=(const VertexElement &rhs) const

Protected

Fields

mStreamIndex

u16 mStreamIndex

mOffset

u32 mOffset

mType

mSemantic

mIndex

u16 mIndex

mInstanceStepRate

u32 mInstanceStepRate