QAttribute Class

class Qt3DRender::QAttribute

Defines an attribute and how data should be read from a QBuffer. More...

Header: #include <Qt3DRender/QAttribute>
qmake: QT += 3drender
Instantiated By: Attribute
Inherits: Qt3DCore::QNode

Public Types

enum AttributeType { VertexAttribute, IndexAttribute, DrawIndirectAttribute }

Public Functions

QAttribute(Qt3DRender::QBuffer *buf, const QString &name, int type, uint dataSize, uint count, uint offset = 0, uint stride = 0, Qt3DCore::QNode *parent = nullptr)
QAttribute(Qt3DRender::QBuffer *buf, int type, uint dataSize, uint count, uint offset = 0, uint stride = 0, Qt3DCore::QNode *parent = nullptr)

Static Public Members

Protected Functions

void dataSizeChanged(uint vertexSize)
typedef QBufferPtr

Detailed Description

There are 3 types of attributes.

  • VertexAttribute: used to define data to be read on a per vertex basis
  • IndexAttribute: used to define vertex indices when indexed draw calls are to be used
  • DrawIndirectAttribute: used to specify the DrawIndirect buffer to be used when indirect draw calls are to be used

Note: when an attribute is of type DrawIndirectAttribute, only count, stride and offset are relevant.

When providing your own attributes, it may make sense to name your attribute using helpers such as QAttribute::defaultPositionAttributeName() as that will ensure your geometry will be compatible with picking and the various materials provided in the Qt3DExtras module.

See also QBuffer.

Member Type Documentation

enum QAttribute::AttributeType

The type of the attribute.

ConstantValue
Qt3DRender::QAttribute::VertexAttribute0
Qt3DRender::QAttribute::IndexAttribute1
Qt3DRender::QAttribute::DrawIndirectAttribute2

Member Function Documentation

QAttribute::QAttribute(Qt3DRender::QBuffer *buf, const QString &name, int type, uint dataSize, uint count, uint offset = 0, uint stride = 0, Qt3DCore::QNode *parent = nullptr)

Constructs a new QAttribute named name from buf of type, dataSize, count, offset, and stride with parent.

QAttribute::QAttribute(Qt3DRender::QBuffer *buf, int type, uint dataSize, uint count, uint offset = 0, uint stride = 0, Qt3DCore::QNode *parent = nullptr)

Constructs a new QAttribute from buf of type, dataSize, count, offset, and stride with parent.

[protected] void QAttribute::dataSizeChanged(uint vertexSize)

The signal is emitted with vertexSize when the dataSize changes.

[static] QString QAttribute::defaultColorAttributeName()

QAttribute::defaultColorAttributeName Returns the name of the default color attribute

[static] QString QAttribute::defaultJointIndicesAttributeName()

QAttribute::defaultJointIndicesAttributeName Returns the name of the default joint indices attribute

[static] QString QAttribute::defaultJointWeightsAttributeName()

QAttribute::defaultJointIndicesAttributeName Returns the name of the default joint weights attribute

[static] QString QAttribute::defaultNormalAttributeName()

QAttribute::defaultNormalAttributeName Returns the name of the default normal attribute

[static] QString QAttribute::defaultPositionAttributeName()

QAttribute::defaultPositionAttributeName Returns the name of the default position attribute

[static] QString QAttribute::defaultTangentAttributeName()

QAttribute::defaultTangentAttributeName Returns the name of the default tangent attribute

[static] QString QAttribute::defaultTextureCoordinate1AttributeName()

QAttribute::defaultTextureCoordinate1AttributeName Returns the name of the default attribute for the second layer of texture coordinates

[static] QString QAttribute::defaultTextureCoordinate2AttributeName()

QAttribute::defaultTextureCoordinate2AttributeName Returns the name of the default attribute for the third layer of texture coordinates

[static] QString QAttribute::defaultTextureCoordinateAttributeName()

QAttribute::defaultTextureCoordinateAttributeName Returns the name of the default texture coordinate attribute

Related Non-Members

typedef QBufferPtr