-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyGLWidget.h
77 lines (61 loc) · 1.83 KB
/
MyGLWidget.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
#ifndef MYGLWIDGET_H
#define MYGLWIDGET_H
//Qt
#include <QOpenGLWidget>
#include <QKeyEvent>
#include <QOpenGLExtraFunctions>
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLFunctions_4_5_Core>
#include <QOpenGLShaderProgram>
//Custom
#include <DataProcessing.h>
#include "Camera.h"
enum DataType
{
PointType,
MeshType,
};
class MyGLWidget:public QOpenGLWidget, protected QOpenGLFunctions_4_5_Core {
Q_OBJECT
public:
MyGLWidget(QWidget* parent, int DT);
~MyGLWidget();
void setImageData(std::vector<GLfloat> data);
void setAdaptivePara(QVector3D center, float radius);
void setMesh(pcl::PolygonMesh mesh);
DataProcessing* glDataProc;
bool isMouseBrush;
float grayValue;
public slots:
void updateCursor();
protected:
void initializeGL() override;
void paintGL() override;
void resizeGL(int w, int h) override;
void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
void mouseMoveEvent(QMouseEvent* event) override;
void wheelEvent(QWheelEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
void keyReleaseEvent(QKeyEvent* event) override;
void convScreen2World(QPoint point, GLdouble& wx, GLdouble& wy, GLdouble& wz);
private:
pcl::PolygonMesh mesh;
QOpenGLShaderProgram* pShader, * mShader;
QMatrix4x4 model, proj;
Camera* camera;
std::vector<GLfloat> vertices;
int dataType;
GLuint pVAO, pVBO, mVAO, mVBO;
bool isShiftPressed;
float brushParam, brushSize, rotationAngle;
QPoint pressPosition, lastMousePos;
QVector3D brushPosition;
// lr
bool isPolyClipped = false;
bool isBoxClipped = false;
bool idSliceClipped = false;
QVector<QPoint> m_points;//
};
#endif