diff options
| -rw-r--r-- | logic/pipeline.cpp | 14 | ||||
| -rw-r--r-- | logic/pipeline.hpp | 8 | 
2 files changed, 17 insertions, 5 deletions
| diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 7774b02e..494d93ff 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -37,6 +37,13 @@ static constexpr inline double d2r = M_PI / 180.;  reltrans::reltrans() {} +void reltrans::on_center() +{ +    interp_pos = { 0, 0, 0 }; +    in_zone = false; +    cur = false; +} +  euler_t reltrans::rotate(const rmat& R, const euler_t& in, vec3_bool disable) const  {      enum { tb_Z, tb_X, tb_Y }; @@ -410,8 +417,11 @@ Pose pipeline::apply_zero_pos(Pose value) const      return value;  } -Pose pipeline::apply_reltrans(Pose value, vec6_bool disabled) +Pose pipeline::apply_reltrans(Pose value, vec6_bool disabled, bool centerp)  { +    if (centerp) +        rel.on_center(); +      value = rel.apply_pipeline(s.reltrans_mode, value,                                 { !!s.reltrans_disable_src_yaw,                                   !!s.reltrans_disable_src_pitch, @@ -483,7 +493,7 @@ void pipeline::logic()              value(i) = map(value(i), m(i));      } -    value = apply_reltrans(value, disabled); +    value = apply_reltrans(value, disabled, center_ordered);      {          // CAVEAT translation only, due to tcomp diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp index 82a339a3..7132a36b 100644 --- a/logic/pipeline.hpp +++ b/logic/pipeline.hpp @@ -40,7 +40,7 @@ using vec3_bool = Mat<bool, 6, 1>;  class reltrans  { -    euler_t interp_pos, last_value; +    euler_t interp_pos;      Timer interp_timer;      // this implements smooth transition into reltrans mode @@ -54,6 +54,8 @@ class reltrans  public:      reltrans(); +    void on_center(); +      warn_result_unused      euler_t rotate(const rmat& rmat, const euler_t& in, vec3_bool disable) const; @@ -80,7 +82,7 @@ struct OTR_LOGIC_EXPORT bits      void set(flags flag_, bool val_);      void negate(flags flag_); -    bool get(flags flag); +    bool get(unsigned flag);      bits();  }; @@ -130,7 +132,7 @@ private:      Pose apply_center(Pose value) const;      std::tuple<Pose, Pose, vec6_bool> get_selected_axis_value(const Pose& newpose) const;      Pose maybe_apply_filter(const Pose& value) const; -    Pose apply_reltrans(Pose value, vec6_bool disabled); +    Pose apply_reltrans(Pose value, vec6_bool disabled, bool centerp);      Pose apply_zero_pos(Pose value) const;      // reminder: float exponent base is 2 | 
