QAttribute 类
class Qt3DCore::QAttribute定义了属性及其从 QBuffer 中读取数据的方式。更多信息...
| 头文件 | #include <Qt3DCore/QAttribute> |
| CMake | find_package(Qt6 REQUIRED COMPONENTS 3DCore) target_link_libraries(mytarget PRIVATE Qt6::3DCore) |
| qmake | QT += 3dcore |
| 实例化自 | 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:在要使用索引绘制调用时,用于定义顶点索引
- DrawIndirectAttribute:在要使用间接绘制调用时,用于指定要使用的DrawIndirect缓冲区
注意:当属性类型为DrawIndirectAttribute时,只有计数、步长和偏移量是相关的。
当提供自己的属性时,使用如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) |
通知信号
| void | vertexSizeChanged(uint vertexSize) |
成员函数文档
[明确] QAttribute::QAttribute(Qt3DCore::QNode *parent = nullptr)
使用 父对象 构建一个新的 QAttribute。
[显式] 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构建一个新的QAttribute,并将其设置为parent。
[显式] 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)
从buf、type、dataSize、count、offset和stride构建一个新的名为name的QAttribute,并将其设置为parent。
[信号] void QAttribute::dataSizeChanged(uint vertexSize)
当数据大小改变时,触发vertexSize信号。
[信号] void QAttribute::dataTypeChanged(Qt3DCore::QAttribute::VertexBaseType vertexBaseType)
当数据类型改变时,触发vertexBaseType信号。
[静态调用] QString QAttribute::defaultColorAttributeName()
QAttribute::defaultColorAttributeName 返回默认颜色属性的名称
注意:此函数可以通过元对象系统和从QML调用。参见Q_INVOKABLE。
注意:默认颜色属性名称的获取函数。
[静态] QString QAttribute::defaultJointIndicesAttributeName()
QAttribute::defaultJointIndicesAttributeName 返回默认关节索引属性的名称
注意:默认关节索引属性名称的获取函数。
[静态] QString QAttribute::defaultJointWeightsAttributeName()
QAttribute::defaultJointWeightsAttributeName 返回默认关节权重属性的名称
注意:默认关节权重属性名称的获取函数。
[静态调用] QString QAttribute::defaultNormalAttributeName()
QAttribute::defaultNormalAttributeName 返回默认法线属性的名称
注意:此函数可以通过元对象系统和从QML调用。参见Q_INVOKABLE。
注意:默认法线属性名称的获取函数。
[静态可调用的] QString QAttribute::defaultPositionAttributeName()
QAttribute::defaultPositionAttributeName 返回默认位置属性名称
注意:此函数可以通过元对象系统和从QML调用。参见Q_INVOKABLE。
注意:defaultPositionAttributeName属性的获取器函数。
[静态可调用的] QString QAttribute::defaultTangentAttributeName()
QAttribute::defaultTangentAttributeName 返回默认切线属性名称
注意:此函数可以通过元对象系统和从QML调用。参见Q_INVOKABLE。
注意:defaultTangentAttributeName属性的获取器函数。
[静态] QString QAttribute::defaultTextureCoordinate1AttributeName()
QAttribute::defaultTextureCoordinate1AttributeName 返回第二层纹理坐标的默认属性名称
注意:defaultTextureCoordinate1AttributeName属性的获取器函数。
[静态] QString QAttribute::defaultTextureCoordinate2AttributeName()
QAttribute::defaultTextureCoordinate2AttributeName 返回第三层纹理坐标的默认属性名称
注意:defaultTextureCoordinate2AttributeName属性的获取器函数。
[静态可调用的] QString QAttribute::defaultTextureCoordinateAttributeName()
QAttribute::defaultTextureCoordinateAttributeName 返回默认纹理坐标属性名称
注意:此函数可以通过元对象系统和从QML调用。参见Q_INVOKABLE。
注意:defaultTextureCoordinateAttributeName属性的获取器函数。
© 2024 Qt公司。本文件中的文档贡献是各自所有者的版权。本文件提供的文档受GNU自由文档许可证版1.3的条款约束,该许可证由自由软件基金会发布。Qt及其相关徽标是Qt公司在芬兰和/或其他国家的商标。所有其他商标均为其各自所有者的财产。