-
Notifications
You must be signed in to change notification settings - Fork 0
/
BasicGLWidget.h
48 lines (35 loc) · 995 Bytes
/
BasicGLWidget.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
#ifndef MYGLWIDGET_H
#define MYGLWIDGET_H
#include <QGLWidget>
#include <QTime>
class Scene;
class TrackBallCamera;
class Mesh;
class Node;
class BasicGLWidget : public QGLWidget
{
Q_OBJECT
public:
explicit BasicGLWidget(QWidget *parent = 0);
~BasicGLWidget();
Scene* scene() const;
signals:
void meshSelected(Mesh* mesh);
void initialized();
protected:
virtual void initializeGL();
virtual void paintGL();
virtual void resizeGL(int width, int height);
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void wheelEvent(QWheelEvent *e);
Mesh* getNearestMesh(QVector3D const& pos, QVector3D const& direction) const;
private slots:
void updateScene();
private:
Mesh* _getNearestMesh(QVector3D const& pos, QVector3D const& direction, Node* current, float &k) const;
Scene* _scene;
TrackBallCamera* _camera;
QTime _loopTime;
};
#endif // MYGLWIDGET_H