QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
qwt3d_surface_p.h
1#ifndef QWT3D_SURFACE_P_H
2#define QWT3D_SURFACE_P_H
3
4#include "qwt3d_surface.h"
5#include "qwt3d_types.h"
6
7#include <QOpenGLBuffer>
8#include <QOpenGLVertexArrayObject>
9#include <QOpenGLShaderProgram>
10#include <QVector3D>
11#include <QVector4D>
12#include <QMatrix3x3>
13
14#include <list>
15#include <cfloat>
16
24{
25 QVector3D position;
26 QVector3D normal;
27 QVector4D color;
28};
29
30class Qwt3DSurface::PrivateData
31{
32 QWT_DECLARE_PUBLIC(Qwt3DSurface)
33
34public:
35 explicit PrivateData(Qwt3DSurface* q);
36 ~PrivateData();
37
38 // Data storage
39 Qwt3DGridData* m_actualDataG;
40 Qwt3DCellData* m_actualDataC;
41
42 // Normals display
43 bool m_dataNormals;
44 double m_normalLength;
45 int m_normalQuality;
46
47 // Resolution (index buffer stepping)
48 int m_resolution;
49
50 // Floor projection style
51 FLOORSTYLE m_floorStyle;
52
53 // Plot style and color
54 PLOTSTYLE m_plotStyle;
55 SHADINGSTYLE m_shading;
56 Qwt3DColor* m_dataColor;
57 RGBA m_meshColor;
58 double m_meshLineWidth;
59 int m_isolines;
60 bool m_smoothDataMesh;
61 double m_polygonOffset;
62
63 // Enrichments
64 std::list<Qwt3DEnrichment*> m_enrichmentList;
65
66 // GL resources (created lazily in draw())
67 bool m_vboDirty;
68 bool m_shaderInitialized;
69 QOpenGLBuffer m_vertexBuffer;
70 QOpenGLBuffer m_indexBuffer;
71 QOpenGLVertexArrayObject m_vao;
72 QOpenGLShaderProgram m_shader;
73
74 // Index counts (tri indices first, then line indices in the same EBO)
75 int m_triIndexCount;
76 int m_lineIndexCount;
77 int m_vertexCount;
78
79 // Cached hull
80 ParallelEpiped m_hull;
81};
82
83inline Qwt3DSurface::PrivateData::PrivateData(Qwt3DSurface* q)
84 : q_ptr(q)
85 , m_actualDataG(nullptr)
86 , m_actualDataC(nullptr)
87 , m_dataNormals(false)
88 , m_normalLength(0.02)
89 , m_normalQuality(3)
90 , m_resolution(1)
91 , m_floorStyle(NOFLOOR)
92 , m_plotStyle(FILLEDMESH)
93 , m_shading(GOURAUD)
94 , m_dataColor(nullptr)
95 , m_meshColor(RGBA(0.0, 0.0, 0.0, 1.0))
96 , m_meshLineWidth(1.0)
97 , m_isolines(0)
98 , m_smoothDataMesh(false)
99 , m_polygonOffset(0.5)
100 , m_vboDirty(true)
101 , m_shaderInitialized(false)
102 , m_triIndexCount(0)
103 , m_lineIndexCount(0)
104 , m_vertexCount(0)
105 , m_hull(Triple(0, 0, 0), Triple(0, 0, 0))
106{
107 m_actualDataG = new Qwt3DGridData();
108 m_actualDataC = new Qwt3DCellData();
109
110 // QOpenGLBuffer with default target GL_ARRAY_BUFFER
111 m_indexBuffer = QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
112}
113
114inline Qwt3DSurface::PrivateData::~PrivateData()
115{
116 // Destroy GL resources (safe to call even without current context)
117 m_vertexBuffer.destroy();
118 m_indexBuffer.destroy();
119 m_vao.destroy();
120
121 // Clean up data
122 delete m_actualDataG;
123 delete m_actualDataC;
124
125 // Clean up color functor
126 if (m_dataColor) {
127 m_dataColor->destroy();
128 }
129
130 // Clean up enrichments
131 for (auto* e : m_enrichmentList)
132 delete e;
133 m_enrichmentList.clear();
134}
135
136#endif // QWT3D_SURFACE_P_H
Implements a graph-like cell structure with limit access functions.
Definition qwt3d_types.h:481
Abstract base class for color functors.
Definition qwt3d_color.h:25
Implements a matrix of z-Values with limit access functions.
Definition qwt3d_types.h:448
3D surface plot item with VBO/VAO rendering
Definition qwt3d_surface.h:37
Parallelepiped spanned by 2 Triples.
Definition qwt3d_types.h:334
Red-Green-Blue-Alpha value.
Definition qwt3d_types.h:395
Vertex structure for VBO upload.
Definition qwt3d_surface_p.h:24
Triple [x,y,z].
Definition qwt3d_types.h:201