Euphoria
orbitcontroller.cc
Go to the documentation of this file.
1 #include "core/orbitcontroller.h"
2 
3 #include "base/range.h"
4 
5 namespace eu::core
6 {
8  : center(zero3f)
9  , horizontal_rotation(Angle::from_degrees(45.0f))
10  , vertical_rotation(Angle::from_degrees(45.0f))
11  {}
12 
13 
14  quatf
16  {
17  const auto hor =
19  (
21  (
22  common::up,
24  )
25  );
26  const auto vert =
28  (
30  (
33  )
34  );
35  return hor * vert;
36  }
37 
38 
39  void
40  OrbitController::on_pan_input(float dx, float dy)
41  {
42  const auto movement = get_rotation().create_from_right_up_in(vec3f
43  {
46  0
47  });
48  center += movement * 0.01f;
49  }
50 
51 
52  void
54  {
56  (
58  );
60 
62  (
64  );
65 
66  const auto r = make_range(-quarter_turn, quarter_turn);
68  }
69 
70  void
72  {
74  }
75 
76 
77  vec3f
79  {
80  return center - get_rotation().get_in() * distance;
81  }
82 }
constexpr unit3f right
Definition: vec3.h:133
constexpr unit3f up
Definition: vec3.h:131
T keep_within(const Range< T > &range, T value)
Definition: range.h:115
constexpr Angle quarter_turn
Definition: angle.h:89
Range< T > make_range(T min, T max)
Definition: range.h:39
size2f max(const size2f lhs, const size2f rhs)
Definition: size2.cc:149
constexpr vec3f zero3f
Definition: vec3.h:95
void wrap()
Definition: angle.cc:19
constexpr static Angle from_degrees(float degrees)
Definition: angle.h:16
static AxisAngle from_right_hand_around(const unit3f &axis, const Angle &angle)
Definition: axisangle.cc:14
void on_pan_input(float dx, float dy)
vec3f get_camera_position() const
void on_rotate_input(float dx, float dy)
float get_multiplier_with_sign() const
Definition: sensitivity.cc:22
Definition: quat.h:15
static quatf from_axis_angle(const AxisAngle &aa)
Definition: quat.cc:23
unit3f get_in() const
Definition: quat.cc:186
vec3f create_from_right_up_in(const vec3f &v) const
returns In*Z + Right*X + Up*Y
Definition: quat.cc:196
Definition: vec3.h:48