本页内容

Qt3DExtras::QTextureMaterial Class

class Qt3DExtras::QTextureMaterial

QTextureMaterial 提供了一个简单的无光照纹理材质的默认实现。更多内容...

头文件: #include <qtexturematerial.h>
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

指示在渲染过程中是否会考虑来自“漫反射”属性的透明度信息。默认值为 false。

访问函数:

bool isAlphaBlendingEnabled() const
void setAlphaBlendingEnabled(bool enabled)

通知器信号:

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)

通知器信号:

void textureTransformChanged(const QMatrix3x3 &textureTransform)

成员函数文档

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

创建一个新的 QTextureMaterial 实例,其父对象为parent 。

[virtual noexcept] QTextureMaterial::~QTextureMaterial()

销毁该QTextureMaterial 实例。

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