Skip to content

Commit

Permalink
[3d] Increase the range of camera tilt from [0-80] degrees to [0-180]
Browse files Browse the repository at this point in the history
Previously the changing camera's pitch (tilting the view) would stop
when the camera view is nearly parallel with the horizon. Now it will
be also possible to look up.

Let's see how this will work - we can always switch back in case of problems.
  • Loading branch information
wonder-sk committed Jun 30, 2018
1 parent 78491a6 commit 7b751cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/3d/qgscameracontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ QPointF screen_point_to_point_on_plane( const QPointF &pt, const QRect &viewport

void QgsCameraController::rotateCamera( float diffPitch, float diffYaw )
{
if ( mCameraData.pitch + diffPitch > 80 )
diffPitch = 80 - mCameraData.pitch; // prevent going under the plane
if ( mCameraData.pitch + diffPitch > 180 )
diffPitch = 180 - mCameraData.pitch; // prevent going over the head
if ( mCameraData.pitch + diffPitch < 0 )
diffPitch = 0 - mCameraData.pitch; // prevent going over the head

Expand Down Expand Up @@ -353,8 +353,8 @@ void QgsCameraController::frameTriggered( float dt )
mCameraData.x = mCameraData.y = 0;
}

if ( mCameraData.pitch > 80 )
mCameraData.pitch = 80; // prevent going under the plane
if ( mCameraData.pitch > 180 )
mCameraData.pitch = 180; // prevent going over the head
if ( mCameraData.pitch < 0 )
mCameraData.pitch = 0; // prevent going over the head
if ( mCameraData.dist < 10 )
Expand Down

0 comments on commit 7b751cb

Please sign in to comment.