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_RAYCASTINGJOB_H
5#define QT3DRENDER_RENDER_RAYCASTINGJOB_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 "abstractpickingjob_p.h"
19#include <Qt3DRender/qpickevent.h>
20#include <Qt3DRender/private/handle_types_p.h>
21#include <Qt3DRender/private/qcollisionqueryresult_p.h>
22#include <Qt3DRender/private/qt3drender_global_p.h>
23#include <QMouseEvent>
24#include <QKeyEvent>
25#include <QSharedPointer>
26
27QT_BEGIN_NAMESPACE
28
29namespace Qt3DRender {
30namespace Render {
31
32namespace PickingUtils {
33typedef std::vector<RayCasting::QCollisionQueryResult::Hit> HitList;
34}
35
36class RayCastingJobPrivate;
37
38class Q_3DRENDERSHARED_PRIVATE_EXPORT RayCastingJob : public AbstractPickingJob
39{
40public:
41 RayCastingJob();
42
43 void markCastersDirty();
44 bool runHelper() override;
45
46 QAbstractRayCaster::Hits pick(QAbstractRayCaster *rayCaster);
47 bool pick(const QList<QPair<Entity *, RayCaster *>> &entities);
48
49protected:
50 void dispatchHits(RayCaster *rayCaster, const PickingUtils::HitList &sphereHits);
51
52private:
53 Q_DECLARE_PRIVATE(RayCastingJob)
54
55 bool m_castersDirty;
56 bool m_oneEnabledAtLeast;
57};
58
59typedef QSharedPointer<RayCastingJob> RayCastingJobPtr;
60
61} // namespace Render
62
63} // namespace Qt3DRender
64
65QT_END_NAMESPACE
66
67#endif // QT3DRENDER_RENDER_RAYCASTINGJOB_H
68

source code of qt3d/src/render/jobs/raycastingjob_p.h