本页内容

Qt3DCore::QBoundingVolume Class

class Qt3DCore::QBoundingVolume

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

标题: #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::QGeometryRenderer 以及Qt3DRender::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 的计算出的边界体积。如果几何体发生变化,implicitMinPoint 和implicitMaxPoint 属性将会更新。请注意,此操作是在后台线程上异步执行的,因此在读取这些属性之前,应先检查implicitPointsValid 的值。

您可以通过调用updateImplicitBounds 来强制更新隐式边界。此操作将在调用线程上阻塞,直到结果可用为止。

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

属性文档

[read-only] implicitMaxPoint : QVector3D

* * * 存储根据指定视图计算出的边界体积的最大范围。

访问函数:

QVector3D implicitMaxPoint() const

通知信号:

void implicitMaxPointChanged(const QVector3D &implicitMaxPoint)

[read-only] implicitMinPoint : QVector3D

* * * 存储根据指定视图计算出的边界体积的最小范围。

访问函数:

QVector3D implicitMinPoint() const

通知信号:

void implicitMinPointChanged(const QVector3D &implicitMinPoint)

[read-only] implicitPointsValid : bool

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

访问函数:

bool areImplicitPointsValid() const

通知器信号:

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)

通知信号:

void viewChanged(Qt3DCore::QGeometryView *view)

成员函数文档

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

使用parent 构造一个新的 QBoundingVolume。

[slot] bool QBoundingVolume::updateImplicitBounds()

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

注意: 计算在调用线程中进行,对于大型网格,此操作 * 可能需要相当长的时间。

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