removed timer rotation, now the user has full control,

added keyboard support,
reset rotation with space
This commit is contained in:
Anakin
2016-12-27 14:05:39 +01:00
parent a30f1b125c
commit faea3b0737
2 changed files with 46 additions and 42 deletions

View File

@@ -24,7 +24,8 @@ public:
protected:
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
void initializeGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
@@ -34,17 +35,17 @@ protected:
void initTextures();
private:
QBasicTimer timer;
struct {
bool left = false;
bool right = false;
QVector2D position;
} m_mouse;
QOpenGLShaderProgram program;
GeometryEngine *geometries;
QOpenGLTexture *texture;
QMatrix4x4 projection;
QVector2D mousePressPosition;
QVector3D rotationAxis;
qreal angularSpeed;
QQuaternion rotation;
QMatrix4x4 m_projection;
QQuaternion m_rotation;
};