Aufgrund von Umarbeiten des s3 Storage wird es in GitLab, in nächster Zeit, mögliche Performance-Einbußen geben. Näheres dazu unter: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/43/show_ticket/6670

OglViewerWidget.h 1.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#pragma once

#include "geometryengine.h"

#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QMatrix4x4>
#include <QQuaternion>
#include <QVector2D>
#include <QBasicTimer>
#include <QOpenGLShaderProgram>
Anakin's avatar
Anakin committed
12

13 14 15 16 17 18 19 20 21 22 23

class GeometryEngine;

class OglViewerWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
	Q_OBJECT

public:
	explicit OglViewerWidget(QWidget *parent = 0);
	~OglViewerWidget();

Anakin's avatar
Anakin committed
24 25 26 27 28 29 30 31 32 33 34
private:
	struct {
		bool left = false;
		bool right = false;
		QVector2D position;
	} m_mouse;

	QOpenGLShaderProgram m_program;
	GeometryEngine *m_dataEngine;

	QMatrix4x4 m_projection;
Anakin's avatar
Anakin committed
35
	QVector3D m_translation;
Anakin's avatar
Anakin committed
36 37
	QQuaternion m_rotation;

38 39 40
protected:
	void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
	void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
41
	void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
Anakin's avatar
Anakin committed
42
	void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
43
	void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
44 45 46 47 48

	void initializeGL() Q_DECL_OVERRIDE;
	void resizeGL(int w, int h) Q_DECL_OVERRIDE;
	void paintGL() Q_DECL_OVERRIDE;

Anakin's avatar
Anakin committed
49
private:
50 51 52 53 54
	void initShaders();


};