Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
f67da57b
Commit
f67da57b
authored
Jul 06, 2019
by
chili
Browse files
prevent +/-PI pitch (camera look at does not like that)
parent
cdb56818
Changes
1
Hide whitespace changes
Inline
Side-by-side
hw3d/Camera.cpp
View file @
f67da57b
...
...
@@ -35,7 +35,7 @@ void Camera::SpawnControlWindow() noexcept
ImGui
::
SliderFloat
(
"Y"
,
&
pos
.
y
,
-
80.0
f
,
80.0
f
,
"%.1f"
);
ImGui
::
SliderFloat
(
"Z"
,
&
pos
.
z
,
-
80.0
f
,
80.0
f
,
"%.1f"
);
ImGui
::
Text
(
"Orientation"
);
ImGui
::
SliderAngle
(
"Pitch"
,
&
pitch
,
-
90.0
f
,
90.0
f
);
ImGui
::
SliderAngle
(
"Pitch"
,
&
pitch
,
0.995
f
*
-
90.0
f
,
0.995
f
*
90.0
f
);
ImGui
::
SliderAngle
(
"Yaw"
,
&
yaw
,
-
180.0
f
,
180.0
f
);
if
(
ImGui
::
Button
(
"Reset"
)
)
{
...
...
@@ -55,7 +55,7 @@ void Camera::Reset() noexcept
void
Camera
::
Rotate
(
float
dx
,
float
dy
)
noexcept
{
yaw
=
wrap_angle
(
yaw
+
dx
*
rotationSpeed
);
pitch
=
std
::
clamp
(
pitch
+
dy
*
rotationSpeed
,
-
PI
/
2.0
f
,
PI
/
2.0
f
);
pitch
=
std
::
clamp
(
pitch
+
dy
*
rotationSpeed
,
0.995
f
*
-
PI
/
2.0
f
,
0.995
f
*
PI
/
2.0
f
);
}
void
Camera
::
Translate
(
DirectX
::
XMFLOAT3
translation
)
noexcept
...
...
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