forked from PeterS242/YARRH
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglwidget.h
56 lines (51 loc) · 1.2 KB
/
glwidget.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
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
#include <QtOpenGL>
#include <QDebug>
#include <math.h>
#include "gcodeobject.h"
//widget for 3d wiev of Gcode
class GlWidget : public QGLWidget
{
Q_OBJECT
public:
GlWidget(QWidget *parent = 0);
~GlWidget();
QSize minimumSizeHint() const;
QSize sizeHint() const;
void addObject(GCodeObject* object);
void clearObjects();
void setLayers(int layers);
void setTableSize(int x, int y);
public slots:
void showTravel(bool show);
void setCurrentLayer(int layer);
protected:
void initializeGL();
void paintGL();
void resizeGL(int width, int height);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent * event);
private:
GLfloat eyeX,eyeY,eyeZ;
GLfloat upX,upY,upZ;
GLfloat theta,phi;
GLfloat r;
int sizeX, sizeY;
float xMove;
float yMove;
float zoom;
int layers;
int currentLayer;
bool show_travel;
QPoint lastPos;
QColor qtGreen;
QColor qtPurple;
void drawAxis();
void drawGrid();
QList<GCodeObject*> objects;
QPointF screenToWorld(int x, int y);
};
#endif // GLWIDGET_H