Commit 4332f836 by Alisa Jung

fertig bis trackball

parent 3ebc80d3
......@@ -95,6 +95,12 @@ MainWindow::MainWindow(QWidget *parent)
tesselationSlider->setValue(1);
connect(tesselationSlider,SIGNAL(valueChanged(int)),myGLWidget,SLOT(setTessellation(int)));
toolBar->addWidget(tesselationSlider);
//reset Camera button
resetCameraAction = new QAction("Reset Camera",toolBar);
connect(resetCameraAction,SIGNAL(triggered(bool)),myGLWidget,SLOT(resetCamera()));
toolBar->addAction(resetCameraAction);
}
MainWindow::~MainWindow()
......
......@@ -47,6 +47,8 @@ private:
QAction *shadePhongAction;
QActionGroup *shaderGroup;
QAction *resetCameraAction;
//Widgets
MyGLWidget *myGLWidget;
......
......@@ -5,6 +5,10 @@
#include <gl/GLU.h>
#include <QDebug>
#include <QWheelEvent>
#include <QQuaternion>
#include <QMatrix4x4>
#include <math.h>
#include <QVector3D>
class MyGLWidget : public QGLWidget
{
......@@ -28,11 +32,22 @@ protected:
void wheelEvent(QWheelEvent *event);
private:
//tesselation slider
int tesselation;
//zoom camera
const double cameraZoomDefault = -5;
double cameraZoom;
//translate camera
QPoint clickStartPosition;
bool rightButtonPressed;
double translationX, translationY;
double tx, ty;
//rotate cube
bool leftButtonPressed;
QQuaternion qubeRotationQuaternion;
QPoint screenCenter;//Center of screen in pixel coordinates
public slots:
......@@ -42,6 +57,7 @@ public slots:
void shadeGouraudSlot();
void shadePhongSlot();
void setTessellation(int t);
void resetCamera();
};
#endif // GLWIDGET_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment