summaryrefslogtreecommitdiffhomepage
path: root/logic/pipeline.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-01-06 01:45:44 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-01-10 03:17:08 +0100
commit5ad2275e0e50be8a4e9f506fb3f8dab2b02d0420 (patch)
tree24af38431505363977e08ebcd652d1aebe79fed9 /logic/pipeline.hpp
parentdbacc00b52e294f65a8d292dbcce0f4fc93b5bf0 (diff)
logic/pipeline: conditionalize
Will activate only when looking down or backward. When activating or deactivating, will slowly slide into the new position, no instant movement involved. Issue: #712
Diffstat (limited to 'logic/pipeline.hpp')
-rw-r--r--logic/pipeline.hpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp
index 0cb828e7..dc04d44b 100644
--- a/logic/pipeline.hpp
+++ b/logic/pipeline.hpp
@@ -32,6 +32,27 @@
namespace gui_tracker_impl {
+using rmat = euler::rmat;
+using euler_t = euler::euler_t;
+
+class reltrans
+{
+ euler_t tcomp_interp_pos, tcomp_last_value;
+ Timer tcomp_interp_timer;
+ bool tcomp_state = false;
+ bool tcomp_in_zone = false;
+
+public:
+ reltrans();
+
+ warn_result_unused
+ euler_t rotate(const rmat& rmat, const euler_t& xyz,
+ bool disable_tx, bool disable_ty, bool disable_tz) const;
+
+ warn_result_unused
+ Pose apply_pipeline(bool enable, const Pose& value, const Mat<bool, 6, 1>& disable);
+};
+
using namespace time_units;
struct OTR_LOGIC_EXPORT bits
@@ -55,9 +76,6 @@ class OTR_LOGIC_EXPORT pipeline : private QThread, private bits
{
Q_OBJECT
private:
- using rmat = euler::rmat;
- using euler_t = euler::euler_t;
-
QMutex mtx;
main_settings s;
Mappings& m;
@@ -82,6 +100,8 @@ private:
{}
};
+ reltrans rel;
+
state real_rotation, scaled_rotation;
euler_t t_center;
@@ -91,13 +111,8 @@ private:
double map(double pos, Map& axis);
void logic();
- void t_compensate(const rmat& rmat, const euler_t& ypr, euler_t& output,
- bool disable_tx, bool disable_ty, bool disable_tz);
void run() override;
- static constexpr double r2d = 180. / M_PI;
- static constexpr double d2r = M_PI / 180.;
-
// note: float exponent base is 2
static constexpr double c_mult = 16;
static constexpr double c_div = 1./c_mult;