1// Copyright (C) 2020 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_PICKINGPROXY_H
5#define QT3DRENDER_RENDER_PICKINGPROXY_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 <Qt3DRender/private/backendnode_p.h>
19#include <Qt3DRender/qpickingproxy.h>
20
21QT_BEGIN_NAMESPACE
22
23namespace Qt3DRender {
24namespace Render {
25
26class PickingProxyManager;
27
28class Q_3DRENDERSHARED_PRIVATE_EXPORT PickingProxy : public BackendNode
29{
30public:
31 PickingProxy();
32 ~PickingProxy();
33
34 void cleanup();
35 void setManager(PickingProxyManager *manager);
36 void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
37
38 inline Qt3DCore::QNodeId geometryId() const { return m_geometryId; }
39 inline int instanceCount() const { return m_instanceCount; }
40 inline int vertexCount() const { return m_vertexCount; }
41 inline int indexOffset() const { return m_indexOffset; }
42 inline int firstInstance() const { return m_firstInstance; }
43 inline int firstVertex() const { return m_firstVertex; }
44 inline int indexBufferByteOffset() const { return m_indexBufferByteOffset; }
45 inline int restartIndexValue() const { return m_restartIndexValue; }
46 inline int verticesPerPatch() const { return m_verticesPerPatch; }
47 inline bool primitiveRestartEnabled() const { return m_primitiveRestartEnabled; }
48 inline Qt3DCore::QGeometryView::PrimitiveType primitiveType() const { return m_primitiveType; }
49 inline bool isValid() const { return m_valid; }
50 inline bool isDirty() const { return m_dirty; }
51 void unsetDirty();
52
53private:
54 Qt3DCore::QNodeId m_geometryId;
55 int m_instanceCount;
56 int m_vertexCount;
57 int m_indexOffset;
58 int m_firstInstance;
59 int m_firstVertex;
60 int m_indexBufferByteOffset;
61 int m_restartIndexValue;
62 int m_verticesPerPatch;
63 bool m_primitiveRestartEnabled;
64 bool m_dirty;
65 bool m_valid;
66 Qt3DCore::QGeometryView::PrimitiveType m_primitiveType;
67 PickingProxyManager *m_manager;
68};
69
70class PickingProxyFunctor : public Qt3DCore::QBackendNodeMapper
71{
72public:
73 explicit PickingProxyFunctor(AbstractRenderer *renderer, PickingProxyManager *manager);
74 Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override;
75 Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override;
76 void destroy(Qt3DCore::QNodeId id) const override;
77private:
78 PickingProxyManager *m_manager;
79 AbstractRenderer *m_renderer;
80};
81
82} // namespace Render
83
84} // namespace Qt3DRender
85
86QT_END_NAMESPACE
87
88#endif // QT3DRENDER_RENDER_PICKINGPROXY_H
89

source code of qt3d/src/render/geometry/pickingproxy_p.h