QAttribute Class
class Qt3DCore::QAttributeDefines an attribute and how data should be read from a QBuffer. More...
Header: | #include <Qt3DCore/QAttribute> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3DCore) target_link_libraries(mytarget PRIVATE Qt6::3DCore) |
qmake: | QT += 3dcore |
In QML: | Attribute |
Inherits: | Qt3DCore::QNode |
Status: | Deprecated |
Public Types
enum | AttributeType { VertexAttribute, IndexAttribute, DrawIndirectAttribute } |
enum | VertexBaseType { Byte, UnsignedByte, Short, UnsignedShort, Int, …, Double } |
Properties
|
|
Public Functions
QAttribute(Qt3DCore::QNode *parent = nullptr) | |
QAttribute(Qt3DCore::QBuffer *buf, Qt3DCore::QAttribute::VertexBaseType type, uint dataSize, uint count, uint offset = 0, uint stride = 0, Qt3DCore::QNode *parent = nullptr) | |
QAttribute(Qt3DCore::QBuffer *buf, const QString &name, Qt3DCore::QAttribute::VertexBaseType type, uint dataSize, uint count, uint offset = 0, uint stride = 0, Qt3DCore::QNode *parent = nullptr) | |
Qt3DCore::QAttribute::AttributeType | attributeType() const |
Qt3DCore::QBuffer * | buffer() const |
uint | byteOffset() const |
uint | byteStride() const |
uint | count() const |
uint | divisor() const |
QString | name() const |
Qt3DCore::QAttribute::VertexBaseType | vertexBaseType() const |
uint | vertexSize() const |
Public Slots
void | setAttributeType(Qt3DCore::QAttribute::AttributeType attributeType) |
void | setBuffer(Qt3DCore::QBuffer *buffer) |
void | setByteOffset(uint byteOffset) |
void | setByteStride(uint byteStride) |
void | setCount(uint count) |
void | setDivisor(uint divisor) |
void | setName(const QString &name) |
void | setVertexBaseType(Qt3DCore::QAttribute::VertexBaseType type) |
void | setVertexSize(uint size) |
Signals
void | attributeTypeChanged(Qt3DCore::QAttribute::AttributeType attributeType) |
void | bufferChanged(Qt3DCore::QBuffer *buffer) |
void | byteOffsetChanged(uint byteOffset) |
void | byteStrideChanged(uint byteStride) |
void | countChanged(uint count) |
void | dataSizeChanged(uint vertexSize) |
void | dataTypeChanged(Qt3DCore::QAttribute::VertexBaseType vertexBaseType) |
void | divisorChanged(uint divisor) |
void | nameChanged(const QString &name) |
void | vertexBaseTypeChanged(Qt3DCore::QAttribute::VertexBaseType vertexBaseType) |
void | vertexSizeChanged(uint vertexSize) |
Static Public Members
QString | defaultColorAttributeName() |
QString | defaultJointIndicesAttributeName() |
QString | defaultJointWeightsAttributeName() |
QString | defaultNormalAttributeName() |
QString | defaultPositionAttributeName() |
QString | defaultTangentAttributeName() |
QString | defaultTextureCoordinate1AttributeName() |
QString | defaultTextureCoordinate2AttributeName() |
QString | defaultTextureCoordinateAttributeName() |
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.
Constant | Value |
---|---|
Qt3DCore::QAttribute::VertexAttribute | 0 |
Qt3DCore::QAttribute::IndexAttribute | 1 |
Qt3DCore::QAttribute::DrawIndirectAttribute | 2 |
enum QAttribute::VertexBaseType
The type of the data.
Constant | Value |
---|---|
Qt3DCore::QAttribute::Byte | 0 |
Qt3DCore::QAttribute::UnsignedByte | 1 |
Qt3DCore::QAttribute::Short | 2 |
Qt3DCore::QAttribute::UnsignedShort | 3 |
Qt3DCore::QAttribute::Int | 4 |
Qt3DCore::QAttribute::UnsignedInt | 5 |
Qt3DCore::QAttribute::HalfFloat | 6 |
Qt3DCore::QAttribute::Float | 7 |
Qt3DCore::QAttribute::Double | 8 |
Property Documentation
attributeType : AttributeType
Holds the attribute type.
Access functions:
Qt3DCore::QAttribute::AttributeType | attributeType() const |
void | setAttributeType(Qt3DCore::QAttribute::AttributeType attributeType) |
Notifier signal:
void | attributeTypeChanged(Qt3DCore::QAttribute::AttributeType attributeType) |
buffer : Qt3DCore::QBuffer*
Holds the buffer.
Access functions:
Qt3DCore::QBuffer * | buffer() const |
void | setBuffer(Qt3DCore::QBuffer *buffer) |
Notifier signal:
void | bufferChanged(Qt3DCore::QBuffer *buffer) |
byteOffset : uint
Holds the byte offset.
Access functions:
uint | byteOffset() const |
void | setByteOffset(uint byteOffset) |
Notifier signal:
void | byteOffsetChanged(uint byteOffset) |
byteStride : uint
Holds the byte stride.
Access functions:
uint | byteStride() const |
void | setByteStride(uint byteStride) |
Notifier signal:
void | byteStrideChanged(uint byteStride) |
count : uint
Holds the count.
Access functions:
uint | count() const |
void | setCount(uint count) |
Notifier signal:
void | countChanged(uint count) |
divisor : uint
Holds the divisor.
Access functions:
uint | divisor() const |
void | setDivisor(uint divisor) |
Notifier signal:
void | divisorChanged(uint divisor) |
name : QString
Holds the name.
Access functions:
QString | name() const |
void | setName(const QString &name) |
Notifier signal:
void | nameChanged(const QString &name) |
vertexBaseType : VertexBaseType
Holds the data type.
Access functions:
Qt3DCore::QAttribute::VertexBaseType | vertexBaseType() const |
void | setVertexBaseType(Qt3DCore::QAttribute::VertexBaseType type) |
Notifier signal:
void | vertexBaseTypeChanged(Qt3DCore::QAttribute::VertexBaseType vertexBaseType) |
vertexSize : uint
Holds the data size, it can only be 1 to 4 units (scalars and vectors), 9 units (3x3 matrices) or 16 units (4x4 matrices).
Access functions:
uint | vertexSize() const |
void | setVertexSize(uint size) |
Notifier signal:
void | vertexSizeChanged(uint vertexSize) |
Member Function Documentation
[explicit]
QAttribute::QAttribute(Qt3DCore::QNode *parent = nullptr)
Constructs a new QAttribute with parent.
[explicit]
QAttribute::QAttribute(Qt3DCore::QBuffer *buf, Qt3DCore::QAttribute::VertexBaseType 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.
[explicit]
QAttribute::QAttribute(Qt3DCore::QBuffer *buf, const QString &name, Qt3DCore::QAttribute::VertexBaseType 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.
[signal]
void QAttribute::dataSizeChanged(uint vertexSize)
The signal is emitted with vertexSize when the dataSize changes.
[signal]
void QAttribute::dataTypeChanged(Qt3DCore::QAttribute::VertexBaseType vertexBaseType)
The signal is emitted with vertexBaseType when the dataType changed.
[static invokable]
QString QAttribute::defaultColorAttributeName()
QAttribute::defaultColorAttributeName Returns the name of the default color attribute
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property defaultColorAttributeName.
[static]
QString QAttribute::defaultJointIndicesAttributeName()
QAttribute::defaultJointIndicesAttributeName Returns the name of the default joint indices attribute
Note: Getter function for property defaultJointIndicesAttributeName.
[static]
QString QAttribute::defaultJointWeightsAttributeName()
QAttribute::defaultJointIndicesAttributeName Returns the name of the default joint weights attribute
Note: Getter function for property defaultJointWeightsAttributeName.
[static invokable]
QString QAttribute::defaultNormalAttributeName()
QAttribute::defaultNormalAttributeName Returns the name of the default normal attribute
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property defaultNormalAttributeName.
[static invokable]
QString QAttribute::defaultPositionAttributeName()
QAttribute::defaultPositionAttributeName Returns the name of the default position attribute
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property defaultPositionAttributeName.
[static invokable]
QString QAttribute::defaultTangentAttributeName()
QAttribute::defaultTangentAttributeName Returns the name of the default tangent attribute
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property defaultTangentAttributeName.
[static]
QString QAttribute::defaultTextureCoordinate1AttributeName()
QAttribute::defaultTextureCoordinate1AttributeName Returns the name of the default attribute for the second layer of texture coordinates
Note: Getter function for property defaultTextureCoordinate1AttributeName.
[static]
QString QAttribute::defaultTextureCoordinate2AttributeName()
QAttribute::defaultTextureCoordinate2AttributeName Returns the name of the default attribute for the third layer of texture coordinates
Note: Getter function for property defaultTextureCoordinate2AttributeName.
[static invokable]
QString QAttribute::defaultTextureCoordinateAttributeName()
QAttribute::defaultTextureCoordinateAttributeName Returns the name of the default texture coordinate attribute
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Note: Getter function for property defaultTextureCoordinateAttributeName.