-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewer.h
150 lines (114 loc) · 3.1 KB
/
Viewer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#ifndef VIEWER_H
#define VIEWER_H
#include <QGLViewer/qglviewer.h>
#include <QGLBuffer>
#include <QPixmap>
#include "PointCloud.h"
using namespace qglviewer;
class Viewer : public QGLViewer
{
Q_OBJECT
public:
explicit Viewer(QWidget *parent = 0);
bool setPointCloud(const PointCloud& cloud);
bool multisampleAvailable() const;
bool stereoEnabled() const { return m_stereo; }
bool supportsHardwareStereo() const;
QVector<float> m_fov;
enum StereoMode
{
Hardware,
Red_Cyan,
Red_Blue,
Side_by_Side,
Stacked
};
StereoMode stereoMode() const { return m_stereoMode; }
QStringList openGLInfo();
QStringList pointCloudInfo();
signals:
void pointSizeChanged(int pointSize);
void pointDensityChanged(int pointDensity);
void smoothPointsChanged(bool smoothPoints);
void pointColorChanged(bool);
void depthMaskingChanged(bool);
void multisampleChanged(bool);
void fastInteractionChanged(bool);
// Signals for changes in stereo parameters
void IODistanceChanged(double);
void focusDistanceChanged(double);
void physicalScreenWidthChanged(double);
void stereoModeChanged(StereoMode);
void error(QString);
public slots:
void setPointSize(int pointSize);
void setPointDensity(int density);
void setSmoothPoints(bool smoothPoints);
void toggleSmoothPoints();
void setColorPoints(bool value);
void setDepthMasking(bool value);
void setMultisample(bool value);
void setFastInteraction(bool value);
void restoreView();
void setIODistance(double distance);
void setScreenWidth(double width);
void setFocusDistance(double distance);
void setSwapLeftRight(bool swap);
void setStereo(bool stereo = true);
void toggleStereo();
void setStereoMode(StereoMode mode);
void toggleTurntable();
void resetTurntable();
void increaseTurntableSpeed();
void decreaseTurntableSpeed();
void updateSpin();
void toggleLogo();
void savePathMovie();
protected:
void init();
void draw();
void drawRedCyanStereo();
void drawRedBlueStereo();
void drawSideBySideStereo();
void drawStackedStereo();
void drawHardwareStereo();
void postDraw();
void fastDraw();
void paintGL();
void keyPressEvent(QKeyEvent *);
bool bindToVertexBuffer(const QVector<float> &vertices);
bool loadColorsToBuffer(const QVector<float> &colors);
void notifyStereoParametersChanged();
private:
QString speedToString();
// Vertex buffer object for point cloud
QGLBuffer m_vertexBuffer;
QGLBuffer m_colorBuffer;
// Total number of vertices for point cloud
int m_vertexCount;
// Point cloud display options
float m_density;
float m_pointSize;
bool m_smoothPoints;
bool m_colorPoints;
bool m_depthMasking;
bool m_multisample;
bool m_fastInteraction;
int m_fastInteractionMax;
// Swap eyes for stereo
bool m_swapLeftRight;
// Stereo enabled
bool m_stereo;
// Stereo mode
StereoMode m_stereoMode;
// Onscreen logo
QPixmap m_logoPixmap;
GLuint m_logoTextureId;
bool m_showLogo;
// Turntable speed
double m_turntableRPM;
Vec m_turntableUp;
bool m_turntableStarted;
PointCloud m_pointCloud;
};
#endif // VIEWER_H