Qt3DExtras::QTextureMaterial Class

class Qt3DExtras::QTextureMaterial

QTextureMaterial 提供了一种简单的非光照纹理材质的默认实现。更多

Header: #include <QTextureMaterial>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dextras)
target_link_libraries(mytarget PRIVATE Qt6::3dextras)
qmake: QT += 3dextras
继承: Qt3DRender::QMaterial
状态:已废弃

属性

公共功能

QTextureMaterial(Qt3DCore::QNode *parent = nullptr)
virtual ~QTextureMaterial()
bool isAlphaBlendingEnabled() const
Qt3DRender::QAbstractTexture *texture() const
QVector2D textureOffset() const
QMatrix3x3 textureTransform() const

公共插槽

void setAlphaBlendingEnabled(bool enabled)
void setTexture(Qt3DRender::QAbstractTexture *texture)
void setTextureOffset(QVector2D textureOffset)
void setTextureTransform(const QMatrix3x3 &matrix)

信号

void alphaBlendingEnabledChanged(bool enabled)
void textureChanged(Qt3DRender::QAbstractTexture *texture)
void textureOffsetChanged(QVector2D textureOffset)
void textureTransformChanged(const QMatrix3x3 &textureTransform)

详细说明

该素材使用单次渲染通道方法制作效果。该技术适用于 OpenGL 2、OpenGL 3 或更高版本以及 OpenGL ES 2。

属性文档

alphaBlending : bool

表示在渲染过程中是否会考虑来自漫反射属性的 alpha 信息。默认为 false。

访问函数:

bool isAlphaBlendingEnabled() const
void setAlphaBlendingEnabled(bool enabled)

Notifier 信号:

void alphaBlendingEnabledChanged(bool enabled)

texture : Qt3DRender::QAbstractTexture*

保存材质使用的当前纹理。

访问功能:

Qt3DRender::QAbstractTexture *texture() const
void setTexture(Qt3DRender::QAbstractTexture *texture)

通知信号:

void textureChanged(Qt3DRender::QAbstractTexture *texture)

textureOffset : QVector2D

这是一个实用属性。它设置一般纹理变换矩阵的平移分量。

访问功能:

QVector2D textureOffset() const
void setTextureOffset(QVector2D textureOffset)

通知信号:

void textureOffsetChanged(QVector2D textureOffset)

textureTransform : QMatrix3x3

保存当前的纹理变换。它会在渲染时应用于纹理坐标。默认为身份矩阵。

访问功能:

QMatrix3x3 textureTransform() const
void setTextureTransform(const QMatrix3x3 &matrix)

Notifier 信号:

void textureTransformChanged(const QMatrix3x3 &textureTransform)

成员函数 文档

[explicit] QTextureMaterial::QTextureMaterial(Qt3DCore::QNode *parent = nullptr)

使用父对象parent 构建一个新的 QTextureMaterial 实例。

[virtual noexcept] QTextureMaterial::~QTextureMaterial()

销毁QTextureMaterial 实例。

© 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.