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 SURFACESERIESRENDERCACHE_P_H
15#define SURFACESERIESRENDERCACHE_P_H
16
17#include "datavisualizationglobal_p.h"
18#include "seriesrendercache_p.h"
19#include "qsurface3dseries_p.h"
20#include "surfaceobject_p.h"
21#include "selectionpointer_p.h"
22
23#include <QtGui/QMatrix4x4>
24
25QT_BEGIN_NAMESPACE
26
27class Surface3DRenderer;
28
29class SurfaceSeriesRenderCache : public SeriesRenderCache
30{
31public:
32 SurfaceSeriesRenderCache(QAbstract3DSeries *series, Surface3DRenderer *renderer);
33 virtual ~SurfaceSeriesRenderCache();
34
35 void populate(bool newSeries) override;
36 void cleanup(TextureHelper *texHelper) override;
37
38 inline bool surfaceVisible() const { return m_surfaceVisible; }
39 inline bool surfaceGridVisible() const { return m_surfaceGridVisible; }
40 inline bool isFlatShadingEnabled() const { return m_surfaceFlatShading; }
41 inline void setFlatShadingEnabled(bool enabled) { m_surfaceFlatShading = enabled; }
42 inline void setFlatChangeAllowed(bool allowed) { m_flatChangeAllowed = allowed; }
43 inline SurfaceObject *surfaceObject() { return m_surfaceObj; }
44 inline SurfaceObject *sliceSurfaceObject() { return m_sliceSurfaceObj; }
45 inline const QRect &sampleSpace() const { return m_sampleSpace; }
46 inline void setSampleSpace(const QRect &sampleSpace) { m_sampleSpace = sampleSpace; }
47 inline QSurface3DSeries *series() const { return static_cast<QSurface3DSeries *>(m_series); }
48 inline QSurfaceDataArray &dataArray() { return m_dataArray; }
49 inline QSurfaceDataArray &sliceDataArray() { return m_sliceDataArray; }
50 inline bool renderable() const { return m_visible && (m_surfaceVisible ||
51 m_surfaceGridVisible); }
52 inline void setSelectionTexture(GLuint texture) { m_selectionTexture = texture; }
53 inline GLuint selectionTexture() const { return m_selectionTexture; }
54 inline void setSelectionIdRange(uint start, uint end) { m_selectionIdStart = start;
55 m_selectionIdEnd = end; }
56 inline uint selectionIdStart() const { return m_selectionIdStart; }
57 inline bool isWithinIdRange(uint selection) const { return selection >= m_selectionIdStart &&
58 selection <= m_selectionIdEnd; }
59 inline bool isFlatStatusDirty() const { return m_flatStatusDirty; }
60 inline void setFlatStatusDirty(bool status) { m_flatStatusDirty = status; }
61 inline void setMVPMatrix(const QMatrix4x4 &matrix) { m_MVPMatrix = matrix; }
62 inline const QMatrix4x4 &MVPMatrix() { return m_MVPMatrix; }
63
64 inline void setSliceSelectionPointer(SelectionPointer *pointer) { m_sliceSelectionPointer = pointer; }
65 inline SelectionPointer *sliceSelectionPointer() const { return m_sliceSelectionPointer; }
66 inline void setMainSelectionPointer(SelectionPointer *pointer) { m_mainSelectionPointer = pointer; }
67 inline SelectionPointer *mainSelectionPointer() const { return m_mainSelectionPointer; }
68
69 inline void setSlicePointerActivity(bool activity) { m_slicePointerActive = activity; }
70 inline bool slicePointerActive() const { return m_slicePointerActive; }
71 inline void setMainPointerActivity(bool activity) { m_mainPointerActive = activity; }
72 inline bool mainPointerActive() const { return m_mainPointerActive; }
73 inline void setSurfaceTexture(GLuint texture) { m_surfaceTexture = texture; }
74 inline GLuint surfaceTexture() const { return m_surfaceTexture; }
75
76protected:
77 bool m_surfaceVisible;
78 bool m_surfaceGridVisible;
79 bool m_surfaceFlatShading;
80 SurfaceObject *m_surfaceObj;
81 SurfaceObject *m_sliceSurfaceObj;
82 QRect m_sampleSpace;
83 QSurfaceDataArray m_dataArray;
84 QSurfaceDataArray m_sliceDataArray;
85 GLuint m_selectionTexture;
86 uint m_selectionIdStart;
87 uint m_selectionIdEnd;
88 bool m_flatChangeAllowed;
89 bool m_flatStatusDirty;
90 QMatrix4x4 m_MVPMatrix;
91 SelectionPointer *m_sliceSelectionPointer;
92 SelectionPointer *m_mainSelectionPointer;
93 bool m_slicePointerActive;
94 bool m_mainPointerActive;
95 GLuint m_surfaceTexture;
96};
97
98QT_END_NAMESPACE
99
100#endif
101

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