1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DPICKRESULT_P_H
5#define QQUICK3DPICKRESULT_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 purely as an
12// implementation detail. 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 <QtQuick3D/qquick3dobject.h>
19#include <QObject>
20#include <QtGui/QVector2D>
21#include <QtGui/QVector3D>
22#include "qquick3dmodel_p.h"
23#include "qquick3dcamera_p.h"
24
25QT_BEGIN_NAMESPACE
26class QQuick3DModel;
27
28class Q_QUICK3D_EXPORT QQuick3DPickResult
29{
30 Q_GADGET
31 Q_PROPERTY(QQuick3DModel* objectHit READ objectHit CONSTANT)
32 Q_PROPERTY(float distance READ distance CONSTANT)
33 Q_PROPERTY(QVector2D uvPosition READ uvPosition CONSTANT)
34 Q_PROPERTY(QVector3D scenePosition READ scenePosition CONSTANT)
35 Q_PROPERTY(QVector3D position READ position CONSTANT)
36 Q_PROPERTY(QVector3D normal READ normal CONSTANT)
37 Q_PROPERTY(QVector3D sceneNormal READ sceneNormal CONSTANT)
38 Q_PROPERTY(int instanceIndex READ instanceIndex CONSTANT)
39
40public:
41
42 QQuick3DPickResult();
43 explicit QQuick3DPickResult(QQuick3DModel *hitObject,
44 float distanceFromCamera,
45 const QVector2D &uvPosition,
46 const QVector3D &scenePosition,
47 const QVector3D &position,
48 const QVector3D &normal,
49 int instanceIndex);
50 QQuick3DModel *objectHit() const;
51 float distance() const;
52 QVector2D uvPosition() const;
53 QVector3D scenePosition() const;
54 QVector3D position() const;
55 QVector3D normal() const;
56 QVector3D sceneNormal() const;
57 int instanceIndex() const;
58
59private:
60 QQuick3DModel *m_objectHit;
61 float m_distance;
62 QVector2D m_uvPosition;
63 QVector3D m_scenePosition;
64 QVector3D m_position;
65 QVector3D m_normal;
66 int m_instanceIndex;
67};
68
69QT_END_NAMESPACE
70
71Q_DECLARE_METATYPE(QQuick3DPickResult)
72
73#endif // QQUICK3DPICKRESULT_P_H
74

source code of qtquick3d/src/quick3d/qquick3dpickresult_p.h