-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenglpicture.h
57 lines (39 loc) · 1.2 KB
/
openglpicture.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
#ifndef OPENGLPICTURE_H
#define OPENGLPICTURE_H
#include "geometryengine.h"
#include <QOpenGLWidget>
#include <QBasicTimer>
#include <QColor>
#include <memory>
class OpenGLPicture : public QOpenGLWidget, protected QOpenGLFunctions {
Q_OBJECT
public:
OpenGLPicture(bool isAnimate = false,
double chosenTime = 0.0,
QWidget *parent = nullptr);
~OpenGLPicture() override;
int getPeriodSize() const;
public slots:
void setChosenTime(int t);
void setColor(const QColor &);
void setRotationAxis(const QString &);
void setAnimated(bool value = true);
protected:
void timerEvent(QTimerEvent *e) override;
void initializeGL() override;
void paintGL() override;
void resizeGL(int w, int h) override;
void initShaders();
private:
QBasicTimer timer;
QOpenGLShaderProgram program;
std::unique_ptr<GeometryEngine> geometries;
QMatrix4x4 projection;
QVector3D rotationAxis = {1.0, 1.0, 1.0};
QColor color = QColor::fromRgb(100.0, 200.0, 100.0);
int periodSize = 100;
double curTime = 0.;
bool isAnimated = true;
double chosenTime = 0.0;
};
#endif /** OPENGLPICTURE_H */