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_QRAYCASTER_H
5#define QT3DRENDER_QRAYCASTER_H
6
7#include <Qt3DRender/qt3drender_global.h>
8#include <Qt3DRender/QAbstractRayCaster>
9
10#include <QtGui/QVector3D>
11
12QT_BEGIN_NAMESPACE
13
14namespace Qt3DRender {
15
16class Q_3DRENDERSHARED_EXPORT QRayCaster : public QAbstractRayCaster
17{
18 Q_OBJECT
19 Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
20 Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
21 Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
22
23public:
24 explicit QRayCaster(QNode *parent = nullptr);
25 ~QRayCaster();
26
27 QVector3D origin() const;
28 QVector3D direction() const;
29 float length() const;
30
31public Q_SLOTS:
32 void setOrigin(const QVector3D& origin);
33 void setDirection(const QVector3D& direction);
34 void setLength(float length);
35
36 void trigger();
37 void trigger(const QVector3D& origin, const QVector3D& direction, float length);
38
39 Hits pick(const QVector3D& origin, const QVector3D& direction, float length);
40
41Q_SIGNALS:
42 void originChanged(const QVector3D &origin);
43 void directionChanged(const QVector3D &direction);
44 void lengthChanged(float length);
45
46protected:
47 explicit QRayCaster(QAbstractRayCasterPrivate &dd, QNode *parent = nullptr);
48};
49
50} // Qt3D
51
52QT_END_NAMESPACE
53
54#endif // QT3DRENDER_QRAYCASTER_H
55

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