Repository navigation
Expand file tree
/
Copy pathglwidget.h
More file actions
executable file
·98 lines (89 loc) · 2.46 KB
/
Copy pathglwidget.h
File metadata and controls
executable file
·98 lines (89 loc) · 2.46 KB
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
#ifndef GLWIDGET_H
#define GLWIDGET_H
// Include standard headers
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
//#include <string>
// Include GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// Qt includes
//#include <QDebug>
#include <QKeyEvent>
#include <QOpenGLDebugLogger>
#include <QOpenGLWidget>
#include <QTime>
#include <QTimer>
// Include GLM
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
// My headers
#include "camera.h"
#include "directionallight.h"
#include "material.h"
#include "mesh.h"
#include "scene.h"
#include "shader.h"
enum meshSurfaceVizualization {
fillSurface,
fillSurface_and_showWireframe,
showWireframe
};
enum Mode { defaultView, segmentsView };
enum ContractionMode { automatic, manual };
class GLWidget : public QOpenGLWidget {
Q_OBJECT
public:
explicit GLWidget(QWidget *parent);
private:
~GLWidget();
void initializeGL() override;
void resizeGL(int w, int h) override;
void paintGL() override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void showMeshSegments_signal();
void segmentSelection_signal(float, float);
void contraction_signal();
void reverseContraction_signal();
void connectivitySurgery_signal();
void refinementEmbedding_signal();
void showMeshVertices_signal();
void segmentDeformation_signal(bool inflation);
void cameraZoomChange_signal(float delta);
void cameraReset_signal();
void initializeShaders();
void cgalSkeletonization_signal();
private:
meshSurfaceVizualization surfaceState{fillSurface};
Shader *defaultShader{nullptr};
Shader *axesShader{nullptr};
Shader *segmentShader{nullptr};
Shader *edgeShader{nullptr};
Shader *activeShader{nullptr};
Scene scene{};
QTimer timer{};
QVector2D lastMousePos{0, 0};
float fov{45};
int WIDTH{800};
int HEIGHT{600};
Mode mode{defaultView};
ContractionMode contractionMode{automatic};
public slots:
void loadModel(std::string filename);
void updateAxesState(bool state);
void updateMeshSurfaceState(int state);
void resetCamera();
void showVerticesStateChange(int state);
void saveModel(std::string);
void saveSegment(std::string);
void updateContractionVolumeThreshold(int newThreshold);
void updateContractionMode(bool newState);
void clearSkeleton();
};
#endif // GLWIDGET_H