Commit 3ebc80d3 by Alisa Jung

funktionierender zwischenstand, bis 4.2 zoom und translate

parent bcb34491
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
#------------------------------------------------- #-------------------------------------------------
QT += core gui QT += core gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
...@@ -13,9 +13,11 @@ TEMPLATE = app ...@@ -13,9 +13,11 @@ TEMPLATE = app
SOURCES += main.cpp\ SOURCES += main.cpp\
mainwindow.cpp mainwindow.cpp \
myglwidget.cpp
HEADERS += mainwindow.h HEADERS += mainwindow.h \
myglwidget.h
RESOURCES += \ RESOURCES += \
helloqube.qrc helloqube.qrc
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2015-10-31T13:14:17. --> <!-- Written by QtCreator 3.5.1, 2015-11-01T13:07:11. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value> <value type="int">2</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.EditorSettings</variable> <variable>ProjectExplorer.Project.EditorSettings</variable>
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
<value type="int">13</value> <value type="int">13</value>
<value type="int">14</value> <value type="int">14</value>
</valuelist> </valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">-1</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value> <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
...@@ -600,14 +600,16 @@ ...@@ -600,14 +600,16 @@
<value type="int">13</value> <value type="int">13</value>
<value type="int">14</value> <value type="int">14</value>
</valuelist> </valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">-1</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">helloqube</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/_Daten/projekte/grapa/helloqube/helloqube.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">helloqube.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
...@@ -787,7 +789,7 @@ ...@@ -787,7 +789,7 @@
<value type="int">13</value> <value type="int">13</value>
<value type="int">14</value> <value type="int">14</value>
</valuelist> </valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">-1</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value> <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
......
...@@ -20,33 +20,33 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -20,33 +20,33 @@ MainWindow::MainWindow(QWidget *parent)
//3.2.2 Shading Menu //3.2.2 Shading Menu
shadingMenu = new QMenu("Shading"); shadingMenu = new QMenu("Shading");
shadeNoneAction = new QAction("None",shadingMenu); shadeWireframeAction = new QAction("Wireframe",shadingMenu);
shadeFlatAction = new QAction("Flat",shadingMenu); shadeFlatAction = new QAction("Flat",shadingMenu);
shadeGouraudAction = new QAction("Gouraud",shadingMenu); shadeGouraudAction = new QAction("Gouraud",shadingMenu);
shadePhongAction = new QAction("Phong",shadingMenu); shadePhongAction = new QAction("Phong",shadingMenu);
shadeNoneAction->setShortcut(QKeySequence(tr("Ctrl+1"))); shadeWireframeAction->setShortcut(QKeySequence(tr("Ctrl+1")));
shadeFlatAction->setShortcut(QKeySequence(tr("Ctrl+2"))); shadeFlatAction->setShortcut(QKeySequence(tr("Ctrl+2")));
shadeGouraudAction->setShortcut(QKeySequence(tr("Ctrl+3"))); shadeGouraudAction->setShortcut(QKeySequence(tr("Ctrl+3")));
shadePhongAction->setShortcut(QKeySequence(tr("Ctrl+4"))); shadePhongAction->setShortcut(QKeySequence(tr("Ctrl+4")));
shadeNoneAction->setCheckable(true); shadeWireframeAction->setCheckable(true);
shadeFlatAction->setCheckable(true); shadeFlatAction->setCheckable(true);
shadeGouraudAction->setCheckable(true); shadeGouraudAction->setCheckable(true);
shadePhongAction->setCheckable(true); shadePhongAction->setCheckable(true);
shadeNoneAction->setIcon(QIcon(":/img/wireframe.png")); shadeWireframeAction->setIcon(QIcon(":/img/wireframe.png"));
shadeFlatAction->setIcon(QIcon(":/img/flat.png")); shadeFlatAction->setIcon(QIcon(":/img/flat.png"));
shadeGouraudAction->setIcon(QIcon(":/img/gouraud.png")); shadeGouraudAction->setIcon(QIcon(":/img/gouraud.png"));
shadePhongAction->setIcon(QIcon(":/img/phong.png")); shadePhongAction->setIcon(QIcon(":/img/phong.png"));
shaderGroup = new QActionGroup(shadingMenu); shaderGroup = new QActionGroup(shadingMenu);
shaderGroup->addAction(shadeNoneAction); shaderGroup->addAction(shadeWireframeAction);
shaderGroup->addAction(shadeFlatAction); shaderGroup->addAction(shadeFlatAction);
shaderGroup->addAction(shadeGouraudAction); shaderGroup->addAction(shadeGouraudAction);
shaderGroup->addAction(shadePhongAction); shaderGroup->addAction(shadePhongAction);
shadingMenu->addAction(shadeNoneAction); shadingMenu->addAction(shadeWireframeAction);
shadingMenu->addAction(shadeFlatAction); shadingMenu->addAction(shadeFlatAction);
shadingMenu->addAction(shadeGouraudAction); shadingMenu->addAction(shadeGouraudAction);
shadingMenu->addAction(shadePhongAction); shadingMenu->addAction(shadePhongAction);
...@@ -55,6 +55,7 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -55,6 +55,7 @@ MainWindow::MainWindow(QWidget *parent)
menuBar->addMenu(shadingMenu); menuBar->addMenu(shadingMenu);
setMenuBar(menuBar);
//3.2.3 About Message Box //3.2.3 About Message Box
aboutAction = new QAction("About",menuBar); aboutAction = new QAction("About",menuBar);
...@@ -63,7 +64,7 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -63,7 +64,7 @@ MainWindow::MainWindow(QWidget *parent)
//3.3 Toolbar //3.3 Toolbar
toolBar = new QToolBar("ToolBar",this); toolBar = new QToolBar("ToolBar",this);
toolBar->addAction(shadeNoneAction); toolBar->addAction(shadeWireframeAction);
toolBar->addAction(shadeFlatAction); toolBar->addAction(shadeFlatAction);
toolBar->addAction(shadeGouraudAction); toolBar->addAction(shadeGouraudAction);
toolBar->addAction(shadePhongAction); toolBar->addAction(shadePhongAction);
...@@ -74,7 +75,26 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -74,7 +75,26 @@ MainWindow::MainWindow(QWidget *parent)
statusBar->showMessage("test status message"); statusBar->showMessage("test status message");
setStatusBar(statusBar); setStatusBar(statusBar);
setMenuBar(menuBar); //4.0 Widget
myGLWidget = new MyGLWidget(this);
setCentralWidget(myGLWidget);
//4.1.1 connect shading actions to slot
connect(shadeWireframeAction,SIGNAL(triggered(bool)),myGLWidget,SLOT(shadeWireframeSlot()));
connect(shadeFlatAction,SIGNAL(triggered(bool)),myGLWidget,SLOT(shadeFlatSlot()));
connect(shadeGouraudAction,SIGNAL(triggered(bool)),myGLWidget,SLOT(shadeGouraudSlot()));
connect(shadePhongAction,SIGNAL(triggered(bool)),myGLWidget,SLOT(shadePhongSlot()));
//tesselation slider
tesselationSlider = new QSlider(Qt::Horizontal,this);
tesselationSlider->setTickPosition(QSlider::TicksBelow);
tesselationSlider->setTickInterval(2);
tesselationSlider->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
tesselationSlider->setMinimum(1);
tesselationSlider->setMaximum(16);
tesselationSlider->setValue(1);
connect(tesselationSlider,SIGNAL(valueChanged(int)),myGLWidget,SLOT(setTessellation(int)));
toolBar->addWidget(tesselationSlider);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
...@@ -82,6 +102,7 @@ MainWindow::~MainWindow() ...@@ -82,6 +102,7 @@ MainWindow::~MainWindow()
} }
//3.2.3 about message box
void MainWindow::showAboutBox(){ void MainWindow::showAboutBox(){
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setWindowTitle("About Hello Cube!"); msgBox.setWindowTitle("About Hello Cube!");
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <QMessageBox> #include <QMessageBox>
#include <QToolBar> #include <QToolBar>
#include <QStatusBar> #include <QStatusBar>
#include <myglwidget.h>
#include <QSlider>
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
...@@ -39,13 +41,17 @@ private: ...@@ -39,13 +41,17 @@ private:
QAction *aboutAction; QAction *aboutAction;
QAction *shadeNoneAction; QAction *shadeWireframeAction;
QAction *shadeFlatAction; QAction *shadeFlatAction;
QAction *shadeGouraudAction; QAction *shadeGouraudAction;
QAction *shadePhongAction; QAction *shadePhongAction;
QActionGroup *shaderGroup; QActionGroup *shaderGroup;
//Widgets
MyGLWidget *myGLWidget;
//4.1.1 Slider
QSlider* tesselationSlider;
public slots : public slots :
void showAboutBox ( ) ; void showAboutBox ( ) ;
......
#include "myglwidget.h"
MyGLWidget::MyGLWidget(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
tesselation = 1;
cameraZoom = -5;
translationX = 0;
translationY = 0;
clickStartPosition = QPoint(0,0);
rightButtonPressed = false;
}
MyGLWidget::~MyGLWidget()
{
/*http://doc.qt.io/qt-4.8/qt-opengl-hellogl-example.html :
* We use a destructor to ensure that any OpenGL-specific
* data structures are deleted when the widget is no longer
* needed (although in this case nothing needs cleaning up).
*/
//In helloGL example: nothin needs cleaning up.
}
/*
* We provide size hint functions to ensure that
* the widgetis shown at a reasonable size:
*/
QSize MyGLWidget::minimumSizeHint() const
{
return QSize(50, 50);
}
/*
* We provide size hint functions to ensure that
* the widgetis shown at a reasonable size:
*/
QSize MyGLWidget::sizeHint() const
{
return QSize(600, 400);
}
void MyGLWidget::initializeGL()
{
glClearColor(0.0, 0.0, 0.0, 0.0);//TODO brauch ich das?
glEnable(GL_DEPTH_TEST);//TODO warum genau?
// glEnable(GL_CULL_FACE);//backface culling
// glCullFace(GL_BACK);//backface culling
// glEnable(GL_COLOR_MATERIAL); //Habe ich für glColor3f gebraucht. Wieder raus für Material. //In order to use both color and lighting you must activate openGL color materials
//4.1.1
/*
* The initial state of the OpenGL state machine is defined in
initializeGL(). Furthermore, you can set all OpenGL parameters
that will not change during program execution here as well, for
example, the background color.
*/
glEnable(GL_LIGHTING);//enable lighting.
glEnable(GL_LIGHT0);//enable an OpenGL light
/*
* https://msdn.microsoft.com/en-us/library/windows/desktop/dd373578%28v=vs.85%29.aspx
* The glLightfv function returns light source parameter values.
* GL_POSITION:
* The params parameter contains four floating-point values
* that specify the position of the light in homogeneous object
* coordinates. Both integer and floating-point values are
* mapped directly. Neither integer nor floating-point values
* are clamped.
*/
static GLfloat lightPosition[4] = {0.5, 0.0, 2.0, 1.0};
glLightfv(GL_LIGHT0,GL_POSITION,lightPosition);//set Position of light source.
//HelloGL Example:
/*
qglClearColor(qtPurple.dark());
logo = new QtLogo(this, 64);
logo->setColor(qtGreen.dark());
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glShadeModel(GL_SMOOTH);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_MULTISAMPLE);
static GLfloat lightPosition[4] = { 0.5, 5.0, 7.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
*/
}
void MyGLWidget::paintGL(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(translationX,translationY,cameraZoom);//Kamera sitzt sonst in (0,0,0) und man sieht nichts (duh)
double qubeWidth = 1.0;
double dist = qubeWidth/(double)tesselation;
//4.1.1 Unit Qube + Tesselation + Diffuse Material
{
glBegin(GL_QUADS);
//TODO später einfügen.
// GLfloat specularColor[] = {1,1,1};
// GLfloat shininess[] = {100};//specular exponent
// glMaterialfv(GL_FRONT,GL_SPECULAR,specularColor);
// glMaterialfv(GL_FRONT,GL_SHININESS,shininess);
//vorne // z-Achse
// glColor3f(0,0,1);//blau
GLfloat blue[] = {0,0,1};
glMaterialfv(GL_FRONT,GL_DIFFUSE,blue);
for (int i = 0; i < tesselation; i++){
for (int j = 0; j < tesselation; j++){
glVertex3f(0.5-dist*i,0.5-dist*j,0.5);
glVertex3f(0.5-dist*(i+1),0.5-dist*j,0.5);
glVertex3f(0.5-dist*(i+1),0.5-dist*(j+1),0.5);
glVertex3f(0.5-dist*i,0.5-dist*(j+1),0.5);
}
}
// glVertex3f(0.5, 0.5, 0.5);//4
// glVertex3f(-0.5, 0.5, 0.5);//3
// glVertex3f(-0.5, -0.5, 0.5);//2
// glVertex3f(0.5, -0.5, 0.5);//1
//oben // y-Achse
GLfloat green[] = {0,1,0};
glMaterialfv(GL_FRONT,GL_DIFFUSE,green);
for (int i = 0; i < tesselation; i++){
for (int j = 0; j < tesselation; j++){
glVertex3f(0.5-dist*(i+1), 0.5, 0.5-dist*(j+1));
glVertex3f(0.5-dist*(i+1), 0.5, 0.5-dist*j);
glVertex3f(0.5-dist*i, 0.5, 0.5-dist*j);
glVertex3f(0.5-dist*i, 0.5, 0.5-dist*(j+1));
}
}
//rechts //x-Achse
GLfloat red[] = {1,0,0};
glMaterialfv(GL_FRONT,GL_DIFFUSE,red);
for (int i = 0; i < tesselation; i++){
for (int j = 0; j < tesselation; j++){
glVertex3f(0.5, 0.5-dist*i, 0.5-dist*j);
glVertex3f(0.5, 0.5-dist*(i+1), 0.5-dist*j);
glVertex3f(0.5, 0.5-dist*(i+1), 0.5-dist*(j+1));
glVertex3f(0.5, 0.5-dist*i, 0.5-dist*(j+1));
}
}
//hinten // z-Achse
GLfloat yellow[] = {1,0.9,0};
glMaterialfv(GL_FRONT,GL_DIFFUSE,yellow);
for (int i = 0; i < tesselation; i++){
for (int j = 0; j < tesselation; j++){
glVertex3f(0.5-dist*i, 0.5-dist*(j+1), -0.5);//4
glVertex3f(0.5-dist*(i+1), 0.5-dist*(j+1), -0.5);//3
glVertex3f(0.5-dist*(i+1), 0.5-dist*j, -0.5);//2
glVertex3f(0.5-dist*i, 0.5-dist*j, -0.5);//1
}
}
//links
GLfloat cyan[] = {0,1,1};
glMaterialfv(GL_FRONT,GL_DIFFUSE,cyan);
for (int i = 0; i < tesselation; i++){
for (int j = 0; j < tesselation; j++){
glVertex3f(-0.5, 0.5-dist*i, 0.5-dist*(j+1));
glVertex3f(-0.5, 0.5-dist*(i+1), 0.5-dist*(j+1));
glVertex3f(-0.5, 0.5-dist*(i+1), 0.5-dist*j);
glVertex3f(-0.5, 0.5-dist*i, 0.5-dist*j);
}
}
//unten //-y
GLfloat magenta[] = {1,0,1};
glMaterialfv(GL_FRONT,GL_DIFFUSE,magenta);
for (int i = 0; i < tesselation; i++){
for (int j = 0; j < tesselation; j++){
glVertex3f(0.5-dist*i, -0.5, 0.5-dist*(j+1));
glVertex3f(0.5-dist*i, -0.5, 0.5-dist*j);
glVertex3f(0.5-dist*(i+1), -0.5, 0.5-dist*j);
glVertex3f(0.5-dist*(i+1), -0.5, 0.5-dist*(j+1));
}
}
glEnd();
}
}
void MyGLWidget::resizeGL(int width, int height){
double p = (double)width / (double)height;
qDebug() << "Resize to " << width << "," << height << ", Perspective: " << p;
//old:
// GLInt x = 0;//The lower-left corner of the viewport rectangle, in pixels. The default is (0,0).
// GLInt y = 0;//The lower-left corner of the viewport rectangle, in pixels. The default is (0,0).
// glViewport(x,y,width,height);//The width of the viewport. When an OpenGL context is first attached to a window, width and height are set to the dimensions of that window.
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,p,0.1,1000);//TODO komisch: wenn schmaler als hoch auf einmal grau.
glMatrixMode(GL_MODELVIEW);
}
void MyGLWidget::mousePressEvent(QMouseEvent *event){
rightButtonPressed = false;
if (event->button() == Qt::RightButton){
rightButtonPressed = true;
clickStartPosition = event->pos();
qDebug() << "mouse press at " << clickStartPosition;
}
}
void MyGLWidget:: mouseMoveEvent(QMouseEvent *event){
//This didn't work properly if (event->button() == Qt::RightButton){
if (rightButtonPressed){
QPoint currentPosition = event->pos();
QPoint diff = currentPosition - clickStartPosition;
clickStartPosition = currentPosition;
translationX -= 0.01*diff.x();
translationY += 0.01*diff.y();
updateGL();
}
qDebug() << "mouse move button " << event->button();
}
//4.1.2 User Input: Zooming
void MyGLWidget::wheelEvent(QWheelEvent *event){
cameraZoom += 0.01*event->delta();
qDebug() << "Cam zoom delta " << event->delta() << " stored " << cameraZoom;
updateGL();
}
//4.1.1 slots for shading modes
void MyGLWidget::shadeWireframeSlot(){
qDebug() << "Wireframe selected";
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);//Wireframe looks way cooler with both faces on
updateGL();
}
void MyGLWidget::shadeFlatSlot(){
qDebug() << "Flat selected";
glShadeModel(GL_FLAT);
glPolygonMode(GL_FRONT,GL_FILL);
updateGL();
}
void MyGLWidget::shadeGouraudSlot(){
qDebug() << "Gouraud selected";
glShadeModel(GL_SMOOTH);
glPolygonMode(GL_FRONT,GL_FILL);
updateGL();
}
void MyGLWidget::shadePhongSlot(){
qDebug() << "Phong selected";
updateGL();
}
//4.1.1 tesselation slot
void MyGLWidget::setTessellation(int t){
qDebug() << "Tesselation: " << t;
tesselation = t;
updateGL();
}
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
#include <gl/GLU.h>
#include <QDebug>
#include <QWheelEvent>
class MyGLWidget : public QGLWidget
{
Q_OBJECT //from HelloGL Example
public:
MyGLWidget(QWidget *parent = 0);
~MyGLWidget();
//From HelloGL example.
QSize minimumSizeHint() const;//do I need this?
QSize sizeHint() const;//do I need this?
protected:
//4.1 Core Functionality
void initializeGL();
void paintGL();
void resizeGL(int width, int height);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
private:
int tesselation;
double cameraZoom;
QPoint clickStartPosition;
bool rightButtonPressed;
double translationX, translationY;
public slots:
//4.1.1 slots for shading modes
void shadeWireframeSlot();
void shadeFlatSlot();
void shadeGouraudSlot();
void shadePhongSlot();
void setTessellation(int t);
};
#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