QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt3d_plot_p.h
1#ifndef QWT3D_PLOT_P_H
2#define QWT3D_PLOT_P_H
3
4#include "qwt3d_plot.h"
5#include "qwt3d_portability.h"
6
7#include <QPoint>
8#include <QMatrix4x4>
9#include <QList>
10#include <QOpenGLShaderProgram>
11#include <memory>
12
13
14class Qwt3DPlotItem;
15
16class Qwt3DPlot::PrivateData
17{
18 QWT_DECLARE_PUBLIC(Qwt3DPlot)
19
20public:
21 PrivateData(Qwt3DPlot* q);
22
23 struct Light
24 {
25 Light()
26 : unlit(true)
27 , ambient(0.3, 0.3, 0.3, 1.0)
28 , diffuse(1.0, 1.0, 1.0, 1.0)
29 , specular(1.0, 1.0, 1.0, 1.0)
30 {
31 }
32
33 bool unlit;
34 Triple rot;
35 Triple shift;
36
37 // RGBA components (GL_AMBIENT / GL_DIFFUSE / GL_SPECULAR), uploaded to
38 // the surface shader uniforms
39 RGBA ambient;
40 RGBA diffuse;
41 RGBA specular;
42 };
43
44 struct Material
45 {
46 Material()
47 : ambient(1.0, 1.0, 1.0, 1.0)
48 , diffuse(1.0, 1.0, 1.0, 1.0)
49 , specular(0.5, 0.5, 0.5, 1.0)
50 , shininess(32.0)
51 {
52 }
53
54 // the defaults reproduce the hardcoded parameters of the shader
55 RGBA ambient;
56 RGBA diffuse;
57 RGBA specular;
58 double shininess;
59 };
60
61 Qwt3DCoordinateSystem m_coordinates;
62
63 std::vector< Light > m_lights;
64 Material m_material;
65
66 double m_xRot, m_yRot, m_zRot;
67 double m_xShift, m_yShift, m_zShift;
68 double m_zoom;
69 double m_xScale, m_yScale, m_zScale;
70 double m_xVPShift, m_yVPShift;
71
72 RGBA m_bgColor;
73 bool m_ortho;
74 ASPECTRATIOMODE m_aspectRatioMode = AUTOFILL;
75
76 bool m_displayLegend;
77
78 ParallelEpiped m_hull;
79
80 Qwt3DColorLegend m_legend;
81
82 Qwt3DLabel m_title;
83 Tuple m_titleRel;
84 ANCHOR m_titleAnchor;
85
86 QPoint m_lastMouseMovePosition;
87 bool m_pressed;
88
89 Qwt3DMouseState m_xrotMState, m_yrotMState, m_zrotMState;
90 Qwt3DMouseState m_xscaleMState, m_yscaleMState, m_zscaleMState;
91 Qwt3DMouseState m_zoomMState;
92 Qwt3DMouseState m_xshiftMState, m_yshiftMState;
93 Qwt3DMouseState m_rollMState;
94
95 // Mouse drag speeds: turns per widget dimension (rotation), exponential gain
96 // (scaling) and world units per widget dimension (shifting)
97 double m_mouseRotSpeed, m_mouseScaleSpeed, m_mouseShiftSpeed;
98
99 bool m_mouseInputEnabled;
100
101 Qwt3DKeyboardState m_xrotKState[ 2 ], m_yrotKState[ 2 ], m_zrotKState[ 2 ];
102 Qwt3DKeyboardState m_xscaleKState[ 2 ], m_yscaleKState[ 2 ], m_zscaleKState[ 2 ];
103 Qwt3DKeyboardState m_zoomKState[ 2 ];
104 Qwt3DKeyboardState m_xshiftKState[ 2 ], m_yshiftKState[ 2 ];
105
106 bool m_kPressed;
107 bool m_kbdInputEnabled;
108 double m_kbdRotSpeed, m_kbdScaleSpeed, m_kbdShiftSpeed;
109
110 bool m_lightingEnabled;
111
112 // set in paintGL(): true while the scene is replayed for the gl2ps
113 // vector capture (GL render mode GL_FEEDBACK)
114 bool m_vectorExport;
115 bool m_initializedGL;
116 bool m_renderPixmapRequest;
117
118 Qwt3DTheme m_theme;
119
120 // CPU-side transformation matrices
121 QMatrix4x4 m_modelView;
122 QMatrix4x4 m_projection;
123
124 // Viewport dimensions
125 int m_viewportWidth = 0;
126 int m_viewportHeight = 0;
127
128 // Shared generic shaders
129 std::unique_ptr< QOpenGLShaderProgram > m_lineShader;
130 std::unique_ptr< QOpenGLShaderProgram > m_pointShader;
131 std::unique_ptr< QOpenGLShaderProgram > m_polygonShader;
132 std::unique_ptr< QOpenGLShaderProgram > m_textShader;
133
134 // Attached items list (sorted by z-order)
136};
137
138
139#endif // QWT3D_PLOT_P_H
Definition qwt_raster_data.h:38
A flat color legend
Definition qwt3d_colorlegend.h:19
A coordinate system with different styles (BOX, FRAME)
Definition qwt3d_coordsys.h:13
Creates a (key-button, modifier) pair
Definition qwt3d_portability.h:52
A Qt string or an output device dependent string
Definition qwt3d_label.h:21
Creates a (mouse-button, modifier) pair
Definition qwt3d_portability.h:21
Base class for all 3D plot items
Definition qwt3d_plotitem.h:55
Pure rendering window for 3D plots
Definition qwt3d_plot.h:36
Complete visual theme descriptor for Qwt3DPlot widgets.
Definition qwt3d_theme.h:34
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
Tuple [x,y]
Definition qwt3d_types.h:182