diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-09-22 16:47:59 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-09-22 16:51:51 +0200 |
commit | e36f509d2459ca74c0dc7fe2e8ea2275b88f0649 (patch) | |
tree | 2f62ae2004ef9fb2dcaceb7ded7bd404e41bbd92 | |
parent | 4063f006285db0473046bde645f236c814460eb0 (diff) |
api: expose raw data to protocols
Issue: #975
-rw-r--r-- | api/plugin-api.hpp | 2 | ||||
-rw-r--r-- | logic/pipeline.cpp | 4 | ||||
-rw-r--r-- | proto-flightgear/ftnoir_protocol_fg.cpp | 2 | ||||
-rw-r--r-- | proto-flightgear/ftnoir_protocol_fg.h | 2 | ||||
-rw-r--r-- | proto-ft/ftnoir_protocol_ft.cpp | 9 | ||||
-rw-r--r-- | proto-ft/ftnoir_protocol_ft.h | 2 | ||||
-rw-r--r-- | proto-iokit-foohid/iokitprotocol.cpp | 2 | ||||
-rw-r--r-- | proto-iokit-foohid/iokitprotocol.h | 2 | ||||
-rw-r--r-- | proto-libevdev/ftnoir_protocol_libevdev.cpp | 2 | ||||
-rw-r--r-- | proto-libevdev/ftnoir_protocol_libevdev.h | 2 | ||||
-rw-r--r-- | proto-mouse/ftnoir_protocol_mouse.cpp | 2 | ||||
-rw-r--r-- | proto-mouse/ftnoir_protocol_mouse.h | 2 | ||||
-rw-r--r-- | proto-simconnect/ftnoir_protocol_sc.cpp | 2 | ||||
-rw-r--r-- | proto-simconnect/ftnoir_protocol_sc.h | 2 | ||||
-rw-r--r-- | proto-udp/ftnoir_protocol_ftn.cpp | 2 | ||||
-rw-r--r-- | proto-udp/ftnoir_protocol_ftn.h | 2 | ||||
-rw-r--r-- | proto-vjoystick/vjoystick.cpp | 2 | ||||
-rw-r--r-- | proto-vjoystick/vjoystick.h | 2 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine.cpp | 2 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine.h | 2 |
20 files changed, 28 insertions, 21 deletions
diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp index 892f3500..e49530d2 100644 --- a/api/plugin-api.hpp +++ b/api/plugin-api.hpp @@ -160,7 +160,7 @@ struct OTR_API_EXPORT IProtocol : module_status_mixin // called 250 times a second with XYZ yaw pitch roll pose // try not to perform intense computation here. use a thread. - virtual void pose(const double* headpose) = 0; + virtual void pose(const double* pose, const double* raw) = 0; // return game name or placeholder text virtual QString game_name() = 0; }; diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 1bd5c736..e6f82063 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -468,7 +468,7 @@ ok: value = apply_zero_pos(value); ev.run_events(EV::ev_finished, value); - libs.pProtocol->pose(value); + libs.pProtocol->pose(value, raw); QMutexLocker foo(&mtx); output_pose = value; @@ -575,7 +575,7 @@ void pipeline::run() // filter may inhibit exact origin Pose p; - libs.pProtocol->pose(p); + libs.pProtocol->pose(p, p); for (int i = 0; i < 6; i++) { diff --git a/proto-flightgear/ftnoir_protocol_fg.cpp b/proto-flightgear/ftnoir_protocol_fg.cpp index 4c2156ac..d777d801 100644 --- a/proto-flightgear/ftnoir_protocol_fg.cpp +++ b/proto-flightgear/ftnoir_protocol_fg.cpp @@ -13,7 +13,7 @@ // For Todd and Arda Kutlu -void flightgear::pose(const double* headpose) { +void flightgear::pose(const double* headpose, const double*) { FlightData.x = -headpose[TX] * 1e-2; FlightData.y = headpose[TY] * 1e-2; FlightData.z = headpose[TZ] * 1e-2; diff --git a/proto-flightgear/ftnoir_protocol_fg.h b/proto-flightgear/ftnoir_protocol_fg.h index 4b4efa29..3a08b546 100644 --- a/proto-flightgear/ftnoir_protocol_fg.h +++ b/proto-flightgear/ftnoir_protocol_fg.h @@ -44,7 +44,7 @@ class flightgear : TR, public IProtocol Q_OBJECT public: - void pose(const double *headpose) override; + void pose(const double *headpose, const double*) override; QString game_name() override { return tr("FlightGear"); } module_status initialize() override; private: diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index 46879475..4f41c21c 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -51,7 +51,7 @@ static std::int32_t load(std::int32_t volatile& place) return InterlockedCompareExchange((volatile LONG*) &place, 0, 0); } -void freetrack::pose(const double* headpose) +void freetrack::pose(const double* headpose, const double* raw) { constexpr double d2r = M_PI/180; @@ -76,6 +76,13 @@ void freetrack::pose(const double* headpose) store(data->Pitch, pitch); store(data->Roll, roll); + store(data->RawYaw, float(-raw[Yaw] * d2r)); + store(data->RawPitch, float(raw[Pitch] * d2r)); + store(data->RawRoll, float(raw[Roll] * d2r)); + store(data->RawX, float(raw[TX] * 10)); + store(data->RawY, float(raw[TY] * 10)); + store(data->RawZ, float(raw[TZ] * 10)); + const std::int32_t id = load(ft->GameID); if (intGameID != id) diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h index 0056721c..a59796dd 100644 --- a/proto-ft/ftnoir_protocol_ft.h +++ b/proto-ft/ftnoir_protocol_ft.h @@ -42,7 +42,7 @@ public: freetrack() = default; ~freetrack() override; module_status initialize() override; - void pose(const double* pose) override; + void pose(const double* pose, const double*) override; QString game_name() override; private: settings s; diff --git a/proto-iokit-foohid/iokitprotocol.cpp b/proto-iokit-foohid/iokitprotocol.cpp index b66aeb7b..6f163d8f 100644 --- a/proto-iokit-foohid/iokitprotocol.cpp +++ b/proto-iokit-foohid/iokitprotocol.cpp @@ -47,7 +47,7 @@ static uint8_t valueToStick(FooHIDJoystick *stick, double min, double value, dou stick->minValue() + stick->range())); } -void IOKitProtocol::pose(const double *headpose) +void IOKitProtocol::pose(const double *headpose, const double*) { const uint8_t x = valueToStick(joystick.get(), -75., headpose[0], +75.); const uint8_t y = valueToStick(joystick.get(), -75., headpose[1], +75.); diff --git a/proto-iokit-foohid/iokitprotocol.h b/proto-iokit-foohid/iokitprotocol.h index 2590b382..8148e7ab 100644 --- a/proto-iokit-foohid/iokitprotocol.h +++ b/proto-iokit-foohid/iokitprotocol.h @@ -19,7 +19,7 @@ public: IOKitProtocol(); module_status initialize() override; - void pose(const double *headpose) final; + void pose(const double *headpose, const double*) final; QString game_name() final; private: diff --git a/proto-libevdev/ftnoir_protocol_libevdev.cpp b/proto-libevdev/ftnoir_protocol_libevdev.cpp index 72c05dc5..5b07beff 100644 --- a/proto-libevdev/ftnoir_protocol_libevdev.cpp +++ b/proto-libevdev/ftnoir_protocol_libevdev.cpp @@ -102,7 +102,7 @@ evdev::~evdev() libevdev_free(dev); } -void evdev::pose(const double* headpose) { +void evdev::pose(const double* headpose, const double*) { static const int axes[] = { /* translation goes first */ ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ diff --git a/proto-libevdev/ftnoir_protocol_libevdev.h b/proto-libevdev/ftnoir_protocol_libevdev.h index 34032396..0b0f2612 100644 --- a/proto-libevdev/ftnoir_protocol_libevdev.h +++ b/proto-libevdev/ftnoir_protocol_libevdev.h @@ -21,7 +21,7 @@ class evdev : public TR, public IProtocol public: evdev(); ~evdev() override; - void pose(const double *headpose) override; + void pose(const double *headpose, const double*) override; QString game_name() override { return tr("Virtual joystick for Linux"); } module_status initialize() override; diff --git a/proto-mouse/ftnoir_protocol_mouse.cpp b/proto-mouse/ftnoir_protocol_mouse.cpp index 40e28c32..aed49f2b 100644 --- a/proto-mouse/ftnoir_protocol_mouse.cpp +++ b/proto-mouse/ftnoir_protocol_mouse.cpp @@ -24,7 +24,7 @@ static const double invert[] = { 1., -1., 1. }; -void mouse::pose(const double* headpose) +void mouse::pose(const double* headpose, const double*) { const int axis_x = s.mouse_x - 1; const int axis_y = s.mouse_y - 1; diff --git a/proto-mouse/ftnoir_protocol_mouse.h b/proto-mouse/ftnoir_protocol_mouse.h index b7cf61cf..9b52a053 100644 --- a/proto-mouse/ftnoir_protocol_mouse.h +++ b/proto-mouse/ftnoir_protocol_mouse.h @@ -29,7 +29,7 @@ class mouse : public TR, public IProtocol public: mouse() = default; module_status initialize() override { return status_ok(); } - void pose(const double* headpose) override; + void pose(const double* headpose, const double*) override; QString game_name() override; }; diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp index 42cdf596..226a427b 100644 --- a/proto-simconnect/ftnoir_protocol_sc.cpp +++ b/proto-simconnect/ftnoir_protocol_sc.cpp @@ -89,7 +89,7 @@ void simconnect::run() CloseHandle(event); } -void simconnect::pose(const double* pose) +void simconnect::pose(const double* pose, const double*) { QMutexLocker l(&mtx); diff --git a/proto-simconnect/ftnoir_protocol_sc.h b/proto-simconnect/ftnoir_protocol_sc.h index a51d1518..28b9b1d8 100644 --- a/proto-simconnect/ftnoir_protocol_sc.h +++ b/proto-simconnect/ftnoir_protocol_sc.h @@ -42,7 +42,7 @@ public: simconnect() = default; ~simconnect() override; module_status initialize() override; - void pose(const double* headpose) override; + void pose(const double* headpose, const double*) override; QString game_name() override; void run() override; diff --git a/proto-udp/ftnoir_protocol_ftn.cpp b/proto-udp/ftnoir_protocol_ftn.cpp index 000a0a79..f04f4f4c 100644 --- a/proto-udp/ftnoir_protocol_ftn.cpp +++ b/proto-udp/ftnoir_protocol_ftn.cpp @@ -21,7 +21,7 @@ udp::udp() Qt::DirectConnection); } -void udp::pose(const double *headpose) +void udp::pose(const double *headpose, const double*) { QMutexLocker l(&lock); diff --git a/proto-udp/ftnoir_protocol_ftn.h b/proto-udp/ftnoir_protocol_ftn.h index 53387a6c..ca387a37 100644 --- a/proto-udp/ftnoir_protocol_ftn.h +++ b/proto-udp/ftnoir_protocol_ftn.h @@ -35,7 +35,7 @@ class udp : public QObject, public IProtocol public: udp(); module_status initialize() override; - void pose(const double *headpose) override; + void pose(const double *headpose, const double*) override; QString game_name() override { return tr("UDP over network"); } private: QUdpSocket outSocket; diff --git a/proto-vjoystick/vjoystick.cpp b/proto-vjoystick/vjoystick.cpp index e49a2756..f322ced9 100644 --- a/proto-vjoystick/vjoystick.cpp +++ b/proto-vjoystick/vjoystick.cpp @@ -164,7 +164,7 @@ module_status vjoystick::initialize() return {}; } -void vjoystick::pose(const double *pose) +void vjoystick::pose(const double *pose, const double*) { if (first_run) { diff --git a/proto-vjoystick/vjoystick.h b/proto-vjoystick/vjoystick.h index 7e119b21..39bc14e3 100644 --- a/proto-vjoystick/vjoystick.h +++ b/proto-vjoystick/vjoystick.h @@ -22,7 +22,7 @@ public: vjoystick(); ~vjoystick() override; module_status initialize() override; - void pose( const double *headpose ) override; + void pose(const double* headpose, const double*) override; QString game_name() override { return tr("Virtual joystick"); } private: diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index 23e929df..2e618ff9 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -26,7 +26,7 @@ wine::~wine() //shm_unlink("/" WINE_SHM_NAME); } -void wine::pose( const double *headpose ) +void wine::pose(const double *headpose, const double*) { if (shm) { diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h index b4cbd305..ed142f83 100644 --- a/proto-wine/ftnoir_protocol_wine.h +++ b/proto-wine/ftnoir_protocol_wine.h @@ -21,7 +21,7 @@ public: ~wine() override; module_status initialize() override; - void pose(const double* headpose) override; + void pose(const double* headpose, const double*) override; QString game_name() override { |