summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/export.hpp13
-rw-r--r--opentrack/mingw-version-script.txt8
-rw-r--r--opentrack/plugin-api.hpp4
-rw-r--r--opentrack/pose.hpp22
-rw-r--r--opentrack/posix-version-script.txt8
-rw-r--r--opentrack/qcopyable-mutex.hpp37
-rw-r--r--opentrack/sleep.hpp22
-rw-r--r--opentrack/timer.hpp75
-rw-r--r--opentrack/tracker.h20
-rw-r--r--opentrack/version.cc2
10 files changed, 21 insertions, 190 deletions
diff --git a/opentrack/export.hpp b/opentrack/export.hpp
deleted file mode 100644
index f0983b75..00000000
--- a/opentrack/export.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma once
-
-#ifdef _WIN32
-# define OPENTRACK_LINKAGE __declspec(dllexport)
-#else
-# define OPENTRACK_LINKAGE
-#endif
-
-#ifndef _MSC_VER
-# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE
-#else
-# define OPENTRACK_EXPORT OPENTRACK_LINKAGE
-#endif \ No newline at end of file
diff --git a/opentrack/mingw-version-script.txt b/opentrack/mingw-version-script.txt
deleted file mode 100644
index fe20ad37..00000000
--- a/opentrack/mingw-version-script.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- global:
- GetDialog?0;
- GetConstructor?0;
- GetMetadata?0;
- local:
- *;
-};
diff --git a/opentrack/plugin-api.hpp b/opentrack/plugin-api.hpp
index b0da4950..572b7f31 100644
--- a/opentrack/plugin-api.hpp
+++ b/opentrack/plugin-api.hpp
@@ -8,7 +8,7 @@
#pragma once
-#include "export.hpp"
+#include "../opentrack-compat/export.hpp"
#include <QString>
#include <QWidget>
#include <QFrame>
@@ -59,7 +59,7 @@ struct IFilter
// optional destructor
virtual ~IFilter() {}
// perform filtering step.
- // you have to take care of dt on your own, try "opentrack/timer.hpp"
+ // you have to take care of dt on your own, try "opentrack-compat/timer.hpp"
virtual void filter(const double *input, double *output) = 0;
};
diff --git a/opentrack/pose.hpp b/opentrack/pose.hpp
deleted file mode 100644
index 93d467a9..00000000
--- a/opentrack/pose.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include <utility>
-#include <algorithm>
-#include "./plugin-api.hpp"
-
-class Pose {
-private:
- static constexpr double pi = 3.141592653;
- static constexpr double d2r = pi/180.0;
- static constexpr double r2d = 180./pi;
-
- double axes[6];
-public:
- Pose() : axes {0,0,0, 0,0,0} {}
-
- inline operator double*() { return axes; }
- inline operator const double*() const { return axes; }
-
- inline double& operator()(int i) { return axes[i]; }
- inline double operator()(int i) const { return axes[i]; }
-};
diff --git a/opentrack/posix-version-script.txt b/opentrack/posix-version-script.txt
deleted file mode 100644
index 97edb9aa..00000000
--- a/opentrack/posix-version-script.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- global:
- GetDialog;
- GetConstructor;
- GetMetadata;
- local:
- *;
-}; \ No newline at end of file
diff --git a/opentrack/qcopyable-mutex.hpp b/opentrack/qcopyable-mutex.hpp
deleted file mode 100644
index f7f36f93..00000000
--- a/opentrack/qcopyable-mutex.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-
-#include <QMutex>
-
-class MyMutex {
-private:
- QMutex inner;
-
-public:
- QMutex* operator->() { return &inner; }
- QMutex* operator->() const { return &const_cast<MyMutex*>(this)->inner; }
-
- MyMutex operator=(const MyMutex& datum)
- {
- auto mode =
- datum->isRecursive()
- ? QMutex::Recursive
- : QMutex::NonRecursive;
-
- return MyMutex(mode);
- }
-
- MyMutex(const MyMutex& datum)
- {
- *this = datum;
- }
-
- MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) :
- inner(mode)
- {
- }
-
- QMutex* operator&()
- {
- return &inner;
- }
-};
diff --git a/opentrack/sleep.hpp b/opentrack/sleep.hpp
deleted file mode 100644
index 27920842..00000000
--- a/opentrack/sleep.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-namespace portable
-{
-#ifdef _WIN32
- #include <windows.h>
-
- template<typename = void>
- void sleep(unsigned milliseconds)
- {
- Sleep(milliseconds);
- }
-#else
- #include <unistd.h>
-
- template<typename = void>
- void sleep(unsigned milliseconds)
- {
- usleep(milliseconds * 1000U); // takes microseconds
- }
-#endif
-}
diff --git a/opentrack/timer.hpp b/opentrack/timer.hpp
deleted file mode 100644
index fd710499..00000000
--- a/opentrack/timer.hpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (c) 2014-2015, Stanislaw Halik <sthalik@misaki.pl>
-
- * Permission to use, copy, modify, and/or distribute this
- * software for any purpose with or without fee is hereby granted,
- * provided that the above copyright notice and this permission
- * notice appear in all copies.
- */
-
-#pragma once
-#include <ctime>
-#if defined (_WIN32)
-# include <windows.h>
-# ifndef CLOCK_MONOTONIC
-# define CLOCK_MONOTONIC -1
-# endif
-static inline void opentrack_clock_gettime(int, struct timespec* ts)
-{
- static LARGE_INTEGER freq;
-
- if (!freq.QuadPart)
- (void) QueryPerformanceFrequency(&freq);
-
- LARGE_INTEGER d;
-
- (void) QueryPerformanceCounter(&d);
-
- d.QuadPart *= 1000000000L;
- d.QuadPart /= freq.QuadPart;
-
- ts->tv_sec = d.QuadPart / 1000000000L;
- ts->tv_nsec = d.QuadPart % 1000000000L;
-}
-# define clock_gettime opentrack_clock_gettime
-#else
-# if defined(__MACH__)
-# define CLOCK_MONOTONIC 0
-# include <inttypes.h>
-# include <mach/mach_time.h>
-static inline void clock_gettime(int, struct timespec* ts)
-{
- static mach_timebase_info_data_t sTimebaseInfo;
- uint64_t state, nsec;
- if ( sTimebaseInfo.denom == 0 ) {
- (void) mach_timebase_info(&sTimebaseInfo);
- }
- state = mach_absolute_time();
- nsec = state * sTimebaseInfo.numer / sTimebaseInfo.denom;
- ts->tv_sec = nsec / 1000000000L;
- ts->tv_nsec = nsec % 1000000000L;
-}
-# endif
-#endif
-class Timer {
-private:
- struct timespec state;
- long conv(const struct timespec& cur)
- {
- return (cur.tv_sec - state.tv_sec) * 1000000000L + (cur.tv_nsec - state.tv_nsec);
- }
-public:
- Timer() {
- start();
- }
- void start() {
- (void) clock_gettime(CLOCK_MONOTONIC, &state);
- }
- long elapsed() {
- struct timespec cur;
- (void) clock_gettime(CLOCK_MONOTONIC, &cur);
- return conv(cur);
- }
- long elapsed_ms() {
- return elapsed() / 1000000L;
- }
-};
diff --git a/opentrack/tracker.h b/opentrack/tracker.h
index 453357c4..c5c39797 100644
--- a/opentrack/tracker.h
+++ b/opentrack/tracker.h
@@ -10,10 +10,9 @@
#include <vector>
-#include "timer.hpp"
+#include "opentrack-compat/timer.hpp"
#include "plugin-support.hpp"
#include "mappings.hpp"
-#include "pose.hpp"
#include "simple-mat.hpp"
#include "selected-libraries.hpp"
@@ -24,6 +23,23 @@
#include <QMutex>
#include <QThread>
+class Pose {
+private:
+ static constexpr double pi = 3.141592653;
+ static constexpr double d2r = pi/180.0;
+ static constexpr double r2d = 180./pi;
+
+ double axes[6];
+public:
+ Pose() : axes {0,0,0, 0,0,0} {}
+
+ inline operator double*() { return axes; }
+ inline operator const double*() const { return axes; }
+
+ inline double& operator()(int i) { return axes[i]; }
+ inline double operator()(int i) const { return axes[i]; }
+};
+
class Tracker : private QThread {
Q_OBJECT
private:
diff --git a/opentrack/version.cc b/opentrack/version.cc
index 026ad057..13bc5dc5 100644
--- a/opentrack/version.cc
+++ b/opentrack/version.cc
@@ -1,4 +1,4 @@
-#include "opentrack/export.hpp"
+#include "opentrack-compat/export.hpp"
#ifdef __cplusplus
extern "C"