1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30//
31// W A R N I N G
32// -------------
33//
34// This file is not part of the QtDataVisualization API. It exists purely as an
35// implementation detail. This header file may change from version to
36// version without notice, or even be removed.
37//
38// We mean it.
39
40#ifndef SCATTERSERIESRENDERCACHE_P_H
41#define SCATTERSERIESRENDERCACHE_P_H
42
43#include "datavisualizationglobal_p.h"
44#include "seriesrendercache_p.h"
45#include "qscatter3dseries_p.h"
46#include "scatterrenderitem_p.h"
47
48QT_BEGIN_NAMESPACE_DATAVISUALIZATION
49
50class ScatterObjectBufferHelper;
51class ScatterPointBufferHelper;
52
53class ScatterSeriesRenderCache : public SeriesRenderCache
54{
55public:
56 ScatterSeriesRenderCache(QAbstract3DSeries *series, Abstract3DRenderer *renderer);
57 virtual ~ScatterSeriesRenderCache();
58
59 void cleanup(TextureHelper *texHelper);
60
61 inline ScatterRenderItemArray &renderArray() { return m_renderArray; }
62 inline QScatter3DSeries *series() const { return static_cast<QScatter3DSeries *>(m_series); }
63 inline void setItemSize(float size) { m_itemSize = size; }
64 inline float itemSize() const { return m_itemSize; }
65 inline void setSelectionIndexOffset(int offset) { m_selectionIndexOffset = offset; }
66 inline int selectionIndexOffset() const { return m_selectionIndexOffset; }
67 inline void setStaticBufferDirty(bool state) { m_staticBufferDirty = state; }
68 inline bool staticBufferDirty() const { return m_staticBufferDirty; }
69 inline int oldArraySize() const { return m_oldRenderArraySize; }
70 inline void setOldArraySize(int size) { m_oldRenderArraySize = size; }
71 inline const QString &oldMeshFileName() const { return m_oldMeshFileName; }
72 inline void setOldMeshFileName(const QString &meshFileName) { m_oldMeshFileName = meshFileName; }
73 inline void setBufferObject(ScatterObjectBufferHelper *object) { m_scatterBufferObj = object; }
74 inline ScatterObjectBufferHelper *bufferObject() const { return m_scatterBufferObj; }
75 inline void setBufferPoints(ScatterPointBufferHelper *object) { m_scatterBufferPoints = object; }
76 inline ScatterPointBufferHelper *bufferPoints() const { return m_scatterBufferPoints; }
77 inline QVector<int> &updateIndices() { return m_updateIndices; }
78 inline QVector<int> &bufferIndices() { return m_bufferIndices; }
79 inline void setVisibilityChanged(bool changed) { m_visibilityChanged = changed; }
80 inline bool visibilityChanged() const { return m_visibilityChanged; }
81
82protected:
83 ScatterRenderItemArray m_renderArray;
84 float m_itemSize;
85 int m_selectionIndexOffset; // Temporarily cached value for selection color calculations
86 bool m_staticBufferDirty;
87 int m_oldRenderArraySize; // Used to detect if full buffer change needed
88 QString m_oldMeshFileName; // Used to detect if full buffer change needed
89 ScatterObjectBufferHelper *m_scatterBufferObj;
90 ScatterPointBufferHelper *m_scatterBufferPoints;
91 QVector<int> m_updateIndices; // Used as temporary cache during item updates
92 QVector<int> m_bufferIndices; // Cache for mapping renderarray to mesh buffer
93 bool m_visibilityChanged; // Used to detect if full buffer change needed
94};
95
96QT_END_NAMESPACE_DATAVISUALIZATION
97
98#endif
99

source code of qtdatavis3d/src/datavisualization/engine/scatterseriesrendercache_p.h