Wayverb
receiver.h
1 #pragma once
2 
3 #include "combined/model/capsule.h"
4 #include "combined/model/hover.h"
5 #include "combined/model/min_size_vector.h"
6 
7 #include "cereal/types/base_class.hpp"
8 
9 namespace wayverb {
10 namespace combined {
11 namespace model {
12 
13 class receiver final : public owning_member<receiver,
14  min_size_vector<capsule, 1>,
15  hover_state> {
16 public:
17  explicit receiver(std::string name = "new receiver",
18  glm::vec3 position = glm::vec3{0},
19  core::orientation orientation = core::orientation{});
20 
21  void set_name(std::string name);
22  std::string get_name() const;
23 
24  void set_position(const glm::vec3& p);
25  glm::vec3 get_position() const;
26 
27  void set_orientation(const core::orientation& orientation);
28  core::orientation get_orientation() const;
29 
30  const auto& capsules() const { return get<0>(); }
31  auto& capsules() { return get<0>(); }
32 
33  using hover_state_t = class hover_state;
34  const auto& hover_state() const { return get<1>(); }
35  auto& hover_state() { return get<1>(); }
36 
37  template <typename Archive>
38  void serialize(Archive& archive) {
39  archive(*capsules(), name_, position_, orientation_);
40  }
41 
42  NOTIFYING_COPY_ASSIGN_DECLARATION(receiver)
43 private:
44  void swap(receiver& other) noexcept {
45  using std::swap;
46  swap(name_, other.name_);
47  swap(position_, other.position_);
48  swap(orientation_, other.orientation_);
49  }
50 
51  std::string name_;
52  glm::vec3 position_;
53  core::orientation orientation_;
54 };
55 
56 bool operator==(const receiver& a, const receiver& b);
57 bool operator!=(const receiver& a, const receiver& b);
58 
60 
62 
63 } // namespace model
64 } // namespace combined
65 } // namespace wayverb
Definition: receiver.h:13
Definition: capsule_base.h:9
A vector which must hold some minimum number of elements.
Definition: min_size_vector.h:11
Invariant: pointing_ is a unit vector.
Definition: orientation.h:15