QBoundingVolume Class

class Qt3DCore::QBoundingVolume

can be used to override the bounding volume of an entity. More...

Header: #include <Qt3DCore/QBoundingVolume>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3DCore)
target_link_libraries(mytarget PRIVATE Qt6::3DCore)
qmake: QT += 3dcore
Since: Qt 6.0
Instantiated By: BoundingVolume
Inherits: Qt3DCore::QComponent
Inherited By:

Qt3DRender::QGeometryRenderer and Qt3DRender::QPickingProxy

Properties

Public Functions

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

Public Slots

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

Signals

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)

Detailed Description

An entity's bounding volume is used for many operations such as picking or view frustum culling. It is normally computed by traversing the rendered geometry.

QBoundingVolume can be used when the extent of the geometry is known to the application so that Qt 3D does not have to compute it.

A bounding volume can be provided either as minimum and maximum extent coordinates, or a separate, usually simpler, geometry that approximates the rendered mesh.

When using minimum and maximum extents, these are considered to be the opposite corners of an axis aligned bounding box, in the geometry's local coordinate system.

QBoundingVolume can also be used to query the computed bounding volume of a GeometryView. The implicitMinPoint and implicitMaxPoint properties will be updated if the geometry changes. Note that this is done asynchronously on a background thread so you should check the value of implicitPointsValid before reading them.

You can force the implicit extents to be updated by calling updateImplicitBounds. This will block on the calling thread until the results are available.

Note: GeometryRenderer inherits BoundingVolume and thus supports reading implicit bounds or setting explicit bounds also.

Property Documentation

[read-only] implicitMaxPoint : const QVector3D

* * * Holds maximum extent of the bounding volume computed from the specified view.

Access functions:

QVector3D implicitMaxPoint() const

Notifier signal:

void implicitMaxPointChanged(const QVector3D &implicitMaxPoint)

[read-only] implicitMinPoint : const QVector3D

* * * Holds minimum extent of the bounding volume computed from the specified view.

Access functions:

QVector3D implicitMinPoint() const

Notifier signal:

void implicitMinPointChanged(const QVector3D &implicitMinPoint)

[read-only] implicitPointsValid : const bool

* * * True if a view has been assigned and the implicit extent properties are up to date. * *

Access functions:

bool areImplicitPointsValid() const

Notifier signal:

void implicitPointsValidChanged(bool implicitPointsValid)

See also updateImplicitBounds.

maxPoint : QVector3D

* * * User specified maximum extent of the bounding volume. When set (along with minimum * extent), this will be used internally to avoid computing the volume from the * geometry.

Access functions:

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

Notifier signal:

void maxPointChanged(QVector3D maxPoint)

minPoint : QVector3D

* * * User specified minimum extent of the bounding volume. When set (along with maximum * extent), this will be used internally to avoid computing the volume from the * geometry.

Access functions:

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

Notifier signal:

void minPointChanged(QVector3D minPoint)

view : QGeometryView*

* * * Holds a pointer to the instance of QGeometryView which will be used, if set, * to compute the bounding volume.

Access functions:

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

Notifier signal:

void viewChanged(Qt3DCore::QGeometryView *view)

Member Function Documentation

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

Constructs a new QBoundingVolume with parent.

[slot] bool QBoundingVolume::updateImplicitBounds()

* Updates the implicit bounds of the specified view. Returns * true if the computation succeeded and false otherwise. * *

Note: The calculations are done in the call thread, this * could take significant time for large meshes.