mainwindow.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /// \file mainwindow.hpp
  2. /// \brief Main window and algorhytms.
  3. /// \author [email protected]
  4. /// \date 2016
  5. #pragma once
  6. // Header files, Qt.
  7. #include <QtWidgets>
  8. // Header files, project.
  9. #include "glview.hpp"
  10. #include "loggerview.hpp"
  11. // Header files, Assimp.
  12. #include <assimp/Importer.hpp>
  13. #include <assimp/scene.h>
  14. namespace Ui { class MainWindow; }
  15. /// \class MainWindow
  16. /// Main window and algorhytms.
  17. class MainWindow : public QMainWindow
  18. {
  19. Q_OBJECT
  20. /**********************************/
  21. /************ Variables ***********/
  22. /**********************************/
  23. private:
  24. Ui::MainWindow *ui;
  25. CGLView* mGLView;///< Pointer to OpenGL render.
  26. CLoggerView* mLoggerView;///< Pointer to logging object.
  27. Assimp::Importer mImporter;///< Assimp importer.
  28. const aiScene* mScene;///< Pointer to loaded scene (\ref aiScene).
  29. QPoint mPosition_Pressed_LMB;///< Position where was pressed left mouse button.
  30. QPoint mPosition_Pressed_RMB;///< Position where was pressed right mouse button.
  31. /**********************************/
  32. /************ Functions ***********/
  33. /**********************************/
  34. /********************************************************************/
  35. /********************* Import/Export functions **********************/
  36. /********************************************************************/
  37. /// \fn void ImportFile(const QString& pFileName)
  38. /// Import scene from file.
  39. /// \param [in] pFileName - path and name of the file.
  40. void ImportFile(const QString& pFileName);
  41. /********************************************************************/
  42. /************************ Logging functions *************************/
  43. /********************************************************************/
  44. /// \fn void LogInfo(const QString& pMessage)
  45. /// Add message with severity "Warning" to log.
  46. void LogInfo(const QString& pMessage);
  47. /// \fn void LogError(const QString& pMessage)
  48. /// Add message with severity "Error" to log.
  49. void LogError(const QString& pMessage);
  50. /********************************************************************/
  51. /*********************** Overrided functions ************************/
  52. /********************************************************************/
  53. protected:
  54. /// \fn void mousePressEvent(QMouseEvent* pEvent) override
  55. /// Overrided function which handle mouse event "button pressed".
  56. /// \param [in] pEvent - pointer to event data.
  57. void mousePressEvent(QMouseEvent* pEvent) override;
  58. /// \fn void mouseMoveEvent(QMouseEvent* pEvent) override
  59. /// Overrided function which handle mouse event "move".
  60. /// \param [in] pEvent - pointer to event data.
  61. void mouseMoveEvent(QMouseEvent* pEvent) override;
  62. /// \fn void keyPressEvent(QKeyEvent* pEvent) override
  63. /// Overrided function which handle key event "key pressed".
  64. /// \param [in] pEvent - pointer to event data.
  65. void keyPressEvent(QKeyEvent* pEvent) override;
  66. public:
  67. /********************************************************************/
  68. /********************** Constructor/Destructor **********************/
  69. /********************************************************************/
  70. /// \fn explicit MainWindow(QWidget* pParent = 0)
  71. /// \param [in] pParent - pointer to parent widget.
  72. explicit MainWindow(QWidget* pParent = 0);
  73. /// \fn ~MainWindow()
  74. /// Destructor.
  75. ~MainWindow();
  76. /********************************************************************/
  77. /****************************** Slots *******************************/
  78. /********************************************************************/
  79. private slots:
  80. /// \fn void Paint_Finished(const int pPaintTime)
  81. /// Show paint/render time and distance between camera and center of the scene.
  82. /// \param [in] pPaintTime_ms - paint time in milliseconds.
  83. void Paint_Finished(const size_t pPaintTime_ms, const GLfloat pDistance);
  84. /// \fn void SceneObject_Camera(const QString& pName)
  85. /// Add camera name to list.
  86. /// \param [in] pName - name of the camera.
  87. void SceneObject_Camera(const QString& pName);
  88. /// \fn void SceneObject_LightSource(const QString& pName)
  89. /// Add lighting source name to list.
  90. /// \param [in] pName - name of the light source,
  91. void SceneObject_LightSource(const QString& pName);
  92. void on_butOpenFile_clicked();
  93. void on_butExport_clicked();
  94. void on_cbxLighting_clicked(bool pChecked);
  95. void on_lstLight_itemSelectionChanged();
  96. void on_lstCamera_clicked(const QModelIndex &index);
  97. void on_cbxBBox_clicked(bool checked);
  98. void on_cbxTextures_clicked(bool checked);
  99. };