| 31 | } |
| 32 | |
| 33 | void OrbitCamera::SetPosition(const Maths::vec3& position) { |
| 34 | Camera::SetPosition(position); |
| 35 | m_forward = m_position - m_target; |
| 36 | m_radius = Maths::length(m_forward); |
| 37 | |
| 38 | Maths::Quaternion quat_around_y = Maths::angleAxis(m_yaw_angle, Maths::Vector3(0.0f, 1.0f, 0.0f)); |
| 39 | Maths::Quaternion quat_around_x = Maths::angleAxis(m_pitch_angle, Maths::Vector3(1.0f, 0.0f, 0.0f)); |
| 40 | Maths::Quaternion quat_around_yx = quat_around_y * quat_around_x; |
| 41 | |
| 42 | m_forward = Maths::rotate(Maths::normalize(quat_around_yx), Maths::normalize(m_forward)); |
| 43 | m_position = m_target + (m_radius * m_forward); |
| 44 | m_forward = Maths::normalize(m_position - m_target); |
| 45 | |
| 46 | PerspectiveCamera::UpdateCoordinateVectors(); |
| 47 | PerspectiveCamera::UpdateViewMatrix(); |
| 48 | } |
| 49 | |
| 50 | void OrbitCamera::SetPosition(float yaw_degree, float pitch_degree) { |
| 51 |
nothing calls this directly
no outgoing calls
no test coverage detected