From 3089c4bbc10e98d18f43e8a70e7a3d0c0eaf0900 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Mar 2013 20:48:17 +0100 Subject: Downcase. PLEASE TURN OFF IGNORING CASE IN GIT CONFIG!!! .git/config: [core] ignorecase = false --- FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui | 405 -------------------- FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h | 157 -------- .../FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user | 65 ---- FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc8.vcproj | 413 --------------------- FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc9.vcproj | 405 -------------------- FTNoIR_Tracker_SM/Tracker.qrc | 5 - FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp | 254 ------------- .../ftnoir_tracker_faceapi_dialog.cpp | 346 ----------------- FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp | 85 ----- FTNoIR_Tracker_SM/images/SeeingMachines.ico | Bin 37798 -> 0 bytes 10 files changed, 2135 deletions(-) delete mode 100644 FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui delete mode 100644 FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h delete mode 100644 FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user delete mode 100644 FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc8.vcproj delete mode 100644 FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc9.vcproj delete mode 100644 FTNoIR_Tracker_SM/Tracker.qrc delete mode 100644 FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp delete mode 100644 FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp delete mode 100644 FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp delete mode 100644 FTNoIR_Tracker_SM/images/SeeingMachines.ico (limited to 'FTNoIR_Tracker_SM') diff --git a/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui b/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui deleted file mode 100644 index 93befd19..00000000 --- a/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui +++ /dev/null @@ -1,405 +0,0 @@ - - - UICSMClientControls - - - - 0 - 0 - 388 - 313 - - - - faceAPI tracker settings FaceTrackNoIR - - - - images/FaceTrackNoIR.icoimages/FaceTrackNoIR.ico - - - Qt::LeftToRight - - - false - - - - - - - - - 100 - 0 - - - - wait... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Camera - - - - - - - Start - - - - - - - Stop - - - - - - - Engine state: - - - - - - - Internal filtering: - - - - - - - - - - - - - 0 - 140 - - - - Enable Axis - - - - - 10 - 20 - 55 - 110 - - - - - - - Roll: - - - - - - - Pitch: - - - - - - - Yaw: - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - - - X: - - - - - - - Y: - - - - - - - Z: - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 70 - 0 - - - - - 100 - 16777215 - - - - Save - - - - - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - - 70 - 0 - - - - - 100 - 16777215 - - - - OK - - - - - - - - 0 - 0 - - - - - 70 - 0 - - - - - 100 - 16777215 - - - - Cancel - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - - btnOK - btnCancel - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h deleted file mode 100644 index b7aed1d0..00000000 --- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* 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 . * -* * -********************************************************************************/ -#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" -#include "..\ftnoir_tracker_base\ftnoir_tracker_sm_types.h" -#include "ui_FTNoIR_SM_controls.h" - -#include -#include -#include -#include "Windows.h" -#include "math.h" - -using namespace std; - -class FTNoIR_Tracker : public ITracker -{ -public: - FTNoIR_Tracker(); - ~FTNoIR_Tracker(); - - void Initialize( QFrame *videoframe ); - void StartTracker( HWND parent_window ); - void StopTracker( bool exit ); - bool GiveHeadPoseData(THeadPoseData *data); // Returns true if confidence is good - - void loadSettings(); - bool SMCreateMapping(); - -private: - // - // global variables - // - HANDLE hSMMemMap; - SMMemMap *pMemData; - HANDLE hSMMutex; - QProcess *faceAPI; - -// int numTracker; - bool bEnableRoll; - bool bEnablePitch; - bool bEnableYaw; - bool bEnableX; - bool bEnableY; - bool bEnableZ; -}; - -// Widget that has controls for SMoIR protocol client-settings. -class TrackerControls: public QWidget, Ui::UICSMClientControls, public ITrackerDialog -{ - Q_OBJECT -public: - - explicit TrackerControls(); - virtual ~TrackerControls(); - void showEvent ( QShowEvent * event ); - - void Initialize(QWidget *parent); - void registerTracker(ITracker *tracker) { - theTracker = (FTNoIR_Tracker *) tracker; // Accept the pointer to the Tracker - }; - void unRegisterTracker() { - theTracker = NULL; // Reset the pointer - }; - -private: - Ui::UICSMClientControls ui; - void loadSettings(); - bool SMCreateMapping(); - void doCommand( int command ); - void doCommand( int command, int value ); - - /** helper **/ - bool settingsDirty; - int prev_state; // Previous engine state - - // - // global variables - // - HANDLE hSMMemMap; - SMMemMap *pMemData; - HANDLE hSMMutex; - smEngineHandle *engine_handle; - QTimer *timUpdateSettings; // Timer to display current settings - - FTNoIR_Tracker *theTracker; - -private slots: - void doOK(); - void doCancel(); - void save(); - void settingChanged() { settingsDirty = true; }; - void doTimUpdate(); - void showSettings( int newState ); - void doStartEngine(){ - doCommand(FT_SM_START); - } - void doStopEngine(){ - doCommand(FT_SM_STOP); - } - void doShowCam(){ - doCommand(FT_SM_SHOW_CAM); - } - void doSetFilter(int value){ - doCommand(FT_SM_SET_PAR_FILTER, value); - } - void settingChanged(int dummy) { - settingsDirty = true; - }; - -signals: - void stateChanged(int newState); - -}; - -//******************************************************************************************************* -// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker -//******************************************************************************************************* -class FTNoIR_TrackerDll : public ITrackerDll -{ -public: - FTNoIR_TrackerDll(); - ~FTNoIR_TrackerDll(); - - void Initialize(); - - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); - -private: - QString trackerFullName; // Trackers' name and description - QString trackerShortName; - QString trackerDescription; -}; diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user deleted file mode 100644 index 12f78238..00000000 --- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc8.vcproj b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc8.vcproj deleted file mode 100644 index 2efa6022..00000000 --- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc8.vcproj +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc9.vcproj b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc9.vcproj deleted file mode 100644 index 8fbfae89..00000000 --- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM_vc9.vcproj +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FTNoIR_Tracker_SM/Tracker.qrc b/FTNoIR_Tracker_SM/Tracker.qrc deleted file mode 100644 index b76ff1b2..00000000 --- a/FTNoIR_Tracker_SM/Tracker.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - images/SeeingMachines.ico - - diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp deleted file mode 100644 index 624e35a0..00000000 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* 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 . * -* * -********************************************************************************/ -#include "ftnoir_tracker_sm.h" -#include - -FTNoIR_Tracker::FTNoIR_Tracker() -{ -} - -FTNoIR_Tracker::~FTNoIR_Tracker() -{ - qDebug() << "~FTNoIR_Tracker says: cleaning up"; - - if ( pMemData != NULL ) { - UnmapViewOfFile ( pMemData ); - } - - bEnableRoll = true; - bEnablePitch = true; - bEnableYaw = true; - bEnableX = true; - bEnableY = true; - bEnableZ = true; - - CloseHandle( hSMMutex ); - CloseHandle( hSMMemMap ); - hSMMemMap = 0; -} - -void FTNoIR_Tracker::Initialize( QFrame *videoframe ) -{ - qDebug() << "FTNoIR_Tracker::Initialize says: Starting "; - - if (SMCreateMapping()) { - qDebug() << "FTNoIR_Tracker::Initialize Mapping created."; - } - else { - QMessageBox::warning(0,"FaceTrackNoIR Error","Memory mapping not created!",QMessageBox::Ok,QMessageBox::NoButton); - } - - loadSettings(); - - if ( pMemData != NULL ) { - pMemData->command = 0; // Reset any and all commands - if (videoframe != NULL) { - pMemData->handle = videoframe->winId(); // Handle of Videoframe widget - } - else { - pMemData->handle = NULL; // reset Handle of Videoframe widget - } - } - - // - // Start FTNoIR_FaceAPI_EXE.exe. The exe contains all faceAPI-stuff and is non-Qt... - // - QString program = "FTNoIR_FaceAPI_EXE.exe"; - faceAPI = new QProcess(0); - faceAPI->start(program); - - // Show the video widget - qDebug() << "FTNoIR_Tracker::Initialize says: videoframe = " << videoframe; - - if (videoframe != NULL) { - videoframe->show(); - } - return; -} - -void FTNoIR_Tracker::StartTracker( HWND parent_window ) -{ - if ( pMemData != NULL ) { - pMemData->command = FT_SM_START; // Start command - } - return; -} - -void FTNoIR_Tracker::StopTracker( bool exit ) -{ - - qDebug() << "FTNoIR_Tracker::StopTracker says: Starting "; - // stops the faceapi engine - if ( pMemData != NULL ) { -// if (exit == true) { - pMemData->command = (exit) ? FT_SM_EXIT : FT_SM_STOP; // Issue 'stop' command - //} - //else { - // pMemData->command = FT_SM_STOP; // Issue 'stop' command - //} - } - return; -} - -bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) -{ - // - // Check if the pointer is OK and wait for the Mutex. - // - if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) { - -// qDebug() << "FTNoIR_Tracker::GiveHeadPoseData says: Retrieving data."; - - // - // Copy the measurements to FaceTrackNoIR. - // - if (bEnableX) { - data->x = pMemData->data.new_pose.head_pos.x * 100.0f; // From meters to centimeters - } - if (bEnableY) { - data->y = pMemData->data.new_pose.head_pos.y * 100.0f; - } - if (bEnableZ) { - data->z = pMemData->data.new_pose.head_pos.z * 100.0f; - } - if (bEnableYaw) { - data->yaw = pMemData->data.new_pose.head_rot.y_rads * 57.295781f; // From rads to degrees - } - if (bEnablePitch) { - data->pitch = pMemData->data.new_pose.head_rot.x_rads * 57.295781f; - } - if (bEnableRoll) { - data->roll = pMemData->data.new_pose.head_rot.z_rads * 57.295781f; - } - - // - // Reset the handshake, to let faceAPI know we're still here! - // - pMemData->handshake = 0; - - ReleaseMutex(hSMMutex); - return ( pMemData->data.new_pose.confidence > 0 ); - } - return false; -} - -// -// Load the current Settings from the currently 'active' INI-file. -// -void FTNoIR_Tracker::loadSettings() { - - qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; - QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile; - - iniFile.beginGroup ( "SMTracker" ); - if (pMemData) { - pMemData->initial_filter_level = iniFile.value ( "FilterLevel", 1 ).toInt(); - } - - bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool(); - bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool(); - bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool(); - bEnableX = iniFile.value ( "EnableX", 1 ).toBool(); - bEnableY = iniFile.value ( "EnableY", 1 ).toBool(); - bEnableZ = iniFile.value ( "EnableZ", 1 ).toBool(); - - iniFile.endGroup (); -} - -// -// Create a memory-mapping to the faceAPI data. -// It contains the tracking data, a command-code from FaceTrackNoIR -// -// -bool FTNoIR_Tracker::SMCreateMapping() -{ - qDebug() << "FTNoIR_Tracker::FTCreateMapping says: Starting Function"; - - // - // A FileMapping is used to create 'shared memory' between the faceAPI and FaceTrackNoIR. - // - // Try to create a FileMapping to the Shared Memory. - // If one already exists: close it. - // - hSMMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 , - sizeof( TFaceData ) + sizeof( HANDLE ) + 100, - (LPCSTR) SM_MM_DATA ); - - if ( hSMMemMap != 0 ) { - qDebug() << "FTNoIR_Tracker::FTCreateMapping says: FileMapping Created!"; - } - - if ( ( hSMMemMap != 0 ) && ( (long) GetLastError == ERROR_ALREADY_EXISTS ) ) { - CloseHandle( hSMMemMap ); - hSMMemMap = 0; - } - - // - // Create a new FileMapping, Read/Write access - // - hSMMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) SM_MM_DATA ); - if ( ( hSMMemMap != 0 ) ) { - qDebug() << "FTNoIR_Tracker::FTCreateMapping says: FileMapping Created again..." << hSMMemMap; - pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TFaceData)); - if (pMemData != NULL) { - qDebug() << "FTNoIR_Tracker::FTCreateMapping says: MapViewOfFile OK."; -// pMemData->handle = handle; // The game uses the handle, to send a message that the Program-Name was set! - } - hSMMutex = CreateMutexA(NULL, false, SM_MUTEX); - } - else { - qDebug() << "FTNoIR_Tracker::FTCreateMapping says: Error creating Shared Memory for faceAPI!"; - return false; - } - - //if (pMemData != NULL) { - // pMemData->data.DataID = 1; - // pMemData->data.CamWidth = 100; - // pMemData->data.CamHeight = 250; - //} - - return true; -} - - - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker object. - -// Export both decorated and undecorated names. -// GetTracker - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTracker@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetTracker=_GetTracker@0") - -FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker() -{ - return new FTNoIR_Tracker; -} diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp deleted file mode 100644 index 5c422402..00000000 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp +++ /dev/null @@ -1,346 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* 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 . * -* * -********************************************************************************/ -#include "ftnoir_tracker_sm.h" -#include - -//******************************************************************************************************* -// faceAPI Client Settings-dialog. -//******************************************************************************************************* - -// -// Constructor for server-settings-dialog -// -TrackerControls::TrackerControls() : -QWidget() -{ - ui.setupUi( this ); - - theTracker = NULL; - prev_state = -1; - - // Connect Qt signals to member-functions - connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - connect(ui.btnEngineStart, SIGNAL(clicked()), this, SLOT(doStartEngine())); - connect(ui.btnEngineStop, SIGNAL(clicked()), this, SLOT(doStopEngine())); - connect(ui.btnSave, SIGNAL(clicked()), this, SLOT(save())); - - ui.cbxFilterSetting->addItem("None"); - ui.cbxFilterSetting->addItem("Normal"); - ui.cbxFilterSetting->addItem("High"); - connect(ui.cbxFilterSetting, SIGNAL(currentIndexChanged(int)), this, SLOT(doSetFilter( int ))); - connect(ui.btnCameraSettings, SIGNAL(clicked()), this, SLOT(doShowCam())); - - if (SMCreateMapping()) { - qDebug() << "TrackerControls::Initialize Mapping created."; - } - else { - QMessageBox::warning(0,"FaceTrackNoIR Error","Memory mapping not created!",QMessageBox::Ok,QMessageBox::NoButton); - } - - //Setup the timer for showing the headpose. - timUpdateSettings = new QTimer(this); - connect(timUpdateSettings, SIGNAL(timeout()), this, SLOT(doTimUpdate())); - timUpdateSettings->start(100); - connect(this, SIGNAL(stateChanged( int )), this, SLOT(showSettings( int ))); - - connect(ui.chkEnableRoll, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnablePitch, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnableYaw, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnableX, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnableY, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnableZ, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - -} - -// -// Destructor for server-dialog -// -TrackerControls::~TrackerControls() { - qDebug() << "~TrackerControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void TrackerControls::Initialize(QWidget *parent) { - - QPoint offsetpos(200, 200); - if (parent) { - this->move(parent->pos() + offsetpos); - } - - // Load the settings from the current .INI-file - loadSettings(); - - show(); -} - -// -// OK clicked on server-dialog -// -void TrackerControls::doOK() { - save(); - this->close(); -} - -// override show event -void TrackerControls::showEvent ( QShowEvent * event ) { - prev_state = -1; - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// -void TrackerControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settingsDirty) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } -} - -// -// Load the current Settings from the currently 'active' INI-file. -// -void TrackerControls::loadSettings() { - -// qDebug() << "loadSettings says: Starting "; - QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - -// qDebug() << "loadSettings says: iniFile = " << currentFile; - - iniFile.beginGroup ( "SMTracker" ); - ui.cbxFilterSetting->setCurrentIndex(iniFile.value ( "FilterLevel", 1 ).toInt()); - - ui.chkEnableRoll->setChecked(iniFile.value ( "EnableRoll", 1 ).toBool()); - ui.chkEnablePitch->setChecked(iniFile.value ( "EnablePitch", 1 ).toBool()); - ui.chkEnableYaw->setChecked(iniFile.value ( "EnableYaw", 1 ).toBool()); - ui.chkEnableX->setChecked(iniFile.value ( "EnableX", 1 ).toBool()); - ui.chkEnableY->setChecked(iniFile.value ( "EnableY", 1 ).toBool()); - ui.chkEnableZ->setChecked(iniFile.value ( "EnableZ", 1 ).toBool()); - - iniFile.endGroup (); - - settingsDirty = false; -} - -// -// Save the current Settings to the currently 'active' INI-file. -// -void TrackerControls::save() { - - QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - iniFile.beginGroup ( "SMTracker" ); - iniFile.setValue ( "FilterLevel", ui.cbxFilterSetting->currentIndex() ); - - iniFile.setValue ( "EnableRoll", ui.chkEnableRoll->isChecked() ); - iniFile.setValue ( "EnablePitch", ui.chkEnablePitch->isChecked() ); - iniFile.setValue ( "EnableYaw", ui.chkEnableYaw->isChecked() ); - iniFile.setValue ( "EnableX", ui.chkEnableX->isChecked() ); - iniFile.setValue ( "EnableY", ui.chkEnableY->isChecked() ); - iniFile.setValue ( "EnableZ", ui.chkEnableZ->isChecked() ); - - iniFile.endGroup (); - - // - // If the Tracker is active, let it load the new Settings. - // - if (theTracker) { - theTracker->loadSettings(); - } - - settingsDirty = false; -} - -// -// Create a memory-mapping to the faceAPI data. -// It contains the tracking data, a command-code from FaceTrackNoIR -// -// -bool TrackerControls::SMCreateMapping() -{ - qDebug() << "TrackerControls::FTCreateMapping says: Starting Function"; - - // - // A FileMapping is used to create 'shared memory' between the faceAPI and FaceTrackNoIR. - // - // Try to create a FileMapping to the Shared Memory. - // If one already exists: close it. - // - hSMMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 , - sizeof( TFaceData ) + sizeof( HANDLE ) + 100, - (LPCSTR) SM_MM_DATA ); - - if ( hSMMemMap != 0 ) { - qDebug() << "TrackerControls::FTCreateMapping says: FileMapping Created!"; - } - - if ( ( hSMMemMap != 0 ) && ( (long) GetLastError == ERROR_ALREADY_EXISTS ) ) { - CloseHandle( hSMMemMap ); - hSMMemMap = 0; - } - - // - // Create a new FileMapping, Read/Write access - // - hSMMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) SM_MM_DATA ); - if ( ( hSMMemMap != 0 ) ) { - qDebug() << "TrackerControls::FTCreateMapping says: FileMapping Created again..." << hSMMemMap; - pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TFaceData)); - if (pMemData != NULL) { - qDebug() << "TrackerControls::FTCreateMapping says: MapViewOfFile OK."; -// pMemData->handle = handle; // The game uses the handle, to send a message that the Program-Name was set! - } - hSMMutex = CreateMutexA(NULL, false, SM_MUTEX); - } - else { - qDebug() << "TrackerControls::FTCreateMapping says: Error creating Shared Memory for faceAPI!"; - return false; - } - - //if (pMemData != NULL) { - // pMemData->data.DataID = 1; - // pMemData->data.CamWidth = 100; - // pMemData->data.CamHeight = 250; - //} - - return true; -} - -// -// Show the current engine-settings etc. -// -void TrackerControls::doTimUpdate() -{ - int state = pMemData->state; - if ( state != prev_state) { - emit stateChanged(state); - prev_state = state; - } -} - -// -// Show the current engine-settings etc. -// -void TrackerControls::showSettings( int newState ) -{ - qDebug() << "TrackerControls::showSettings says: Starting Function"; - switch (newState) - { - case SM_API_ENGINE_STATE_TERMINATED: - ui._engine_state_label->setText("TERMINATED"); - break; - case SM_API_ENGINE_STATE_INVALID: - ui._engine_state_label->setText("INVALID"); - break; - case SM_API_ENGINE_STATE_IDLE: - ui._engine_state_label->setText("IDLE"); - break; - case SM_API_ENGINE_STATE_HT_INITIALIZING: - ui._engine_state_label->setText("INITIALIZING"); - break; - case SM_API_ENGINE_STATE_HT_TRACKING: - ui._engine_state_label->setText("TRACKING"); - break; - case SM_API_ENGINE_STATE_HT_SEARCHING: - ui._engine_state_label->setText("SEARCHING"); - break; - default: - ui._engine_state_label->setText("Unknown State!"); - break; - } - - ui.cbxFilterSetting->setEnabled( (newState == SM_API_ENGINE_STATE_IDLE) ); -} - -// -// Send a command without parameter-value to the tracking Engine. -// -void TrackerControls::doCommand(int command) -{ - if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) { - pMemData->command = command; // Send command - ReleaseMutex(hSMMutex); - } - return; -} - -// -// Send a command with integer parameter-value to the tracking Engine. -// -void TrackerControls::doCommand(int command, int value) -{ - if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) { - pMemData->command = command; // Send command - pMemData->par_val_int = value; - ReleaseMutex(hSMMutex); - } - return; -} - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker-settings dialog object. - -// Export both decorated and undecorated names. -// GetTrackerDialog - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0") - -FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( ) -{ - return new TrackerControls; -} diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp deleted file mode 100644 index 5f01568f..00000000 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 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 . * -* * -********************************************************************************/ -/* - Modifications (last one on top): - 20120830 - WVR: The Dialog class was used to get general info on the DLL. This - had a big disadvantage: the complete dialog was loaded, just to get - some data and then it was deleted again (without ever showing the dialog). - The TrackerDll class solves this. - The functions to get the name(s) and icon were removed from the two other classes. -*/ -#include "ftnoir_tracker_sm.h" -#include - -FTNoIR_TrackerDll::FTNoIR_TrackerDll() { - //populate the description strings - trackerFullName = "faceAPI V3.2.6"; - trackerShortName = "faceAPI"; - trackerDescription = "SeeingMachines faceAPI V3.2.6"; -} - -FTNoIR_TrackerDll::~FTNoIR_TrackerDll() -{ - -} - -void FTNoIR_TrackerDll::Initialize() -{ - return; -} - -void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) -{ - *strToBeFilled = trackerFullName; -}; - -void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled) -{ - *strToBeFilled = trackerShortName; -}; - -void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled) -{ - *strToBeFilled = trackerDescription; -}; - -void FTNoIR_TrackerDll::getIcon(QIcon *icon) -{ - *icon = QIcon(":/images/SeeingMachines.ico"); -}; - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker object. - -// Export both decorated and undecorated names. -// GetTrackerDll - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") - -FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() -{ - return new FTNoIR_TrackerDll; -} diff --git a/FTNoIR_Tracker_SM/images/SeeingMachines.ico b/FTNoIR_Tracker_SM/images/SeeingMachines.ico deleted file mode 100644 index 19b24c84..00000000 Binary files a/FTNoIR_Tracker_SM/images/SeeingMachines.ico and /dev/null differ -- cgit v1.2.3