summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2010-12-18 14:18:36 +0000
committerWim Vriend <facetracknoir@gmail.com>2010-12-18 14:18:36 +0000
commit53231950ec75f67a931d47b78987a6bcac9d2eb0 (patch)
tree8a3b2b7c1568126c59150a067a6b9d997bd04467
parent9e0250dcad1ef02dc6cba1315fe37c8c2329769a (diff)
Tracker Source beginning FTNoIR tracker
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@31 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r--FaceTrackNoIR.suobin279040 -> 280064 bytes
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp11
-rw-r--r--FaceTrackNoIR/tracker.cpp69
-rw-r--r--FaceTrackNoIR/tracker.h15
-rw-r--r--bin/FaceTrackNoIR.exebin716800 -> 716800 bytes
-rw-r--r--bin/Settings/default.ini70
6 files changed, 115 insertions, 50 deletions
diff --git a/FaceTrackNoIR.suo b/FaceTrackNoIR.suo
index 1afe4d6a..658821a8 100644
--- a/FaceTrackNoIR.suo
+++ b/FaceTrackNoIR.suo
Binary files differ
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index cbed2ffd..7298a207 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -314,6 +314,10 @@ void FaceTrackNoIR::save() {
iniFile.setValue ( "Selection", ui.iconcomboBox->currentIndex() );
iniFile.endGroup ();
+ iniFile.beginGroup ( "TrackerSource" );
+ iniFile.setValue ( "Selection", ui.iconcomboTrackerSource->currentIndex() );
+ iniFile.endGroup ();
+
settingsDirty = false;
}
@@ -402,6 +406,10 @@ void FaceTrackNoIR::loadSettings() {
setIcon( ui.iconcomboBox->currentIndex() );
iniFile.endGroup ();
+ iniFile.beginGroup ( "TrackerSource" );
+ ui.iconcomboTrackerSource->setCurrentIndex(iniFile.value ( "Selection", 0 ).toInt());
+ iniFile.endGroup ();
+
settingsDirty = false;
// Put the filename in the window-title
@@ -445,7 +453,7 @@ void FaceTrackNoIR::startTracker( ) {
//
// Create the Tracker and setup
//
- tracker = new Tracker ( ui.iconcomboBox->currentIndex() );
+ tracker = new Tracker ( ui.iconcomboBox->currentIndex(), ui.iconcomboTrackerSource->currentIndex() );
// Show the video widget
ui.video_frame->show();
@@ -880,6 +888,7 @@ void FaceTrackNoIR::iconActivated(QSystemTrayIcon::ActivationReason reason)
//
void FaceTrackNoIR::trackingSourceSelected(int index)
{
+ settingsDirty = true;
switch (ui.iconcomboTrackerSource->currentIndex()) {
case 0: // Face API
break;
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index 8439526b..1e3c17b4 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -69,11 +69,12 @@ TShortKey Tracker::StartStopKey; // ShortKey to Start/stop tracking
TShortKey Tracker::InhibitKey; // ShortKey to inhibit axis while tracking
/** constructor **/
-Tracker::Tracker( int clientID ) {
+Tracker::Tracker( int clientID, int facetrackerID ) {
// Remember the selected client, from the ListBox
// If the Tracker runs, this can NOT be changed...
selectedClient = (FTNoIR_Client) clientID;
+ selectedTracker = (FTNoIR_Face_Tracker) facetrackerID;
// Create events
m_StopThread = CreateEvent(0, TRUE, FALSE, 0);
@@ -105,30 +106,30 @@ Tracker::Tracker( int clientID ) {
//
switch (selectedClient) {
case FREE_TRACK:
- server_FG = QSharedPointer<FTServer>(new FTServer ( )); // Create Free-track protocol-server
+ server_Game = QSharedPointer<FTServer>(new FTServer ( )); // Create Free-track protocol-server
break;
case FLIGHTGEAR:
- server_FG = QSharedPointer<FGServer>(new FGServer ( this )); // Create FlightGear protocol-server
+ server_Game = QSharedPointer<FGServer>(new FGServer ( this )); // Create FlightGear protocol-server
break;
case FTNOIR:
break;
case PPJOY:
- server_FG = QSharedPointer<PPJoyServer>(new PPJoyServer ( this )); // Create PPJoy protocol-server
+ server_Game = QSharedPointer<PPJoyServer>(new PPJoyServer ( this )); // Create PPJoy protocol-server
break;
case TRACKIR:
- server_FG = QSharedPointer<FTIRServer>(new FTIRServer ( )); // Create Fake-TIR protocol-server
+ server_Game = QSharedPointer<FTIRServer>(new FTIRServer ( )); // Create Fake-TIR protocol-server
break;
case SIMCONNECT:
- server_FG = QSharedPointer<SCServer>(new SCServer ( )); // Create SimConnect protocol-server
+ server_Game = QSharedPointer<SCServer>(new SCServer ( )); // Create SimConnect protocol-server
break;
case FSUIPC:
- server_FG = QSharedPointer<FSUIPCServer>(new FSUIPCServer ( )); // Create FSUIPC protocol-server
+ server_Game = QSharedPointer<FSUIPCServer>(new FSUIPCServer ( )); // Create FSUIPC protocol-server
break;
default:
@@ -143,8 +144,8 @@ Tracker::Tracker( int clientID ) {
Tracker::~Tracker() {
// Stop the started server(s)
- if (server_FG) {
- server_FG->deleteLater();
+ if (server_Game) {
+ server_Game->deleteLater();
}
// Trigger thread to stop
@@ -192,11 +193,11 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
// 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_FG) {
+ if (server_Game) {
- DLL_Ok = server_FG->checkServerInstallationOK( mainApp->winId() );
+ DLL_Ok = server_Game->checkServerInstallationOK( mainApp->winId() );
if (DLL_Ok) {
- server_FG->start(); // Start the thread
+ server_Game->start(); // Start the thread
}
else {
QMessageBox::information(mainApp, "FaceTrackNoIR error", "Protocol is not (correctly) installed!");
@@ -489,41 +490,41 @@ void Tracker::run() {
//
// Free-track
if (selectedClient == FREE_TRACK) {
- server_FG->setHeadRotX( rotX ); // degrees
- server_FG->setHeadRotY( rotY );
- server_FG->setHeadRotZ( rotZ );
+ server_Game->setHeadRotX( rotX ); // degrees
+ server_Game->setHeadRotY( rotY );
+ server_Game->setHeadRotZ( rotZ );
- server_FG->setHeadPosX( posX ); // centimeters
- server_FG->setHeadPosY( posY );
- server_FG->setHeadPosZ( posZ );
+ server_Game->setHeadPosX( posX ); // centimeters
+ server_Game->setHeadPosY( posY );
+ server_Game->setHeadPosZ( posZ );
}
// FlightGear
- if (server_FG) {
- server_FG->setVirtRotX ( rotX ); // degrees
- server_FG->setVirtRotY ( rotY );
- server_FG->setVirtRotZ ( rotZ );
- server_FG->setVirtPosX ( posX ); // centimeters
- server_FG->setVirtPosY ( posY );
- server_FG->setVirtPosZ ( posZ );
+ if (server_Game) {
+ server_Game->setVirtRotX ( rotX ); // degrees
+ server_Game->setVirtRotY ( rotY );
+ server_Game->setVirtRotZ ( rotZ );
+ server_Game->setVirtPosX ( posX ); // centimeters
+ server_Game->setVirtPosY ( posY );
+ server_Game->setVirtPosZ ( posZ );
}
}
else {
//
// Go to initial position
//
- if (server_FG) {
- server_FG->setVirtRotX ( 0.0f );
- server_FG->setVirtRotY ( 0.0f );
- server_FG->setVirtRotZ ( 0.0f );
- server_FG->setVirtPosX ( 0.0f );
- server_FG->setVirtPosY ( 0.0f );
- server_FG->setVirtPosZ ( 0.0f );
+ if (server_Game) {
+ 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 );
}
}
//for lower cpu load
- msleep(15);
+ msleep(10);
yieldCurrentThread();
}
}
@@ -584,7 +585,7 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
QString Tracker::getGameProgramName() {
QString str;
- str = server_FG->GetProgramName();
+ str = server_Game->GetProgramName();
return str;
}
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 1434cfb4..b81cf636 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -70,6 +70,11 @@ enum FTNoIR_Client {
FSUIPC = 6
};
+enum FTNoIR_Face_Tracker {
+ FT_SM_FACEAPI = 0,
+ FT_FTNOIR = 1
+};
+
class FaceTrackNoIR; // pre-define parent-class to avoid circular includes
//
@@ -115,6 +120,7 @@ private:
HANDLE m_WaitThread;
FTNoIR_Client selectedClient;
+ FTNoIR_Face_Tracker selectedTracker;
/** face api variables **/
APIScope *faceapi_scope;
@@ -162,19 +168,14 @@ private:
QWidget *headPoseWidget;
FaceTrackNoIR *mainApp;
-// FTServer *server_FT; // Freetrack Server
- QSharedPointer<ProtocolServerBase> server_FG; // FlightGear Server
-// PPJoyServer *server_PPJoy; // PPJoy Server
-// FTIRServer *server_FTIR; // Fake TIR Server
-// SCServer *server_SC; // SimConnect Server
-// FSUIPCServer *server_FSUIPC; // FSUIPC Server
+ QSharedPointer<ProtocolServerBase> server_Game; // Protocol Server to communicate headpose-data to the Game!
protected:
// qthread override run method
void run();
public:
- Tracker( int clientID );
+ Tracker( int clientID, int facetrackerID );
~Tracker();
void setup(QWidget *head, FaceTrackNoIR *parent);
diff --git a/bin/FaceTrackNoIR.exe b/bin/FaceTrackNoIR.exe
index 4b846746..c980d4cd 100644
--- a/bin/FaceTrackNoIR.exe
+++ b/bin/FaceTrackNoIR.exe
Binary files differ
diff --git a/bin/Settings/default.ini b/bin/Settings/default.ini
index 3d3c6e94..f6b54380 100644
--- a/bin/Settings/default.ini
+++ b/bin/Settings/default.ini
@@ -1,9 +1,63 @@
[Tracking]
-Smooth=21
-sensYaw=152
-sensPitch=58
-sensRoll=148
-sensX=110
-sensY=177
-sensZ=242
-NeutralZone=3
+Smooth=5
+invertYaw=false
+invertPitch=false
+invertRoll=false
+invertX=false
+invertY=false
+invertZ=false
+useEWMA=true
+redYaw=60
+redPitch=60
+redRoll=60
+redX=71
+redY=70
+redZ=70
+
+[GameProtocol]
+Selection=6
+
+[KB_Shortcuts]
+Keycode_Center=199
+Shift_Center=false
+Ctrl_Center=false
+Alt_Center=false
+Keycode_StartStop=207
+Shift_StartStop=false
+Ctrl_StartStop=false
+Alt_StartStop=false
+
+[Curves]
+Yaw_point1=@Variant(\0\0\0\x1a@\0\0\0\0\0\0\0@\x10\0\0\0\0\0\0)
+Yaw_point2=@Variant(\0\0\0\x1a@_\0\0\0\0\0\0@5\x80\0\0\0\0\0)
+Yaw_point3=@Variant(\0\0\0\x1a@]@\0\0\0\0\0@A\0\0\0\0\0\0)
+Yaw_point4=@Variant(\0\0\0\x1a@f\x80\0\0\0\0\0@I\0\0\0\0\0\0)
+Pitch_point1=@Variant(\0\0\0\x1a@\b\0\0\0\0\0\0@\x10\0\0\0\0\0\0)
+Pitch_point2=@Variant(\0\0\0\x1a@U\xc0\0\0\0\0\0@:\0\0\0\0\0\0)
+Pitch_point3=@Variant(\0\0\0\x1a@Z \0\0\0\0\0@A@\0\0\0\0\0)
+Pitch_point4=@Variant(\0\0\0\x1a@fP\0\0\0\0\0@I\0\0\0\0\0\0)
+Roll_point1=@Variant(\0\0\0\x1a@\b\0\0\0\0\0\0@\x10\0\0\0\0\0\0)
+Roll_point2=@Variant(\0\0\0\x1a@X\xa0\0\0\0\0\0@6\x80\0\0\0\0\0)
+Roll_point3=@Variant(\0\0\0\x1a@Y\xe0\0\0\0\0\0@@\xc0\0\0\0\0\0)
+Roll_point4=@Variant(\0\0\0\x1a@f\x80\0\0\0\0\0@I\0\0\0\0\0\0)
+X_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@\x14\0\0\0\0\0\0)
+X_point2=@Variant(\0\0\0\x1a@<\0\0\0\0\0\0@0\0\0\0\0\0\0)
+X_point3=@Variant(\0\0\0\x1a@F\0\0\0\0\0\0@>\0\0\0\0\0\0)
+X_point4=@Variant(\0\0\0\x1a@R\xc0\0\0\0\0\0@I\0\0\0\0\0\0)
+Y_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@\x14\0\0\0\0\0\0)
+Y_point2=@Variant(\0\0\0\x1a@9\0\0\0\0\0\0@1\0\0\0\0\0\0)
+Y_point3=@Variant(\0\0\0\x1a@E\x80\0\0\0\0\0@A\0\0\0\0\0\0)
+Y_point4=@Variant(\0\0\0\x1a@R\x80\0\0\0\0\0@I\0\0\0\0\0\0)
+Z_point1=@Variant(\0\0\0\x1a@\b\0\0\0\0\0\0@&\0\0\0\0\0\0)
+Z_point2=@Variant(\0\0\0\x1a@D\x80\0\0\0\0\0@B\0\0\0\0\0\0)
+Z_point3=@Variant(\0\0\0\x1a@S\x80\0\0\0\0\0@G\0\0\0\0\0\0)
+Z_point4=@Variant(\0\0\0\x1a@Z@\0\0\0\0\0@I\0\0\0\0\0\0)
+
+[PPJoy]
+Selection=1
+
+[FSUIPC]
+LocationOfDLL=C:/Program Files/Microsoft Games/Flight Simulator 9/Modules/FSUIPC.dll
+
+[TrackerSource]
+Selection=0