-
Notifications
You must be signed in to change notification settings - Fork 12
/
osgwidget.h
84 lines (62 loc) · 1.65 KB
/
osgwidget.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
78
79
80
81
82
83
84
#ifndef MEEN_570_OSGWIDGET
#define MEEN_570_OSGWIDGET
#include <QOpenGLWidget>
#include <osg/ref_ptr>
class QTimerEvent;
namespace robo
{
class Robot;
}
namespace osg
{
class Group;
class Camera;
class Node;
class Geometry;
}
namespace osgViewer
{
class GraphicsWindowEmbedded;
class CompositeViewer;
class View;
}
namespace osgGA
{
class TrackballManipulator;
class EventQueue;
}
class OSGWidget : public QOpenGLWidget
{
Q_OBJECT
public:
OSGWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
virtual ~OSGWidget();
void displayRobot(robo::Robot* robot);
osg::Group* getScene();
protected:
void timerEvent(QTimerEvent *);
virtual void paintEvent(QPaintEvent *paintEvent);
virtual void paintGL();
virtual void resizeGL(int width, int height);
virtual void keyPressEvent(QKeyEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void wheelEvent(QWheelEvent *event);
virtual bool event(QEvent *event);
osgGA::EventQueue *getEventQueue() const;
void repaintOSGGraphicsAfterInteraction(QEvent *event);
virtual void onResize(int width, int height);
unsigned int getMouseButtonNumber(QMouseEvent *event);
osg::Camera* createCamera();
void setupViewCamera();
void setCameraToTrackNode(osg::Node* node_to_track);
int timer_id_;
const double graphics_update_rate_hz_{ 30.0 };
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> graphics_window_;
osg::ref_ptr<osgViewer::CompositeViewer> viewer_;
osg::ref_ptr<osgViewer::View> view_;
osg::ref_ptr<osg::Group> root_;
robo::Robot *robot_ptr_;
};
#endif