DLA-Fire-Prediction-Thesis 1.0

GLWindow.h

Go to the documentation of this file.
00001 #ifndef _GL_WINDOW_H_
00002 #define _GL_WINDOW_H_
00003 
00004 #include "ngl/Camera.h"
00005 #include "ngl/Colour.h"
00006 #include "ngl/Light.h"
00007 #include "ngl/TransformStack.h"
00008 // must be included after our stuff becuase GLEW needs to be first
00009 #include <QtOpenGL>
00010 
00011 #include "FireArea.h"
00012 
00013 //----------------------------------------------------------------------------------------------------------------------
00025 //----------------------------------------------------------------------------------------------------------------------
00026 
00027 class GLWindow : public QGLWidget
00028 {
00029 Q_OBJECT        // must include this if you use Qt signals/slots
00030 public :
00031 
00032   //----------------------------------------------------------------------------------------------------------------------
00035   //----------------------------------------------------------------------------------------------------------------------
00036   GLWindow(
00037           QWidget *_parent
00038           );
00039   //----------------------------------------------------------------------------------------------------------------------
00041   //----------------------------------------------------------------------------------------------------------------------
00042   ~GLWindow();
00043 
00044 private :
00045 
00046   //----------------------------------------------------------------------------------------------------------------------
00048   //----------------------------------------------------------------------------------------------------------------------
00049   bool m_wireframe;
00050   //----------------------------------------------------------------------------------------------------------------------
00052   //----------------------------------------------------------------------------------------------------------------------
00053   bool m_enableMountain;
00054   //----------------------------------------------------------------------------------------------------------------------
00056   //----------------------------------------------------------------------------------------------------------------------
00057   int m_mountainIterations;
00058 
00059   //----------------------------------------------------------------------------------------------------------------------
00061   //----------------------------------------------------------------------------------------------------------------------
00062   enum CAMMODE{MOVEEYE,MOVELOOK,MOVEBOTH,MOVESLIDE};
00063 
00064   //----------------------------------------------------------------------------------------------------------------------
00066   //----------------------------------------------------------------------------------------------------------------------
00067   int m_spinXFace;
00068   //----------------------------------------------------------------------------------------------------------------------
00070   //----------------------------------------------------------------------------------------------------------------------
00071   int m_spinYFace;
00072   //----------------------------------------------------------------------------------------------------------------------
00074   //----------------------------------------------------------------------------------------------------------------------
00075   bool m_rotate;
00076   //----------------------------------------------------------------------------------------------------------------------
00078   //----------------------------------------------------------------------------------------------------------------------
00079   int m_origX;
00080   //----------------------------------------------------------------------------------------------------------------------
00082   //----------------------------------------------------------------------------------------------------------------------
00083   int m_origY;
00084 
00085   //----------------------------------------------------------------------------------------------------------------------
00087   //----------------------------------------------------------------------------------------------------------------------
00088   ngl::TransformStack m_transformStack;
00089 
00090   //----------------------------------------------------------------------------------------------------------------------
00092   //----------------------------------------------------------------------------------------------------------------------
00093   int m_drawHelp;
00094 
00095   //----------------------------------------------------------------------------------------------------------------------
00097   //----------------------------------------------------------------------------------------------------------------------
00098   std::vector <ngl::Camera > m_cameras;
00099   //----------------------------------------------------------------------------------------------------------------------
00101   //----------------------------------------------------------------------------------------------------------------------
00102   int m_cameraIndex;
00103   //----------------------------------------------------------------------------------------------------------------------
00105   //----------------------------------------------------------------------------------------------------------------------
00106   ngl::Light *m_light;
00107   //----------------------------------------------------------------------------------------------------------------------
00109   //----------------------------------------------------------------------------------------------------------------------
00110   float m_fov;
00111   //----------------------------------------------------------------------------------------------------------------------
00113   //----------------------------------------------------------------------------------------------------------------------
00114   float m_aspect;
00115   //----------------------------------------------------------------------------------------------------------------------
00117   //----------------------------------------------------------------------------------------------------------------------
00118   ngl::CAMERAPROJECTION m_projection;
00119 
00120   //----------------------------------------------------------------------------------------------------------------------
00122   //----------------------------------------------------------------------------------------------------------------------
00123   float m_objectRadius;
00124   //----------------------------------------------------------------------------------------------------------------------
00126   //----------------------------------------------------------------------------------------------------------------------
00127   float m_objectHeight;
00128   //----------------------------------------------------------------------------------------------------------------------
00130   //----------------------------------------------------------------------------------------------------------------------
00131   int m_fpsTimer;
00132   //----------------------------------------------------------------------------------------------------------------------
00134   //----------------------------------------------------------------------------------------------------------------------
00135   int m_fps;
00136   //----------------------------------------------------------------------------------------------------------------------
00138   //----------------------------------------------------------------------------------------------------------------------
00139   int m_frames;
00140   //----------------------------------------------------------------------------------------------------------------------
00142   //----------------------------------------------------------------------------------------------------------------------
00143   QTime m_timer;
00144 
00145   //----------------------------------------------------------------------------------------------------------------------
00147   //----------------------------------------------------------------------------------------------------------------------
00148   int m_sceneWidth;
00149   //----------------------------------------------------------------------------------------------------------------------
00151   //----------------------------------------------------------------------------------------------------------------------
00152   int m_sceneHeight;
00153 
00154   //----------------------------------------------------------------------------------------------------------------------
00156   //----------------------------------------------------------------------------------------------------------------------
00157   FireArea *fireScene;
00158 
00159   //----------------------------------------------------------------------------------------------------------------------
00161   //----------------------------------------------------------------------------------------------------------------------
00162   int m_newIndexOfOrigin;
00163   //----------------------------------------------------------------------------------------------------------------------
00165   //----------------------------------------------------------------------------------------------------------------------
00166   int m_windDirectionRot;
00167   //----------------------------------------------------------------------------------------------------------------------
00169   //----------------------------------------------------------------------------------------------------------------------
00170   bool m_showWindDir;
00171   //----------------------------------------------------------------------------------------------------------------------
00173   //----------------------------------------------------------------------------------------------------------------------
00174   double m_temperature;
00175   //----------------------------------------------------------------------------------------------------------------------
00177   //----------------------------------------------------------------------------------------------------------------------
00178   double m_sceneMoisture;
00179 
00180   //----------------------------------------------------------------------------------------------------------------------
00183   //----------------------------------------------------------------------------------------------------------------------
00184   void mouseMoveEvent (
00185                        QMouseEvent * _event
00186                       );
00187   //----------------------------------------------------------------------------------------------------------------------
00191   //----------------------------------------------------------------------------------------------------------------------
00192   void mousePressEvent (
00193                         QMouseEvent *_event
00194                        );
00195 
00196   //----------------------------------------------------------------------------------------------------------------------
00200   //----------------------------------------------------------------------------------------------------------------------
00201   void mouseReleaseEvent (
00202                           QMouseEvent *_event
00203                          );
00204   //----------------------------------------------------------------------------------------------------------------------
00207   //----------------------------------------------------------------------------------------------------------------------
00208   void timerEvent(
00209                     QTimerEvent *_event
00210                    );
00211   //----------------------------------------------------------------------------------------------------------------------
00213   //----------------------------------------------------------------------------------------------------------------------
00214   void createCameras();
00215 
00216   //----------------------------------------------------------------------------------------------------------------------
00219   //----------------------------------------------------------------------------------------------------------------------
00220   void setCameraShape();
00221 
00222   //----------------------------------------------------------------------------------------------------------------------
00226   //----------------------------------------------------------------------------------------------------------------------
00227   void drawAxis(
00228                const std::string &m_shaderName,
00229                ngl::TransformStack &m_axisTransformStack,
00230                float m_scale,
00231                int m_xRot,
00232                int m_yRot
00233                );
00234 protected:
00235   //----------------------------------------------------------------------------------------------------------------------
00238   //----------------------------------------------------------------------------------------------------------------------
00239   void initializeGL();
00240 
00241   //----------------------------------------------------------------------------------------------------------------------
00245   //----------------------------------------------------------------------------------------------------------------------
00246   void resizeGL(
00247                 const int _w,
00248                 const int _h
00249                );
00250   //----------------------------------------------------------------------------------------------------------------------
00253   //----------------------------------------------------------------------------------------------------------------------
00254   void paintGL();
00255 
00256 public slots :
00257   //----------------------------------------------------------------------------------------------------------------------
00260   //----------------------------------------------------------------------------------------------------------------------
00261   void pickCamera(
00262                  int _i
00263                  );
00264   //----------------------------------------------------------------------------------------------------------------------
00266   //----------------------------------------------------------------------------------------------------------------------
00267   void setColour();
00268   //----------------------------------------------------------------------------------------------------------------------
00271   //----------------------------------------------------------------------------------------------------------------------
00272   void toggleWireframe(
00273                       bool _mode
00274                       );
00275   //----------------------------------------------------------------------------------------------------------------------
00277   //----------------------------------------------------------------------------------------------------------------------
00278   void zoomIn();
00279   //----------------------------------------------------------------------------------------------------------------------
00281   //----------------------------------------------------------------------------------------------------------------------
00282   void zoomOut();
00283   //----------------------------------------------------------------------------------------------------------------------
00285   //----------------------------------------------------------------------------------------------------------------------
00286   void increaseTerrainHeight();
00287   //----------------------------------------------------------------------------------------------------------------------
00289   //----------------------------------------------------------------------------------------------------------------------
00290   void decreaseTerrainHeight();
00291 
00292   //----------------------------------------------------------------------------------------------------------------------
00295   //----------------------------------------------------------------------------------------------------------------------
00296   void toggleTerrain(
00297                     bool _mode
00298                     );
00299   //----------------------------------------------------------------------------------------------------------------------
00301   //----------------------------------------------------------------------------------------------------------------------
00302   void resetMountain();
00303   //----------------------------------------------------------------------------------------------------------------------
00306   //----------------------------------------------------------------------------------------------------------------------
00307   void setNewMountainIterations(
00308                                int _newIterations
00309                                );
00310   //----------------------------------------------------------------------------------------------------------------------
00312   //----------------------------------------------------------------------------------------------------------------------
00313   void moveOriginLeft();
00314   //----------------------------------------------------------------------------------------------------------------------
00316   //----------------------------------------------------------------------------------------------------------------------
00317   void moveOriginRight();
00318   //----------------------------------------------------------------------------------------------------------------------
00320   //----------------------------------------------------------------------------------------------------------------------
00321   void moveOriginUp();
00322   //----------------------------------------------------------------------------------------------------------------------
00324   //----------------------------------------------------------------------------------------------------------------------
00325   void moveOriginDown();
00326   //----------------------------------------------------------------------------------------------------------------------
00329   //----------------------------------------------------------------------------------------------------------------------
00330   void adjustObstacleAmount(
00331                            int _newNumber
00332                            );
00333 
00334   //----------------------------------------------------------------------------------------------------------------------
00336   //----------------------------------------------------------------------------------------------------------------------
00337   void generateNewFirePath();
00338   //----------------------------------------------------------------------------------------------------------------------
00340   //----------------------------------------------------------------------------------------------------------------------
00341   void editDLA();
00342   //----------------------------------------------------------------------------------------------------------------------
00344   //----------------------------------------------------------------------------------------------------------------------
00345   void pauseAnimation();
00346   //----------------------------------------------------------------------------------------------------------------------
00348   //----------------------------------------------------------------------------------------------------------------------
00349   void playAnimation();
00350 
00351   //----------------------------------------------------------------------------------------------------------------------
00354   //----------------------------------------------------------------------------------------------------------------------
00355   void assignNewOrigin(
00356                       int _newOriginAmount
00357                       );
00358   //----------------------------------------------------------------------------------------------------------------------
00361   //----------------------------------------------------------------------------------------------------------------------
00362   void selectMovingOrigin(
00363                          int _indexOfOrigin
00364                          );
00365   //----------------------------------------------------------------------------------------------------------------------
00368   //----------------------------------------------------------------------------------------------------------------------
00369   void toggleShowMark(
00370                      bool _mode
00371                      );
00372 
00373   //----------------------------------------------------------------------------------------------------------------------
00376   //----------------------------------------------------------------------------------------------------------------------
00377   void toggleShowLine(
00378                      bool _mode
00379                      );
00380 
00381   //----------------------------------------------------------------------------------------------------------------------
00384   //----------------------------------------------------------------------------------------------------------------------
00385   void adjustFuelAmount(
00386                        int _newAmount
00387                        );
00388 
00389   //----------------------------------------------------------------------------------------------------------------------
00392   //----------------------------------------------------------------------------------------------------------------------
00393   void enableWind(
00394                  bool _mode
00395                  );
00396   //----------------------------------------------------------------------------------------------------------------------
00399   //----------------------------------------------------------------------------------------------------------------------
00400   void showWindDir(
00401                   bool _mode
00402                   );
00403   //----------------------------------------------------------------------------------------------------------------------
00406   //----------------------------------------------------------------------------------------------------------------------
00407   void assignWindSpeed(
00408                       int _newWindSpeed
00409                       );
00410   //----------------------------------------------------------------------------------------------------------------------
00413   //----------------------------------------------------------------------------------------------------------------------
00414   void changeWindDirection(
00415                           int _newDir
00416                           );
00417   //----------------------------------------------------------------------------------------------------------------------
00420   //----------------------------------------------------------------------------------------------------------------------
00421   void changeTemperature(
00422                         double _newTemp
00423                         );
00424   //----------------------------------------------------------------------------------------------------------------------
00427   //----------------------------------------------------------------------------------------------------------------------
00428   void changeMoistureOfTheScene(
00429                                double _newSceneMoisture
00430                                );
00431   //----------------------------------------------------------------------------------------------------------------------
00434   //----------------------------------------------------------------------------------------------------------------------
00435   void changeObjMoisture(
00436                         double _newObjMoisture
00437                         );
00438   //----------------------------------------------------------------------------------------------------------------------
00442   //----------------------------------------------------------------------------------------------------------------------
00443   void adjustFuelSize(
00444                      int _side,
00445                      int _type
00446                      );
00447   //----------------------------------------------------------------------------------------------------------------------
00450   //----------------------------------------------------------------------------------------------------------------------
00451   void selectObjIndexToAdjustSize(
00452                                  int _objIndex
00453                                  );
00454 }; // end class
00455 
00456 #endif // _GL_WINDOW_H_
00457 
00458 //----------------------------------------------------------------------------------------------------------------------
 All Classes Namespaces Files Functions Variables Enumerations Enumerator