Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
grapa_alisa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alisa Jung
grapa_alisa
Commits
4332f836
Commit
4332f836
authored
Nov 01, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fertig bis trackball
parent
3ebc80d3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
150 additions
and
38 deletions
+150
-38
mainwindow.cpp
helloqube/mainwindow.cpp
+6
-0
mainwindow.h
helloqube/mainwindow.h
+2
-0
myglwidget.cpp
helloqube/myglwidget.cpp
+125
-37
myglwidget.h
helloqube/myglwidget.h
+17
-1
No files found.
helloqube/mainwindow.cpp
View file @
4332f836
...
...
@@ -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
()
...
...
helloqube/mainwindow.h
View file @
4332f836
...
...
@@ -47,6 +47,8 @@ private:
QAction
*
shadePhongAction
;
QActionGroup
*
shaderGroup
;
QAction
*
resetCameraAction
;
//Widgets
MyGLWidget
*
myGLWidget
;
...
...
helloqube/myglwidget.cpp
View file @
4332f836
This diff is collapsed.
Click to expand it.
helloqube/myglwidget.h
View file @
4332f836
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment