summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-01-09 20:19:28 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-01-09 20:19:28 +0000
commitfa0149df2e558680918b772a13e507ccce66d74b (patch)
treec5133b1400f04996786abe45af5cd97f72506005 /FaceTrackNoIR
parent40faae3082187a5da496bcc39099ea72b9b79d0f (diff)
Started Excel client
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@37 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r--FaceTrackNoIR/ExcelServer.cpp62
-rw-r--r--FaceTrackNoIR/ExcelServer.h65
-rw-r--r--FaceTrackNoIR/FGServer.cpp2
-rw-r--r--FaceTrackNoIR/FGServer.h2
-rw-r--r--FaceTrackNoIR/FGTypes.h2
-rw-r--r--FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui21
-rw-r--r--FaceTrackNoIR/FTNoIR_Preferences.ui78
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp28
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h2
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.vcproj65
-rw-r--r--FaceTrackNoIR/PPJoyServer.cpp2
-rw-r--r--FaceTrackNoIR/PPJoyServer.h2
-rw-r--r--FaceTrackNoIR/SCServer.cpp46
-rw-r--r--FaceTrackNoIR/SCServer.h32
-rw-r--r--FaceTrackNoIR/main.cpp2
-rw-r--r--FaceTrackNoIR/tracker.cpp102
-rw-r--r--FaceTrackNoIR/tracker.h10
17 files changed, 419 insertions, 104 deletions
diff --git a/FaceTrackNoIR/ExcelServer.cpp b/FaceTrackNoIR/ExcelServer.cpp
new file mode 100644
index 00000000..d512ef7a
--- /dev/null
+++ b/FaceTrackNoIR/ExcelServer.cpp
@@ -0,0 +1,62 @@
+/********************************************************************************
+* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2010 Wim Vriend (Developing) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage *
+* *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 3 of the License, or (at your *
+* option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, but *
+* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
+* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
+* more details. *
+* *
+* You should have received a copy of the GNU General Public License along *
+* with this program; if not, see <http://www.gnu.org/licenses/>. *
+* *
+* ExcelServer ExcelServer is the Class, that communicates headpose-data *
+* to Excel, for analysing purposes. *
+********************************************************************************/
+/*
+ Modifications (last one on top):
+ 20101224 - WVR: Base class is no longer inheriting QThread. sendHeadposeToGame
+ is called from run() of Tracker.cpp
+*/
+#include <QtGui>
+#include "ExcelServer.h"
+#include "Tracker.h"
+
+/** constructor **/
+ExcelServer::ExcelServer( Tracker *parent ) {
+
+ // Save the parent
+ headTracker = parent;
+}
+
+/** destructor **/
+ExcelServer::~ExcelServer() {
+}
+
+//
+// Update Headpose in Game.
+//
+void ExcelServer::sendHeadposeToGame() {
+}
+
+//
+// Check if the Client DLL exists and load it (to test it), if so.
+// Returns 'true' if all seems OK.
+//
+bool ExcelServer::checkServerInstallationOK( HANDLE handle )
+{
+ return true;
+}
+
+//END
diff --git a/FaceTrackNoIR/ExcelServer.h b/FaceTrackNoIR/ExcelServer.h
new file mode 100644
index 00000000..434591e8
--- /dev/null
+++ b/FaceTrackNoIR/ExcelServer.h
@@ -0,0 +1,65 @@
+/********************************************************************************
+* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2010 Wim Vriend (Developing) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage *
+* *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 3 of the License, or (at your *
+* option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, but *
+* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
+* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
+* more details. *
+* *
+* You should have received a copy of the GNU General Public License along *
+* with this program; if not, see <http://www.gnu.org/licenses/>. *
+* *
+* ExcelServer ExcelServer is the Class, that communicates headpose-data *
+* to Excel, for analysing purposes. *
+********************************************************************************/
+#pragma once
+#ifndef INCLUDED_EXCELSERVER_H
+#define INCLUDED_EXCELSERVER_H
+
+#include "FTNoIR_cxx_protocolserver.h"
+#include <QString>
+#include <QMessageBox>
+#include <QSettings>
+#include <QFile>
+#include <QApplication>
+#include <QDebug>
+#include <QMutex>
+#include <QLibrary>
+
+using namespace std;
+using namespace v4friend::ftnoir;
+
+class Tracker; // pre-define parent-class to avoid circular includes
+
+class ExcelServer : public ProtocolServerBase {
+ Q_OBJECT
+
+public:
+
+ // public member methods
+ ExcelServer( Tracker *parent );
+ ~ExcelServer();
+
+ // protected member methods
+protected:
+ bool checkServerInstallationOK( HANDLE handle );
+ void sendHeadposeToGame();
+
+private:
+ Tracker *headTracker; // For upstream messages...
+};
+
+#endif//INCLUDED_EXCELSERVER_H
+//END
diff --git a/FaceTrackNoIR/FGServer.cpp b/FaceTrackNoIR/FGServer.cpp
index a149a776..fa7b60d5 100644
--- a/FaceTrackNoIR/FGServer.cpp
+++ b/FaceTrackNoIR/FGServer.cpp
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
diff --git a/FaceTrackNoIR/FGServer.h b/FaceTrackNoIR/FGServer.h
index 8e7d8b21..6efe2ba3 100644
--- a/FaceTrackNoIR/FGServer.h
+++ b/FaceTrackNoIR/FGServer.h
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
diff --git a/FaceTrackNoIR/FGTypes.h b/FaceTrackNoIR/FGTypes.h
index 0c5244e1..949dc213 100644
--- a/FaceTrackNoIR/FGTypes.h
+++ b/FaceTrackNoIR/FGTypes.h
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
diff --git a/FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui b/FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui
index 02f2028f..cbd0514d 100644
--- a/FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui
+++ b/FaceTrackNoIR/FTNoIR_KeyboardShortcuts.ui
@@ -294,6 +294,27 @@
</property>
</widget>
</item>
+ <item row="1" column="6">
+ <widget class="QRadioButton" name="radioSetZero">
+ <property name="text">
+ <string>Zero</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="7">
+ <widget class="QRadioButton" name="radioSetFreeze">
+ <property name="text">
+ <string>Stay</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="5">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>When OFF:</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
diff --git a/FaceTrackNoIR/FTNoIR_Preferences.ui b/FaceTrackNoIR/FTNoIR_Preferences.ui
index c3fbeff0..78e6aeaf 100644
--- a/FaceTrackNoIR/FTNoIR_Preferences.ui
+++ b/FaceTrackNoIR/FTNoIR_Preferences.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>463</width>
- <height>180</height>
+ <width>485</width>
+ <height>131</height>
</rect>
</property>
<property name="windowTitle">
@@ -43,49 +43,50 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="QSlider" name="slideAutoMinimizeTime">
+ <widget class="QSpinBox" name="spinAutoMinimizeTime">
<property name="toolTip">
<string extracomment="Time after Start Tracker"/>
</property>
<property name="maximum">
<number>1000</number>
</property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <property name="singleStep">
+ <number>5</number>
</property>
</widget>
</item>
<item row="0" column="2">
- <widget class="QSpinBox" name="spinAutoMinimizeTime">
- <property name="toolTip">
- <string extracomment="Time after Start Tracker"/>
- </property>
- <property name="maximum">
- <number>1000</number>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>sec. (after 'Start')</string>
</property>
- <property name="singleStep">
- <number>5</number>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Automatically Start tracking on Startup</string>
</property>
</widget>
</item>
<item row="0" column="3">
- <widget class="QLabel" name="label">
+ <widget class="QRadioButton" name="radioMinimize">
<property name="text">
- <string>sec. (after 'Start')</string>
+ <string>Taskbar</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="chkAutoStartTracking">
+ <item row="0" column="4">
+ <widget class="QRadioButton" name="radioTray">
<property name="text">
- <string/>
+ <string>Tray</string>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="chkAutoStartTracking">
<property name="text">
- <string>Automatically Start tracking on Startup</string>
+ <string/>
</property>
</widget>
</item>
@@ -197,40 +198,7 @@
</layout>
</widget>
<resources/>
- <connections>
- <connection>
- <sender>slideAutoMinimizeTime</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinAutoMinimizeTime</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>245</x>
- <y>21</y>
- </hint>
- <hint type="destinationlabel">
- <x>330</x>
- <y>17</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinAutoMinimizeTime</sender>
- <signal>valueChanged(int)</signal>
- <receiver>slideAutoMinimizeTime</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>352</x>
- <y>17</y>
- </hint>
- <hint type="destinationlabel">
- <x>267</x>
- <y>18</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
<slots>
<slot>startEngineClicked()</slot>
<slot>stopEngineClicked()</slot>
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 241b27e2..fda8ea84 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
@@ -21,7 +21,10 @@
* You should have received a copy of the GNU General Public License along *
* with this program; if not, see <http://www.gnu.org/licenses/>. *
*********************************************************************************/
-
+/*
+ Modifications (last one on top):
+ 20110109 - WVR: Added minimizeTaskBar option added. It is now possible to choose minimized or tray.
+*/
#include "FaceTrackNoIR.h"
#include "tracker.h"
#include "PPJoyServer.h"
@@ -512,8 +515,16 @@ void FaceTrackNoIR::startTracker( ) {
//
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
int timevalue = settings.value ( "AutoMinimizeTime", 0 ).toInt() * 1000;
-
if (timevalue > 0) {
+
+ bool minimizeTaskBar = settings.value ( "MinimizeTaskBar", 1 ).toBool();
+ if (minimizeTaskBar) {
+ connect(timMinimizeFTN, SIGNAL(timeout()), this, SLOT(showMinimized()));
+ }
+ else {
+ connect(timMinimizeFTN, SIGNAL(timeout()), this, SLOT(hide()));
+ }
+
timMinimizeFTN->setSingleShot( true );
timMinimizeFTN->start(timevalue);
}
@@ -923,8 +934,9 @@ QWidget( parent , f)
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- connect(ui.slideAutoMinimizeTime, SIGNAL(valueChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.spinAutoMinimizeTime, SIGNAL(valueChanged(int)), this, SLOT(keyChanged(int)));
connect(ui.chkAutoStartTracking, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
+ connect(ui.radioMinimize, SIGNAL(stateChanged(int)), this, SLOT(keyChanged(int)));
// Load the settings from the current .INI-file
loadSettings();
@@ -989,8 +1001,9 @@ void PreferencesDialog::doCancel() {
void PreferencesDialog::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
- ui.slideAutoMinimizeTime->setValue( settings.value ( "AutoMinimizeTime", 0 ).toInt() );
+ ui.spinAutoMinimizeTime->setValue( settings.value ( "AutoMinimizeTime", 0 ).toInt() );
ui.chkAutoStartTracking->setChecked( settings.value ( "AutoStartTracking", 0 ).toBool() );
+ ui.radioMinimize->setChecked( settings.value ( "MinimizeTaskBar", 1 ).toBool() );
settingsDirty = false;
@@ -1002,8 +1015,9 @@ void PreferencesDialog::loadSettings() {
void PreferencesDialog::save() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
- settings.setValue( "AutoMinimizeTime", ui.slideAutoMinimizeTime->value() );
+ settings.setValue( "AutoMinimizeTime", ui.spinAutoMinimizeTime->value() );
settings.setValue( "AutoStartTracking", ui.chkAutoStartTracking->isChecked() );
+ settings.setValue( "MinimizeTaskBar", ui.radioMinimize->isChecked() );
//
// Send a message to the main program, to update the Settings (for the tracker)
@@ -1292,6 +1306,7 @@ int keyindex;
ui.chkStartStopShift->setChecked (iniFile.value ( "Shift_StartStop", 0 ).toBool());
ui.chkStartStopCtrl->setChecked (iniFile.value ( "Ctrl_StartStop", 0 ).toBool());
ui.chkStartStopAlt->setChecked (iniFile.value ( "Alt_StartStop", 0 ).toBool());
+ ui.radioSetZero->setChecked (iniFile.value ( "SetZero", 1 ).toBool());
// Axis-inhibitor key
keyindex = keyList.indexOf ( iniFile.value ( "Keycode_Inhibit", 1 ).toInt() );
@@ -1340,6 +1355,7 @@ void KeyboardShortcutDialog::save() {
iniFile.setValue ( "Shift_StartStop", ui.chkStartStopShift->isChecked() );
iniFile.setValue ( "Ctrl_StartStop", ui.chkStartStopCtrl->isChecked() );
iniFile.setValue ( "Alt_StartStop", ui.chkStartStopAlt->isChecked() );
+ iniFile.setValue ( "SetZero", ui.radioSetZero->isChecked() );
iniFile.setValue ( "Keycode_Inhibit", keyList.at( ui.cbxInhibitKey->currentIndex() ) );
iniFile.setValue ( "Shift_Inhibit", ui.chkInhibitShift->isChecked() );
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index e4382cd6..8be8b6d6 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj b/FaceTrackNoIR/FaceTrackNoIR.vcproj
index 01a0b679..7eebeece 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.vcproj
+++ b/FaceTrackNoIR/FaceTrackNoIR.vcproj
@@ -196,6 +196,10 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
+ RelativePath=".\ExcelServer.cpp"
+ >
+ </File>
+ <File
RelativePath=".\FaceApp.cpp"
>
</File>
@@ -242,6 +246,32 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
+ RelativePath=".\ExcelServer.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;.\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=".\FaceApp.h"
>
<FileConfiguration
@@ -820,6 +850,18 @@
SourceControlFiles="false"
>
<File
+ RelativePath=".\GeneratedFiles\Release\moc_ExcelServer.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\GeneratedFiles\Release\moc_FaceApp.cpp"
>
<FileConfiguration
@@ -946,6 +988,29 @@
SourceControlFiles="false"
>
<File
+ RelativePath=".\GeneratedFiles\Debug\moc_ExcelServer.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_FaceApp.cpp"
>
<FileConfiguration
diff --git a/FaceTrackNoIR/PPJoyServer.cpp b/FaceTrackNoIR/PPJoyServer.cpp
index cf0773c2..83b27f39 100644
--- a/FaceTrackNoIR/PPJoyServer.cpp
+++ b/FaceTrackNoIR/PPJoyServer.cpp
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
diff --git a/FaceTrackNoIR/PPJoyServer.h b/FaceTrackNoIR/PPJoyServer.h
index b5fdd012..a12ce34a 100644
--- a/FaceTrackNoIR/PPJoyServer.h
+++ b/FaceTrackNoIR/PPJoyServer.h
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
diff --git a/FaceTrackNoIR/SCServer.cpp b/FaceTrackNoIR/SCServer.cpp
index baf3b078..ec6adac0 100644
--- a/FaceTrackNoIR/SCServer.cpp
+++ b/FaceTrackNoIR/SCServer.cpp
@@ -26,18 +26,30 @@
*/
#include "SCServer.h"
+importSimConnect_CameraSetRelative6DOF SCServer::simconnect_set6DOF;
+HANDLE SCServer::hSimConnect = 0; // Handle to SimConnect
+
+float SCServer::virtSCPosX = 0.0f; // Headpose
+float SCServer::virtSCPosY = 0.0f;
+float SCServer::virtSCPosZ = 0.0f;
+
+float SCServer::virtSCRotX = 0.0f;
+float SCServer::virtSCRotY = 0.0f;
+float SCServer::virtSCRotZ = 0.0f;
+
+float SCServer::prevSCPosX = 0.0f; // previous Headpose
+float SCServer::prevSCPosY = 0.0f;
+float SCServer::prevSCPosZ = 0.0f;
+
+float SCServer::prevSCRotX = 0.0f;
+float SCServer::prevSCRotY = 0.0f;
+float SCServer::prevSCRotZ = 0.0f;
+
/** constructor **/
SCServer::SCServer() {
ProgramName = "Microsoft FSX";
blnSimConnectActive = false;
hSimConnect = 0;
-
- //prevPosX = 0.0f;
- //prevPosY = 0.0f;
- //prevPosZ = 0.0f;
- //prevRotX = 0.0f;
- //prevRotY = 0.0f;
- //prevRotZ = 0.0f;
}
/** destructor **/
@@ -53,7 +65,7 @@ SCServer::~SCServer() {
}
qDebug() << "~SCServer says: before unload";
-// SCClientLib.unload();
+// SCClientLib.unload(); Generates crash when tracker is ended...
qDebug() << "~SCServer says: finished";
}
@@ -91,9 +103,9 @@ void SCServer::sendHeadposeToGame() {
//
if ((prevPosX != virtPosX) || (prevPosY != virtPosY) || (prevPosZ != virtPosZ) ||
(prevRotX != virtRotX) || (prevRotY != virtRotY) || (prevRotZ != virtRotZ)) {
- if (S_OK == simconnect_set6DOF(hSimConnect, virtPosX, virtPosY, virtPosZ, virtRotX, virtRotZ, virtRotY)) {
+// if (S_OK == simconnect_set6DOF(hSimConnect, virtPosX, virtPosY, virtPosZ, virtRotX, virtRotZ, virtRotY)) {
// qDebug() << "SCServer::run() says: SimConnect data written!";
- }
+// }
}
prevPosX = virtPosX;
@@ -282,7 +294,19 @@ void CALLBACK SCServer::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD
}
case SIMCONNECT_RECV_ID_EVENT_FRAME:
{
- qDebug() << "SCServer::processNextSimconnectEvent() says: Frame event!";
+// qDebug() << "SCServer::processNextSimconnectEvent() says: Frame event!";
+ if ((prevSCPosX != virtSCPosX) || (prevSCPosY != virtSCPosY) || (prevSCPosZ != virtSCPosZ) ||
+ (prevSCRotX != virtSCRotX) || (prevSCRotY != virtSCRotY) || (prevSCRotZ != virtSCRotZ)) {
+ if (S_OK == simconnect_set6DOF(hSimConnect, virtSCPosX, virtSCPosY, virtSCPosZ, virtSCRotX, virtSCRotZ, virtSCRotY)) {
+ // qDebug() << "SCServer::run() says: SimConnect data written!";
+ }
+ }
+ prevSCPosX = virtSCPosX;
+ prevSCPosY = virtSCPosY;
+ prevSCPosZ = virtSCPosZ;
+ prevSCRotX = virtSCRotX;
+ prevSCRotY = virtSCRotY;
+ prevSCRotZ = virtSCRotZ;
}
case SIMCONNECT_RECV_ID_EXCEPTION:
diff --git a/FaceTrackNoIR/SCServer.h b/FaceTrackNoIR/SCServer.h
index b48a9a07..03917401 100644
--- a/FaceTrackNoIR/SCServer.h
+++ b/FaceTrackNoIR/SCServer.h
@@ -93,26 +93,42 @@ private:
importSimConnect_Open simconnect_open; // SimConnect function(s) in DLL
importSimConnect_Close simconnect_close;
- importSimConnect_CameraSetRelative6DOF simconnect_set6DOF;
+ static importSimConnect_CameraSetRelative6DOF simconnect_set6DOF;
importSimConnect_CallDispatch simconnect_calldispatch;
importSimConnect_SubscribeToSystemEvent simconnect_subscribetosystemevent;
importSimConnect_MapClientEventToSimEvent simconnect_mapclienteventtosimevent;
importSimConnect_AddClientEventToNotificationGroup simconnect_addclienteventtonotificationgroup;
importSimConnect_SetNotificationGroupPriority simconnect_setnotificationgrouppriority;
- HANDLE hSimConnect; // Handle to SimConnect
+ static HANDLE hSimConnect; // Handle to SimConnect
static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext);
+ static float virtSCPosX;
+ static float virtSCPosY;
+ static float virtSCPosZ;
+
+ static float virtSCRotX;
+ static float virtSCRotY;
+ static float virtSCRotZ;
+
+ static float prevSCPosX;
+ static float prevSCPosY;
+ static float prevSCPosZ;
+
+ static float prevSCRotX;
+ static float prevSCRotY;
+ static float prevSCRotZ;
+
bool blnSimConnectActive;
public:
- void setVirtRotX(float rot) { virtRotX = -1.0f * rot; } // degrees
- void setVirtRotY(float rot) { virtRotY = -1.0f * rot; }
- void setVirtRotZ(float rot) { virtRotZ = rot; }
+ void setVirtRotX(float rot) { virtSCRotX = -1.0f * rot; } // degrees
+ void setVirtRotY(float rot) { virtSCRotY = -1.0f * rot; }
+ void setVirtRotZ(float rot) { virtSCRotZ = rot; }
- void setVirtPosX(float pos) { virtPosX = pos/100.f; } // cm to meters
- void setVirtPosY(float pos) { virtPosY = pos/100.f; }
- void setVirtPosZ(float pos) { virtPosZ = -1.0f * pos/100.f; }
+ void setVirtPosX(float pos) { virtSCPosX = pos/100.f; } // cm to meters
+ void setVirtPosY(float pos) { virtSCPosY = pos/100.f; }
+ void setVirtPosZ(float pos) { virtSCPosZ = -1.0f * pos/100.f; }
};
diff --git a/FaceTrackNoIR/main.cpp b/FaceTrackNoIR/main.cpp
index 3ac36886..60a2f71b 100644
--- a/FaceTrackNoIR/main.cpp
+++ b/FaceTrackNoIR/main.cpp
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index a0154788..6e360ade 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
@@ -23,6 +23,8 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20110109 - WVR: Added setZero option to define behaviour after STOP tracking via shortkey.
+ 20110104 - WVR: Removed a few nasty bugs (it was impossible to stop tracker without crash).
20101224 - WVR: Removed the QThread inheritance of the Base Class for the protocol-servers.
Again, this drastically simplifies the code in the protocols.
20101217 - WVR: Created Base Class for the protocol-servers. This drastically simplifies
@@ -47,6 +49,12 @@
#include "tracker.h"
#include "FaceTrackNoIR.h"
+//
+// Definitions for testing purposes
+//
+#define USE_HEADPOSE_CALLBACK
+#define USE_DEBUG_CLIENT
+
using namespace sm::faceapi;
using namespace sm::faceapi::qt;
@@ -57,6 +65,7 @@ bool Tracker::do_tracking = true;
bool Tracker::do_center = false;
bool Tracker::do_inhibit = false;
bool Tracker::useFilter = false;
+bool Tracker::setZero = true;
HANDLE Tracker::hTrackMutex = 0;
long Tracker::prevHeadPoseTime = 0;
@@ -151,6 +160,11 @@ Tracker::Tracker( int clientID, int facetrackerID ) {
// should never be reached
break;
}
+
+# ifdef USE_DEBUG_CLIENT
+ debug_Client = QSharedPointer<ExcelServer>(new ExcelServer ( this )); // Create Excel protocol-server
+# endif
+
// Load the settings from the INI-file
loadSettings();
}
@@ -181,7 +195,12 @@ Tracker::~Tracker() {
if (server_Game) {
server_Game->deleteLater();
}
- qDebug() << "Tracker::~Tracker Finished...";
+
+# ifdef USE_DEBUG_CLIENT
+ debug_Client->deleteLater(); // Delete Excel protocol-server
+# endif
+
+ qDebug() << "Tracker::~Tracker Finished...";
}
@@ -195,7 +214,9 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
if (selectedTracker == FT_SM_FACEAPI) {
//registers the faceapi callback for receiving headpose data **/
+# ifdef USE_HEADPOSE_CALLBACK
registerHeadPoseCallback();
+# endif
// some parameteres [optional]
smHTSetHeadPosePredictionEnabled( _engine->handle(), false);
@@ -225,6 +246,14 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
}
}
+
+# ifdef USE_DEBUG_CLIENT
+ DLL_Ok = debug_Client->checkServerInstallationOK( mainApp->winId() ); // Check installation
+ if (!DLL_Ok) {
+ QMessageBox::information(mainApp, "FaceTrackNoIR error", "Excel Protocol is not (correctly) installed!");
+ }
+# endif
+
}
/** QThread run method @override **/
@@ -247,6 +276,11 @@ void Tracker::run() {
long newHeadPoseTime;
float dT;
+# ifndef USE_HEADPOSE_CALLBACK
+ smEngineHeadPoseData head_pose; // headpose from faceAPI
+ smEngineHeadPoseData temp_head_pose; // headpose from faceAPI
+# endif
+
//
// Setup the DirectInput for keyboard strokes
//
@@ -366,6 +400,21 @@ void Tracker::run() {
if (WaitForSingleObject(Tracker::hTrackMutex, 100) == WAIT_OBJECT_0) {
+# ifndef USE_HEADPOSE_CALLBACK
+ smReturnCode smret = smHTCurrentHeadPose(_engine->handle(), &temp_head_pose);
+ memcpy(&head_pose, &temp_head_pose, sizeof(smEngineHeadPoseData));
+
+ if ( head_pose.confidence > 0 ) {
+
+ Tracker::confid = true;
+
+ // Write the Raw headpose-data and add it to the RawList, for processing...
+ addHeadPose( head_pose );
+ } else {
+ Tracker::confid = false;
+ }
+# endif
+
//
// Get the System-time and substract the time from the previous call.
// dT will be used for the EWMA-filter.
@@ -532,12 +581,31 @@ void Tracker::run() {
server_Game->setVirtPosY ( posY );
server_Game->setVirtPosZ ( posZ );
}
+
+# ifdef USE_DEBUG_CLIENT
+ debug_Client->setHeadRotX( Tracker::Pitch.headPos ); // degrees
+ debug_Client->setHeadRotY( Tracker::Yaw.headPos );
+ debug_Client->setHeadRotZ( Tracker::Roll.headPos );
+
+ debug_Client->setHeadPosX( Tracker::X.headPos ); // centimeters
+ debug_Client->setHeadPosY( Tracker::Y.headPos );
+ debug_Client->setHeadPosZ( Tracker::Z.headPos );
+
+ debug_Client->setVirtRotX ( rotX ); // degrees
+ debug_Client->setVirtRotY ( rotY );
+ debug_Client->setVirtRotZ ( rotZ );
+ debug_Client->setVirtPosX ( posX ); // centimeters
+ debug_Client->setVirtPosY ( posY );
+ debug_Client->setVirtPosZ ( posZ );
+# endif
+
+
}
else {
//
// Go to initial position
//
- if (server_Game) {
+ if (server_Game && setZero) {
server_Game->setVirtRotX ( 0.0f );
server_Game->setVirtRotY ( 0.0f );
server_Game->setVirtRotZ ( 0.0f );
@@ -568,12 +636,27 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
{
//
// Perform actions, when valid data is received from faceAPI.
- // Write the Raw headpose-data and add it to the RawList, for processing...
//
if (( head_pose.confidence > 0 ) && (WaitForSingleObject(Tracker::hTrackMutex, 100) == WAIT_OBJECT_0) ) {
Tracker::confid = true;
+ // Write the Raw headpose-data and add it to the RawList, for processing...
+ addHeadPose( head_pose );
+ } else {
+ Tracker::confid = false;
+ }
+
+ ReleaseMutex(Tracker::hTrackMutex);
+
+ // for lower cpu load
+ msleep(10);
+ yieldCurrentThread();
+}
+
+/** Add the headpose-data to the Lists **/
+void Tracker::addHeadPose( smEngineHeadPoseData head_pose )
+{
// Pitch
Tracker::Pitch.headPos = head_pose.head_rot.x_rads * 57.295781f; // degrees
addRaw2List ( &Pitch.rawList, Pitch.maxItems, Tracker::Pitch.headPos );
@@ -597,16 +680,6 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
// Z-position (distance to camera, absolute!)
Tracker::Z.headPos = head_pose.head_pos.z * 100.0f; // centimeters
addRaw2List ( &Z.rawList, Z.maxItems, Tracker::Z.headPos );
-
- } else {
- Tracker::confid = false;
- }
-
- ReleaseMutex(Tracker::hTrackMutex);
-
- // for lower cpu load
- msleep(10);
- yieldCurrentThread();
}
//
@@ -895,6 +968,7 @@ QPointF point1, point2, point3, point4;
StartStopKey.shift = iniFile.value ( "Shift_StartStop", 0 ).toBool();
StartStopKey.ctrl = iniFile.value ( "Ctrl_StartStop", 0 ).toBool();
StartStopKey.alt = iniFile.value ( "Alt_StartStop", 0 ).toBool();
+ setZero = iniFile.value ( "SetZero", 1 ).toBool();
// Inhibit key
InhibitKey.keycode = iniFile.value ( "Keycode_Inhibit", 0 ).toInt();
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 18c629de..49d24f86 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -1,6 +1,6 @@
/********************************************************************************
* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay for *
+* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
@@ -42,6 +42,7 @@
#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 "FTNoIR_cxx_protocolserver.h"
// include the DirectX Library files
@@ -129,6 +130,7 @@ private:
/** static callback method for the head pose tracking **/
static void STDCALL receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVideoFrame video_frame);
+ static void addHeadPose( smEngineHeadPoseData head_pose );
static void addRaw2List ( QList<float> *rawList, float maxIndex, float raw );
static float lowPassFilter ( float newvalue, float *oldvalue, float dt, float coeff);
static float rateLimiter ( float newvalue, float *oldvalue, float dt, float max_rate);
@@ -156,7 +158,8 @@ private:
static HANDLE hTrackMutex; // Prevent reading/writing the headpose simultaneously
- static bool useFilter;
+ static bool useFilter; // Use EWMA-filtering
+ static bool setZero; // Set to zero's, when OFF (one-shot)
static long prevHeadPoseTime; // Time from previous sample
/** QT objects **/
@@ -171,7 +174,8 @@ private:
QWidget *headPoseWidget;
FaceTrackNoIR *mainApp;
- QSharedPointer<ProtocolServerBase> server_Game; // Protocol Server to communicate headpose-data to the Game!
+ QSharedPointer<ProtocolServerBase> server_Game; // Protocol Server to communicate headpose-data to the Game!
+ QSharedPointer<ProtocolServerBase> debug_Client; // Protocol Server to log debug-data
protected:
// qthread override run method