diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-09-17 12:40:39 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-09-17 12:41:45 +0200 |
commit | 679f424c250a38473c82bf1f997b75fbea4d3758 (patch) | |
tree | 06fee960550a851387fb9a26d85d44e5fc56649b /facetracknoir | |
parent | 4fdc2d9b3733f2b8d3edd4e10fdba0b7a525ae22 (diff) |
nix explicit malloc
simplifies, allows for copy operator
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/facetracknoir.cpp | 4 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.h | 2 | ||||
-rw-r--r-- | facetracknoir/tracker.h | 46 |
3 files changed, 23 insertions, 29 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 8df368cd..da8fae61 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -366,8 +366,8 @@ void FaceTrackNoIR::startTracker( ) { for (int i = 0; i < 6; i++) { - axis(i).curve.loadSettings(iniFile); - axis(i).curveAlt.loadSettings(iniFile); + axis(i).curve.loadSettings(iniFile, axis(i).name1); + axis(i).curveAlt.loadSettings(iniFile, axis(i).name2); } } diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 1da2d6b8..dc37ad37 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -86,7 +86,7 @@ public: return dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL); } THeadPoseDOF& axis(int idx) { - return *pose.axes[idx]; + return pose.axes[idx]; } #if defined(_WIN32) diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 152551d4..d06ac9d2 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -21,12 +21,7 @@ #include "facetracknoir/timer.hpp" using namespace options; -class FaceTrackNoIR; // pre-define parent-class to avoid circular includes - class THeadPoseDOF { -private: - THeadPoseDOF(const THeadPoseDOF &) = delete; - THeadPoseDOF& operator=(const THeadPoseDOF&) = delete; public: THeadPoseDOF(QString primary, QString secondary, @@ -36,22 +31,27 @@ public: int maxOutput2, axis_opts* opts) : headPos(0), - curve(primary, maxInput1, maxOutput1), - curveAlt(secondary, maxInput2, maxOutput2), - opts(*opts) + curve(maxInput1, maxOutput1), + curveAlt(maxInput2, maxOutput2), + opts(*opts), + name1(primary), + name2(secondary) { QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); - curve.loadSettings(iniFile); - curveAlt.loadSettings(iniFile); + curve.loadSettings(iniFile, primary); + curveAlt.loadSettings(iniFile, secondary); } volatile double headPos; FunctionConfig curve; FunctionConfig curveAlt; axis_opts& opts; + QString name1, name2; }; +class FaceTrackNoIR; + class Tracker : protected QThread { Q_OBJECT @@ -80,23 +80,17 @@ public: class HeadPoseData { public: - THeadPoseDOF* axes[6]; - HeadPoseData(std::vector<axis_opts*> opts) - { - axes[TX] = new THeadPoseDOF("tx","tx_alt", 100, 100, 100, 100, opts[TX]); - axes[TY] = new THeadPoseDOF("ty","ty_alt", 100, 100, 100, 100, opts[TY]); - axes[TZ] = new THeadPoseDOF("tz","tz_alt", 100, 100, 100, 100, opts[TZ]); - axes[Yaw] = new THeadPoseDOF("rx", "rx_alt", 180, 180, 180, 180, opts[Yaw]); - axes[Pitch] = new THeadPoseDOF("ry", "ry_alt", 90, 90, 90, 90, opts[Pitch]); - axes[Roll] = new THeadPoseDOF("rz", "rz_alt", 180, 180, 180, 180, opts[Roll]); - } - ~HeadPoseData() - { - for (int i = 0; i < 6; i++) - { - delete axes[i]; + THeadPoseDOF axes[6]; + HeadPoseData(std::vector<axis_opts*> opts) : + axes { + THeadPoseDOF("tx","tx_alt", 100, 100, 100, 100, opts[TX]), + THeadPoseDOF("ty","ty_alt", 100, 100, 100, 100, opts[TY]), + THeadPoseDOF("tz","tz_alt", 100, 100, 100, 100, opts[TZ]), + THeadPoseDOF("rx", "rx_alt", 180, 180, 180, 180, opts[Yaw]), + THeadPoseDOF("ry", "ry_alt", 90, 90, 90, 90, opts[Pitch]), + THeadPoseDOF("rz", "rz_alt", 180, 180, 180, 180, opts[Roll]) } - } + {} }; #endif |