1// Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
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_TRIANGLESVISITOR_P_H
5#define QT3DRENDER_RENDER_TRIANGLESVISITOR_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 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 <Qt3DCore/qnodeid.h>
19#include <Qt3DRender/private/bufferutils_p.h>
20#include <Qt3DCore/private/vector3d_p.h>
21#include <Qt3DCore/private/vector4d_p.h>
22
23#include <private/qt3drender_global_p.h>
24
25QT_BEGIN_NAMESPACE
26
27namespace Qt3DCore {
28class QEntity;
29}
30
31namespace Qt3DRender {
32
33namespace Render {
34
35class GeometryRenderer;
36class PickingProxy;
37class NodeManagers;
38class Attribute;
39class Buffer;
40
41class Q_AUTOTEST_EXPORT TrianglesVisitor
42{
43public:
44 explicit TrianglesVisitor(NodeManagers *manager) : m_manager(manager) { }
45 virtual ~TrianglesVisitor();
46
47 void apply(const Qt3DCore::QEntity *entity);
48 void apply(const GeometryRenderer *renderer, const Qt3DCore::QNodeId id);
49 void apply(const PickingProxy *proxy, const Qt3DCore::QNodeId id);
50
51 virtual void visit(uint andx, const Vector3D &a,
52 uint bndx, const Vector3D &b,
53 uint cndx, const Vector3D &c) = 0;
54
55protected:
56 NodeManagers *m_manager;
57 Qt3DCore::QNodeId m_nodeId;
58};
59
60class Q_3DRENDERSHARED_PRIVATE_EXPORT CoordinateReader
61{
62public:
63 explicit CoordinateReader(NodeManagers *manager)
64 : m_manager(manager)
65 , m_attribute(nullptr)
66 , m_buffer(nullptr)
67 {
68 }
69
70 bool setGeometry(const GeometryRenderer *renderer, const QString &attributeName);
71
72 Vector4D getCoordinate(uint vertexIndex);
73
74protected:
75 NodeManagers *m_manager;
76 Attribute *m_attribute;
77 Buffer *m_buffer;
78 BufferInfo m_bufferInfo;
79};
80
81} // namespace Render
82
83} // namespace Qt3DRender
84
85QT_END_NAMESPACE
86
87
88#endif // QT3DRENDER_RENDER_TRIANGLESVISITOR_P_H
89

source code of qt3d/src/render/backend/trianglesvisitor_p.h