本页内容

Qt3DRender::QPolygonOffset Class

class Qt3DRender::QPolygonOffset

QPolygonOffset 类用于设置比例和步长,以计算多边形偏移的深度值。更多内容...

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

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

属性

公共函数

QPolygonOffset(Qt3DCore::QNode *parent = nullptr)
float depthSteps() const
float scaleFactor() const

公共槽位

void setDepthSteps(float depthSteps)
void setScaleFactor(float scaleFactor)

信号

void depthStepsChanged(float depthSteps)
void scaleFactorChanged(float scaleFactor)

详细说明

QPolygonOffset 类会在深度测试和深度写入之前,对片元深度值添加一个偏移量。当渲染深度值非常接近的多边形(例如贴花)时,该偏移量可用于避免 Z 冲突。

属性文档

depthSteps : float

用于存储生成固定深度偏移量的单元。默认值为 0。

访问函数:

float depthSteps() const
void setDepthSteps(float depthSteps)

通知信号:

void depthStepsChanged(float depthSteps)

scaleFactor : float

存储用于为每个多边形生成可变深度偏移量的缩放因子。默认值为 0。

访问函数:

float scaleFactor() const
void setScaleFactor(float scaleFactor)

通知信号:

void scaleFactorChanged(float scaleFactor)

成员函数文档

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

该构造函数使用指定的参数创建一个新的QPolygonOffset::QPolygonOffset 实例parent

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