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 QT3DCORE_QGEOMETRYVIEW_P_H
5#define QT3DCORE_QGEOMETRYVIEW_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/private/qnode_p.h>
19#include <Qt3DCore/qgeometryview.h>
20#include <Qt3DCore/private/qgeometryfactory_p.h>
21#include <Qt3DCore/private/qt3dcore_global_p.h>
22
23#include <QtGui/qvector3d.h>
24#include <memory>
25
26QT_BEGIN_NAMESPACE
27
28namespace Qt3DCore {
29
30class Q_3DCORESHARED_EXPORT QGeometryViewPrivate : public Qt3DCore::QNodePrivate
31{
32public:
33 QGeometryViewPrivate();
34 ~QGeometryViewPrivate();
35
36 static QGeometryViewPrivate *get(QGeometryView *q);
37
38 void update() override;
39
40 Q_DECLARE_PUBLIC(QGeometryView)
41
42 int m_instanceCount;
43 int m_vertexCount;
44 int m_indexOffset;
45 int m_firstInstance;
46 int m_firstVertex;
47 int m_indexBufferByteOffset;
48 int m_restartIndexValue;
49 int m_verticesPerPatch;
50 bool m_primitiveRestart;
51 QGeometry *m_geometry;
52 QGeometryView::PrimitiveType m_primitiveType;
53 bool m_dirty;
54};
55
56class BoundingVolumeCalculator
57{
58public:
59 BoundingVolumeCalculator() = default;
60
61 const QVector3D min() const { return m_min; }
62 const QVector3D max() const { return m_max; }
63 const QVector3D center() const { return m_center; }
64 float radius() const { return m_radius; }
65 bool isValid() const { return m_radius >= 0.f; }
66
67 bool apply(QAttribute *positionAttribute,
68 QAttribute *indexAttribute,
69 int drawVertexCount,
70 bool primitiveRestartEnabled,
71 int primitiveRestartIndex);
72
73private:
74 QVector3D m_min;
75 QVector3D m_max;
76 QVector3D m_center;
77 float m_radius = -1.f;
78};
79
80} // namespace Qt3DCore
81
82QT_END_NAMESPACE
83
84
85#endif // QT3DCORE_QGEOMETRYVIEW_P_H
86
87

source code of qt3d/src/core/geometry/qgeometryview_p.h