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_QABSTRACTRAYCASTER_P_H
5#define QT3DRENDER_QABSTRACTRAYCASTER_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 <Qt3DCore/private/qcomponent_p.h>
19#include <Qt3DCore/qnodeid.h>
20#include <Qt3DRender/QAbstractRayCaster>
21#include <Qt3DRender/private/qt3drender_global_p.h>
22
23#include <QtGui/QVector3D>
24
25QT_BEGIN_NAMESPACE
26
27namespace Qt3DRender {
28
29class QLayer;
30
31/*!
32 \internal
33*/
34class Q_3DRENDERSHARED_PRIVATE_EXPORT QAbstractRayCasterPrivate : public Qt3DCore::QComponentPrivate
35{
36public:
37 QAbstractRayCasterPrivate();
38
39 enum RayCasterType {
40 WorldSpaceRayCaster,
41 ScreenScapeRayCaster
42 };
43
44 static QAbstractRayCasterPrivate *get(QAbstractRayCaster *obj);
45 static const QAbstractRayCasterPrivate *get(const QAbstractRayCaster *obj);
46 static void updateHitEntites(QAbstractRayCaster::Hits &hits, Qt3DCore::QScene *scene);
47
48 RayCasterType m_rayCasterType = WorldSpaceRayCaster;
49 QAbstractRayCaster::RunMode m_runMode = QAbstractRayCaster::SingleShot;
50 QAbstractRayCaster::Hits m_hits;
51 QPoint m_position;
52 QVector3D m_origin;
53 QVector3D m_direction = QVector3D(0., 0., 1.f);
54 float m_length = 1.f;
55 QAbstractRayCaster::FilterMode m_filterMode = QAbstractRayCaster::AcceptAnyMatchingLayers;
56 QList<QLayer *> m_layers;
57
58 QAbstractRayCaster::Hits pick();
59 virtual void dispatchHits(const QAbstractRayCaster::Hits &hits);
60
61 Q_DECLARE_PUBLIC(QAbstractRayCaster)
62};
63
64} // namespace Qt3DRender
65
66QT_END_NAMESPACE
67
68#endif // QT3DRENDER_QABSTRACTRAYCASTER_P_H
69

source code of qt3d/src/render/picking/qabstractraycaster_p.h