Home -> RawVertexAttribute

Declaration

class RawVertexAttribute :public IVertexAttribute;

Description

The RawVertexAttribute 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.

The RawVertexAttribute class is similar to VertexAttribute, however unlike VertexAttribute this class is not templated, and provides no compile-time type safety to ensure it is used with arguments of the correct type, nor does it ensure that type characteristics such as stride are correctly determined by default. For this reason, it is recommended to use the VertexAttribute class where possible. The RawVertexAttribute class is intended more for use behind higher level support libraries, where aspects such as type safety have already been handled for the application programmer by those libraries, and a simple attribute type is desired to forward already validated information to the renderer.

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
Public Enum DataType
Indicates the fundamental type of the data contained in this attribute
Public Enum 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.
Public Enum 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
Public member Constructor
Creates a RawVertexAttribute object. Note that the type itself is immutable, and all state is passed into the constructor.

Type methods

Name Description
Public member GetDataType
Returns the type of a single index entry
Public member GetVertexCount
Returns the number of vertices accessible through this vertex attribute
Public member GetAttributeElementCount
Returns the number of elements in the vector type set as the type of this vertex attribute
Public member GetDataTypeByteSize
Returns the size of a single vertex entry in bytes

Usage methods

Name Description
Public member GetPerformanceHintCpu
Returns the specified CPU performance hint for this vertex attribute
Public member GetPerformanceHintGpu
Returns the specified GPU performance hint for this vertex attribute
Public member GetDataPersistenceFlags
Returns the specified data persistence flags for this vertex attribute

Binding methods

Name Description
Public member IsBoundToBuffer
Reports whether this attribute has already been bound to a buffer
Public member 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
Public member 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.
Public member QueueDataUpdate
Updates data in the associated buffer. Unlike the SetInitialData method, the provided memory can be modified or deallocated immediately after this method returns.

See also