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 SERIESRENDERCACHE_P_H
41 #define SERIESRENDERCACHE_P_H
42 
43 #include "datavisualizationglobal_p.h"
44 #include "qabstract3dseries_p.h"
45 
46 QT_BEGIN_NAMESPACE_DATAVISUALIZATION
47 
48 class Abstract3DRenderer;
49 class ObjectHelper;
50 class TextureHelper;
51 
52 class SeriesRenderCache
53 {
54 public:
55     SeriesRenderCache(QAbstract3DSeries *series, Abstract3DRenderer *renderer);
56     virtual ~SeriesRenderCache();
57 
58     virtual void populate(bool newSeries);
59     virtual void cleanup(TextureHelper *texHelper);
60 
61     // NOTE: Series pointer can only be used to access the series when syncing with controller.
62     // It is not guaranteed to be valid while rendering and should only be used as an identifier.
series()63     inline QAbstract3DSeries *series() const { return m_series; }
64 
mesh()65     inline const QAbstract3DSeries::Mesh &mesh() const { return m_mesh; }
meshRotation()66     inline const QQuaternion &meshRotation() const { return m_meshRotation; }
setMeshRotation(const QQuaternion & rotation)67     inline void setMeshRotation(const QQuaternion &rotation) { m_meshRotation = rotation; }
object()68     inline ObjectHelper *object() const { return m_object; }
colorStyle()69     inline const Q3DTheme::ColorStyle &colorStyle() const { return m_colorStyle; }
baseColor()70     inline const QVector4D &baseColor() const { return m_baseColor; }
baseUniformTexture()71     inline const GLuint &baseUniformTexture() const { return m_baseUniformTexture; }
baseGradientTexture()72     inline const GLuint &baseGradientTexture() const { return m_baseGradientTexture; }
gradientImage()73     inline const QImage &gradientImage() const { return m_gradientImage; }
singleHighlightColor()74     inline const QVector4D &singleHighlightColor() const { return m_singleHighlightColor; }
singleHighlightGradientTexture()75     inline const GLuint &singleHighlightGradientTexture() const { return m_singleHighlightGradientTexture; }
multiHighlightColor()76     inline const QVector4D &multiHighlightColor() const { return m_multiHighlightColor; }
multiHighlightGradientTexture()77     inline const GLuint &multiHighlightGradientTexture() const { return m_multiHighlightGradientTexture; }
name()78     inline const QString &name() const { return m_name; }
itemLabel()79     inline const QString &itemLabel() const { return m_itemLabel; }
setValid(bool valid)80     inline void setValid(bool valid) { m_valid = valid; }
isValid()81     inline bool isValid() const { return m_valid; }
isVisible()82     inline bool isVisible() const { return m_visible; }
setDataDirty(bool state)83     inline void setDataDirty(bool state) { m_objectDirty = state; }
dataDirty()84     inline bool dataDirty() const { return m_objectDirty; }
setStaticObjectUVDirty(bool state)85     inline void setStaticObjectUVDirty(bool state) { m_staticObjectUVDirty = state; }
staticObjectUVDirty()86     inline bool staticObjectUVDirty() { return m_staticObjectUVDirty; }
87 
88 protected:
89     QAbstract3DSeries *m_series;
90     ObjectHelper *m_object; // Shared reference
91     QAbstract3DSeries::Mesh m_mesh;
92     QQuaternion m_meshRotation;
93 
94     Q3DTheme::ColorStyle m_colorStyle;
95     QVector4D m_baseColor;
96     GLuint m_baseUniformTexture;
97     GLuint m_baseGradientTexture;
98     QImage m_gradientImage;
99     QVector4D m_singleHighlightColor;
100     GLuint m_singleHighlightGradientTexture;
101     QVector4D m_multiHighlightColor;
102     GLuint m_multiHighlightGradientTexture;
103 
104     QString m_name;
105     QString m_itemLabel;
106     bool m_valid;
107     bool m_visible;
108     Abstract3DRenderer *m_renderer;
109     bool m_objectDirty;
110     bool m_staticObjectUVDirty;
111 };
112 
113 QT_END_NAMESPACE_DATAVISUALIZATION
114 
115 #endif
116 
117