Skip to content
Snippets Groups Projects
Commit daabc5cf authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

mv rotation speed prefactor

parent e76aa01d
No related branches found
No related tags found
1 merge request!1089Img3D: simplify class Canvas
......@@ -98,11 +98,8 @@ void Camera::endTransform(bool keep)
set();
}
void Camera::horizontalTurn(float angle)
void Camera::horizontalTurn(float theta)
{
const float theta = angle * static_cast<float>(M_PI / 180.0); // in radians
// Horizontal camera turn for 3D axes
const CameraParams initial_pos3DAxes = getPos3DAxes();
const F3 v_eye3DAxes = initial_pos3DAxes.eye; // camera's position vector
......@@ -142,11 +139,8 @@ void Camera::horizontalTurn(float angle)
endTransform(true);
}
void Camera::verticalTurn(float angle)
void Camera::verticalTurn(float theta)
{
const float theta = angle * static_cast<float>(M_PI / 180.0); // in radians
// Vertical camera turn for 3D axes
const CameraParams initial_pos3DAxes = getPos3DAxes();
const F3 v_eye3DAxes = initial_pos3DAxes.eye; // camera's position vector
......
......@@ -49,8 +49,8 @@ public:
const F3 lightPosRotated() const { return lightPosRotated1; }
// Flying Camera implementation (similar to Blender's camera system)
void horizontalTurn(float angle);
void verticalTurn(float angle);
void horizontalTurn(float theta);
void verticalTurn(float theta);
signals:
void updated(Camera const&);
......
......@@ -42,9 +42,6 @@ float ZoomOutScale()
return 0.8f;
}
const float rot_speed_h = 0.4f; // camera rotation speed in horizontal direction
const float rot_speed_v = 0.4f; // camera rotation speed in vertical direction
// Default camera position in accordance with RealspaceBuilder.h
const float cameraDefaultPosY = -200.0f; // default camera position on Y axis
const float cameraDefaultPosZ = 120.0f; // default camera position on Z axis
......@@ -230,11 +227,11 @@ void Canvas::mouseMoveEvent(QMouseEvent* e)
if (!isInitialized())
break;
// -ve for consistency with Blender
// minus sign for consistency with Blender; arbitrary prefactor for decent rotation speed
if (delta_x != 0)
m_camera->horizontalTurn(-delta_x * rot_speed_h);
m_camera->horizontalTurn(-0.007f*delta_x);
if (delta_y != 0)
m_camera->verticalTurn(-delta_y * rot_speed_v);
m_camera->verticalTurn(-0.007f*delta_y);
m_lastMouseCoords = e->pos();
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment