| 1 | // Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB). |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DRENDER_RENDER_RAYCASTER_P_H |
| 5 | #define QT3DRENDER_RENDER_RAYCASTER_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <Qt3DRender/private/backendnode_p.h> |
| 19 | #include <Qt3DRender/qabstractraycaster.h> |
| 20 | #include <Qt3DRender/private/qabstractraycaster_p.h> |
| 21 | |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | #include <QtGui/QVector3D> |
| 26 | |
| 27 | namespace Qt3DRender { |
| 28 | |
| 29 | namespace Render { |
| 30 | |
| 31 | class Q_3DRENDERSHARED_PRIVATE_EXPORT RayCaster : public BackendNode |
| 32 | { |
| 33 | public: |
| 34 | RayCaster(); |
| 35 | ~RayCaster(); |
| 36 | |
| 37 | QAbstractRayCasterPrivate::RayCasterType type() const; |
| 38 | QAbstractRayCaster::RunMode runMode() const; |
| 39 | QVector3D origin() const; |
| 40 | QVector3D direction() const; |
| 41 | float length() const; |
| 42 | QPoint position() const; |
| 43 | |
| 44 | Qt3DCore::QNodeIdVector layerIds() const; |
| 45 | QAbstractRayCaster::FilterMode filterMode() const; |
| 46 | |
| 47 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override; |
| 48 | void cleanup(); |
| 49 | |
| 50 | private: |
| 51 | void notifyJob(); |
| 52 | |
| 53 | QAbstractRayCasterPrivate::RayCasterType m_type = QAbstractRayCasterPrivate::WorldSpaceRayCaster; |
| 54 | QAbstractRayCaster::RunMode m_runMode = QAbstractRayCaster::SingleShot; |
| 55 | QVector3D m_origin; |
| 56 | QVector3D m_direction = {0.f, 0.f, 1.f}; |
| 57 | float m_length = 1.f; |
| 58 | QPoint m_position; |
| 59 | Qt3DCore::QNodeIdVector m_layerIds; |
| 60 | QAbstractRayCaster::FilterMode m_filterMode = QAbstractRayCaster::AcceptAnyMatchingLayers; |
| 61 | }; |
| 62 | |
| 63 | } // Render |
| 64 | |
| 65 | } // Qt3DRender |
| 66 | |
| 67 | QT_END_NAMESPACE |
| 68 | |
| 69 | #endif // QT3DRENDER_RENDER_RAYCASTER_P_H |
| 70 |
