diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-05 19:55:05 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-05 19:55:05 +0200 |
commit | f4754d23984126de847279f4abad4ae713d9e386 (patch) | |
tree | 78757d55b07887da427058853d88718ce27c2028 /facetracknoir | |
parent | cfffa29e29db6b2234c7f534b1ebcd612b7f4914 (diff) |
flush and push
Diffstat (limited to 'facetracknoir')
-rwxr-xr-x | facetracknoir/clientfiles/make-csv.pl | 72 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c) | 7 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/tester/main.cpp (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/tester/npifc.c (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/tester/npifc.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in) | 0 | ||||
-rw-r--r-- | facetracknoir/clientfiles/very-important-source-code/tester/resource.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h) | 0 | ||||
l--------- | facetracknoir/clientfiles/very-important-source-code/tester/rest.c (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c) | 0 | ||||
l--------- | facetracknoir/clientfiles/very-important-source-code/tester/rest.h (renamed from facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h) | 0 | ||||
-rw-r--r-- | facetracknoir/plugin-qt-api.hpp | 1 | ||||
-rw-r--r-- | facetracknoir/pose.hpp (renamed from facetracknoir/tracker_types.h) | 22 | ||||
-rw-r--r-- | facetracknoir/quat.hpp | 26 | ||||
-rw-r--r-- | facetracknoir/tracker.cpp | 40 | ||||
-rw-r--r-- | facetracknoir/tracker.h | 9 |
27 files changed, 119 insertions, 58 deletions
diff --git a/facetracknoir/clientfiles/make-csv.pl b/facetracknoir/clientfiles/make-csv.pl new file mode 100755 index 00000000..ee60364e --- /dev/null +++ b/facetracknoir/clientfiles/make-csv.pl @@ -0,0 +1,72 @@ +#!/usr/bin/env perl + +use strict; +use List::Util qw'reduce'; + +sub get_games_1 { + my @games; + + open my $fd, "<", $ARGV[1] or die "open: $!"; + <$fd>; + + while (defined(my $line = <$fd>)) { + chomp $line; + if ($line !~ /^(\d+)\s+"([^"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) { + warn "Broken line"; + next; + } + push @games, +{ id => $1, name => $2, key => defined $3 ? (sprintf "%04X", $1) . $3 . '00' : undef}; + } + + [@games]; +} + +sub get_games_2 { + open my $fd, "<", $ARGV[0] or die "open: $!"; + <$fd>; + my @games; + while (defined(my $line = <$fd>)) { + chomp $line; + my @line = split/;/, $line; + if (@line != 8) { + warn "Broken line"; + next; + } + my @cols = qw'no name proto since verified by id key'; + push @games, +{ map { $cols[$_] => $line[$_] } 0..$#cols }; + } + [@games]; +} + +sub merge { + my ($new_games, $old_games) = @_; + my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; + my %game_hash = map { $_->{name} => $_ } @$old_games; + my %ids = map { $_->{id} => 1 } @$old_games; + for my $g (@$new_games) { + if (!exists $game_hash{$g->{name}} && !exists $ids{$g->{id}}) { + $game_hash{$g->{name}} = +{ + no => $no++, + name => $g->{name}, + proto => 'FreeTrack20', + since => (defined $g->{key} ? 'V170' : 'V160'), + verified => '', + by => '', + id => $g->{id}, + key => $g->{key} + }; + } + } + print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; + for (sort { lc($a->{name}) cmp lc($b->{name}) } values %game_hash) { + my $g = {%$_}; + if (!defined $g->{key}) { + $g->{key} = (sprintf "%04X", $g->{no}) . (join"", map { sprintf "%02X", int rand 256 } 0 .. 7) . '00'; + } + my @cols = qw'no name proto since verified by id key'; + print join";", map { $g->{$_} } @cols; + print "\n"; + } +} + +merge(get_games_1(), get_games_2()); diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt b/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt index 82214139..82214139 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt +++ b/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am index 02747edb..02747edb 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in index d1fff34d..d1fff34d 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in b/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in index 332f3c73..332f3c73 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp b/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp index a737f88f..a737f88f 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h b/facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h index 8bba17b4..8bba17b4 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h index 770e1c71..770e1c71 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec index 7fe5f1b4..7fe5f1b4 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h index b0bab5db..b0bab5db 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c index f892f89e..f892f89e 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c index 3197ba37..f80a7d44 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c @@ -6,8 +6,6 @@ #include <stdint.h> #include <sys/stat.h> #include <string.h> -#include <utils.h> - //First 5 bytes is MD5 hash of "NaturalPoint" static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; @@ -114,10 +112,12 @@ static void game_data_close() free(decoded); } +#define ltr_int_log_message(...) fprintf(stderr, __VA_ARGS__) + bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) { FILE *outfile = NULL; - if((outfile = fopen(output_fname, "w")) == NULL){ + if((outfile = (output_fname ? fopen(output_fname, "w") : stdout)) == NULL){ ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); return false; } @@ -147,3 +147,4 @@ bool get_game_data(const char *input_fname, const char *output_fname, bool from_ return true; } +int main(int argc, char** argv) { return argc > 1 && get_game_data(argv[1], NULL, false); } diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h index b71f7a15..b71f7a15 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am index e025209a..e025209a 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am +++ b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in index cc49d754..cc49d754 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in +++ b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp b/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp index 95ca0d9b..95ca0d9b 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp +++ b/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c index b036464e..b036464e 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h index d580e16d..d580e16d 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in b/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in index 231002f1..231002f1 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h b/facetracknoir/clientfiles/very-important-source-code/tester/resource.h index 328d9cb7..328d9cb7 100644 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h +++ b/facetracknoir/clientfiles/very-important-source-code/tester/resource.h diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c b/facetracknoir/clientfiles/very-important-source-code/tester/rest.c index 663c21a9..663c21a9 120000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c +++ b/facetracknoir/clientfiles/very-important-source-code/tester/rest.c diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h b/facetracknoir/clientfiles/very-important-source-code/tester/rest.h index 6dca182a..6dca182a 120000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h +++ b/facetracknoir/clientfiles/very-important-source-code/tester/rest.h diff --git a/facetracknoir/plugin-qt-api.hpp b/facetracknoir/plugin-qt-api.hpp index 0e2e3c32..1697d8e7 100644 --- a/facetracknoir/plugin-qt-api.hpp +++ b/facetracknoir/plugin-qt-api.hpp @@ -56,7 +56,6 @@ struct ITracker virtual ~ITracker() = 0; virtual void StartTracker( QFrame* frame ) = 0; virtual void GetHeadPoseData(double *data) = 0; - virtual int preferredHz() { return 200; } }; inline ITracker::~ITracker() {} diff --git a/facetracknoir/tracker_types.h b/facetracknoir/pose.hpp index 02aacdcf..ec9faaa3 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/pose.hpp @@ -5,7 +5,7 @@ #include "./quat.hpp" #include "./plugin-api.hpp" -struct T6DOF { +class Pose { private: static constexpr double pi = 3.141592653; static constexpr double d2r = pi/180.0; @@ -13,7 +13,7 @@ private: double axes[6]; public: - T6DOF() : axes {0,0,0, 0,0,0 } {} + Pose() : axes {0,0,0, 0,0,0 } {} inline operator double*() { return axes; } inline operator const double*() const { return axes; } @@ -26,34 +26,34 @@ public: return Quat(axes[Yaw]*d2r, axes[Pitch]*d2r, axes[Roll]*d2r); } - static T6DOF fromQuat(const Quat& q) + static Pose fromQuat(const Quat& q) { - T6DOF ret; - q.to_euler_rads(ret(Yaw), ret(Pitch), ret(Roll)); + Pose ret; + q.to_euler_degrees(ret(Yaw), ret(Pitch), ret(Roll)); return ret; } - T6DOF operator-(const T6DOF& B) const + Pose operator-(const Pose& B) const { const Quat q = (quat() * B.quat().inv()); - T6DOF ret = fromQuat(q); + Pose ret = fromQuat(q); for (int i = TX; i < Yaw; i++) ret(i) = B(i); return ret; } - T6DOF operator+(const T6DOF& B) const + Pose operator+(const Pose& B) const { const Quat q = (quat() * B.quat().inv()); - T6DOF ret = fromQuat(q); + Pose ret = fromQuat(q); for (int i = TX; i < Yaw; i++) ret(i) = B(i); return ret; } - T6DOF operator|(const T6DOF& replacement) const + Pose operator|(const Pose& replacement) const { - T6DOF ret = *this; + Pose ret = *this; for (int i = 0; i < 6; i++) { static constexpr double eps = 1e-5; diff --git a/facetracknoir/quat.hpp b/facetracknoir/quat.hpp index 1e268963..6d777b28 100644 --- a/facetracknoir/quat.hpp +++ b/facetracknoir/quat.hpp @@ -14,7 +14,7 @@ private: static constexpr double r2d = 180./pi; double a,b,c,d; // quaternion coefficients public: - Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} + Quat() : a(1.),b(0.),c(0.),d(0.) {} Quat(double yaw, double pitch, double roll) { from_euler_rads(yaw, pitch, roll); } Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} @@ -27,12 +27,12 @@ public: void from_euler_rads(double yaw, double pitch, double roll) { - double sin_phi = sin(roll/2.0); - double cos_phi = cos(roll/2.0); - double sin_the = sin(pitch/2.0); - double cos_the = cos(pitch/2.0); - double sin_psi = sin(yaw/2.0); - double cos_psi = cos(yaw/2.0); + const double sin_phi = sin(roll/2.); + const double cos_phi = cos(roll/2.); + const double sin_the = sin(pitch/2.); + const double cos_the = cos(pitch/2.); + const double sin_psi = sin(yaw/2.); + const double cos_psi = cos(yaw/2.); a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; @@ -42,9 +42,9 @@ public: void to_euler_rads(double& yaw, double& pitch, double& roll) const { - roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c)); - pitch = asin(2.0*(a*c - b*d)); - yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); + roll = atan2(2.*(a*b + c*d), 1. - 2.*(b*b + c*c)); + pitch = asin(2.*(a*c - b*d)); + yaw = atan2(2.*(a*d + b*c), 1. - 2.*(c*c + d*d)); } void to_euler_degrees(double& yaw, double& pitch, double& roll) const @@ -59,8 +59,8 @@ public: { const Quat& A = *this; return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication - A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, - A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, - A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); + A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, + A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, + A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); } }; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 0c2d289f..e1f86294 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -12,8 +12,7 @@ * originally written by Wim Vriend. */ -#include "tracker.h" -#include "facetracknoir.h" +#include "./tracker.h" #include <opencv2/core/core.hpp> #include <cmath> #include <algorithm> @@ -49,9 +48,10 @@ void Tracker::get_curve(double pos, double& out, Mapping& axis) { static void t_compensate(double* input, double* output, bool rz) { - const auto H = input[Yaw] * M_PI / -180; - const auto P = input[Pitch] * M_PI / -180; - const auto B = input[Roll] * M_PI / 180; + static constexpr double pi = 3.141592653; + const auto H = input[Yaw] * pi / -180; + const auto P = input[Pitch] * pi / -180; + const auto B = input[Roll] * pi / 180; const auto cosH = cos(H); const auto sinH = sin(H); @@ -83,15 +83,10 @@ static void t_compensate(double* input, double* output, bool rz) } void Tracker::run() { - T6DOF pose_offset, unstopped_pose; + Pose pose_offset, unstopped_pose; double newpose[6] = {0}; - int sleep_ms = 15; - - if (Libraries->pTracker) - sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); - - qDebug() << "tracker Hz:" << 1000 / sleep_ms; + const int sleep_ms = 3; #if defined(_WIN32) (void) timeBeginPeriod(1); @@ -104,9 +99,7 @@ void Tracker::run() { if (should_quit) break; - if (Libraries->pTracker) { - Libraries->pTracker->GetHeadPoseData(newpose); - } + Libraries->pTracker->GetHeadPoseData(newpose); { QMutexLocker foo(&mtx); @@ -130,15 +123,12 @@ void Tracker::run() { if (enabledp) unstopped_pose = raw_6dof; - { + if (Libraries->pFilter) + Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); + else + output_pose = unstopped_pose; - if (Libraries->pFilter) - Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); - else - output_pose = unstopped_pose; - - output_pose = output_pose - pose_offset; - } + output_pose = output_pose - pose_offset; for (int i = 0; i < 6; i++) get_curve(output_pose(i), output_pose(i), m(i)); @@ -147,9 +137,7 @@ void Tracker::run() { if (s.tcomp_p) t_compensate(output_pose, output_pose, s.tcomp_tz); - if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame(output_pose); - } + Libraries->pProtocol->sendHeadposeToGame(output_pose); } const long q = std::max(0L, sleep_ms * 1000L - std::max(0L, t.elapsed())); diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 3d9a3858..8a4ecb1f 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -10,14 +10,15 @@ #include <QPainterPath> #include <QDebug> #include <QMutex> -#include "plugin-support.h" -#include "mappings.hpp" +#include "./plugin-support.h" +#include "./mappings.hpp" +#include "./pose.hpp" #include <vector> #include <atomic> #include <qfunctionconfigurator/functionconfig.h> -#include "tracker_types.h" +#include "./quat.hpp" #include "facetracknoir/main-settings.hpp" #include "facetracknoir/options.h" #include "facetracknoir/timer.hpp" @@ -30,7 +31,7 @@ private: // XXX can be const-cast when functionconfig const-correct -sh 20141004 Mappings& m; Timer t; - T6DOF output_pose, raw_6dof; + Pose output_pose, raw_6dof; std::atomic<bool> centerp; std::atomic<bool> enabledp; std::atomic<bool> should_quit; |