本页内容

Qt3DRender::QAlphaTest Class

class Qt3DRender::QAlphaTest

QAlphaTest 类指定了阿尔法参考测试。更多内容...

头文件: #include <qalphatest.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
在 QML 中: AlphaTest
继承自: Qt3DRender::QRenderState
状态: 已弃用

该类已弃用。我们强烈建议不要在新代码中使用它。

公共类型

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

属性

公共函数

Qt3DRender::QAlphaTest::AlphaFunction alphaFunction() const
float referenceValue() const

公共插槽

void setAlphaFunction(Qt3DRender::QAlphaTest::AlphaFunction alphaFunction)
void setReferenceValue(float referenceValue)

信号

void alphaFunctionChanged(Qt3DRender::QAlphaTest::AlphaFunction alphaFunction)
void referenceValueChanged(float referenceValue)

详细说明

正如 OpenGL 文档所解释的那样:Alpha 测试根据传入片段的 Alpha 值与一个常量参考值之间的比较结果,决定是否丢弃该片段。

成员类型文档

enum QAlphaTest::AlphaFunction

alpha 函数值的枚举

常量值描述
Qt3DRender::QAlphaTest::Never0x0200永远不通过 alpha 测试
Qt3DRender::QAlphaTest::Always0x0207始终通过α测试
Qt3DRender::QAlphaTest::Less0x0201若片段α小于参考值,则通过α测试
Qt3DRender::QAlphaTest::LessOrEqual0x0203若片段α小于或等于参考值,则通过α测试
Qt3DRender::QAlphaTest::Equal0x0202若片段α等于参考值,则通过α测试
Qt3DRender::QAlphaTest::GreaterOrEqual0x0206若片段α大于或等于参考值,则通过α测试
Qt3DRender::QAlphaTest::Greater0x0204若片段α值大于参考值,则通过α测试
Qt3DRender::QAlphaTest::NotEqual0x0205如果片段α值不等于参考值,则通过α测试

属性文档

alphaFunction : AlphaFunction

存储alpha测试所使用的alpha函数。默认值为“Never”。

访问函数:

Qt3DRender::QAlphaTest::AlphaFunction alphaFunction() const
void setAlphaFunction(Qt3DRender::QAlphaTest::AlphaFunction alphaFunction)

通知器信号:

void alphaFunctionChanged(Qt3DRender::QAlphaTest::AlphaFunction alphaFunction)

referenceValue : float

存储α测试所使用的参考值。默认值为0.0。设置后,该值将被限制在0到1之间。

访问函数:

float referenceValue() const
void setReferenceValue(float referenceValue)

通知信号:

void referenceValueChanged(float referenceValue)

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