Qt3DCore::QBoundingVolume Class

class Qt3DCore::QBoundingVolume

可用于覆盖实体的边界体积。更多

Header: #include <Qt3DCore/QBoundingVolume>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3DCore)
target_link_libraries(mytarget PRIVATE Qt6::3DCore)
qmake: QT += 3dcore
Qt 6.0
在 QML 中: BoundingVolume
继承于 Qt3DCore::QComponent
继承于

Qt3DRender::QGeometryRendererQt3DRender::QPickingProxy

状态:已废弃

属性

公共功能

QBoundingVolume(Qt3DCore::QNode *parent = nullptr)
bool areImplicitPointsValid() const
QVector3D implicitMaxPoint() const
QVector3D implicitMinPoint() const
QVector3D maxPoint() const
QVector3D minPoint() const
Qt3DCore::QGeometryView *view() const

公共插槽

void setMaxPoint(const QVector3D &maxPoint)
void setMinPoint(const QVector3D &minPoint)
void setView(Qt3DCore::QGeometryView *view)
bool updateImplicitBounds()

信号

void implicitMaxPointChanged(const QVector3D &implicitMaxPoint)
void implicitMinPointChanged(const QVector3D &implicitMinPoint)
void implicitPointsValidChanged(bool implicitPointsValid)
void maxPointChanged(QVector3D maxPoint)
void minPointChanged(QVector3D minPoint)
void viewChanged(Qt3DCore::QGeometryView *view)

详细说明

实体的边界体积可用于拾取或视图缩放等多种操作。它通常是通过遍历渲染的几何体来计算的。

当应用程序已知几何体的范围时,就可以使用 QBoundingVolume,这样Qt 3D 就不必计算它。

包围体可以以最小和最大范围坐标的形式提供,也可以是一个单独的、通常更简单的、近似于渲染网格的几何体。

使用最小和最大范围坐标时,在几何体的本地坐标系中,这些坐标被视为轴对齐包围盒的对角。

QBoundingVolume 也可用于查询GeometryView 的计算边界体积。如果几何体发生变化,implicitMinPointimplicitMaxPoint 属性将被更新。请注意,这是在后台线程上异步完成的,因此在读取它们之前应检查implicitPointsValid 的值。

您可以通过调用updateImplicitBounds 来强制更新隐式扩展。这将阻塞调用线程,直到结果可用。

注意: GeometryRenderer 继承于BoundingVolume ,因此也支持读取隐式边界或设置显式边界。

属性文档

[read-only] implicitMaxPoint : const QVector3D

* * 保存根据指定视图计算出的边界卷的最大范围。

访问功能:

QVector3D implicitMaxPoint() const

通知信号:

void implicitMaxPointChanged(const QVector3D &implicitMaxPoint)

[read-only] implicitMinPoint : const QVector3D

* * 保存根据指定视图计算出的边界卷的最小范围。

访问功能:

QVector3D implicitMinPoint() const

通知信号:

void implicitMinPointChanged(const QVector3D &implicitMinPoint)

[read-only] implicitPointsValid : const bool

* * 如果已分配视图且隐式范围属性是最新的,则为 True。* *

访问功能:

bool areImplicitPointsValid() const

Notifier 信号:

void implicitPointsValidChanged(bool implicitPointsValid)

另请参阅 updateImplicitBounds

maxPoint : QVector3D

* 用户指定的边界体最大范围。设置后(连同最小范围),内部将使用该值来避免从几何体中计算体积。

访问功能:

QVector3D maxPoint() const
void setMaxPoint(const QVector3D &maxPoint)

通知信号:

void maxPointChanged(QVector3D maxPoint)

minPoint : QVector3D

* 用户指定边界体的最小范围。设置后(连同最大范围),内部将使用该值来避免从几何体中计算体积。

访问功能:

QVector3D minPoint() const
void setMinPoint(const QVector3D &minPoint)

通知信号:

void minPointChanged(QVector3D minPoint)

view : QGeometryView*

* 保存指向QGeometryView 实例的指针,如果设置了该指针,将用于 * 计算边界体。

访问函数:

Qt3DCore::QGeometryView *view() const
void setView(Qt3DCore::QGeometryView *view)

Notifier 信号:

void viewChanged(Qt3DCore::QGeometryView *view)

成员函数 文档

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

构建一个新的 QBoundingVolume,parent

[slot] bool QBoundingVolume::updateImplicitBounds()

* 更新指定视图的隐式边界。如果计算成功,则返回 *true ,否则返回 false。* *

注意: 计算在调用线程中进行,对于大型网格可能会耗费大量时间。

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