@@ -51,8 +51,9 @@ void CCamera::Rotate(float XAmount, float YAmount)
5151void CCamera::Zoom (float Amount)
5252{
5353 if (mMode == ECameraMoveMode::Free)
54+ {
5455 mPosition += mDirection * (Amount * mMoveSpeed );
55-
56+ }
5657 else
5758 {
5859 mOrbitDistance -= Amount * mMoveSpeed ;
@@ -83,32 +84,36 @@ void CCamera::ProcessKeyInput(FKeyInputs KeyFlags, double DeltaTime)
8384 const auto is_shift_pressed = (KeyFlags & EKeyInput::Shift) != 0 ;
8485 mMoveSpeed = is_shift_pressed ? 2 .0f : default_move_speed;
8586
86- if (KeyFlags & EKeyInput::W) Zoom (FDeltaTime * 25 .f );
87- if (KeyFlags & EKeyInput::S) Zoom (-FDeltaTime * 25 .f );
88- if (KeyFlags & EKeyInput::Q) Pan (0 , -FDeltaTime * 25 .f );
89- if (KeyFlags & EKeyInput::E) Pan (0 , FDeltaTime * 25 .f );
90- if (KeyFlags & EKeyInput::A) Pan (-FDeltaTime * 25 .f , 0 );
91- if (KeyFlags & EKeyInput::D) Pan (FDeltaTime * 25 .f , 0 );
87+ if (( KeyFlags & EKeyInput::W) != 0 ) Zoom (FDeltaTime * 25 .f );
88+ if (( KeyFlags & EKeyInput::S) != 0 ) Zoom (-FDeltaTime * 25 .f );
89+ if (( KeyFlags & EKeyInput::Q) != 0 ) Pan (0 , -FDeltaTime * 25 .f );
90+ if (( KeyFlags & EKeyInput::E) != 0 ) Pan (0 , FDeltaTime * 25 .f );
91+ if (( KeyFlags & EKeyInput::A) != 0 ) Pan (-FDeltaTime * 25 .f , 0 );
92+ if (( KeyFlags & EKeyInput::D) != 0 ) Pan (FDeltaTime * 25 .f , 0 );
9293}
9394
9495void CCamera::ProcessMouseInput (FKeyInputs KeyFlags, FMouseInputs MouseFlags, float XMovement, float YMovement)
9596{
9697 // Free Camera
9798 if (mMode == ECameraMoveMode::Free)
9899 {
99- if (MouseFlags & EMouseInput::MiddleButton)
100+ if (( MouseFlags & EMouseInput::MiddleButton) != 0 )
100101 {
101- if (KeyFlags & EKeyInput::Ctrl) Zoom (-YMovement * 0 .2f );
102- else Pan (-XMovement, YMovement);
102+ if ((KeyFlags & EKeyInput::Ctrl) != 0 )
103+ Zoom (-YMovement * 0 .2f );
104+ else
105+ Pan (-XMovement, YMovement);
106+ }
107+ else if ((MouseFlags & EMouseInput::RightButton) != 0 )
108+ {
109+ Rotate (XMovement, YMovement);
103110 }
104-
105- else if (MouseFlags & EMouseInput::RightButton) Rotate (XMovement, YMovement);
106111 }
107-
108- // Orbit Camera
109112 else if (mMode == ECameraMoveMode::Orbit)
110113 {
111- if ((MouseFlags & EMouseInput::MiddleButton) || (MouseFlags & EMouseInput::RightButton))
114+ // Orbit Camera
115+
116+ if ((MouseFlags & EMouseInput::MiddleButton) != 0 || (MouseFlags & EMouseInput::RightButton) != 0 )
112117 Pan (-XMovement, YMovement);
113118 }
114119}
0 commit comments