| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | // |
| 5 | // W A R N I N G |
| 6 | // ------------- |
| 7 | // |
| 8 | // This file is not part of the QtDataVisualization API. It exists purely as an |
| 9 | // implementation detail. This header file may change from version to |
| 10 | // version without notice, or even be removed. |
| 11 | // |
| 12 | // We mean it. |
| 13 | |
| 14 | #ifndef SCATTERSERIESRENDERCACHE_P_H |
| 15 | #define SCATTERSERIESRENDERCACHE_P_H |
| 16 | |
| 17 | #include "datavisualizationglobal_p.h" |
| 18 | #include "seriesrendercache_p.h" |
| 19 | #include "qscatter3dseries_p.h" |
| 20 | #include "scatterrenderitem_p.h" |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | class ScatterObjectBufferHelper; |
| 25 | class ScatterPointBufferHelper; |
| 26 | |
| 27 | class ScatterSeriesRenderCache : public SeriesRenderCache |
| 28 | { |
| 29 | public: |
| 30 | ScatterSeriesRenderCache(QAbstract3DSeries *series, Abstract3DRenderer *renderer); |
| 31 | virtual ~ScatterSeriesRenderCache(); |
| 32 | |
| 33 | void cleanup(TextureHelper *texHelper) override; |
| 34 | |
| 35 | inline ScatterRenderItemArray &renderArray() { return m_renderArray; } |
| 36 | inline QScatter3DSeries *series() const { return static_cast<QScatter3DSeries *>(m_series); } |
| 37 | inline void setItemSize(float size) { m_itemSize = size; } |
| 38 | inline float itemSize() const { return m_itemSize; } |
| 39 | inline void setSelectionIndexOffset(int offset) { m_selectionIndexOffset = offset; } |
| 40 | inline int selectionIndexOffset() const { return m_selectionIndexOffset; } |
| 41 | inline void setStaticBufferDirty(bool state) { m_staticBufferDirty = state; } |
| 42 | inline bool staticBufferDirty() const { return m_staticBufferDirty; } |
| 43 | inline int oldArraySize() const { return m_oldRenderArraySize; } |
| 44 | inline void setOldArraySize(int size) { m_oldRenderArraySize = size; } |
| 45 | inline const QString &oldMeshFileName() const { return m_oldMeshFileName; } |
| 46 | inline void setOldMeshFileName(const QString &meshFileName) { m_oldMeshFileName = meshFileName; } |
| 47 | inline void setBufferObject(ScatterObjectBufferHelper *object) { m_scatterBufferObj = object; } |
| 48 | inline ScatterObjectBufferHelper *bufferObject() const { return m_scatterBufferObj; } |
| 49 | inline void setBufferPoints(ScatterPointBufferHelper *object) { m_scatterBufferPoints = object; } |
| 50 | inline ScatterPointBufferHelper *bufferPoints() const { return m_scatterBufferPoints; } |
| 51 | inline QList<int> &updateIndices() { return m_updateIndices; } |
| 52 | inline QList<int> &bufferIndices() { return m_bufferIndices; } |
| 53 | inline void setVisibilityChanged(bool changed) { m_visibilityChanged = changed; } |
| 54 | inline bool visibilityChanged() const { return m_visibilityChanged; } |
| 55 | |
| 56 | protected: |
| 57 | ScatterRenderItemArray m_renderArray; |
| 58 | float m_itemSize; |
| 59 | int m_selectionIndexOffset; // Temporarily cached value for selection color calculations |
| 60 | bool m_staticBufferDirty; |
| 61 | int m_oldRenderArraySize; // Used to detect if full buffer change needed |
| 62 | QString m_oldMeshFileName; // Used to detect if full buffer change needed |
| 63 | ScatterObjectBufferHelper *m_scatterBufferObj; |
| 64 | ScatterPointBufferHelper *m_scatterBufferPoints; |
| 65 | QList<int> m_updateIndices; // Used as temporary cache during item updates |
| 66 | QList<int> m_bufferIndices; // Cache for mapping renderarray to mesh buffer |
| 67 | bool m_visibilityChanged; // Used to detect if full buffer change needed |
| 68 | }; |
| 69 | |
| 70 | QT_END_NAMESPACE |
| 71 | |
| 72 | #endif |
| 73 |
