💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.2 KiB

  1. /*
  2. * Copyright (C) 2020 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ANTKEEPER_ORBIT_CAM_HPP
  20. #define ANTKEEPER_ORBIT_CAM_HPP
  21. #include "camera-rig.hpp"
  22. /**
  23. * Rig which orbits around a focal point.
  24. */
  25. class orbit_cam: public camera_rig
  26. {
  27. public:
  28. orbit_cam();
  29. virtual ~orbit_cam();
  30. virtual void update(float dt);
  31. /// @param direction Specifies the movement direction and speed scale on the XZ plane
  32. void move(const float2& direction);
  33. void rotate(float angle);
  34. void tilt(float angle);
  35. void zoom(float distance);
  36. void set_focal_point(const float3& point);
  37. void set_focal_distance(float distance);
  38. void set_elevation(float angle);
  39. void set_azimuth(float angle);
  40. void set_target_focal_point(const float3& point);
  41. void set_target_focal_distance(float distance);
  42. void set_target_elevation(float angle);
  43. void set_target_azimuth(float angle);
  44. const float3& get_focal_point() const;
  45. float get_focal_distance() const;
  46. float get_elevation() const;
  47. float get_azimuth() const;
  48. const float3& get_target_focal_point() const;
  49. float get_target_focal_distance() const;
  50. float get_target_elevation() const;
  51. float get_target_azimuth() const;
  52. const float3& get_target_translation() const;
  53. const vmq::quaternion<float>& get_target_rotation() const;
  54. private:
  55. float3 focal_point;
  56. float focal_distance;
  57. float elevation;
  58. float azimuth;
  59. float3 target_focal_point;
  60. float target_focal_distance;
  61. float target_elevation;
  62. float target_azimuth;
  63. vmq::quaternion<float> elevation_rotation;
  64. vmq::quaternion<float> azimuth_rotation;
  65. vmq::quaternion<float> target_elevation_rotation;
  66. vmq::quaternion<float> target_azimuth_rotation;
  67. vmq::quaternion<float> target_rotation;
  68. float3 target_translation;
  69. };
  70. inline const float3& orbit_cam::get_focal_point() const
  71. {
  72. return focal_point;
  73. }
  74. inline float orbit_cam::get_focal_distance() const
  75. {
  76. return focal_distance;
  77. }
  78. inline float orbit_cam::get_elevation() const
  79. {
  80. return elevation;
  81. }
  82. inline float orbit_cam::get_azimuth() const
  83. {
  84. return azimuth;
  85. }
  86. inline const float3& orbit_cam::get_target_focal_point() const
  87. {
  88. return target_focal_point;
  89. }
  90. inline float orbit_cam::get_target_focal_distance() const
  91. {
  92. return target_focal_distance;
  93. }
  94. inline float orbit_cam::get_target_elevation() const
  95. {
  96. return target_elevation;
  97. }
  98. inline float orbit_cam::get_target_azimuth() const
  99. {
  100. return target_azimuth;
  101. }
  102. inline const float3& orbit_cam::get_target_translation() const
  103. {
  104. return target_translation;
  105. }
  106. inline const vmq::quaternion<float>& orbit_cam::get_target_rotation() const
  107. {
  108. return target_rotation;
  109. }
  110. #endif // ANTKEEPER_ORBIT_CAM_HPP