QSGOpaqueTextureMaterial Class

QSGOpaqueTextureMaterial 类提供了一种在场景图中渲染纹理几何体的便捷方法。更多

Header: #include <QSGOpaqueTextureMaterial>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
继承: QSGMaterial
继承于:

QSGTextureMaterial

公共函数

QSGOpaqueTextureMaterial()
QSGTexture::AnisotropyLevel anisotropyLevel() const
QSGTexture::Filtering filtering() const
QSGTexture::WrapMode horizontalWrapMode() const
QSGTexture::Filtering mipmapFiltering() const
void setAnisotropyLevel(QSGTexture::AnisotropyLevel level)
void setFiltering(QSGTexture::Filtering filtering)
void setHorizontalWrapMode(QSGTexture::WrapMode mode)
void setMipmapFiltering(QSGTexture::Filtering filtering)
void setTexture(QSGTexture *texture)
void setVerticalWrapMode(QSGTexture::WrapMode mode)
QSGTexture *texture() const
QSGTexture::WrapMode verticalWrapMode() const

详细说明

警告: 该实用程序类只有在运行Qt Quick 场景图的默认后台时才有效。

不透明纹理材质将用提供的纹理填充几何体中的每个像素。该材质不尊重QSGMaterialShader::RenderState 的不透明度,因此使用该材质的节点的父节点链中的不透明度节点不会产生任何影响。

使用不透明纹理材质渲染的几何体需要属性位置 0 中的顶点和属性位置 1 中的纹理坐标。纹理坐标是一个二维浮点元组。QSGGeometry::defaultAttributes_TexturedPoint2D 会返回一个与此材质兼容的属性集。

可以使用setTexture() 设置要渲染的纹理。可以使用setMipmapFiltering(),setFiltering(),setHorizontalWrapMode() 和setVerticalWrapMode() 指定纹理的渲染方式。渲染状态是在绑定纹理实例之前设置的。

不透明纹理材质尊重当前矩阵和纹理的 alpha 通道。它会忽略场景图中累积的不透明度。

纹理材质在场景图中作为材质使用之前,必须先设置纹理。

成员函数文档

QSGOpaqueTextureMaterial::QSGOpaqueTextureMaterial()

创建新的 QSGOpaqueTextureMaterial(QSGOpaque纹理材质)。

默认的 mipmap 过滤和过滤模式设置为QSGTexture::Nearest 。默认的包裹模式设置为QSGTexture::ClampToEdge

QSGTexture::AnisotropyLevel QSGOpaqueTextureMaterial::anisotropyLevel() const

返回该材料的熵值。

另请参阅 setAnisotropyLevel().

QSGTexture::Filtering QSGOpaqueTextureMaterial::filtering() const

返回该材料的过滤模式。

默认过滤模式为QSGTexture::Nearest

另请参阅 setFiltering() 。

QSGTexture::WrapMode QSGOpaqueTextureMaterial::horizontalWrapMode() const

返回此材质的水平换行模式。

默认水平换行模式为QSGTexture::ClampToEdge

另请参阅 setHorizontalWrapMode() 。

QSGTexture::Filtering QSGOpaqueTextureMaterial::mipmapFiltering() const

返回此材质的 mipmap 过滤模式。

默认 mipmap 模式为QSGTexture::Nearest

另请参阅 setMipmapFiltering() 。

void QSGOpaqueTextureMaterial::setAnisotropyLevel(QSGTexture::AnisotropyLevel level)

将此材料的熵值设置为level

另请参阅 anisotropyLevel() 。

void QSGOpaqueTextureMaterial::setFiltering(QSGTexture::Filtering filtering)

将过滤设置为filtering

过滤模式是在绑定纹理进行渲染之前在纹理实例上设置的。

另请参阅 filtering() 。

void QSGOpaqueTextureMaterial::setHorizontalWrapMode(QSGTexture::WrapMode mode)

将水平缠绕模式设置为mode

水平环绕模式是在绑定纹理进行渲染之前在纹理实例上设置的。

另请参阅 horizontalWrapMode() 。

void QSGOpaqueTextureMaterial::setMipmapFiltering(QSGTexture::Filtering filtering)

将 mipmap 模式设置为filtering

mipmap 过滤模式是在绑定纹理进行渲染之前在纹理实例上设置的。

如果纹理不支持 mipmap,启用 mipmap 将不起作用。

另请参阅 mipmapFiltering().

void QSGOpaqueTextureMaterial::setTexture(QSGTexture *texture)

将此材质的纹理设置为texture

该材质不拥有纹理的所有权。

另请参阅 texture().

void QSGOpaqueTextureMaterial::setVerticalWrapMode(QSGTexture::WrapMode mode)

将垂直换行模式设置为mode

垂直换行模式是在绑定纹理进行渲染之前在纹理实例上设置的。

另请参阅 verticalWrapMode() 。

QSGTexture *QSGOpaqueTextureMaterial::texture() const

返回此纹理材质的纹理。

另请参阅 setTexture()。

QSGTexture::WrapMode QSGOpaqueTextureMaterial::verticalWrapMode() const

返回此材质的垂直换行模式。

默认垂直换行模式为QSGTexture::ClampToEdge

另请参阅 setVerticalWrapMode() 。

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