2016-07-31 11:56:30 +00:00
|
|
|
|
/// \file mainwindow.hpp
|
|
|
|
|
/// \brief Main window and algorhytms.
|
|
|
|
|
/// \author smal.root@gmail.com
|
|
|
|
|
/// \date 2016
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
// Header files, Qt.
|
2018-05-25 18:19:06 +00:00
|
|
|
|
#if ASSIMP_QT4_VIEWER
|
|
|
|
|
# include <QMainWindow>
|
|
|
|
|
#else
|
|
|
|
|
# include <QtWidgets>
|
|
|
|
|
#endif
|
2016-07-31 11:56:30 +00:00
|
|
|
|
|
|
|
|
|
// Header files, project.
|
|
|
|
|
#include "glview.hpp"
|
|
|
|
|
#include "loggerview.hpp"
|
|
|
|
|
|
|
|
|
|
// Header files, Assimp.
|
|
|
|
|
#include <assimp/Importer.hpp>
|
|
|
|
|
#include <assimp/scene.h>
|
|
|
|
|
|
|
|
|
|
namespace Ui { class MainWindow; }
|
|
|
|
|
|
|
|
|
|
/// \class MainWindow
|
|
|
|
|
/// Main window and algorhytms.
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
/**********************************/
|
|
|
|
|
/************ Variables ***********/
|
|
|
|
|
/**********************************/
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
Ui::MainWindow *ui;
|
|
|
|
|
|
|
|
|
|
CGLView* mGLView;///< Pointer to OpenGL render.
|
|
|
|
|
CLoggerView* mLoggerView;///< Pointer to logging object.
|
|
|
|
|
Assimp::Importer mImporter;///< Assimp importer.
|
|
|
|
|
const aiScene* mScene;///< Pointer to loaded scene (\ref aiScene).
|
2018-05-24 14:11:21 +00:00
|
|
|
|
|
|
|
|
|
/// \struct SMouse_Transformation
|
|
|
|
|
/// Holds data about transformation of the scene/camera when mouse us used.
|
|
|
|
|
struct SMouse_Transformation
|
|
|
|
|
{
|
|
|
|
|
bool Position_Pressed_Valid;///< Mouse button pressed on GLView.
|
|
|
|
|
QPoint Position_Pressed_LMB;///< Position where was pressed left mouse button.
|
|
|
|
|
QPoint Position_Pressed_RMB;///< Position where was pressed right mouse button.
|
|
|
|
|
aiMatrix4x4 Rotation_AroundCamera;///< Rotation matrix which set rotation angles of the scene around camera.
|
|
|
|
|
aiMatrix4x4 Rotation_Scene;///< Rotation matrix which set rotation angles of the scene around own center.
|
|
|
|
|
} mMouse_Transformation;
|
2016-07-31 11:56:30 +00:00
|
|
|
|
|
|
|
|
|
/**********************************/
|
|
|
|
|
/************ Functions ***********/
|
|
|
|
|
/**********************************/
|
|
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
/********************* Import/Export functions **********************/
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
|
|
|
|
|
/// \fn void ImportFile(const QString& pFileName)
|
|
|
|
|
/// Import scene from file.
|
|
|
|
|
/// \param [in] pFileName - path and name of the file.
|
|
|
|
|
void ImportFile(const QString& pFileName);
|
|
|
|
|
|
2017-12-28 12:55:41 +00:00
|
|
|
|
|
|
|
|
|
/// \fn void ResetSceneInfos()
|
|
|
|
|
/// Reset informations about the scene
|
|
|
|
|
void ResetSceneInfos();
|
|
|
|
|
|
2016-07-31 11:56:30 +00:00
|
|
|
|
/********************************************************************/
|
|
|
|
|
/************************ Logging functions *************************/
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
|
|
|
|
|
/// \fn void LogInfo(const QString& pMessage)
|
|
|
|
|
/// Add message with severity "Warning" to log.
|
|
|
|
|
void LogInfo(const QString& pMessage);
|
|
|
|
|
|
|
|
|
|
/// \fn void LogError(const QString& pMessage)
|
|
|
|
|
/// Add message with severity "Error" to log.
|
|
|
|
|
void LogError(const QString& pMessage);
|
|
|
|
|
|
|
|
|
|
/********************************************************************/
|
2017-11-09 22:19:26 +00:00
|
|
|
|
/*********************** Override functions ************************/
|
2016-07-31 11:56:30 +00:00
|
|
|
|
/********************************************************************/
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
/// \fn void mousePressEvent(QMouseEvent* pEvent) override
|
2017-11-09 22:19:26 +00:00
|
|
|
|
/// Override function which handles mouse event "button pressed".
|
2016-07-31 11:56:30 +00:00
|
|
|
|
/// \param [in] pEvent - pointer to event data.
|
|
|
|
|
void mousePressEvent(QMouseEvent* pEvent) override;
|
|
|
|
|
|
2018-05-24 14:11:21 +00:00
|
|
|
|
/// \fn void mouseReleaseEvent(QMouseEvent *pEvent) override
|
|
|
|
|
/// Override function which handles mouse event "button released".
|
|
|
|
|
/// \param [in] pEvent - pointer to event data.
|
|
|
|
|
void mouseReleaseEvent(QMouseEvent *pEvent) override;
|
|
|
|
|
|
2016-07-31 11:56:30 +00:00
|
|
|
|
/// \fn void mouseMoveEvent(QMouseEvent* pEvent) override
|
2017-11-09 22:19:26 +00:00
|
|
|
|
/// Override function which handles mouse event "move".
|
2016-07-31 11:56:30 +00:00
|
|
|
|
/// \param [in] pEvent - pointer to event data.
|
|
|
|
|
void mouseMoveEvent(QMouseEvent* pEvent) override;
|
|
|
|
|
|
|
|
|
|
/// \fn void keyPressEvent(QKeyEvent* pEvent) override
|
2017-11-09 22:19:26 +00:00
|
|
|
|
/// Override function which handles key event "key pressed".
|
2016-07-31 11:56:30 +00:00
|
|
|
|
/// \param [in] pEvent - pointer to event data.
|
|
|
|
|
void keyPressEvent(QKeyEvent* pEvent) override;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
/********************** Constructor/Destructor **********************/
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
|
|
|
|
|
/// \fn explicit MainWindow(QWidget* pParent = 0)
|
|
|
|
|
/// \param [in] pParent - pointer to parent widget.
|
|
|
|
|
explicit MainWindow(QWidget* pParent = 0);
|
|
|
|
|
|
|
|
|
|
/// \fn ~MainWindow()
|
|
|
|
|
/// Destructor.
|
|
|
|
|
~MainWindow();
|
|
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
/****************************** Slots *******************************/
|
|
|
|
|
/********************************************************************/
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
|
|
/// \fn void Paint_Finished(const int pPaintTime)
|
|
|
|
|
/// Show paint/render time and distance between camera and center of the scene.
|
|
|
|
|
/// \param [in] pPaintTime_ms - paint time in milliseconds.
|
|
|
|
|
void Paint_Finished(const size_t pPaintTime_ms, const GLfloat pDistance);
|
|
|
|
|
|
|
|
|
|
/// \fn void SceneObject_Camera(const QString& pName)
|
|
|
|
|
/// Add camera name to list.
|
|
|
|
|
/// \param [in] pName - name of the camera.
|
|
|
|
|
void SceneObject_Camera(const QString& pName);
|
|
|
|
|
|
|
|
|
|
/// \fn void SceneObject_LightSource(const QString& pName)
|
|
|
|
|
/// Add lighting source name to list.
|
|
|
|
|
/// \param [in] pName - name of the light source,
|
|
|
|
|
void SceneObject_LightSource(const QString& pName);
|
|
|
|
|
|
|
|
|
|
void on_butOpenFile_clicked();
|
|
|
|
|
void on_butExport_clicked();
|
|
|
|
|
void on_cbxLighting_clicked(bool pChecked);
|
|
|
|
|
void on_lstLight_itemSelectionChanged();
|
|
|
|
|
void on_lstCamera_clicked(const QModelIndex &index);
|
|
|
|
|
void on_cbxBBox_clicked(bool checked);
|
|
|
|
|
void on_cbxTextures_clicked(bool checked);
|
2018-04-05 07:50:30 +00:00
|
|
|
|
void on_cbxDrawAxes_clicked(bool checked);
|
2016-07-31 11:56:30 +00:00
|
|
|
|
};
|