00001 /* 00002 ** Projet etudiants 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 00021 #ifndef GLWIDGET_HPP 00022 #define GLWIDGET_HPP 00023 00024 00025 #include <QtOpenGL/QGLWidget> 00026 #include <navigator_tool.hpp> 00027 #include <scene.hpp> 00028 00029 class Window; 00030 00031 class glwidget : public QGLWidget 00032 { 00033 00034 Q_OBJECT 00035 00036 public: 00037 00038 glwidget(QWidget *parent=0); 00039 ~glwidget(); 00040 00041 //l'objet scene courant que l'on va utiliser pour la scene 3D 00042 scene current_scene; 00043 00044 //un pointeur vers la fenetre Qt 00045 Window *p_window; 00046 00047 protected: 00048 00049 //les fonctions OpenGL 00050 void initializeGL(); 00051 void paintGL(); 00052 void resizeGL(int width, int height); 00053 void mousePressEvent(QMouseEvent *event); 00054 void mouseReleaseEvent(QMouseEvent *event); 00055 void mouseMoveEvent(QMouseEvent *event); 00056 void keyPressEvent(QKeyEvent *event); 00057 00058 00059 private: 00060 00061 //le gestionnaire de naviguation 3D 00062 cpe::navigator_tool nav; 00063 00064 //affichage d'une aide au lancement du programme 00065 void print_help_start() const; 00066 00067 00068 00069 00070 }; 00071 00072 00073 #endif