QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt3d_line3d_p.h
1#ifndef QWT3D_LINE3D_P_H
2#define QWT3D_LINE3D_P_H
3
4#include "qwt3d_line3d.h"
5#include "qwt3d_types.h"
6#include "qwt3d_color.h"
7
8#include <QOpenGLBuffer>
9#include <QOpenGLVertexArrayObject>
10#include <QOpenGLShaderProgram>
11#include <QVector3D>
12#include <QVector4D>
13
14#include "qwt_series_data.h"
15#include "qwt_point_3d.h"
16
17#include <cfloat>
18
25{
26 QVector3D position;
27 QVector3D normal;
28 QVector4D color;
29};
30
37{
38 QVector3D position;
39 QVector4D color;
40};
41
42class Qwt3DLine::PrivateData
43{
44 QWT_DECLARE_PUBLIC(Qwt3DLine)
45
46public:
47 explicit PrivateData(Qwt3DLine* q);
48 ~PrivateData();
49
50 // Data
52
53 // Style
55 double m_lineWidth;
56 double m_tubeRadius; // <= 0 means auto
57 int m_tubeSegments;
58 double m_pointSize;
59 bool m_pointVisible;
60 Qwt3DLine::PointShape m_pointShape;
61
62 // Color
63 RGBA m_solidColor;
64 Qwt3DColor* m_dataColor;
65
66 // GL resources (created lazily in draw())
67 bool m_vboDirty;
68 bool m_pointsDirty;
69 bool m_tubeShaderInitialized;
70 QOpenGLBuffer m_vertexBuffer; // tube vertices (Tube style)
71 QOpenGLBuffer m_indexBuffer; // tube side indices (Tube style)
72 QOpenGLVertexArrayObject m_vao; // tube VAO (Tube style)
73 QOpenGLShaderProgram m_tubeShader; // Tube style reuses the surface shader
74
75 // Separate points VBO/VAO for the Dots style and the point-marker overlay
76 QOpenGLBuffer m_pointsBuffer;
77 QOpenGLVertexArrayObject m_pointsVAO;
78
79 // Shape marker VBO/VAO/EBO (used when m_pointShape != Dot)
80 QOpenGLBuffer m_markerVertexBuffer;
81 QOpenGLBuffer m_markerIndexBuffer;
82 QOpenGLVertexArrayObject m_markerVAO;
83 bool m_markersDirty;
84 int m_markerIndexCount;
85
86 // Counts
87 int m_vertexCount; // ring vertices (Tube) or polyline vertices (Lines/Dots)
88 int m_indexCount; // tube side indices (Tube style only)
89 int m_pointCount; // number of polyline sample points
90
91 // Cached hull
92 ParallelEpiped m_hull;
93};
94
95inline Qwt3DLine::PrivateData::PrivateData(Qwt3DLine* q)
96 : q_ptr(q)
97 , m_series(new QwtPoint3DSeriesData())
98 , m_style(Qwt3DLine::Lines)
99 , m_lineWidth(1.0)
100 , m_tubeRadius(-1.0)
101 , m_tubeSegments(8)
102 , m_pointSize(8.0)
103 , m_pointVisible(false)
104 , m_pointShape(Qwt3DLine::Dot)
105 , m_solidColor(RGBA(0.9, 0.9, 0.9, 1.0))
106 , m_dataColor(nullptr)
107 , m_vboDirty(true)
108 , m_pointsDirty(true)
109 , m_tubeShaderInitialized(false)
110 , m_markersDirty(true)
111 , m_vertexCount(0)
112 , m_indexCount(0)
113 , m_pointCount(0)
114 , m_markerIndexCount(0)
115 , m_hull(Triple(0, 0, 0), Triple(0, 0, 0))
116{
117 m_indexBuffer = QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
118 m_markerIndexBuffer = QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
119}
120
121inline Qwt3DLine::PrivateData::~PrivateData()
122{
123 m_vertexBuffer.destroy();
124 m_indexBuffer.destroy();
125 m_vao.destroy();
126 m_pointsBuffer.destroy();
127 m_pointsVAO.destroy();
128 m_markerVertexBuffer.destroy();
129 m_markerIndexBuffer.destroy();
130 m_markerVAO.destroy();
131
132 if (m_series)
133 delete m_series;
134 if (m_dataColor)
135 m_dataColor->destroy();
136}
137
138#endif // QWT3D_LINE3D_P_H
Abstract base class for color functors
Definition qwt3d_color.h:25
3D line/curve plot item with VBO/VAO rendering
Definition qwt3d_line3d.h:47
LineStyle
Line rendering style
Definition qwt3d_line3d.h:53
PointShape
Point marker shape for the Dots style and the point-marker overlay
Definition qwt3d_line3d.h:61
Interface for iterating over an array of 3D points
Definition qwt_series_data.h:249
Abstract interface for iterating over samples
Definition qwt_series_data.h:88
Vertex for the Lines/Dots styles (position + color, 28 bytes)
Definition qwt3d_line3d_p.h:37
Vertex for the Tube style (position + normal + color, 40 bytes)
Definition qwt3d_line3d_p.h:25
Parallelepiped spanned by 2 Triples
Definition qwt3d_types.h:334
Red-Green-Blue-Alpha value
Definition qwt3d_types.h:395
Triple [x,y,z]
Definition qwt3d_types.h:201