1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSGRENDERPICKRESULT_H
5#define QSSGRENDERPICKRESULT_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 <QtQuick3DRuntimeRender/private/qssgrenderableobjects_p.h>
19#include <limits>
20
21QT_BEGIN_NAMESPACE
22
23struct QSSGRenderPickResult
24{
25 const QSSGRenderGraphObject *m_hitObject = nullptr;
26 float m_distanceSq = std::numeric_limits<float>::max();
27 // The local coordinates in X,Y UV space where the hit occurred
28 QVector2D m_localUVCoords;
29 // The position in world coordinates
30 QVector3D m_scenePosition;
31 // The position in local coordinates
32 QVector3D m_localPosition;
33 // The normal of the hit face
34 QVector3D m_faceNormal;
35 // The subset index
36 int m_subset = 0;
37 int m_instanceIndex = -1;
38};
39
40Q_STATIC_ASSERT(std::is_trivially_destructible<QSSGRenderPickResult>::value);
41
42struct QSSGPickResultProcessResult : public QSSGRenderPickResult
43{
44 QSSGPickResultProcessResult(const QSSGRenderPickResult &inSrc) : QSSGRenderPickResult(inSrc) {}
45 QSSGPickResultProcessResult(const QSSGRenderPickResult &inSrc, bool consumed) : QSSGRenderPickResult(inSrc), m_wasPickConsumed(consumed) {}
46 QSSGPickResultProcessResult() = default;
47 bool m_wasPickConsumed = false;
48};
49
50QT_END_NAMESPACE
51
52#endif // QSSGRENDERPICKRESULT_H
53

source code of qtquick3d/src/runtimerender/qssgrenderpickresult_p.h