QBoundingVolume Class

class Qt3DCore ::QBoundingVolume

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

头: #include <Qt3DCore/QBoundingVolume>
CMake: find_package(Qt6 COMPONENTS 3dcore REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::3dcore)
qmake: QT += 3dcore
Since: Qt 6.0
实例化: BoundingVolume
继承: Qt3DCore::QComponent
继承者: Qt3DRender::QGeometryRenderer and 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 )

详细描述

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

注意: GeometryRenderer 继承 BoundingVolume and thus supports reading implicit bounds or setting explicit bounds also.

特性文档编制

[read-only] implicitMaxPoint : const QVector3D

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

访问函数:

QVector3D implicitMaxPoint () const

通知程序信号:

void implicitMaxPointChanged (const QVector3D & implicitMaxPoint )

[read-only] implicitMinPoint : const QVector3D

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

访问函数:

QVector3D implicitMinPoint () const

通知程序信号:

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

访问函数:

bool areImplicitPointsValid () const

通知程序信号:

void implicitPointsValidChanged (bool implicitPointsValid )

另请参阅 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.

访问函数:

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

通知程序信号:

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.

访问函数:

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

通知程序信号:

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.

访问函数:

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

通知程序信号:

void viewChanged (Qt3DCore::QGeometryView * view )

成员函数文档编制

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

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