From: <sv...@ww...> - 2005-06-19 18:21:04
|
Author: mkrose Date: 2005-06-19 11:20:58 -0700 (Sun, 19 Jun 2005) New Revision: 1574 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Include/Views/CameraKinematics.h trunk/CSP/CSPSim/Source/Views/CameraKinematics.cpp Log: Reduce the sensitivity of the camera panning (mouse and keyboard) when the field of view is narrow. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1574 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2005-06-19 18:20:27 UTC (rev 1573) +++ trunk/CSP/CSPSim/CHANGES.current 2005-06-19 18:20:58 UTC (rev 1574) @@ -5,6 +5,9 @@ * Add an extra side leaning movement of the torso when looking down in the cockpit to help see around obstacles. + * Reduce the sensitivity of the camera panning (mouse and keyboard) when + the field of view is narrow. + 2005-06-18: onsight * Convert F16 UFC to use InputEventChannels instead of static event handlers. ICP button events can then be captured by the UFC system Modified: trunk/CSP/CSPSim/Include/Views/CameraKinematics.h =================================================================== --- trunk/CSP/CSPSim/Include/Views/CameraKinematics.h 2005-06-19 18:20:27 UTC (rev 1573) +++ trunk/CSP/CSPSim/Include/Views/CameraKinematics.h 2005-06-19 18:20:58 UTC (rev 1574) @@ -35,12 +35,13 @@ const float m_MinimumDistanceOffset, m_AbsoluteMaximumDistance; double m_Phi, m_Theta; + float m_FOVScale; float m_PanRatePhi, m_PanRateTheta, m_ZoomRate; double m_DistanceToObject, m_MinimumDistance; double m_Accel; bool m_ExternalPan; - void rotateTheta(double dt) { m_Theta += m_Accel * m_PanRateTheta * dt; } - void rotatePhi(double dt) { m_Phi += m_Accel * m_PanRatePhi * dt; } + void rotateTheta(double dt) { m_Theta += m_Accel * m_PanRateTheta * dt * m_FOVScale; } + void rotatePhi(double dt) { m_Phi += m_Accel * m_PanRatePhi * dt * m_FOVScale; } void scale(double dt); float smooth(double value, float min_value,float max_value) const; public: Modified: trunk/CSP/CSPSim/Source/Views/CameraKinematics.cpp =================================================================== --- trunk/CSP/CSPSim/Source/Views/CameraKinematics.cpp 2005-06-19 18:20:27 UTC (rev 1573) +++ trunk/CSP/CSPSim/Source/Views/CameraKinematics.cpp 2005-06-19 18:20:58 UTC (rev 1574) @@ -47,6 +47,7 @@ if (m_PanRateTheta != 0.0 || m_PanRatePhi != 0.0) { m_Accel = std::min(3.0, m_Accel + 1.0 * dt); } + m_FOVScale = std::min(CSPSim::theSim->getScene()->getViewAngle() / 40.0, 1.0); rotateTheta(dt); rotatePhi(dt); scale(dt); @@ -69,10 +70,11 @@ m_DisplacementCoefficient(0.001), m_MinimumDistanceOffset(10.0), m_AbsoluteMaximumDistance(80000.0), - m_Accel(1.0) { + m_FOVScale(1.0), + m_Accel(1.0), + m_ExternalPan(false) { reset(); } - void CameraKinematics::clampPhi(float min_phi, float max_phi, bool smooth_on) { if (smooth_on && m_PanRatePhi != 0.0) { m_PanRatePhi = simdata::sign(m_PanRatePhi) * smooth(m_Phi, min_phi, max_phi) * m_BaseRate; @@ -163,8 +165,8 @@ m_PanRatePhi = 0.0; m_PanRateTheta = 0.0; m_Accel = std::min(3.0, m_Accel + 0.1 * (dx * dx + dy * dy)); - m_Theta -= dx * m_Accel * m_DisplacementCoefficient; - m_Phi -= dy * m_Accel * m_DisplacementCoefficient; + m_Theta -= dx * m_Accel * m_DisplacementCoefficient * m_FOVScale; + m_Phi -= dy * m_Accel * m_DisplacementCoefficient * m_FOVScale; m_ExternalPan = true; } |