Home -> VertexAttribute
Declaration
template<class T>
class VertexAttribute :public IVertexAttribute;Description
The VertexAttribute class defines a vertex attribute, used to provide vertex shader input data such as vertex coordinates for an IRenderableNode object during drawing. In order to use a vertex attribute, it must first be added to an IVertexBuffer, which then needs to be allocated. Once the attached buffer has been allocated, the vertex attribute can then be bound to any number of IRenderableNode objects.
This class a templated type. The template argument specifies the data type of the contained vertex data. The following data types are supported:
- V1Int8 / V2Int8 / V3Int8 / V4Int8
- V1Int16 / V2Int16 / V3Int16 / V4Int16
- V1Int32 / V2Int32 / V3Int32 / V4Int32
- V1UInt8 / V2UInt8 / V3UInt8 / V4UInt8
- V1UInt16 / V2UInt16 / V3UInt16 / V4UInt16
- V1UInt32 / V2UInt32 / V3UInt32 / V4UInt32
- V1Norm8 / V2Norm8 / V3Norm8 / V4Norm8
- V1Norm16 / V2Norm16 / V3Norm16 / V4Norm16
- V1UNorm8 / V2UNorm8 / V3UNorm8 / V4UNorm8
- V1UNorm16 / V2UNorm16 / V3UNorm16 / V4UNorm16
- V1Float16 / V2Float16 / V3Float16 / V4Float16
- V1Float32 / V2Float32 / V3Float32 / V4Float32
Attempting to create an instance of this class with any other type argument will generate a compilation error.
Unlike most other types in this API, the VertexAttribute class is a concrete type that is directly created by the application, and passed into the API. Internally, this class derives from the IVertexAttribute interface, which allows the class implementation to be fully separated over pure virtual interfaces from the renderers.
Enumerations
| Name | Description | |
|---|---|---|
| DataType |
Indicates the fundamental type of the data contained in this attribute
|
|
| PerformanceHint |
Flags to provide hints to the graphics system about how the application will use this attribute. Correct use of
performance hints allows the renderer to optimize the way the data is stored and modified to give the best
performance.
|
|
| DataPersistenceFlags |
Flags to provide hints to the graphics system about the required lifetime of data stored in this attribute.
These flags can be used to reduce memory requirements or increase performance in some circumstances.
|
Members
Constructors
| Name | Description | |
|---|---|---|
| Constructor |
Creates an VertexAttribute object. Note that the type itself is immutable, and all state is passed into the constructor.
|
Type methods
| Name | Description | |
|---|---|---|
| GetDataType |
Returns the type of a single index entry
|
|
| GetVertexCount |
Returns the number of vertices accessible through this vertex attribute
|
|
| GetAttributeElementCount |
Returns the number of elements in the vector type set as the type of this vertex attribute
|
|
| GetDataTypeByteSize |
Returns the size of a single vertex entry in bytes
|
Usage methods
| Name | Description | |
|---|---|---|
| GetPerformanceHintCpu |
Returns the specified CPU performance hint for this vertex attribute
|
|
| GetPerformanceHintGpu |
Returns the specified GPU performance hint for this vertex attribute
|
|
| GetDataPersistenceFlags |
Returns the specified data persistence flags for this vertex attribute
|
Binding methods
| Name | Description | |
|---|---|---|
| IsBoundToBuffer |
Reports whether this attribute has already been bound to a buffer
|
|
| BuildReadOnlyAttribute |
Attempts to populate a ReadOnlyVertexAttribute
from this attribute. Note that this attribute must already have been bound to a buffer for the call to
succeed.
|
Data methods
| Name | Description | |
|---|---|---|
| SetInitialData |
Supplies initial data to use when allocating the buffer this attribute is assigned to. Note that the supplied
memory must remain valid and accessible until the AllocateMemory
method is called.
|
|
| QueueDataUpdate |
Updates data in the associated buffer. Unlike the SetInitialData method, the provided
memory can be modified or deallocated immediately after this method returns.
|