💿🐜 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.

85 lines
2.8 KiB

  1. /*
  2. * Copyright (C) 2023 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_NEST_SELECTION_STATE_HPP
  20. #define ANTKEEPER_NEST_SELECTION_STATE_HPP
  21. #include "game/states/game-state.hpp"
  22. #include <engine/entity/id.hpp>
  23. #include <engine/math/vector.hpp>
  24. #include <engine/render/model.hpp>
  25. #include <engine/animation/ik/solvers/ccd-ik-solver.hpp>
  26. #include <engine/scene/light-probe.hpp>
  27. class nest_selection_state: public game_state
  28. {
  29. public:
  30. explicit nest_selection_state(::game& ctx);
  31. virtual ~nest_selection_state();
  32. private:
  33. void create_first_person_camera_rig();
  34. void destroy_first_person_camera_rig();
  35. void set_first_person_camera_rig_pedestal(float pedestal);
  36. void move_first_person_camera_rig(const math::fvec2& direction, float factor);
  37. void satisfy_first_person_camera_rig_constraints();
  38. void setup_controls();
  39. void enable_controls();
  40. void disable_controls();
  41. std::vector<std::shared_ptr<::event::subscription>> action_subscriptions;
  42. std::shared_ptr<::event::subscription> mouse_motion_subscription;
  43. std::shared_ptr<render::model> worker_model;
  44. bool mouse_look{false};
  45. bool mouse_drag{false};
  46. bool adjust_exposure{false};
  47. bool adjust_time{false};
  48. bool moving{false};
  49. math::fvec2 movement_direction{0.0f, 0.0f};
  50. float movement_speed{0.0f};
  51. entity::id worker_ant_eid;
  52. entity::id larva_eid;
  53. entity::id first_person_camera_rig_eid;
  54. float first_person_camera_rig_translation_spring_angular_frequency;
  55. float first_person_camera_rig_rotation_spring_angular_frequency;
  56. float first_person_camera_rig_fov_spring_angular_frequency;
  57. float first_person_camera_rig_min_elevation;
  58. float first_person_camera_rig_max_elevation;
  59. float first_person_camera_near_fov;
  60. float first_person_camera_far_fov;
  61. float first_person_camera_near_speed;
  62. float first_person_camera_far_speed;
  63. float first_person_camera_rig_pedestal_speed;
  64. float first_person_camera_rig_pedestal;
  65. double first_person_camera_yaw{0.0};
  66. double first_person_camera_pitch{0.0};
  67. std::shared_ptr<ccd_ik_solver> larva_ik_solver;
  68. std::shared_ptr<scene::light_probe> sky_probe;
  69. };
  70. #endif // ANTKEEPER_NEST_SELECTION_STATE_HPP