Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
C-Fu
OpenGL
Commits
3be5793f
Commit
3be5793f
authored
Jan 08, 2017
by
Anakin
Browse files
limit pitch to [-90,90]
parent
f5ee8a97
Changes
2
Hide whitespace changes
Inline
Side-by-side
QtMeshViewer/Source/OglViewerWidget.cpp
View file @
3be5793f
...
...
@@ -72,17 +72,19 @@ void OglViewerWidget::mouseMoveEvent(QMouseEvent *e)
}
else
if
(
m_rotDirections
.
x
&&
m_rotDirections
.
y
&&
!
m_rotDirections
.
z
)
{
//float pitch, yaw, roll;
//m_rotation.getEulerAngles(&pitch, &yaw, &roll);
//pitch += diff.y() * 0.5;
//yaw += diff.x() * 0.5;
//std::cout << pitch << " - " << yaw << std::endl;
float
pitch
,
yaw
,
roll
;
m_rotation
.
getEulerAngles
(
&
pitch
,
&
yaw
,
&
roll
);
//m_rotation = QQuaternion::fromEulerAngles(pitch, yaw, roll);
pitch
+=
diff
.
y
()
*
0.5
;
yaw
+=
diff
.
x
()
*
0.5
;
m_rotation
=
QQuaternion
::
fromAxisAndAngle
(
QVector3D
(
0.0
,
1.0
,
0.0
).
normalized
(),
diff
.
x
()
*
0.5
)
+
m_rotation
;
m_rotation
=
QQuaternion
::
fromAxisAndAngle
(
QVector3D
(
1.0
,
0.0
,
0.0
).
normalized
(),
diff
.
y
()
*
0.5
)
+
m_rotation
;
if
(
pitch
>
89
)
pitch
=
89
;
else
if
(
pitch
<
-
89
)
pitch
=
-
89
;
m_rotation
=
QQuaternion
::
fromEulerAngles
(
pitch
,
yaw
,
roll
);
}
else
if
(
m_rotDirections
.
x
&&
!
m_rotDirections
.
y
&&
!
m_rotDirections
.
z
)
...
...
@@ -97,6 +99,29 @@ void OglViewerWidget::mouseMoveEvent(QMouseEvent *e)
{
m_rotation
=
QQuaternion
::
fromAxisAndAngle
(
QVector3D
(
0.0
,
0.0
,
1.0
).
normalized
(),
diff
.
x
()
*
0.5
)
*
m_rotation
;
}
else
if
(
m_rotDirections
.
x
&&
!
m_rotDirections
.
y
&&
m_rotDirections
.
z
)
{
float
pitch
,
yaw
,
roll
;
m_rotation
.
getEulerAngles
(
&
pitch
,
&
yaw
,
&
roll
);
roll
-=
diff
.
y
()
*
0.5
;
yaw
+=
diff
.
x
()
*
0.5
;
m_rotation
=
QQuaternion
::
fromEulerAngles
(
pitch
,
yaw
,
roll
);
}
else
if
(
!
m_rotDirections
.
x
&&
m_rotDirections
.
y
&&
m_rotDirections
.
z
)
{
float
pitch
,
yaw
,
roll
;
m_rotation
.
getEulerAngles
(
&
pitch
,
&
yaw
,
&
roll
);
pitch
+=
diff
.
y
()
*
0.5
;
roll
+=
diff
.
x
()
*
0.5
;
if
(
pitch
>
89
)
pitch
=
89
;
else
if
(
pitch
<
-
89
)
pitch
=
-
89
;
m_rotation
=
QQuaternion
::
fromEulerAngles
(
pitch
,
yaw
,
roll
);
}
// request an update
...
...
Release/QtMeshViewer.exe
View file @
3be5793f
No preview for this file type
Write
Preview
Supports
Markdown
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