summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
diff options
context:
space:
mode:
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r--FaceTrackNoIR/FGServer.cpp6
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp77
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui4
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.vcproj95
-rw-r--r--FaceTrackNoIR/Release/FaceTrackNoIR.exe.intermediate.manifest5
-rw-r--r--FaceTrackNoIR/tracker.cpp22
-rw-r--r--FaceTrackNoIR/tracker.h1
7 files changed, 173 insertions, 37 deletions
diff --git a/FaceTrackNoIR/FGServer.cpp b/FaceTrackNoIR/FGServer.cpp
index fa7b60d5..53cd68ff 100644
--- a/FaceTrackNoIR/FGServer.cpp
+++ b/FaceTrackNoIR/FGServer.cpp
@@ -46,10 +46,8 @@ FGServer::FGServer( Tracker *parent ) {
/** destructor **/
FGServer::~FGServer() {
- inSocket->disconnectFromHost();
- inSocket->waitForDisconnected();
- outSocket->disconnectFromHost();
- outSocket->waitForDisconnected();
+ inSocket->close();
+ outSocket->close();
delete inSocket;
delete outSocket;
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 8c678100..eda9b51b 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -31,6 +31,7 @@
#include "FSUIPCServer.h"
#include "FTIRServer.h"
#include "FGServer.h"
+#include "FTNServer.h"
using namespace sm::faceapi;
using namespace sm::faceapi::qt;
@@ -340,7 +341,8 @@ void FaceTrackNoIR::saveAs()
// Get the new filename of the INI-file.
//
QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"),
- QCoreApplication::applicationDirPath() + "/Settings",
+ oldFile,
+// QCoreApplication::applicationDirPath() + "/Settings",
tr("Settings file (*.ini);;All Files (*)"));
if (!fileName.isEmpty()) {
@@ -368,8 +370,10 @@ void FaceTrackNoIR::saveAs()
settings.setValue ("SettingsFile", fileName);
save();
- // Put the filename in the window-title
- setWindowTitle ( "FaceTrackNoIR (1.5) - " + newFileInfo.fileName() );
+ //
+ // Reload the settings, to get the GUI right again...
+ //
+ loadSettings();
}
}
@@ -424,9 +428,10 @@ void FaceTrackNoIR::loadSettings() {
ui.chkInvertY->setChecked (iniFile.value ( "invertY", 0 ).toBool());
ui.chkInvertZ->setChecked (iniFile.value ( "invertZ", 0 ).toBool());
ui.chkUseEWMA->setChecked (iniFile.value ( "useEWMA", 1 ).toBool());
- ui.minSmooth->setValue (iniFile.value ( "minSmooth", 2 ).toInt());
+
+ ui.minSmooth->setValue (iniFile.value ( "minSmooth", 15 ).toInt());
+ ui.maxSmooth->setValue (iniFile.value ( "maxSmooth", 50 ).toInt());
ui.powCurve->setValue (iniFile.value ( "powCurve", 10 ).toInt());
- ui.maxSmooth->setValue (iniFile.value ( "maxSmooth", 10 ).toInt());
iniFile.endGroup ();
iniFile.beginGroup ( "GameProtocol" );
@@ -514,10 +519,19 @@ void FaceTrackNoIR::startTracker( ) {
ui.btnStopTracker->setEnabled ( true );
// Engine controls
- ui.btnShowEngineControls->setEnabled ( true );
- ui.iconcomboBox->setEnabled ( false );
+ switch (ui.iconcomboTrackerSource->currentIndex()) {
+ case FT_SM_FACEAPI: // Face API
+ ui.btnShowEngineControls->setEnabled ( true ); // Active only when started!
+ break;
+ case FT_FTNOIR: // FTNoir server
+ ui.btnShowEngineControls->setEnabled ( false );
+ break;
+ default:
+ break;
+ }
// Enable/disable Protocol-server Settings
+ ui.iconcomboBox->setEnabled ( false );
ui.btnShowServerControls->setEnabled ( false );
//
@@ -577,6 +591,21 @@ void FaceTrackNoIR::stopTracker( ) {
// Enable/disable Protocol-server Settings
ui.btnShowServerControls->setEnabled ( true );
+ // Engine controls
+ switch (ui.iconcomboTrackerSource->currentIndex()) {
+ case FT_SM_FACEAPI: // Face API
+ ui.btnShowEngineControls->setEnabled ( false ); // Active only when started!
+ break;
+ case FT_FTNOIR: // FTNoir server
+ ui.btnShowEngineControls->setEnabled ( true );
+ break;
+ default:
+ break;
+ }
+
+ //
+ // Stop the timer, so it won't go off again...
+ //
timMinimizeFTN->stop();
}
@@ -673,10 +702,27 @@ void FaceTrackNoIR::showHeadPoseWidget() {
/** toggles Engine Controls Dialog **/
void FaceTrackNoIR::showEngineControls() {
- // Create if new
+ //
+ // Delete the existing QDialog
+ //
+ if (_engine_controls) {
+ delete _engine_controls;
+ _engine_controls = 0;
+ }
+
+ // Create new
if (!_engine_controls)
{
- _engine_controls = new EngineControls( tracker->getEngine(), true, false, this, Qt::Dialog );
+ switch (ui.iconcomboTrackerSource->currentIndex()) {
+ case FT_SM_FACEAPI: // Face API
+ _engine_controls = new EngineControls( tracker->getEngine(), true, false, this, Qt::Dialog );
+ break;
+ case FT_FTNOIR: // FTNoir server
+ break;
+ default:
+ break;
+ }
+
}
// Show if already created
@@ -702,11 +748,9 @@ void FaceTrackNoIR::showServerControls() {
if (!_server_controls)
{
-
// Show the appropriate Protocol-server Settings
switch (ui.iconcomboBox->currentIndex()) {
case FREE_TRACK:
- case FTNOIR:
case SIMCONNECT:
break;
case PPJOY:
@@ -721,6 +765,9 @@ void FaceTrackNoIR::showServerControls() {
case FLIGHTGEAR:
_server_controls = new FGControls( this, Qt::Dialog );
break;
+ case FTNOIR:
+ _server_controls = new FTNServerControls( this, Qt::Dialog );
+ break;
default:
break;
}
@@ -860,7 +907,6 @@ void FaceTrackNoIR::setIcon(int index)
// Enable/disable Protocol-server Settings
switch (ui.iconcomboBox->currentIndex()) {
case FREE_TRACK:
- case FTNOIR:
case SIMCONNECT:
ui.btnShowServerControls->hide();
break;
@@ -868,6 +914,7 @@ void FaceTrackNoIR::setIcon(int index)
case FSUIPC:
case TRACKIR:
case FLIGHTGEAR:
+ case FTNOIR:
ui.btnShowServerControls->show();
ui.btnShowServerControls->setEnabled ( true );
break;
@@ -904,11 +951,13 @@ void FaceTrackNoIR::trackingSourceSelected(int index)
{
settingsDirty = true;
switch (ui.iconcomboTrackerSource->currentIndex()) {
- case 0: // Face API
+ case FT_SM_FACEAPI: // Face API
+ ui.btnShowEngineControls->setEnabled ( false );
break;
- case 1: // FTNoir server
+ case FT_FTNOIR: // FTNoir server
ui.video_frame->hide();
ui.headPoseWidget->show();
+ ui.btnShowEngineControls->setEnabled ( true );
break;
default:
break;
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index e6ebde75..698929cb 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -408,8 +408,8 @@ color:#000;</string>
</property>
<property name="maximumSize">
<size>
- <width>250</width>
- <height>180</height>
+ <width>500</width>
+ <height>500</height>
</size>
</property>
<property name="styleSheet">
diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj b/FaceTrackNoIR/FaceTrackNoIR.vcproj
index e56d9e5c..aeb346da 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.vcproj
+++ b/FaceTrackNoIR/FaceTrackNoIR.vcproj
@@ -224,6 +224,10 @@
>
</File>
<File
+ RelativePath=".\FTNServer.cpp"
+ >
+ </File>
+ <File
RelativePath=".\FTServer.cpp"
>
</File>
@@ -440,6 +444,32 @@
</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; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_NETWORK_LIB -DQT_NO_DEBUG -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;$(SM_API_CPP_WRAPPERS)\include\.&quot; -I&quot;$(SM_API_PATH)\include\.&quot; -I&quot;$(SM_API_QTDIR)\include\.&quot; -I&quot;$(SM_API_WIDGETS)\include\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Filter_EWMA2\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\.&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>
+ <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=".\FTServer.h"
>
<FileConfiguration
@@ -692,6 +722,32 @@
</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
@@ -837,6 +893,10 @@
>
</File>
<File
+ RelativePath=".\GeneratedFiles\ui_FTNoIR_FTNServerControls.h"
+ >
+ </File>
+ <File
RelativePath=".\GeneratedFiles\ui_FTNoIR_KeyboardShortcuts.h"
>
</File>
@@ -938,6 +998,18 @@
</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_FTServer.cpp"
>
<FileConfiguration
@@ -1098,6 +1170,29 @@
</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_FTServer.cpp"
>
<FileConfiguration
diff --git a/FaceTrackNoIR/Release/FaceTrackNoIR.exe.intermediate.manifest b/FaceTrackNoIR/Release/FaceTrackNoIR.exe.intermediate.manifest
index ca044622..324c707e 100644
--- a/FaceTrackNoIR/Release/FaceTrackNoIR.exe.intermediate.manifest
+++ b/FaceTrackNoIR/Release/FaceTrackNoIR.exe.intermediate.manifest
@@ -5,9 +5,4 @@
<assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.4053' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
- </dependentAssembly>
- </dependency>
</assembly>
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index bc7b45f8..f271ee5b 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -163,6 +163,7 @@ QLibrary *filterLib;
break;
case FTNOIR:
+ server_Game = QSharedPointer<FTNServer>(new FTNServer ( this )); // Create FaceTrackNoIR protocol-server
break;
case PPJOY:
@@ -556,15 +557,15 @@ void Tracker::run() {
if (Tracker::do_tracking && Tracker::confid) {
// Pitch
- target_camera_position.x = X.headPos - X.offset_headPos - X.initial_headPos;
- target_camera_position.y = Y.headPos - Y.offset_headPos - Y.initial_headPos;
- target_camera_position.z = Z.headPos - Z.offset_headPos - Z.initial_headPos;
- target_camera_position.pitch = Pitch.headPos - Pitch.offset_headPos - Pitch.initial_headPos;
- target_camera_position.yaw = Yaw.headPos - Yaw.offset_headPos - Yaw.initial_headPos;
- target_camera_position.roll = Roll.headPos - Roll.offset_headPos - Roll.initial_headPos;
+ target_camera_position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos - X.initial_headPos;
+ target_camera_position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos - Y.initial_headPos;
+ target_camera_position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos - Z.initial_headPos;
+ target_camera_position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos - Pitch.initial_headPos;
+ target_camera_position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos - Yaw.initial_headPos;
+ target_camera_position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos - Roll.initial_headPos;
if (Tracker::useFilter && pFilter) {
- pFilter->FilterHeadPoseData(&current_camera_position, &target_camera_position, &new_camera_position);
+ pFilter->FilterHeadPoseData(&current_camera_position, &target_camera_position, &new_camera_position, Tracker::Pitch.newSample);
}
else {
new_camera_position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos - X.initial_headPos;
@@ -658,9 +659,10 @@ void Tracker::run() {
debug_Client->prev_value = Tracker::Pitch.prevPos;
debug_Client->dT = dT;
debug_Client->sendHeadposeToGame(); // Log to Excel
- Tracker::Pitch.newSample = false;
# endif
+ Tracker::Pitch.newSample = false;
+
ReleaseMutex(Tracker::hTrackMutex);
server_Game->sendHeadposeToGame();
@@ -694,10 +696,6 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
}
ReleaseMutex(Tracker::hTrackMutex);
-
- // for lower cpu load
- msleep(10);
- yieldCurrentThread();
}
/** Add the headpose-data to the Lists **/
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 73d4161e..6c436ff8 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -43,6 +43,7 @@
#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.h"