QAttribute Class

(Qt3DRender::QAttribute)

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

头文件: #include <Qt3DRender/QAttribute>
qmake: QT += 3drender
Instantiated By: Attribute
基类: Qt3DCore::QNode

公有类型

enum AttributeType { VertexAttribute, IndexAttribute, DrawIndirectAttribute }
enum VertexBaseType { Byte, UnsignedByte, Short, UnsignedShort, ..., Double }

属性

公有函数

QAttribute(QNode *parent = nullptr)
QAttribute(QBuffer *buf, VertexBaseType type, uint dataSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = nullptr)
QAttribute(QBuffer *buf, const QString &name, VertexBaseType type, uint dataSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = nullptr)
AttributeType attributeType() const
QBuffer *buffer() const
uint byteOffset() const
uint byteStride() const
uint count() const
uint divisor() const
QString name() const
VertexBaseType vertexBaseType() const
uint vertexSize() const

公有槽函数

void setAttributeType(AttributeType attributeType)
void setBuffer(QBuffer *buffer)
void setByteOffset(uint byteOffset)
void setByteStride(uint byteStride)
void setCount(uint count)
(deprecated) void setDataSize(uint size)
(deprecated) void setDataType(VertexBaseType type)
void setDivisor(uint divisor)
void setName(const QString &name)
void setVertexBaseType(VertexBaseType type)
void setVertexSize(uint size)

信号

void attributeTypeChanged(AttributeType attributeType)
void bufferChanged(QBuffer *buffer)
void byteOffsetChanged(uint byteOffset)
void byteStrideChanged(uint byteStride)
void countChanged(uint count)
void dataSizeChanged(uint vertexSize)
void dataTypeChanged(VertexBaseType vertexBaseType)
void divisorChanged(uint divisor)
void nameChanged(const QString &name)
void vertexBaseTypeChanged(VertexBaseType vertexBaseType)
void vertexSizeChanged(uint vertexSize)

静态公有成员

  • 10 个静态公有成员继承自 QObject
typedef QBufferPtr

其他继承的成员

详细描述

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

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.

参见 QBuffer.

成员类型

enum QAttribute::AttributeType

The type of the attribute.

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

enum QAttribute::VertexBaseType

The type of the data.

ConstantValue
Qt3DRender::QAttribute::Byte0
Qt3DRender::QAttribute::UnsignedByte1
Qt3DRender::QAttribute::Short2
Qt3DRender::QAttribute::UnsignedShort3
Qt3DRender::QAttribute::Int4
Qt3DRender::QAttribute::UnsignedInt5
Qt3DRender::QAttribute::HalfFloat6
Qt3DRender::QAttribute::Float7
Qt3DRender::QAttribute::Double8

属性

attributeType : AttributeType

Holds the attribute type.

访问函数:

AttributeType attributeType() const
void setAttributeType(AttributeType attributeType)

Notifier signal:

void attributeTypeChanged(AttributeType attributeType)

buffer : Qt3DRender::QBuffer *

Holds the buffer.

访问函数:

QBuffer *buffer() const
void setBuffer(QBuffer *buffer)

Notifier signal:

void bufferChanged(QBuffer *buffer)

byteOffset : uint

Holds the byte offset.

访问函数:

uint byteOffset() const
void setByteOffset(uint byteOffset)

Notifier signal:

void byteOffsetChanged(uint byteOffset)

byteStride : uint

Holds the byte stride.

访问函数:

uint byteStride() const
void setByteStride(uint byteStride)

Notifier signal:

void byteStrideChanged(uint byteStride)

count : uint

Holds the count.

访问函数:

uint count() const
void setCount(uint count)

Notifier signal:

void countChanged(uint count)

defaultColorAttributeName : const QString

访问函数:

defaultNormalAttributeName : const QString

访问函数:

defaultPositionAttributeName : const QString

访问函数:

defaultTangentAttributeName : const QString

访问函数:

defaultTextureCoordinateAttributeName : const QString

访问函数:

divisor : uint

Holds the divisor.

访问函数:

uint divisor() const
void setDivisor(uint divisor)

Notifier signal:

void divisorChanged(uint divisor)

name : QString

Holds the name.

访问函数:

QString name() const
void setName(const QString &name)

Notifier signal:

void nameChanged(const QString &name)

vertexBaseType : VertexBaseType

Holds the data type.

访问函数:

VertexBaseType vertexBaseType() const
void setVertexBaseType(VertexBaseType type)

Notifier signal:

void vertexBaseTypeChanged(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).

访问函数:

uint vertexSize() const
void setVertexSize(uint size)

Notifier signal:

void vertexSizeChanged(uint vertexSize)

成员函数

QAttribute::QAttribute(QNode *parent = nullptr)

Constructs a new QAttribute with parent.

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

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

QAttribute::QAttribute(QBuffer *buf, const QString &name, VertexBaseType type, uint dataSize, uint count, uint offset = 0, uint stride = 0, 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)

[signal] void QAttribute::dataTypeChanged(VertexBaseType vertexBaseType)

[static] QString QAttribute::defaultColorAttributeName()

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

Note: Getter function for property defaultColorAttributeName.

[static] QString QAttribute::defaultNormalAttributeName()

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

Note: Getter function for property defaultNormalAttributeName.

[static] QString QAttribute::defaultPositionAttributeName()

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

Note: Getter function for property defaultPositionAttributeName.

[static] QString QAttribute::defaultTangentAttributeName()

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

Note: Getter function for property defaultTangentAttributeName.

[static] QString QAttribute::defaultTextureCoordinateAttributeName()

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

Note: Getter function for property defaultTextureCoordinateAttributeName.

[slot] void QAttribute::setDataSize(uint size)

This function is deprecated.

[slot] void QAttribute::setDataType(VertexBaseType type)

This function is deprecated.

相关非成员

typedef Qt3DRender::QBufferPtr