Qt3DRender::QSortPolicy Class
class Qt3DRender::QSortPolicy用于存储待使用的排序类型。更多...
| 标题: | #include <qsortpolicy.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| 在 QML 中: | SortPolicy |
| 继承自: | Qt3DRender::QFrameGraphNode |
| 状态: | 已弃用 |
该类已弃用。我们强烈建议不要在新代码中使用它。
公共类型
| enum | SortType { StateChangeCost, BackToFront, Material, FrontToBack, Texture, Uniform } |
属性
- sortTypes : QList<int>
公共函数
| QSortPolicy(Qt3DCore::QNode *parent = nullptr) | |
| QList<Qt3DRender::QSortPolicy::SortType> | sortTypes() const |
| QList<int> | sortTypesInt() const |
公共槽位
| void | setSortTypes(const QList<Qt3DRender::QSortPolicy::SortType> &sortTypes) |
| void | setSortTypes(const QList<int> &sortTypesInt) |
信号
| void | sortTypesChanged(const QList<Qt3DRender::QSortPolicy::SortType> &sortTypes) |
| void | sortTypesChanged(const QList<int> &sortTypes) |
详细说明
Qt3DRender::QSortPolicy 类用于存储FrameGraph所使用的排序类型。排序类型决定了可绘制实体在绘制前如何进行排序,从而确定绘制顺序。当FrameGraph中存在QSortPolicy时,排序机制由sortTypes 列表决定。 可以同时使用多种排序类型。如果FrameGraph中不存在QSortPolicy,则实体将按照其在实体层次结构中的出现顺序进行绘制。
成员类型文档
enum QSortPolicy::SortType
此枚举类型描述了可用的排序类型。
| 常量 | 值 | 描述 |
|---|---|---|
Qt3DRender::QSortPolicy::StateChangeCost | (1 << 0) | 对对象进行排序,以最大限度地降低从当前渲染状态切换所需的成本 |
Qt3DRender::QSortPolicy::BackToFront | (1 << 1) | 根据反转的 z 顺序将对象从后往前排序。更准确地说,排序键是“从摄像机到对象中心”向量在摄像机视向量上的投影的 z 分量。 |
Qt3DRender::QSortPolicy::Material | (1 << 2) | 根据对象的材质(着色器)值对对象进行排序。 |
Qt3DRender::QSortPolicy::FrontToBack | (1 << 3) | 将对象从前到后排序。与 BackToFront 相反。 |
Qt3DRender::QSortPolicy::Texture (since Qt 5.14) | (1 << 4) | 按对象排序,以将纹理变化降至最低。 |
Qt3DRender::QSortPolicy::Uniform (since Qt 5.15) | (1 << 5) | 对对象进行排序,以最大限度地减少均匀变量的变化。 |
属性文档
sortTypes : QList<int>
指定要使用的排序类型。
访问函数:
| QList<int> | sortTypesInt() const |
| void | setSortTypes(const QList<Qt3DRender::QSortPolicy::SortType> &sortTypes) |
| void | setSortTypes(const QList<int> &sortTypesInt) |
通知信号:
| void | sortTypesChanged(const QList<Qt3DRender::QSortPolicy::SortType> &sortTypes) |
| void | sortTypesChanged(const QList<int> &sortTypes) |
成员函数文档
[explicit] QSortPolicy::QSortPolicy(Qt3DCore::QNode *parent = nullptr)
根据给定的parent 实例,构建QSortPolicy对象。
QList<Qt3DRender::QSortPolicy::SortType> QSortPolicy::sortTypes() const
返回当前正在使用的排序类型
另请参阅 setSortTypes()。
© 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.