2016-12-24 15:03:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "geometryengine.h"
|
|
|
|
|
|
|
|
#include <QOpenGLWidget>
|
|
|
|
#include <QOpenGLFunctions>
|
|
|
|
#include <QMatrix4x4>
|
|
|
|
#include <QQuaternion>
|
|
|
|
#include <QVector2D>
|
|
|
|
#include <QBasicTimer>
|
|
|
|
#include <QOpenGLShaderProgram>
|
2016-12-29 12:37:15 +00:00
|
|
|
|
2016-12-24 15:03:37 +00:00
|
|
|
|
|
|
|
class GeometryEngine;
|
|
|
|
|
|
|
|
class OglViewerWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit OglViewerWidget(QWidget *parent = 0);
|
|
|
|
~OglViewerWidget();
|
|
|
|
|
2017-01-03 10:47:27 +00:00
|
|
|
signals:
|
|
|
|
void loadFile(const char*);
|
|
|
|
|
2016-12-29 13:06:25 +00:00
|
|
|
private:
|
|
|
|
struct {
|
|
|
|
bool left = false;
|
|
|
|
bool right = false;
|
|
|
|
QVector2D position;
|
|
|
|
} m_mouse;
|
|
|
|
|
|
|
|
QOpenGLShaderProgram m_program;
|
|
|
|
GeometryEngine *m_dataEngine;
|
|
|
|
|
|
|
|
QMatrix4x4 m_projection;
|
2016-12-30 12:28:07 +00:00
|
|
|
QVector3D m_translation;
|
2016-12-29 13:06:25 +00:00
|
|
|
QQuaternion m_rotation;
|
|
|
|
|
2016-12-24 15:03:37 +00:00
|
|
|
protected:
|
|
|
|
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
2016-12-27 13:05:39 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
2016-12-30 12:28:07 +00:00
|
|
|
void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
|
2017-01-03 10:47:27 +00:00
|
|
|
void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
|
2016-12-31 15:18:35 +00:00
|
|
|
void dropEvent(QDropEvent * event) Q_DECL_OVERRIDE;
|
2016-12-27 13:05:39 +00:00
|
|
|
void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
|
2016-12-24 15:03:37 +00:00
|
|
|
|
|
|
|
void initializeGL() Q_DECL_OVERRIDE;
|
|
|
|
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
|
|
|
void paintGL() Q_DECL_OVERRIDE;
|
|
|
|
|
2016-12-29 12:37:15 +00:00
|
|
|
private:
|
2016-12-24 15:03:37 +00:00
|
|
|
void initShaders();
|
2017-01-04 13:35:27 +00:00
|
|
|
void setConnections();
|
2016-12-24 15:03:37 +00:00
|
|
|
|
add exe icon,
signal-slot for openFile,
resetView on openFile,
cleanup when open a new file,
triangulate quad poly now correctly, more not working, bug from previous version,
next:
fix 5,6,.. triangulation,
triClothMan, IC Helmet, still buggy,
2017-01-02 11:21:32 +00:00
|
|
|
private slots:
|
|
|
|
void resetView();
|
2016-12-24 15:03:37 +00:00
|
|
|
};
|
|
|
|
|