Qt3DCore::QAttribute Class
class Qt3DCore::QAttribute定义属性以及从QBuffer 读取数据的方式 ...更多...
头文件: | #include <Qt3DCore/QAttribute> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3DCore) target_link_libraries(mytarget PRIVATE Qt6::3DCore) |
qmake: | QT += 3dcore |
在 QML 中: | Attribute |
继承: | Qt3DCore::QNode |
状态: | 已废弃 |
公共类型
enum | AttributeType { VertexAttribute, IndexAttribute, DrawIndirectAttribute } |
enum | VertexBaseType { Byte, UnsignedByte, Short, UnsignedShort, Int, …, Double } |
属性
|
|
公共功能
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 |
公共插槽
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) |
信号
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) |
静态公共成员
QString | defaultColorAttributeName() |
QString | defaultJointIndicesAttributeName() |
QString | defaultJointWeightsAttributeName() |
QString | defaultNormalAttributeName() |
QString | defaultPositionAttributeName() |
QString | defaultTangentAttributeName() |
QString | defaultTextureCoordinate1AttributeName() |
QString | defaultTextureCoordinate2AttributeName() |
QString | defaultTextureCoordinateAttributeName() |
相关非成员
详细说明
有 3 种类型的属性。
- VertexAttribute:用于定义按顶点读取的数据
- IndexAttribute顶点索引:当使用索引绘制调用时,用于定义顶点索引
- DrawIndirectAttributeDrawIndirect:当使用间接绘制调用时,用于指定 DrawIndirect 缓冲区。
注意: 当属性类型为DrawIndirectAttribute 时,只有 count、stride 和 offset 是相关的。
在提供您自己的属性时,使用QAttribute::defaultPositionAttributeName() 等助手为您的属性命名可能会更有意义,因为这将确保您的几何体与 Qt3DExtras 模块中提供的拾取和各种材质兼容。
另请参阅 QBuffer 。
成员类型文档
enum QAttribute::AttributeType
属性类型。
常数 | 值 |
---|---|
Qt3DCore::QAttribute::VertexAttribute | 0 |
Qt3DCore::QAttribute::IndexAttribute | 1 |
Qt3DCore::QAttribute::DrawIndirectAttribute | 2 |
enum QAttribute::VertexBaseType
数据类型。
常数 | 值 |
---|---|
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 |
属性文档
attributeType : AttributeType
保存属性类型。
访问功能:
Qt3DCore::QAttribute::AttributeType | attributeType() const |
void | setAttributeType(Qt3DCore::QAttribute::AttributeType attributeType) |
通知信号:
void | attributeTypeChanged(Qt3DCore::QAttribute::AttributeType attributeType) |
buffer : Qt3DCore::QBuffer*
保存缓冲区。
访问功能:
Qt3DCore::QBuffer * | buffer() const |
void | setBuffer(Qt3DCore::QBuffer *buffer) |
通知信号:
void | bufferChanged(Qt3DCore::QBuffer *buffer) |
byteOffset : uint
保存字节偏移量。
访问功能:
uint | byteOffset() const |
void | setByteOffset(uint byteOffset) |
通知信号:
void | byteOffsetChanged(uint byteOffset) |
byteStride : uint
保存字节跨距。
访问功能:
uint | byteStride() const |
void | setByteStride(uint byteStride) |
通知信号:
void | byteStrideChanged(uint byteStride) |
count : uint
保存计数。
访问功能:
uint | count() const |
void | setCount(uint count) |
通知信号:
void | countChanged(uint count) |
divisor : uint
保存除数。
访问功能:
uint | divisor() const |
void | setDivisor(uint divisor) |
通知信号:
void | divisorChanged(uint divisor) |
name : QString
保存名称。
访问功能:
QString | name() const |
void | setName(const QString &name) |
通知信号:
void | nameChanged(const QString &name) |
vertexBaseType : VertexBaseType
保存数据类型。
访问功能:
Qt3DCore::QAttribute::VertexBaseType | vertexBaseType() const |
void | setVertexBaseType(Qt3DCore::QAttribute::VertexBaseType type) |
通知信号:
void | vertexBaseTypeChanged(Qt3DCore::QAttribute::VertexBaseType vertexBaseType) |
vertexSize : uint
保存数据大小,只能是 1 至 4 个单位(标量和矢量)、9 个单位(3x3 矩阵)或 16 个单位(4x4 矩阵)。
访问功能:
uint | vertexSize() const |
void | setVertexSize(uint size) |
Notifier 信号:
void | vertexSizeChanged(uint vertexSize) |
成员函数 文档
[explicit]
QAttribute::QAttribute(Qt3DCore::QNode *parent = nullptr)
使用parent 构建一个新的 QAttribute。
[explicit]
QAttribute::QAttribute(Qt3DCore::QBuffer *buf, Qt3DCore::QAttribute::VertexBaseType type, uint dataSize, uint count, uint offset = 0, uint stride = 0, Qt3DCore::QNode *parent = nullptr)
从buf 中的type,dataSize,count,offset, 和stride 与parent 构建一个新的 QAttribute。
[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)
从type,dataSize,count,offset, 和stride 的buf 与parent 构建名为name 的新 QAttribute。
[signal]
void QAttribute::dataSizeChanged(uint vertexSize)
当 dataSize 发生变化时,会通过vertexSize 发送信号。
[signal]
void QAttribute::dataTypeChanged(Qt3DCore::QAttribute::VertexBaseType vertexBaseType)
当数据类型发生变化时,会发出vertexBaseType 信号。
[static invokable]
QString QAttribute::defaultColorAttributeName()
QAttribute::defaultColorAttributeName 返回默认颜色属性的名称
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
注: 属性 defaultColorAttributeName 的获取函数。
[static]
QString QAttribute::defaultJointIndicesAttributeName()
QAttribute::defaultJointIndicesAttributeName 返回默认关节点属性的名称
注: 属性 defaultJointIndicesAttributeName 的获取函数。
[static]
QString QAttribute::defaultJointWeightsAttributeName()
QAttribute::defaultJointIndicesAttributeName 返回默认关节点权重属性名称
注: 属性 defaultJointWeightsAttributeName 的获取函数。
[static invokable]
QString QAttribute::defaultNormalAttributeName()
QAttribute::defaultNormalAttributeName 返回默认法线属性的名称
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
注: 属性 defaultNormalAttributeName 的获取函数。
[static invokable]
QString QAttribute::defaultPositionAttributeName()
QAttribute::defaultPositionAttributeName 返回默认位置属性的名称
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
注: 属性 defaultPositionAttributeName 的获取函数。
[static invokable]
QString QAttribute::defaultTangentAttributeName()
QAttribute::defaultTangentAttributeName 返回默认切线属性的名称
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
注: 属性 defaultTangentAttributeName 的获取函数。
[static]
QString QAttribute::defaultTextureCoordinate1AttributeName()
QAttribute::defaultTextureCoordinate1AttributeName 返回第二层纹理坐标的默认属性名称
注: 属性 defaultTextureCoordinate1AttributeName 的获取函数。
[static]
QString QAttribute::defaultTextureCoordinate2AttributeName()
QAttribute::defaultTextureCoordinate2AttributeName 返回第三层纹理坐标的默认属性名称。
注: 属性 defaultTextureCoordinate2AttributeName 的获取函数。
[static invokable]
QString QAttribute::defaultTextureCoordinateAttributeName()
QAttribute::defaultTextureCoordinateAttributeName 返回默认纹理坐标属性的名称
注: 此函数可通过元对象系统和 QML 调用。请参阅Q_INVOKABLE 。
注: 属性 defaultTextureCoordinateAttributeName 的获取函数。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.