class VertexDescription

Inherits: IReflectable

Contains information about layout of vertices in a buffer.

Public

Constructors

VertexDescription

VertexDescription(const TArrayView<VertexElement> &elements, bool calculateOffsets = true)

Methods

GetId

u32 GetId() const

Returns a unique identifier of this combination of vertex elements.

All vertex descriptions sharing the same set of vertex elements will have the same ID.

HasElement

bool HasElement(VertexElementSemantic semantic, u32 semanticIndex = 0, u32 streamIndex = 0) const

Query if we have vertex data for the specified semantic.

GetElementSize

u32 GetElementSize(VertexElementSemantic semantic, u32 semanticIndex = 0, u32 streamIndex = 0) const

Returns the size in bytes of the vertex element with the specified semantic.

GetElementOffsetFromStream

u32 GetElementOffsetFromStream(VertexElementSemantic semantic, u32 semanticIndex = 0, u32 streamIndex = 0) const

Returns offset of the vertex from start of the stream in bytes.

GetVertexStride

u32 GetVertexStride(u32 streamIndex) const

Gets vertex stride in bytes (offset from one vertex to another) in the specified stream.

GetVertexStride

u32 GetVertexStride() const

Gets vertex stride in bytes (offset from one vertex to another) in all the streams.

GetStreamOffset

u32 GetStreamOffset(u32 streamIndex) const

Gets offset in bytes from the start of the internal buffer to the start of the specified stream.

GetElementCount

u32 GetElementCount() const

Returns the number of vertex elements.

GetElement

const VertexElement &GetElement(u32 index) const

Returns the vertex element at the specified index.

GetElement

const VertexElement *GetElement(VertexElementSemantic semantic, u32 semanticIndex = 0, u32 streamIndex = 0) const

Returns the vertex element with the specified semantic.

GetElements

const TInlineArray<VertexElement, 8> &GetElements() const

Returns all the elements of the definition.

staticIsCompatibleWithShaderInputs

static bool IsCompatibleWithShaderInputs(const VertexDescription &vertexBufferDescription, const VertexDescription &shaderInputDescription)

staticGetMissingElementsForShaderInput

static TInlineArray<VertexElement, 8> GetMissingElementsForShaderInput(const VertexDescription &vertexBufferDescription, const VertexDescription &shaderInputDescription)

Returns a list of vertex elements that the provided shader expects as inputs, but aren't provided in the list of vertex buffer elements.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const

Returns an interface you can use to access class' Run Time Type Information.

Operators

operator==

bool operator==(const VertexDescription &rhs) const

operator!=

bool operator!=(const VertexDescription &rhs) const

Private

Constructors

VertexDescription

VertexDescription() = default

Methods

GetLargestStreamIndex

u32 GetLargestStreamIndex() const

Returns the largest stream index of all the stored vertex elements.

HasStream

bool HasStream(u32 streamIndex) const

Checks if any of the vertex elements use the specified stream index.

CalculateOffsets

void CalculateOffsets()

Calculates offsets of each vertex element, at which they will be stored in the vertex buffer.

Fields

mVertexElements

TInlineArray<VertexElement, 8> mVertexElements

mId

u32 mId