Qt3DRender::QDepthTest Class

class Qt3DRender::QDepthTest

QDepthTest 类根据写入样本的深度测试片段着色器的深度值。更多

Header: #include <QDepthTest>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
在 QML 中: DepthTest
继承: Qt3DRender::QRenderState
状态:已废弃

公共类型

enum DepthFunction { Never, Always, Less, LessOrEqual, Equal, …, NotEqual }

属性

公共功能

QDepthTest(Qt3DCore::QNode *parent = nullptr)
Qt3DRender::QDepthTest::DepthFunction depthFunction() const

公共插槽

void setDepthFunction(Qt3DRender::QDepthTest::DepthFunction depthFunction)

信号

void depthFunctionChanged(Qt3DRender::QDepthTest::DepthFunction depthFunction)

详细说明

QDepthTest 类用于使用给定的深度测试函数进行深度测试。当深度测试通过时,深度测试会写入片段颜色值,并拒绝未通过测试的片段。深度测试使用深度函数来测试片段深度值与 z 缓冲值的关系。如果底层曲面没有 z 缓冲区,则 QDepthTest 不会执行任何操作。

另请参阅 QAlphaTestQStencilTest

成员类型文档

enum QDepthTest::DepthFunction

深度函数值枚举

常数说明
Qt3DRender::QDepthTest::Never0x0200从不通过深度测试
Qt3DRender::QDepthTest::Always0x0207始终通过深度测试
Qt3DRender::QDepthTest::Less0x0201如果片段深度小于 z 缓冲区值,则通过深度测试
Qt3DRender::QDepthTest::LessOrEqual0x0203如果片段深度小于或等于 z 缓冲区值,则通过深度测试
Qt3DRender::QDepthTest::Equal0x0202如果片段深度等于 z 缓冲区值,则通过深度测试
Qt3DRender::QDepthTest::GreaterOrEqual0x0206如果片段深度大于或等于 z 缓冲区值,则通过深度测试
Qt3DRender::QDepthTest::Greater0x0204如果片段深度大于 z 缓冲区值,通过深度测试
Qt3DRender::QDepthTest::NotEqual0x0205如果片段深度不等于 z 缓冲区值,则通过深度测试

属性文档

depthFunction : DepthFunction

保存深度测试使用的当前函数。默认为从不。

访问功能:

Qt3DRender::QDepthTest::DepthFunction depthFunction() const
void setDepthFunction(Qt3DRender::QDepthTest::DepthFunction depthFunction)

Notifier 信号:

void depthFunctionChanged(Qt3DRender::QDepthTest::DepthFunction depthFunction)

成员函数 文档

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

构造函数使用指定的parent 创建一个新的QDepthTest::QDepthTest 实例。

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