QAbstractRayCaster Class
(Qt3DRender::QAbstractRayCaster)An abstract base class for ray casting in 3d scenes. More...
Header: | #include <QAbstractRayCaster> |
qmake: | QT += 3drender |
Since: | Qt 5.11 |
Instantiated By: | AbstractRayCaster |
Inherits: | Qt3DCore::QComponent |
Inherited By: |
Public Types
enum | FilterMode { AcceptAnyMatchingLayers, AcceptAllMatchingLayers, DiscardAnyMatchingLayers, DiscardAllMatchingLayers } |
typedef | Hits |
enum | RunMode { Continuous, SingleShot } |
Properties
- filterMode : FilterMode
- hits : const Hits
- runMode : RunMode
- 1 property inherited from Qt3DCore::QComponent
- 3 properties inherited from Qt3DCore::QNode
- 1 property inherited from QObject
Public Functions
QAbstractRayCaster(Qt3DCore::QNode *parent = nullptr) | |
void | addLayer(Qt3DRender::QLayer *layer) |
Qt3DRender::QAbstractRayCaster::FilterMode | filterMode() const |
Qt3DRender::QAbstractRayCaster::Hits | hits() const |
QVector<Qt3DRender::QLayer *> | layers() const |
void | removeLayer(Qt3DRender::QLayer *layer) |
Qt3DRender::QAbstractRayCaster::RunMode | runMode() const |
- 2 public functions inherited from Qt3DCore::QComponent
- 13 public functions inherited from Qt3DCore::QNode
- 31 public functions inherited from QObject
Public Slots
void | setFilterMode(Qt3DRender::QAbstractRayCaster::FilterMode filterMode) |
void | setRunMode(Qt3DRender::QAbstractRayCaster::RunMode runMode) |
- 1 public slot inherited from Qt3DCore::QComponent
- 3 public slots inherited from Qt3DCore::QNode
- 1 public slot inherited from QObject
Signals
void | filterModeChanged(Qt3DRender::QAbstractRayCaster::FilterMode filterMode) |
void | hitsChanged(const Qt3DRender::QAbstractRayCaster::Hits &hits) |
void | runModeChanged(Qt3DRender::QAbstractRayCaster::RunMode runMode) |
- 3 signals inherited from Qt3DCore::QComponent
- 4 signals inherited from Qt3DCore::QNode
- 2 signals inherited from QObject
Static Public Members
const QMetaObject | staticMetaObject |
- 9 static public members inherited from QObject
Additional Inherited Members
- 2 protected functions inherited from Qt3DCore::QNode
- 9 protected functions inherited from QObject
Detailed Description
An abstract base class for ray casting in 3d scenes.
Qt3DRender::QAbstractRayCaster is an abstract base class for casting rays into a 3d scene. Qt3DRender::QAbstractRayCaster can not be directly instantiated, but rather through its subclasses. QAbstractRayCaster specifies common properties for all ray casters, such as run mode and layer handling, while leaving the actual ray casting details to the subclasses.
Ray castings differs from picking (using Qt3DRender::QObjectPicker) in that it does not require mouse events to trigger.
By default, the instances of Qt3DRender::QAbstractRayCaster are disabled. When enabled, the specified ray will be tested for intersecting objects at every frame. The QAbstractRayCaster::hits property will be updated with the results of the ray casting, even if no objects are found.
The Qt3DRender::QPickingSettings can be used to control the ray casting, such as which primitives are tested and how the results are returned.
Furthermore, Qt3DRender::QLayer components can be used to control how entities, or entity sub-graphs, react to ray casting.
Note: Components derived from QAbstractRayCaster should not be shared amount multiple entities.
See also Qt3DRender::QRayCaster, Qt3DRender::QScreenRayCaster, Qt3DRender::QObjectPicker, and Qt3DRender::QPickingSettings.
Member Type Documentation
enum QAbstractRayCaster::FilterMode
Specifies the rules for selecting entities to test for raycasting.
Constant | Value | Description |
---|---|---|
Qt3DRender::QAbstractRayCaster::AcceptAnyMatchingLayers |
0 |
Accept entities that reference one or more QLayer objects added to this QAbstractRayCaster. This is the default |
Qt3DRender::QAbstractRayCaster::AcceptAllMatchingLayers |
1 |
Accept entities that reference all the QLayer objects added to this QAbstractRayCaster |
Qt3DRender::QAbstractRayCaster::DiscardAnyMatchingLayers |
2 |
Discard entities that reference one or more QLayer objects added to this QAbstractRayCaster |
Qt3DRender::QAbstractRayCaster::DiscardAllMatchingLayers |
3 |
Discard entities that reference all QLayer objects added to this QAbstractRayCaster |
typedef QAbstractRayCaster::Hits
enum QAbstractRayCaster::RunMode
This enumeration specifies how often ray casting is performed
Constant | Value | Description |
---|---|---|
Qt3DRender::QAbstractRayCaster::Continuous |
0 |
Ray casting is performed at every frame as long as the component is enabled. |
Qt3DRender::QAbstractRayCaster::SingleShot |
1 |
Ray casting is done once then the component disables itself. This is the default |
Property Documentation
filterMode : FilterMode
Holds the filter mode specifying the entities to select for ray casting tests.
The default value is AcceptMatchingLayers.
Access functions:
Qt3DRender::QAbstractRayCaster::FilterMode | filterMode() const |
void | setFilterMode(Qt3DRender::QAbstractRayCaster::FilterMode filterMode) |
Notifier signal:
void | filterModeChanged(Qt3DRender::QAbstractRayCaster::FilterMode filterMode) |
hits : const Hits
Holds the results of last ray casting test as a vector of Qt3DRender::QRayCasterHit instances.
Note that even if successive tests return the exact same results (or empty results), a change notification will be emitted at every test.
Access functions:
Qt3DRender::QAbstractRayCaster::Hits | hits() const |
Notifier signal:
void | hitsChanged(const Qt3DRender::QAbstractRayCaster::Hits &hits) |
runMode : RunMode
Holds the run mode controlling how often ray casting tests are performed.
If set to SingleShot (the default), when the component is enabled, a single ray casting test will be performed and the component will automatically disable itself.
If set to Continuous, ray casting tests will be performed at every frame as long as the component is enabled.
Access functions:
Qt3DRender::QAbstractRayCaster::RunMode | runMode() const |
void | setRunMode(Qt3DRender::QAbstractRayCaster::RunMode runMode) |
Notifier signal:
void | runModeChanged(Qt3DRender::QAbstractRayCaster::RunMode runMode) |
Member Function Documentation
QAbstractRayCaster::QAbstractRayCaster(Qt3DCore::QNode *parent = nullptr)
Default constructs an instance of QAbstractRayCaster.
void QAbstractRayCaster::addLayer(Qt3DRender::QLayer *layer)
Add layer to the current list of layers
QVector<Qt3DRender::QLayer *> QAbstractRayCaster::layers() const
Returns the current list of layers
void QAbstractRayCaster::removeLayer(Qt3DRender::QLayer *layer)
Remove layer from the current list of layers
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.12/qt3drender-qabstractraycaster.html