Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GraPa
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
GraPa
Commits
9a9bd4f3
Commit
9a9bd4f3
authored
Nov 21, 2015
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bewegen richtig
parent
e5a95c53
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
controler.cpp
A2/controler.cpp
+11
-6
sceneobject.cpp
A2/sceneobject.cpp
+4
-1
No files found.
A2/controler.cpp
View file @
9a9bd4f3
...
...
@@ -42,13 +42,17 @@ void Controler::mouseMoveEvent(GLView* view, QMouseEvent *event)
bool
ctrlPressed
=
QApplication
::
keyboardModifiers
()
&
Qt
::
ControlModifier
;
if
((
viewMode
==
CAMERA
)
^
ctrlPressed
){
QVector3D
vec
;
if
(
event
->
delta
()
<
0
)
activeView
->
getCamera
()
->
move
(
QVector3D
(
0.0
,
0.0
,
1.0
)
);
vec
=
QVector3D
(
0.0
,
0.0
,
1.0
);
else
activeView
->
getCamera
()
->
move
(
QVector3D
(
0.0
,
0.0
,
-
1.0
));
}
else
if
((
viewMode
==
EDIT
)
^
ctrlPressed
){
vec
=
QVector3D
(
0.0
,
0.0
,
-
1.0
);
if
((
viewMode
==
CAMERA
)
^
ctrlPressed
){
activeView
->
getCamera
()
->
move
(
vec
);
}
else
if
((
viewMode
==
EDIT
)
^
ctrlPressed
){
vec
=
activeView
->
getCamera
()
->
rotation
->
conjugate
().
rotatedVector
(
vec
);
scene
->
moveActive
(
vec
);
}
else
{
qDebug
()
<<
"möp"
<<
viewMode
<<
" "
<<
CAMERA
<<
" "
<<
EDIT
;
}
...
...
@@ -85,7 +89,7 @@ void Controler::rotate(QVector3D *newPos )
if
((
viewMode
==
CAMERA
)
^
ctrlPressed
){
activeView
->
getCamera
()
->
rotate
(
QQuaternion
::
fromAxisAndAngle
(
axis
,
angle
));
}
else
if
((
viewMode
==
EDIT
)
^
ctrlPressed
){
scene
->
rotateActive
(
QQuaternion
::
fromAxisAndAngle
(
axis
,
angle
));
}
else
{
qDebug
()
<<
"möp"
<<
viewMode
<<
" "
<<
CAMERA
<<
" "
<<
EDIT
;
}
...
...
@@ -107,7 +111,8 @@ void Controler::move(QPointF * newPos){
if
((
viewMode
==
CAMERA
)
^
ctrlPressed
){
activeView
->
getCamera
()
->
move
(
QVector3D
(
dx
,
dy
,
0.0
));
}
else
if
((
viewMode
==
EDIT
)
^
ctrlPressed
){
scene
->
moveActive
(
activeView
->
getCamera
()
->
rotation
->
rotatedVector
(
QVector3D
(
dx
,
dy
,
0.0
)));
QVector3D
vec
=
activeView
->
getCamera
()
->
rotation
->
conjugate
().
rotatedVector
(
QVector3D
(
dx
,
dy
,
0.0
));
scene
->
moveActive
(
vec
);
}
else
{
qDebug
()
<<
"möp"
<<
viewMode
<<
" "
<<
CAMERA
<<
" "
<<
EDIT
;
}
...
...
A2/sceneobject.cpp
View file @
9a9bd4f3
...
...
@@ -21,7 +21,10 @@ void SceneObject::move(QVector3D dir)
}
void
SceneObject
::
rotate
(
QQuaternion
rot
)
{
rotation
*=
QQuaternion
(
rotation
*
rot
);
rotation
=
rot
*
rotation
;
}
void
SceneObject
::
draw
(){
qDebug
()
<<
"Drawing abstract Scene Element"
;}
...
...
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