bool CameraCtrl_Fly::OnControllerInput(Camera* camera, ControllerInput const& input) { CameraView& view = camera->GetView(); if (input.m_type == eCIT_Key) { mat4 cam_to_world_mat(view.m_transform.GetRotation()); vec3 right = cam_to_world_mat.v0.xyz; vec3 up = cam_to_world_mat.v1.xyz; vec3 front = -cam_to_world_mat.v2.xyz; view.m_transform.GetTranslation() += (right * input.m_delta.x + up * input.m_delta.z + front * input.m_delta.y) * m_strafe_speed; } else if (input.m_type == eCIT_Mouse) { // TODO : arcball rotation quat YawPitchRoll(quat::fromeuler_xyz(input.m_delta.y * m_rotation_speed, input.m_delta.x * m_rotation_speed, 0.0f)); view.m_transform.SetRotation(view.m_transform.GetRotation() * YawPitchRoll); } return true; }
BOHGE_FORCEINLINE void RotateXYZ(const T& x, const T& y, const T& z) { YawPitchRoll( y, x, z); }