Wayverb
orientation.h
1 #pragma once
2 
3 #include "glm/glm.hpp"
4 
5 namespace wayverb {
6 namespace core {
7 
8 
13 
15 class orientation final {
16 public:
17  explicit orientation(const glm::vec3& pointing = {0, 0, -1},
18  const glm::vec3& up = {0, 1, 0});
19 
20  glm::vec3 get_pointing() const;
21  void set_pointing(const glm::vec3& u);
22 
23  glm::vec3 get_up() const;
24  void set_up(const glm::vec3& u);
25 
26  glm::mat4 get_matrix() const;
27 
28  template <typename Archive>
29  void serialize(Archive&);
30 
31 private:
32  glm::vec3 pointing_;
33  glm::vec3 up_;
34 };
35 
36 bool operator==(const orientation& a, const orientation& b);
37 bool operator!=(const orientation& a, const orientation& b);
38 
39 orientation combine(const orientation& a, const orientation& b);
40 
41 // Given an object, oriented relative to world-space, and a vector direction
42 // relative to world-space, find the vector direction relative to the
43 // oriented object.
44 glm::vec3 transform(const orientation& orientation, const glm::vec3& vec);
45 
46 } // namespace core
47 } // namespace wayverb
Definition: traits.cpp:2
Definition: capsule_base.h:9
Invariant: pointing_ is a unit vector.
Definition: orientation.h:15