summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp142
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h2
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui398
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.vcproj259
-rw-r--r--FaceTrackNoIR/tracker.cpp368
-rw-r--r--FaceTrackNoIR/tracker.h20
6 files changed, 458 insertions, 731 deletions
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 49a6aab2..8646c248 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -31,12 +31,6 @@
*/
#include "FaceTrackNoIR.h"
#include "tracker.h"
-//#include "PPJoyServer.h"
-#include "FSUIPCServer.h"
-//#include "FTIRServer.h"
-//#include "FGServer.h"
-#include "FTNServer.h"
-
//
// Setup the Main Dialog
@@ -50,7 +44,6 @@ QMainWindow(parent, flags)
// Initialize Widget handles, to prevent memory-access errors.
//
_engine_controls = 0;
- _server_controls = 0;
_keyboard_shortcuts = 0;
_preferences = 0;
_keyboard_shortcuts = 0;
@@ -160,6 +153,8 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
//Setup the timer for showing the headpose.
timUpdateHeadPose = new QTimer(this);
connect(timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose()));
+ ui.txtTracking->setVisible(false);
+ ui.txtAxisReverse->setVisible(false);
}
/** destructor stops the engine and quits the faceapi **/
@@ -593,6 +588,8 @@ void FaceTrackNoIR::stopTracker( ) {
ui.lcdNumOutputRotX->setVisible(false);
ui.lcdNumOutputRotY->setVisible(false);
ui.lcdNumOutputRotZ->setVisible(false);
+ ui.txtTracking->setVisible(false);
+ ui.txtAxisReverse->setVisible(false);
//
// Delete the tracker (after stopping things and all).
@@ -689,6 +686,9 @@ THeadPoseData newdata;
ui.lcdNumRotY->display((double) (((int)(newdata.pitch * 10.0f))/10.0f));
ui.lcdNumRotZ->display((double) (((int)(newdata.roll * 10.0f))/10.0f));
+ ui.txtTracking->setVisible(Tracker::getTrackingActive());
+ ui.txtAxisReverse->setVisible(Tracker::getAxisReverse());
+
//
// Get the output-pose and also display it.
//
@@ -816,104 +816,68 @@ QLibrary *trackerLib;
void FaceTrackNoIR::showServerControls() {
importGetProtocolDialog getIT;
QLibrary *protocolLib;
-
+QString libName;
//
// Delete the existing QDialog
//
- if (_server_controls) {
- delete _server_controls;
- _server_controls = 0;
+ if (pProtocolDialog) {
+ pProtocolDialog.Release();
}
- // Create if new
- if (!_server_controls)
- {
+ // Show the appropriate Protocol-server Settings
+ libName.clear();
+ switch (ui.iconcomboBox->currentIndex()) {
+ case FREE_TRACK:
+ case SIMCONNECT:
+ break;
- // Show the appropriate Protocol-server Settings
- switch (ui.iconcomboBox->currentIndex()) {
- case FREE_TRACK:
- case SIMCONNECT:
- break;
+ case PPJOY:
+ libName = QString("FTNoIR_Protocol_PPJOY.dll");
+ break;
- case PPJOY:
- protocolLib = new QLibrary("FTNoIR_Protocol_PPJOY.dll");
+ case FSUIPC:
+ libName = QString("FTNoIR_Protocol_FSUIPC.dll");
+ break;
- getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
- if (getIT) {
- IProtocolDialogPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pProtocolDialog = ptrXyz;
- pProtocolDialog->Initialize( this );
- qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
- }
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
- break;
+ case TRACKIR:
+ libName = QString("FTNoIR_Protocol_FTIR.dll");
+ break;
- case FSUIPC:
- _server_controls = new FSUIPCControls( this, Qt::Dialog );
- break;
- case TRACKIR:
- protocolLib = new QLibrary("FTNoIR_Protocol_FTIR.dll");
+ case FLIGHTGEAR:
+ libName = QString("FTNoIR_Protocol_FG.dll");
+ break;
- getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
- if (getIT) {
- IProtocolDialogPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pProtocolDialog = ptrXyz;
- pProtocolDialog->Initialize( this );
- qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
- }
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
- break;
+ case FTNOIR:
+ libName = QString("FTNoIR_Protocol_FTN.dll");
+ break;
- case FLIGHTGEAR:
- protocolLib = new QLibrary("FTNoIR_Protocol_FG.dll");
+ default:
+ break;
+ }
- getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
- if (getIT) {
- IProtocolDialogPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pProtocolDialog = ptrXyz;
- pProtocolDialog->Initialize( this );
- qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
- }
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
+ //
+ // Load the Server-settings dialog (if any) and show it.
+ //
+ if (!libName.isEmpty()) {
+ protocolLib = new QLibrary(libName);
+
+ getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
+ if (getIT) {
+ IProtocolDialogPtr ptrXyz(getIT());
+ if (ptrXyz)
+ {
+ pProtocolDialog = ptrXyz;
+ pProtocolDialog->Initialize( this );
+ qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
}
else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
- break;
-
- case FTNOIR:
- _server_controls = new FTNServerControls( this, Qt::Dialog );
- break;
- default:
- break;
+ qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
}
- }
-
- // Show if already created
- if (_server_controls) {
- _server_controls->show();
- _server_controls->raise();
}
}
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index cd9c925b..5ad2a348 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -89,7 +89,7 @@ private:
/** Widget variables **/
QVBoxLayout *l;
QWidget *_engine_controls;
- QWidget *_server_controls;
+// QWidget *_server_controls;
QWidget *_preferences;
QWidget *_keyboard_shortcuts;
QWidget *_curve_config;
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index 48d231ac..2cfe5fbc 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -11,7 +11,7 @@
<x>0</x>
<y>0</y>
<width>925</width>
- <height>396</height>
+ <height>411</height>
</rect>
</property>
<property name="sizePolicy">
@@ -58,6 +58,11 @@ QWidget#widget4logo {
background-color: #000000;
}
+/* Specials for individual widget(s) */
+QWidget#headPoseWidget {
+ background-color: #595959;
+}
+
QWidget#widget4video {
/* background-color: #595959;*/
}
@@ -331,197 +336,266 @@ Support FaceTrackNoIR!</string>
<property name="minimumSize">
<size>
<width>0</width>
- <height>100</height>
+ <height>160</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
- <height>100</height>
+ <height>160</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
- <widget class="QLabel" name="label_4">
+ <widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
- <y>10</y>
- <width>21</width>
- <height>16</height>
+ <y>60</y>
+ <width>231</width>
+ <height>80</height>
</rect>
</property>
- <property name="styleSheet">
- <string notr="true">border:none;
-color:white</string>
+ <property name="title">
+ <string>Raw Input</string>
</property>
- <property name="text">
- <string>X</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_5">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>40</y>
- <width>21</width>
- <height>16</height>
- </rect>
+ <property name="flat">
+ <bool>true</bool>
</property>
- <property name="styleSheet">
- <string notr="true">border:none;
+ <widget class="QLCDNumber" name="lcdNumRotZ">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>60</y>
+ <width>71</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumRotX">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>20</y>
+ <width>71</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_4">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>21</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border:none;
+color:white</string>
+ </property>
+ <property name="text">
+ <string>X</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_5">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>40</y>
+ <width>21</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border:none;
color:white;</string>
- </property>
- <property name="text">
- <string>Y</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_6">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>70</y>
- <width>21</width>
- <height>16</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">color:white;
+ </property>
+ <property name="text">
+ <string>Y</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumZ">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>60</y>
+ <width>61</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_6">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>21</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:white;
border:none;</string>
- </property>
- <property name="text">
- <string>Z</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_7">
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>70</y>
- <width>21</width>
- <height>16</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">border:none;
+ </property>
+ <property name="text">
+ <string>Z</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumY">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>40</y>
+ <width>61</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_7">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>60</y>
+ <width>21</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border:none;
color:white;</string>
- </property>
- <property name="text">
- <string>rotZ</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_8">
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>40</y>
- <width>21</width>
- <height>16</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">color:white;
+ </property>
+ <property name="text">
+ <string>rotZ</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_8">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>40</y>
+ <width>21</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:white;
border:none;</string>
- </property>
- <property name="text">
- <string>rotY</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_9">
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>10</y>
- <width>21</width>
- <height>16</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">border:none;
+ </property>
+ <property name="text">
+ <string>rotY</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_9">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>20</y>
+ <width>21</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border:none;
color:white;</string>
- </property>
- <property name="text">
- <string>rotX</string>
- </property>
- </widget>
- <widget class="QLCDNumber" name="lcdNumX">
- <property name="geometry">
- <rect>
- <x>30</x>
- <y>10</y>
- <width>71</width>
- <height>23</height>
- </rect>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- </widget>
- <widget class="QLCDNumber" name="lcdNumY">
- <property name="geometry">
- <rect>
- <x>30</x>
- <y>40</y>
- <width>71</width>
- <height>23</height>
- </rect>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- </widget>
- <widget class="QLCDNumber" name="lcdNumZ">
- <property name="geometry">
- <rect>
- <x>30</x>
- <y>70</y>
- <width>71</width>
- <height>23</height>
- </rect>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
+ </property>
+ <property name="text">
+ <string>rotX</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumRotY">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>40</y>
+ <width>71</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumX">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>20</y>
+ <width>61</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="numDigits">
+ <number>5</number>
+ </property>
+ </widget>
</widget>
- <widget class="QLCDNumber" name="lcdNumRotX">
+ <widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
- <x>150</x>
+ <x>10</x>
<y>10</y>
- <width>71</width>
- <height>23</height>
- </rect>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- </widget>
- <widget class="QLCDNumber" name="lcdNumRotY">
- <property name="geometry">
- <rect>
- <x>150</x>
- <y>40</y>
- <width>71</width>
- <height>23</height>
+ <width>231</width>
+ <height>50</height>
</rect>
</property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
+ <property name="title">
+ <string>Status</string>
</property>
- </widget>
- <widget class="QLCDNumber" name="lcdNumRotZ">
- <property name="geometry">
- <rect>
- <x>150</x>
- <y>70</y>
- <width>71</width>
- <height>23</height>
- </rect>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
+ <property name="flat">
+ <bool>true</bool>
</property>
+ <widget class="QLabel" name="txtTracking">
+ <property name="geometry">
+ <rect>
+ <x>110</x>
+ <y>10</y>
+ <width>101</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border:none;
+color: rgb(0, 255, 0);</string>
+ </property>
+ <property name="text">
+ <string>Tracking</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="txtAxisReverse">
+ <property name="geometry">
+ <rect>
+ <x>110</x>
+ <y>30</y>
+ <width>101</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border:none;
+color: rgb(0, 255, 0);</string>
+ </property>
+ <property name="text">
+ <string>Axis Reverse</string>
+ </property>
+ </widget>
</widget>
</widget>
</item>
diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj b/FaceTrackNoIR/FaceTrackNoIR.vcproj
index 67546f1b..837d7f69 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.vcproj
+++ b/FaceTrackNoIR/FaceTrackNoIR.vcproj
@@ -70,7 +70,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="opengl32.lib QtMain.lib QtCore4.lib QtGui4.lib QtOpenGL4.lib QtNetwork4.lib Strmiids.lib Ws2_32.lib QBezierConfigurator.lib FSUIPC_User.lib"
+ AdditionalDependencies="opengl32.lib QtMain.lib QtCore4.lib QtGui4.lib QtOpenGL4.lib QtNetwork4.lib Strmiids.lib Ws2_32.lib QBezierConfigurator.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories=""
GenerateManifest="true"
@@ -105,7 +105,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mt.exe -manifest &quot;$(InputDir)SCServer.manifest&quot; -outputresource:&quot;$(OutDir)\$(TargetFileName)&quot;;^#101"
+ CommandLine=""
/>
</Configuration>
<Configuration
@@ -212,14 +212,6 @@
>
</File>
<File
- RelativePath=".\FSUIPCServer.cpp"
- >
- </File>
- <File
- RelativePath=".\FTNServer.cpp"
- >
- </File>
- <File
RelativePath="..\FTNoIR_PoseWidget\glwidget.cpp"
>
</File>
@@ -228,10 +220,6 @@
>
</File>
<File
- RelativePath=".\SCServer.cpp"
- >
- </File>
- <File
RelativePath=".\tracker.cpp"
>
</File>
@@ -320,32 +308,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\FSUIPCServer.h"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_NETWORK_LIB -DQT_DLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Filter_EWMA2\.&quot; &quot;.\FSUIPCServer.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;.\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\FTNoIR_cxx_protocolserver.h"
>
<FileConfiguration
@@ -372,32 +334,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\FTNServer.h"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_NETWORK_LIB -DQT_DLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Filter_EWMA2\.&quot; &quot;.\FTNServer.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;.\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath="..\FTNoIR_PoseWidget\glwidget.h"
>
<FileConfiguration
@@ -428,32 +364,6 @@
>
</File>
<File
- RelativePath=".\SCServer.h"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_NETWORK_LIB -DQT_DLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Filter_EWMA2\.&quot; &quot;.\SCServer.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;.\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\tracker.h"
>
<FileConfiguration
@@ -538,58 +448,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\FTNoIR_FSUIPCcontrols.ui"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\FTNoIR_FTNServerControls.ui"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\FTNoIR_KeyboardShortcuts.ui"
>
<FileConfiguration
@@ -717,14 +575,6 @@
>
</File>
<File
- RelativePath=".\GeneratedFiles\ui_FTNoIR_FSUIPCcontrols.h"
- >
- </File>
- <File
- RelativePath=".\GeneratedFiles\ui_FTNoIR_FTNServerControls.h"
- >
- </File>
- <File
RelativePath=".\GeneratedFiles\ui_FTNoIR_KeyboardShortcuts.h"
>
</File>
@@ -774,18 +624,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Release\moc_FSUIPCServer.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Release\moc_FTNoIR_cxx_protocolserver.cpp"
>
<FileConfiguration
@@ -798,18 +636,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Release\moc_FTNServer.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Release\moc_glwidget.cpp"
>
<FileConfiguration
@@ -822,18 +648,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Release\moc_SCServer.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Release\moc_tracker.cpp"
>
<FileConfiguration
@@ -899,29 +713,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Debug\moc_FSUIPCServer.cpp"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Debug\moc_FTNoIR_cxx_protocolserver.cpp"
>
<FileConfiguration
@@ -934,29 +725,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Debug\moc_FTNServer.cpp"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Debug\moc_glwidget.cpp"
>
<FileConfiguration
@@ -980,29 +748,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Debug\moc_SCServer.cpp"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Debug\moc_tracker.cpp"
>
<FileConfiguration
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index 0dd7311e..223d6d28 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -23,6 +23,9 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20110411 - WVR: Finished moving all Protocols to separate C++ projects. Every protocol now
+ has it's own Class, that's inside it's own DLL. This reduces the size of the program,
+ makes it more structured and enables a more sophisticated installer.
20110328 - WVR: Changed the camera-structs into class-instances. This makes initialisation
easier and hopefully solves the remaining 'start-up problem'.
20110313 - WVR: Removed 'set_initial'. Less is more.
@@ -63,16 +66,18 @@ bool Tracker::confid = false;
bool Tracker::do_tracking = true;
bool Tracker::do_center = false;
bool Tracker::do_inhibit = false;
+bool Tracker::do_axis_reverse = false;
+
bool Tracker::useFilter = false;
bool Tracker::setZero = true;
bool Tracker::setEngineStop = true;
HANDLE Tracker::hTrackMutex = 0;
-T6DOF Tracker::current_camera; // Used for filtering
-T6DOF Tracker::target_camera;
-T6DOF Tracker::new_camera;
-T6DOF Tracker::output_camera; // Position sent to game protocol
+T6DOF Tracker::current_camera(0,0,0,0,0,0); // Used for filtering
+T6DOF Tracker::target_camera(0,0,0,0,0,0);
+T6DOF Tracker::new_camera(0,0,0,0,0,0);
+T6DOF Tracker::output_camera(0,0,0,0,0,0); // Position sent to game protocol
THeadPoseDOF Tracker::Pitch; // One structure for each of 6DOF's
THeadPoseDOF Tracker::Yaw;
@@ -84,6 +89,7 @@ THeadPoseDOF Tracker::Z;
TShortKey Tracker::CenterKey; // ShortKey to Center headposition
TShortKey Tracker::StartStopKey; // ShortKey to Start/stop tracking
TShortKey Tracker::InhibitKey; // ShortKey to inhibit axis while tracking
+TShortKey Tracker::AxisReverseKey; // ShortKey to start/stop axis reverse while tracking
ITrackerPtr Tracker::pTracker; // Pointer to Tracker instance (in DLL)
IProtocolPtr Tracker::pProtocol; // Pointer to Protocol instance (in DLL)
@@ -92,6 +98,7 @@ IFilterPtr Tracker::pFilter; // Pointer to Filter instance (in DLL)
/** constructor **/
Tracker::Tracker( int clientID, int facetrackerID, FaceTrackNoIR *parent ) {
+QString libName;
importGetTracker getIT;
QLibrary *trackerLib;
importGetFilter getFilter;
@@ -132,162 +139,73 @@ QFrame *video_frame;
qDebug() << "Tracker::setup VideoFrame = " << video_frame;
//
- // Start the selected Tracker-engine
+ // Select the Tracker-engine DLL
//
switch (selectedTracker) {
case FT_SM_FACEAPI:
- trackerLib = new QLibrary("FTNoIR_Tracker_SM.dll");
-
- getIT = (importGetTracker) trackerLib->resolve("GetTracker");
-
- if (getIT) {
- ITrackerPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pTracker = ptrXyz;
- pTracker->Initialize( video_frame );
- qDebug() << "Tracker::setup Function Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
+ libName = QString("FTNoIR_Tracker_SM.dll");
break;
case FT_FTNOIR:
- trackerLib = new QLibrary("FTNoIR_Tracker_UDP.dll");
-
- getIT = (importGetTracker) trackerLib->resolve("GetTracker");
-
- if (getIT) {
- ITrackerPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pTracker = ptrXyz;
- pTracker->Initialize( video_frame );
- qDebug() << "Tracker::setup Function Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
+ libName = QString("FTNoIR_Tracker_UDP.dll");
break;
default:
break;
}
+ //
+ // Load the Tracker-engine DLL, get the tracker-class from it and do stuff...
+ //
+ if (!libName.isEmpty()) {
+ trackerLib = new QLibrary(libName);
+ getIT = (importGetTracker) trackerLib->resolve("GetTracker");
+
+ if (getIT) {
+ ITrackerPtr ptrXyz(getIT()); // Get the Class
+ if (ptrXyz)
+ {
+ pTracker = ptrXyz;
+ pTracker->Initialize( video_frame );
+ qDebug() << "Tracker::setup Function Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
+ }
+ }
//
// Initialize all server-handles. Only start the server, that was selected in the GUI.
//
+ libName.clear();
switch (selectedClient) {
case FREE_TRACK:
- server_Game = QSharedPointer<FTNServer>(new FTNServer ( this )); // Create FaceTrackNoIR protocol-server
-
- //
- // Load the DLL with the protocol-logic and retrieve a pointer to the Protocol-class.
- //
- protocolLib = new QLibrary("FTNoIR_Protocol_FT.dll");
-
- getProtocol = (importGetProtocol) protocolLib->resolve("GetProtocol");
- if (getProtocol) {
- IProtocolPtr ptrXyz(getProtocol());
- if (ptrXyz)
- {
- pProtocol = ptrXyz;
- pProtocol->Initialize();
- qDebug() << "Protocol::setup Function Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- return;
- }
+ libName = QString("FTNoIR_Protocol_FT.dll");
break;
case FLIGHTGEAR:
- server_Game = QSharedPointer<FTNServer>(new FTNServer ( this )); // Create FaceTrackNoIR protocol-server
-
- //
- // Load the DLL with the protocol-logic and retrieve a pointer to the Protocol-class.
- //
- protocolLib = new QLibrary("FTNoIR_Protocol_FG.dll");
-
- getProtocol = (importGetProtocol) protocolLib->resolve("GetProtocol");
- if (getProtocol) {
- IProtocolPtr ptrXyz(getProtocol());
- if (ptrXyz)
- {
- pProtocol = ptrXyz;
- pProtocol->Initialize();
- qDebug() << "Protocol::setup Function Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- return;
- }
+ libName = QString("FTNoIR_Protocol_FG.dll");
break;
case FTNOIR:
- server_Game = QSharedPointer<FTNServer>(new FTNServer ( this )); // Create FaceTrackNoIR protocol-server
+ libName = QString("FTNoIR_Protocol_FTN.dll");
break;
case PPJOY:
- server_Game = QSharedPointer<FTNServer>(new FTNServer ( this )); // Create FaceTrackNoIR protocol-server
-
- //
- // Load the DLL with the protocol-logic and retrieve a pointer to the Protocol-class.
- //
- protocolLib = new QLibrary("FTNoIR_Protocol_PPJOY.dll");
-
- getProtocol = (importGetProtocol) protocolLib->resolve("GetProtocol");
- if (getProtocol) {
- IProtocolPtr ptrXyz(getProtocol());
- if (ptrXyz)
- {
- pProtocol = ptrXyz;
- pProtocol->Initialize();
- qDebug() << "Protocol::setup Function Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-installation invalid",QMessageBox::Ok,QMessageBox::NoButton);
- return;
- }
+ libName = QString("FTNoIR_Protocol_PPJOY.dll");
break;
case TRACKIR:
- server_Game = QSharedPointer<FTNServer>(new FTNServer ( this )); // Create FaceTrackNoIR protocol-server
-
- //
- // Load the DLL with the protocol-logic and retrieve a pointer to the Protocol-class.
- //
- protocolLib = new QLibrary("FTNoIR_Protocol_FTIR.dll");
-
- getProtocol = (importGetProtocol) protocolLib->resolve("GetProtocol");
- if (getProtocol) {
- IProtocolPtr ptrXyz(getProtocol());
- if (ptrXyz)
- {
- pProtocol = ptrXyz;
- pProtocol->Initialize();
- qDebug() << "Protocol::setup Function Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- return;
- }
+ libName = QString("FTNoIR_Protocol_FTIR.dll");
break;
case SIMCONNECT:
- server_Game = QSharedPointer<SCServer>(new SCServer ( )); // Create SimConnect protocol-server
+ libName = QString("FTNoIR_Protocol_SC.dll");
break;
case FSUIPC:
- server_Game = QSharedPointer<FSUIPCServer>(new FSUIPCServer ( )); // Create FSUIPC protocol-server
+ libName = QString("FTNoIR_Protocol_FSUIPC.dll");
break;
default:
@@ -295,6 +213,27 @@ QFrame *video_frame;
break;
}
+ //
+ // Load the DLL with the protocol-logic and retrieve a pointer to the Protocol-class.
+ //
+ if (!libName.isEmpty()) {
+ protocolLib = new QLibrary(libName);
+ getProtocol = (importGetProtocol) protocolLib->resolve("GetProtocol");
+ if (getProtocol) {
+ IProtocolPtr ptrXyz(getProtocol());
+ if (ptrXyz)
+ {
+ pProtocol = ptrXyz;
+ pProtocol->Initialize();
+ qDebug() << "Protocol::setup Function Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
+ return;
+ }
+ }
+
# ifdef USE_DEBUG_CLIENT
debug_Client = QSharedPointer<ExcelServer>(new ExcelServer ( this )); // Create Excel protocol-server
# endif
@@ -346,11 +285,6 @@ Tracker::~Tracker() {
::CloseHandle( Tracker::hTrackMutex );
}
- // Stop the started server(s)
- if (server_Game) {
- server_Game->deleteLater();
- }
-
# ifdef USE_DEBUG_CLIENT
debug_Client->deleteLater(); // Delete Excel protocol-server
# endif
@@ -371,20 +305,6 @@ void Tracker::setup() {
// Some servers also create a memory-mapping, for Inter Process Communication.
// The handle of the MainWindow is sent to 'The Game', so it can send a message back.
//
- if (server_Game) {
-
- DLL_Ok = server_Game->checkServerInstallationOK( mainApp->winId() );
- if (!DLL_Ok) {
- QMessageBox::information(mainApp, "FaceTrackNoIR error", "Protocol is not (correctly) installed!");
- }
-
- }
-
- //
- // Check if the Protocol-server files were installed OK.
- // Some servers also create a memory-mapping, for Inter Process Communication.
- // The handle of the MainWindow is sent to 'The Game', so it can send a message back.
- //
if (pProtocol) {
DLL_Ok = pProtocol->checkServerInstallationOK( mainApp->winId() );
@@ -404,14 +324,18 @@ void Tracker::setup() {
/** QThread run method @override **/
void Tracker::run() {
- /** Direct Input variables **/
- LPDIRECTINPUT8 din; // the pointer to our DirectInput interface
- LPDIRECTINPUTDEVICE8 dinkeyboard; // the pointer to the keyboard device
- BYTE keystate[256]; // the storage for the key-information
- HRESULT retAcquire;
- bool lastCenterKey = false; // Remember state, to detect rising edge
- bool lastStartStopKey = false;
- bool lastInhibitKey = false;
+/** Direct Input variables **/
+LPDIRECTINPUT8 din; // the pointer to our DirectInput interface
+LPDIRECTINPUTDEVICE8 dinkeyboard; // the pointer to the keyboard device
+BYTE keystate[256]; // the storage for the key-information
+HRESULT retAcquire;
+bool lastCenterKey = false; // Remember state, to detect rising edge
+bool lastStartStopKey = false;
+bool lastInhibitKey = false;
+bool waitAxisReverse = false;
+bool waitThroughZero = false;
+double actualYaw = 0.0f;
+T6DOF offset_camera(0,0,0,0,0,0);
Tracker::do_center = true; // Center initially
@@ -430,13 +354,6 @@ void Tracker::run() {
}
//
- // Initialize all internal data of the Game-protocol.
- //
- if (server_Game) {
- server_Game->resetProperties();
- }
-
- //
// Setup the DirectInput for keyboard strokes
//
// create the DirectInput interface
@@ -519,6 +436,7 @@ void Tracker::run() {
current_camera.initHeadPoseData();
target_camera.initHeadPoseData();
new_camera.initHeadPoseData();
+ offset_camera.initHeadPoseData();
pTracker->StartTracker( mainApp->winId() );
}
@@ -555,9 +473,25 @@ void Tracker::run() {
}
lastInhibitKey = isShortKeyPressed( &InhibitKey, &keystate[0] ); // Remember
+ //
+ // Check the state of the Axis Reverse key
+ //
+ if ( isShortKeyPressed( &AxisReverseKey, &keystate[0] ) ) {
+ if ((fabs(actualYaw) > 90.0f) && (!waitAxisReverse)) {
+ Tracker::do_axis_reverse = !Tracker::do_axis_reverse;
+ waitAxisReverse = true;
+ }
+ }
}
}
+ //
+ // Reset the 'wait' flag. Moving above 90 with the key pressed, will (de-)activate Axis Reverse.
+ //
+ if (fabs(actualYaw) < 85.0f) {
+ waitAxisReverse = false;
+ }
+
if (WaitForSingleObject(Tracker::hTrackMutex, 100) == WAIT_OBJECT_0) {
THeadPoseData newpose;
@@ -570,26 +504,34 @@ void Tracker::run() {
// If Center is pressed, copy the current values to the offsets.
//
if (Tracker::confid && Tracker::do_center) {
- Pitch.offset_headPos = getSmoothFromList( &Pitch.rawList );
- Yaw.offset_headPos = getSmoothFromList( &Yaw.rawList );
- Roll.offset_headPos = getSmoothFromList( &Roll.rawList );
- X.offset_headPos = getSmoothFromList( &X.rawList );
- Y.offset_headPos = getSmoothFromList( &Y.rawList );
- Z.offset_headPos = getSmoothFromList( &Z.rawList );
+ //Pitch.offset_headPos = getSmoothFromList( &Pitch.rawList );
+ //Yaw.offset_headPos = getSmoothFromList( &Yaw.rawList );
+ //Roll.offset_headPos = getSmoothFromList( &Roll.rawList );
+ //X.offset_headPos = getSmoothFromList( &X.rawList );
+ //Y.offset_headPos = getSmoothFromList( &Y.rawList );
+ //Z.offset_headPos = getSmoothFromList( &Z.rawList );
MessageBeep (MB_ICONASTERISK);
+ offset_camera.position.x = getSmoothFromList( &X.rawList );
+ offset_camera.position.y = getSmoothFromList( &Y.rawList );
+ offset_camera.position.z = getSmoothFromList( &Z.rawList );
+ offset_camera.position.pitch = getSmoothFromList( &Pitch.rawList );
+ offset_camera.position.yaw = getSmoothFromList( &Yaw.rawList );
+ offset_camera.position.roll = getSmoothFromList( &Roll.rawList );
+
Tracker::do_center = false;
}
if (Tracker::do_tracking && Tracker::confid) {
// Pitch
- target_camera.position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos;
- target_camera.position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos;
- target_camera.position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos;
- target_camera.position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
- target_camera.position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos;
- target_camera.position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos;
+ target_camera.position.x = getSmoothFromList( &X.rawList );
+ target_camera.position.y = getSmoothFromList( &Y.rawList );
+ target_camera.position.z = getSmoothFromList( &Z.rawList );
+ target_camera.position.pitch = getSmoothFromList( &Pitch.rawList );
+ target_camera.position.yaw = getSmoothFromList( &Yaw.rawList );
+ target_camera.position.roll = getSmoothFromList( &Roll.rawList );
+ target_camera = target_camera - offset_camera;
if (Tracker::useFilter && pFilter) {
pFilter->FilterHeadPoseData(&current_camera.position, &target_camera.position, &new_camera.position, Tracker::Pitch.newSample);
@@ -610,6 +552,33 @@ void Tracker::run() {
output_camera.position.roll = Roll.invert * getOutputFromCurve(&Roll.curve, new_camera.position.roll, Roll.NeutralZone, Roll.MaxInput);
//
+ // Reverse Axis.
+ //
+ actualYaw = output_camera.position.yaw; // Save the actual Yaw, otherwise we can't check for +90
+ if (Tracker::do_axis_reverse) {
+ if (fabs(actualYaw) < 5.0f) {
+ waitThroughZero = true;
+ }
+ if (waitThroughZero) {
+ output_camera.position.yaw *= -1.0f;
+ }
+ if (output_camera.position.yaw > 0.0f) {
+ output_camera.position.yaw = 180.0f - output_camera.position.yaw;
+ }
+ else {
+ output_camera.position.yaw = -180.0f - output_camera.position.yaw;
+ }
+ }
+ else {
+ if (fabs(actualYaw) < 5.0f) {
+ waitThroughZero = false;
+ }
+ if (waitThroughZero) {
+ output_camera.position.yaw *= -1.0f;
+ }
+ }
+
+ //
// Reset value for the selected axis, if inhibition is active
//
if (Tracker::do_inhibit) {
@@ -621,44 +590,11 @@ void Tracker::run() {
if (InhibitKey.doZ) output_camera.position.z = 0.0f;
}
- //
- // Send the Virtual Pose to selected Protocol-Server
- //
- // Free-track
- if (selectedClient == FREE_TRACK) {
- server_Game->setHeadRotX( output_camera.position.pitch ); // degrees
- server_Game->setHeadRotY( output_camera.position.yaw );
- server_Game->setHeadRotZ( output_camera.position.roll );
-
- server_Game->setHeadPosX( output_camera.position.x ); // centimeters
- server_Game->setHeadPosY( output_camera.position.y );
- server_Game->setHeadPosZ( output_camera.position.z );
- }
-
- // All Protocol server(s)
- if (server_Game) {
- server_Game->setVirtRotX ( output_camera.position.pitch ); // degrees
- server_Game->setVirtRotY ( output_camera.position.yaw );
- server_Game->setVirtRotZ ( output_camera.position.roll );
- server_Game->setVirtPosX ( output_camera.position.x ); // centimeters
- server_Game->setVirtPosY ( output_camera.position.y );
- server_Game->setVirtPosZ ( output_camera.position.z );
- }
-
// All Protocol server(s)
if (pProtocol) {
pProtocol->sendHeadposeToGame( &output_camera ); // degrees & centimeters
}
-// headRotXLine->setText(QString("%1").arg( new_camera.position.pitch, 0, 'f', 1)); // show degrees
-// headRotYLine->setText(QString("%1").arg( new_camera.position.yaw, 0, 'f', 1));
-// headRotZLine->setText(QString("%1").arg( new_camera.position.roll, 0, 'f', 1));
-//
-//// headXLine->setText(QString("%1").arg( new_camera.position.x, 0, 'f', 1)); // show centimeters
-// headYLine->setText(QString("%1").arg( new_camera.position.y, 0, 'f', 1));
-// headZLine->setText(QString("%1").arg( new_camera.position.z, 0, 'f', 1));
-
-
# ifdef USE_DEBUG_CLIENT
debug_Client->setHeadRotX( Tracker::Pitch.headPos ); // degrees
debug_Client->setHeadRotY( Tracker::Yaw.headPos );
@@ -682,13 +618,14 @@ void Tracker::run() {
//
// Go to initial position
//
- if (server_Game && setZero) {
- server_Game->setVirtRotX ( 0.0f );
- server_Game->setVirtRotY ( 0.0f );
- server_Game->setVirtRotZ ( 0.0f );
- server_Game->setVirtPosX ( 0.0f );
- server_Game->setVirtPosY ( 0.0f );
- server_Game->setVirtPosZ ( 0.0f );
+ if (pProtocol && setZero) {
+ output_camera.position.pitch = 0.0f;
+ output_camera.position.yaw = 0.0f;
+ output_camera.position.roll = 0.0f;
+ output_camera.position.x = 0.0f;
+ output_camera.position.y = 0.0f;
+ output_camera.position.z = 0.0f;
+ pProtocol->sendHeadposeToGame( &output_camera ); // degrees & centimeters
}
}
}
@@ -705,7 +642,6 @@ void Tracker::run() {
Tracker::Pitch.newSample = false;
ReleaseMutex(Tracker::hTrackMutex);
- server_Game->sendHeadposeToGame();
//for lower cpu load
usleep(10000);
@@ -749,7 +685,8 @@ void Tracker::addHeadPose( THeadPoseData head_pose )
QString Tracker::getGameProgramName() {
QString str;
- str = server_Game->GetProgramName();
+// str = server_Game->GetProgramName();
+ str = QString("");
return str;
}
@@ -1100,6 +1037,13 @@ QPointF point1, point2, point3, point4;
InhibitKey.doY = iniFile.value ( "Inhibit_Y", 0 ).toBool();
InhibitKey.doZ = iniFile.value ( "Inhibit_Z", 0 ).toBool();
+ // Axis Reverse key
+ AxisReverseKey.keycode = DIK_R;
+ AxisReverseKey.shift = false;
+ AxisReverseKey.ctrl = false;
+ AxisReverseKey.alt = false;
+
+
iniFile.endGroup ();
}
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 3440495f..a46bfa2e 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -35,14 +35,7 @@
#define DIRECTINPUT_VERSION 0x0800
#include <Dinput.h>
-//#include "FTServer.h" // Freetrack-server
-//#include "FGServer.h" // FlightGear-server
-//#include "PPJoyServer.h" // Virtual Joystick
-//#include "FTIRServer.h" // FakeTIR-server
-#include "SCServer.h" // SimConnect-server (for MS Flight Simulator X)
-#include "FSUIPCServer.h" // FSUIPC-server (for MS Flight Simulator 2004)
#include "ExcelServer.h" // Excel-server (for analysing purposes)
-#include "FTNServer.h" // FaceTrackNoIR-server (for client-server)
#include "FTNoIR_cxx_protocolserver.h"
#include "..\ftnoir_tracker_base\FTNoIR_Tracker_base.h"
@@ -88,6 +81,11 @@ enum FTNoIR_Face_Tracker {
FT_FTNOIR = 1
};
+enum FTNoIR_Tracker_Status {
+ TRACKER_OFF = 0,
+ TRACKER_ON = 1
+};
+
class FaceTrackNoIR; // pre-define parent-class to avoid circular includes
//
@@ -179,13 +177,15 @@ private:
static TShortKey CenterKey; // ShortKey to Center headposition
static TShortKey StartStopKey; // ShortKey to Start/stop tracking
- static TShortKey InhibitKey; // ShortKey to one or more axis during tracking
+ static TShortKey InhibitKey; // ShortKey to disable one or more axis during tracking
+ static TShortKey AxisReverseKey; // ShortKey to reverse axis during tracking
// Flags to start/stop/reset tracking
static bool confid; // Tracker data is OK
static bool do_tracking; // Start/stop tracking, using the shortkey
static bool do_center; // Center head-position, using the shortkey
static bool do_inhibit; // Inhibit DOF-axis, using the shortkey
+ static bool do_axis_reverse; // Axis reverse, using the shortkey
static HANDLE hTrackMutex; // Prevent reading/writing the headpose simultaneously
@@ -195,7 +195,6 @@ private:
FaceTrackNoIR *mainApp;
- QSharedPointer<ProtocolServerBase> server_Game; // Protocol Server to communicate headpose-data to the Game!
QSharedPointer<ProtocolServerBase> debug_Client; // Protocol Server to log debug-data
protected:
@@ -214,7 +213,8 @@ public:
void loadSettings(); // Load settings from the INI-file
bool isShortKeyPressed( TShortKey *key, BYTE *keystate );
-// QSharedPointer<EngineBase> getEngine() { return _engine; };
+ static bool getTrackingActive() { return do_tracking; }
+ static bool getAxisReverse() { return do_axis_reverse; }
static bool getConfid() { return confid; }