00001 /* 00002 ** TP 4ETI CPE Lyon 00003 ** Copyright (C) 2012 Damien Rohmer 00004 ** 00005 ** This program is free software: you can redistribute it and/or modify 00006 ** it under the terms of the GNU General Public License as published by 00007 ** the Free Software Foundation, either version 3 of the License, or 00008 ** (at your option) any later version. 00009 ** 00010 ** This program is distributed in the hope that it will be useful, 00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 ** GNU General Public License for more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 00020 #ifndef _GLWIDGET_HPP_ 00021 #define _GLWIDGET_HPP_ 00022 00023 00024 #include <QtOpenGL/QGLWidget> 00025 #include <QTime> 00026 #include <navigator_tool.hpp> 00027 #include <scene.hpp> 00028 00029 00030 class glwidget : public QGLWidget 00031 { 00032 00033 Q_OBJECT 00034 00035 public: 00036 00037 glwidget(QWidget *parent=0); 00038 ~glwidget(); 00039 00040 void set_wireframe(); 00041 void set_filled(); 00042 00043 scene current_scene; 00044 00045 void draw_text(double x,double y,double z,QString text,QFont font); 00046 00047 protected: 00048 void initializeGL(); 00049 void paintGL(); 00050 void resizeGL(int width, int height); 00051 void mousePressEvent(QMouseEvent *event); 00052 void mouseReleaseEvent(QMouseEvent *event); 00053 void mouseMoveEvent(QMouseEvent *event); 00054 void keyPressEvent(QKeyEvent *event); 00055 void timerEvent(QTimerEvent *event); 00056 00057 00058 00059 private: 00060 00061 cpe::navigator_tool nav; 00062 00063 00064 void print_help_start() const; 00065 void draw_pointer(cpe::navigator_tool& nav) const; 00066 void draw_orientation(cpe::navigator_tool& nav) const; 00067 void draw_camera_stat(); 00068 00069 void draw_fps(); 00070 void draw_decorating_info(); 00071 00072 QTime t_timer; 00073 00074 }; 00075 00076 00077 #endif