From a3500eef8d37a644df41c5c232a1a53aea783181 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Sat, 21 Jul 2012 13:15:16 +0000 Subject: BezierConfigurator replaced bt FunctionConfig git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@114 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FaceTrackNoIR/FTNoIR_Curves.ui | 701 ++++++--------------- FaceTrackNoIR/FaceTrackNoIR.cpp | 120 ++-- FaceTrackNoIR/FaceTrackNoIR.vcproj | 16 +- .../FaceTrackNoIR.vcproj.VRIEND200810.Wim.user | 65 -- FaceTrackNoIR/tracker.cpp | 224 ++----- FaceTrackNoIR/tracker.h | 47 +- bin/FunctionConfig.h | Bin 0 -> 3182 bytes bin/QBezierConfigurator.dll | Bin 49152 -> 0 bytes bin/QBezierConfigurator.lib | Bin 22348 -> 0 bytes bin/QFunctionConfigurator.lib | Bin 0 -> 27136 bytes bin/Settings/ArmA.ini | 72 ++- bin/Settings/FreeFalcon.ini | 4 + bin/qbezierconfigurator.h | 130 ---- bin/qfunctionconfigurator.h | 177 ++++++ bin/zlib1.dll | Bin 61952 -> 70656 bytes faceAPI/FaceAPI2FSX.vcproj | 2 +- 16 files changed, 558 insertions(+), 1000 deletions(-) delete mode 100644 FaceTrackNoIR/FaceTrackNoIR.vcproj.VRIEND200810.Wim.user create mode 100644 bin/FunctionConfig.h delete mode 100644 bin/QBezierConfigurator.dll delete mode 100644 bin/QBezierConfigurator.lib create mode 100644 bin/QFunctionConfigurator.lib delete mode 100644 bin/qbezierconfigurator.h create mode 100644 bin/qfunctionconfigurator.h diff --git a/FaceTrackNoIR/FTNoIR_Curves.ui b/FaceTrackNoIR/FTNoIR_Curves.ui index c13565e2..d7ed1fe5 100644 --- a/FaceTrackNoIR/FTNoIR_Curves.ui +++ b/FaceTrackNoIR/FTNoIR_Curves.ui @@ -6,8 +6,8 @@ 0 0 - 757 - 603 + 858 + 605 @@ -97,7 +97,7 @@ color: rgb(255, 255, 255); - 0 + 1 @@ -112,24 +112,30 @@ color: rgb(255, 255, 255); 10 10 - 708 - 511 + 794 + 488 - - - - 50 - - - 180 + + + + + 260 + 240 + + + + + 260 + 240 + - 255 - 170 - 0 + 0 + 255 + 255 @@ -140,41 +146,32 @@ color: rgb(255, 255, 255); - Input Yaw (degr.) + Input Pitch Up (degr.) - Output Yaw (degr.) - - - Yaw (left and right) - - - - 0.000000000000000 - 0.000000000000000 - - - - - 90.000000000000000 - 0.000000000000000 - + Output Pitch Up (degr.) - - - - 50 - - - 180 + + + + + 260 + 240 + + + + + 260 + 240 + 0 255 - 255 + 0 @@ -185,40 +182,31 @@ color: rgb(255, 255, 255); - Input Pitch (degr.) + Input Roll (degr.) - Output Pitch (degr.) - - - Pitch (forward and backward) - - - - 0.000000000000000 - 0.000000000000000 - - - - - 90.000000000000000 - 0.000000000000000 - + Output Roll (degr.) - - - - 50 - - - 180 + + + + + 260 + 240 + + + + + 260 + 240 + - 0 - 255 + 255 + 170 0 @@ -230,140 +218,78 @@ color: rgb(255, 255, 255); - Input Roll (degr.) + Input Yaw (degr.) - Output Roll (degr.) + Output Yaw (degr.) - - Roll (left and right) + + + + + + + 260 + 240 + + + + + 260 + 240 + - - - 0.000000000000000 - 0.000000000000000 - + + + 0 + 255 + 255 + - - - 90.000000000000000 - 0.000000000000000 - + + + 192 + 192 + 192 + - - - - - - 50 + + Input Pitch Down (degr.) - - - - - - NeutralZone + + Output Pitch Down (degr.) - - - - NeutralZone + + + + + 16777215 + 25 + - - - - - NeutralZone + Left-click the graph to place a new point, right-click a point to remove. Left-click and drag to move a point. + + + true - - - 50 + + + + 170 + 140 + - - - - - - 50 + + image: url(:/images/rotation_DOFs.png); - - - - - - - 170 - 140 - - - - - 170 - 140 - - - - image: url(:/images/rotation_DOFs.png); -background-color: rgb(255, 255, 255); - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Maximum - - - - 20 - 115 - - - - - - - - - 16777215 - 25 - - - - Use the circular handles to change - - - - - - - - 16777215 - 25 - - - - the curve(s). - - - - - @@ -378,26 +304,32 @@ background-color: rgb(255, 255, 255); - 10 + 30 10 - 708 - 491 + 794 + 388 - - - - 50 - - - 180 + + + + + 260 + 240 + + + + + 260 + 240 + - 0 - 0 - 255 + 255 + 255 + 0 @@ -408,41 +340,32 @@ background-color: rgb(255, 255, 255); - Input Move (cm) + Left/Right Input X (cm.) - Output Move (cm) - - - Move (up and down) - - - - 0.000000000000000 - 0.000000000000000 - - - - - 90.000000000000000 - 0.000000000000000 - + Output X (cm.) - - - - 50 - - - 180 + + + + + 260 + 240 + + + + + 260 + 240 + - 255 + 85 0 - 0 + 255 @@ -453,40 +376,31 @@ background-color: rgb(255, 255, 255); - Input Move (cm) + Up/Down Input Y (cm.) - Output Move (cm) - - - Move (forward and backward) - - - - 0.000000000000000 - 0.000000000000000 - - - - - 90.000000000000000 - 0.000000000000000 - + Output Y (cm.) - - - - 50 - - - 180 + + + + + 260 + 240 + + + + + 260 + 240 + 255 - 255 + 0 0 @@ -498,87 +412,53 @@ background-color: rgb(255, 255, 255); - Input Move (cm) + Forward/Backward Input Z (cm.) - Output Move (cm) - - - Move (left and right) - - - - 0.000000000000000 - 0.000000000000000 - - - - - 90.000000000000000 - 0.000000000000000 - - - - - - - - NeutralZone + Output Z (cm.) - - - - 50 + + + + + 16777215 + 25 + - - - - - NeutralZone + Left-click the graph to place a new point, right-click a point to remove. Left-click and drag to move a point. - - - - - - NeutralZone + + true - - - 50 - + + + + 170 + 140 + + + + image: url(:/images/translation_DOFs.png); + + + + + -40 + 0 + 260 + 140 + + + + - - - - 50 - - - - - - - - - - 170 - 140 - - - - image: url(:/images/translation_DOFs.png); - - - - - @@ -680,208 +560,15 @@ background-color: rgb(255, 255, 255); - QBezierConfigurator + QFunctionConfigurator QWidget -
qbezierconfigurator.h
+
qfunctionconfigurator.h
- - - curveYaw - valueNeutralZoneChanged(int) - spinNZ_Yaw - setValue(int) - - - 268 - 114 - - - 593 - 125 - - - - - spinNZ_Yaw - valueChanged(int) - curveYaw - setNeutralZone(int) - - - 588 - 115 - - - 296 - 110 - - - - - curvePitch - valueNeutralZoneChanged(int) - spinNZ_Pitch - setValue(int) - - - 321 - 280 - - - 576 - 289 - - - - - spinNZ_Pitch - valueChanged(int) - curvePitch - setNeutralZone(int) - - - 629 - 287 - - - 334 - 285 - - - - - curveRoll - valueNeutralZoneChanged(int) - spinNZ_Roll - setValue(int) - - - 322 - 423 - - - 589 - 447 - - - - - spinNZ_Roll - valueChanged(int) - curveRoll - setNeutralZone(int) - - - 618 - 446 - - - 257 - 464 - - - - - curveX - valueNeutralZoneChanged(int) - spinNZ_X - setValue(int) - - - 312 - 107 - - - 568 - 126 - - - - - spinNZ_X - valueChanged(int) - curveX - setNeutralZone(int) - - - 548 - 125 - - - 322 - 142 - - - - - curveY - valueNeutralZoneChanged(int) - spinNZ_Y - setValue(int) - - - 282 - 261 - - - 569 - 286 - - - - - spinNZ_Y - valueChanged(int) - curveY - setNeutralZone(int) - - - 549 - 282 - - - 342 - 292 - - - - - curveZ - valueNeutralZoneChanged(int) - spinNZ_Z - setValue(int) - - - 363 - 417 - - - 571 - 445 - - - - - spinNZ_Z - valueChanged(int) - curveZ - setNeutralZone(int) - - - 546 - 444 - - - 316 - 447 - - - - + startEngineClicked() stopEngineClicked() diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp index afa5f9ef..3e0d6628 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.cpp +++ b/FaceTrackNoIR/FaceTrackNoIR.cpp @@ -23,6 +23,7 @@ *********************************************************************************/ /* Modifications (last one on top): + 20120717 - WVR: FunctionConfig is now used for the Curves, instead of BezierConfig. 20120427 - WVR: The Protocol-code was already in separate DLLs, but the ListBox was still filled ´statically´. Now, a Dir() of the EXE-folder is done, to locate Protocol-DLLs. The Icons were also moved to the DLLs 20120317 - WVR: The Filter and Tracker-code was moved to separate DLLs. The calling-method @@ -38,6 +39,7 @@ */ #include "FaceTrackNoIR.h" #include "tracker.h" +//#include "FunctionConfig.h" //#define USE_VISAGE @@ -709,7 +711,7 @@ void FaceTrackNoIR::startTracker( ) { // // Start the timer to update the head-pose (digits and 'man in black') // - timUpdateHeadPose->start(10); + timUpdateHeadPose->start(50); ui.lblX->setVisible(true); ui.lblY->setVisible(true); @@ -1126,7 +1128,7 @@ importGetTrackerDialog getTracker; ui.iconcomboProtocol->clear(); for ( int i = 0; i < protocolFileList.size(); i++) { - qDebug() << "createIconGroupBox says: ProtocolName = " << protocolFileList.at(i); +// qDebug() << "createIconGroupBox says: ProtocolName = " << protocolFileList.at(i); // // Delete the existing QDialog @@ -1148,7 +1150,7 @@ importGetTrackerDialog getTracker; pProtocolDialog = ptrXyz; pProtocolDialog->getFullName( protocolName ); pProtocolDialog->getIcon( protocolIcon ); - qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!"; +// qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!"; } else { qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!"; @@ -1177,7 +1179,7 @@ importGetTrackerDialog getTracker; ui.iconcomboFilter->clear(); for ( int i = 0; i < filterFileList.size(); i++) { - qDebug() << "createIconGroupBox says: FilterName = " << filterFileList.at(i); +// qDebug() << "createIconGroupBox says: FilterName = " << filterFileList.at(i); // // Delete the existing QDialog @@ -1199,7 +1201,7 @@ importGetTrackerDialog getTracker; pFilterDialog = ptrXyz; pFilterDialog->getFullName( filterName ); pFilterDialog->getIcon( filterIcon ); - qDebug() << "FaceTrackNoIR::showServerControls GetFilterDialog Function Resolved!"; +// qDebug() << "FaceTrackNoIR::showServerControls GetFilterDialog Function Resolved!"; } else { qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!"; @@ -1228,7 +1230,7 @@ importGetTrackerDialog getTracker; ui.iconcomboTrackerSource->clear(); for ( int i = 0; i < trackerFileList.size(); i++) { - qDebug() << "createIconGroupBox says: TrackerName = " << trackerFileList.at(i); +// qDebug() << "createIconGroupBox says: TrackerName = " << trackerFileList.at(i); // // Delete the existing QDialog @@ -1250,7 +1252,7 @@ importGetTrackerDialog getTracker; pTrackerDialog = ptrXyz; pTrackerDialog->getFullName( trackerName ); pTrackerDialog->getIcon( trackerIcon ); - qDebug() << "FaceTrackNoIR::showServerControls GetTrackerDialog Function Resolved!"; +// qDebug() << "FaceTrackNoIR::showServerControls GetTrackerDialog Function Resolved!"; } else { qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!"; @@ -1911,12 +1913,25 @@ QWidget( parent , f) connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - connect(ui.curveYaw, SIGNAL(BezierCurveChanged(bool)), this, SLOT(curveChanged(bool))); - connect(ui.curvePitch, SIGNAL(BezierCurveChanged(bool)), this, SLOT(curveChanged(bool))); - connect(ui.curveRoll, SIGNAL(BezierCurveChanged(bool)), this, SLOT(curveChanged(bool))); - connect(ui.curveX, SIGNAL(BezierCurveChanged(bool)), this, SLOT(curveChanged(bool))); - connect(ui.curveY, SIGNAL(BezierCurveChanged(bool)), this, SLOT(curveChanged(bool))); - connect(ui.curveZ, SIGNAL(BezierCurveChanged(bool)), this, SLOT(curveChanged(bool))); + ui.qFunctionX->setConfig(Tracker::X.curvePtr); + connect(ui.qFunctionX, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + ui.qFunctionY->setConfig(Tracker::Y.curvePtr); + connect(ui.qFunctionY, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + ui.qFunctionZ->setConfig(Tracker::Z.curvePtr); + connect(ui.qFunctionZ, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + + ui.qFunctionYaw->setConfig(Tracker::Yaw.curvePtr); + connect(ui.qFunctionYaw, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + // + // There are 2 curves for Pitch: Up and Down. Users have indicated that, to be able to use visual Flight controls, it is necessary to have a 'slow' curve for Down... + // + ui.qFunctionPitch->setConfig(Tracker::Pitch.curvePtr); + connect(ui.qFunctionPitch, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + ui.qFunctionPitchDown->setConfig(Tracker::Pitch.curvePtrAlt); + connect(ui.qFunctionPitchDown, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); + + ui.qFunctionRoll->setConfig(Tracker::Roll.curvePtr); + connect(ui.qFunctionRoll, SIGNAL(CurveChanged(bool)), this, SLOT(curveChanged(bool))); // Load the settings from the current .INI-file loadSettings(); @@ -1982,7 +1997,6 @@ void CurveConfigurationDialog::loadSettings() { int NeutralZone; int sensYaw, sensPitch, sensRoll; int sensX, sensY, sensZ; -QPointF point1, point2, point3, point4; qDebug() << "loadSettings says: Starting "; QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) @@ -2003,43 +2017,10 @@ QPointF point1, point2, point3, point4; iniFile.endGroup (); - iniFile.beginGroup ( "Curves" ); - getCurvePoints( &iniFile, "Yaw_", &point1, &point2, &point3, &point4, NeutralZone, sensYaw, 50, 180 ); - ui.curveYaw->setPointOne( point1 ); - ui.curveYaw->setPointTwo( point2 ); - ui.curveYaw->setPointThree( point3 ); - ui.curveYaw->setPointFour( point4 ); - - getCurvePoints( &iniFile, "Pitch_", &point1, &point2, &point3, &point4, NeutralZone, sensPitch, 50, 180 ); - ui.curvePitch->setPointOne( point1 ); - ui.curvePitch->setPointTwo( point2 ); - ui.curvePitch->setPointThree( point3 ); - ui.curvePitch->setPointFour( point4 ); - - getCurvePoints( &iniFile, "Roll_", &point1, &point2, &point3, &point4, NeutralZone, sensRoll, 50, 180 ); - ui.curveRoll->setPointOne( point1 ); - ui.curveRoll->setPointTwo( point2 ); - ui.curveRoll->setPointThree( point3 ); - ui.curveRoll->setPointFour( point4 ); - - getCurvePoints( &iniFile, "X_", &point1, &point2, &point3, &point4, NeutralZone, sensX, 50, 180 ); - ui.curveX->setPointOne( point1 ); - ui.curveX->setPointTwo( point2 ); - ui.curveX->setPointThree( point3 ); - ui.curveX->setPointFour( point4 ); - - getCurvePoints( &iniFile, "Y_", &point1, &point2, &point3, &point4, NeutralZone, sensY, 50, 180 ); - ui.curveY->setPointOne( point1 ); - ui.curveY->setPointTwo( point2 ); - ui.curveY->setPointThree( point3 ); - ui.curveY->setPointFour( point4 ); - - getCurvePoints( &iniFile, "Z_", &point1, &point2, &point3, &point4, NeutralZone, sensZ, 50, 180 ); - ui.curveZ->setPointOne( point1 ); - ui.curveZ->setPointTwo( point2 ); - ui.curveZ->setPointThree( point3 ); - ui.curveZ->setPointFour( point4 ); - iniFile.endGroup (); + ui.qFunctionYaw->loadSettings(iniFile); + ui.qFunctionPitch->loadSettings(iniFile); + ui.qFunctionPitchDown->loadSettings(iniFile); + ui.qFunctionRoll->loadSettings(iniFile); settingsDirty = false; @@ -2057,38 +2038,11 @@ void CurveConfigurationDialog::save() { QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - iniFile.beginGroup ( "Curves" ); - iniFile.setValue ("Yaw_point1", ui.curveYaw->getPointOne() ); - iniFile.setValue ("Yaw_point2", ui.curveYaw->getPointTwo() ); - iniFile.setValue ("Yaw_point3", ui.curveYaw->getPointThree() ); - iniFile.setValue ("Yaw_point4", ui.curveYaw->getPointFour() ); - - iniFile.setValue ("Pitch_point1", ui.curvePitch->getPointOne() ); - iniFile.setValue ("Pitch_point2", ui.curvePitch->getPointTwo() ); - iniFile.setValue ("Pitch_point3", ui.curvePitch->getPointThree() ); - iniFile.setValue ("Pitch_point4", ui.curvePitch->getPointFour() ); - - iniFile.setValue ("Roll_point1", ui.curveRoll->getPointOne() ); - iniFile.setValue ("Roll_point2", ui.curveRoll->getPointTwo() ); - iniFile.setValue ("Roll_point3", ui.curveRoll->getPointThree() ); - iniFile.setValue ("Roll_point4", ui.curveRoll->getPointFour() ); - - iniFile.setValue ("X_point1", ui.curveX->getPointOne() ); - iniFile.setValue ("X_point2", ui.curveX->getPointTwo() ); - iniFile.setValue ("X_point3", ui.curveX->getPointThree() ); - iniFile.setValue ("X_point4", ui.curveX->getPointFour() ); - - iniFile.setValue ("Y_point1", ui.curveY->getPointOne() ); - iniFile.setValue ("Y_point2", ui.curveY->getPointTwo() ); - iniFile.setValue ("Y_point3", ui.curveY->getPointThree() ); - iniFile.setValue ("Y_point4", ui.curveY->getPointFour() ); - - iniFile.setValue ("Z_point1", ui.curveZ->getPointOne() ); - iniFile.setValue ("Z_point2", ui.curveZ->getPointTwo() ); - iniFile.setValue ("Z_point3", ui.curveZ->getPointThree() ); - iniFile.setValue ("Z_point4", ui.curveZ->getPointFour() ); - - iniFile.endGroup (); + ui.qFunctionYaw->saveSettings(iniFile); + ui.qFunctionPitch->saveSettings(iniFile); + ui.qFunctionPitchDown->saveSettings(iniFile); + ui.qFunctionRoll->saveSettings(iniFile); + settingsDirty = false; // diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj b/FaceTrackNoIR/FaceTrackNoIR.vcproj index e682f785..c6732a93 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.vcproj +++ b/FaceTrackNoIR/FaceTrackNoIR.vcproj @@ -47,7 +47,7 @@ OmitFramePointers="false" EnableFiberSafeOptimizations="false" WholeProgramOptimization="false" - AdditionalIncludeDirectories=".\GeneratedFiles;"$(QTDIR)\include";".\GeneratedFiles\$(ConfigurationName)";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\QtOpenGL";"$(QTDIR)\include\QtWebKit";"$(QTDIR)\include\QtTest";"$(SolutionDir)\FTNoIR_Tracker_UDP";"$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles";"$(SolutionDir)\FTNoIR_Filter_EWMA2";"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include";C:\Project\FaceTrackNoIR\VS2005\QBezierConfigurator\QBezierConfigurator" + AdditionalIncludeDirectories=".\GeneratedFiles;"$(QTDIR)\include";".\GeneratedFiles\$(ConfigurationName)";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\QtOpenGL";"$(QTDIR)\include\QtWebKit";"$(QTDIR)\include\QtTest";"$(SolutionDir)\FTNoIR_Tracker_UDP";"$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles";"$(SolutionDir)\FTNoIR_Filter_EWMA2";"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include"" PreprocessorDefinitions="UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_THREAD_SUPPORT;QT_NO_DEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;QT_NETWORK_LIB;QT_DLL" RuntimeLibrary="2" FloatingPointModel="2" @@ -70,7 +70,7 @@ /> @@ -264,7 +264,7 @@ @@ -290,7 +290,7 @@ @@ -316,7 +316,7 @@ @@ -342,7 +342,7 @@ @@ -372,7 +372,7 @@ diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj.VRIEND200810.Wim.user b/FaceTrackNoIR/FaceTrackNoIR.vcproj.VRIEND200810.Wim.user deleted file mode 100644 index aaaa8518..00000000 --- a/FaceTrackNoIR/FaceTrackNoIR.vcproj.VRIEND200810.Wim.user +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp index 49417733..2d4c5917 100644 --- a/FaceTrackNoIR/tracker.cpp +++ b/FaceTrackNoIR/tracker.cpp @@ -91,12 +91,12 @@ T6DOF Tracker::target_camera(0,0,0,0,0,0); T6DOF Tracker::new_camera(0,0,0,0,0,0); T6DOF Tracker::output_camera(0,0,0,0,0,0); // Position sent to game protocol -THeadPoseDOF Tracker::Pitch; // One structure for each of 6DOF's -THeadPoseDOF Tracker::Yaw; -THeadPoseDOF Tracker::Roll; -THeadPoseDOF Tracker::X; -THeadPoseDOF Tracker::Y; -THeadPoseDOF Tracker::Z; +THeadPoseDOF Tracker::Pitch("PitchUp", "PitchDown"); // One structure for each of 6DOF's +THeadPoseDOF Tracker::Yaw("Yaw", ""); +THeadPoseDOF Tracker::Roll("Roll", ""); +THeadPoseDOF Tracker::X("X",""); +THeadPoseDOF Tracker::Y("Y",""); +THeadPoseDOF Tracker::Z("Z",""); TShortKey Tracker::CenterKey; // ShortKey to Center headposition TShortKey Tracker::StartStopKey; // ShortKey to Start/stop tracking @@ -234,6 +234,12 @@ Tracker::~Tracker() { ::WaitForSingleObject(m_WaitThread, INFINITE); } + // + // Remove the Tracker + // 20120615, WVR: As suggested by Stanislaw + if (pTracker) + pTracker.Release(); + // Close handles ::CloseHandle(m_StopThread); ::CloseHandle(m_WaitThread); @@ -516,12 +522,23 @@ T6DOF gameoutput_camera(0,0,0,0,0,0); new_camera.position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos; new_camera.position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos; } - output_camera.position.x = X.invert * getOutputFromCurve(&X.curve, new_camera.position.x, X.NeutralZone, X.MaxInput); - output_camera.position.y = Y.invert * getOutputFromCurve(&Y.curve, new_camera.position.y, Y.NeutralZone, Y.MaxInput); - output_camera.position.z = Z.invert * getOutputFromCurve(&Z.curve, new_camera.position.z, Z.NeutralZone, Z.MaxInput); - output_camera.position.pitch = Pitch.invert * getOutputFromCurve(&Pitch.curve, new_camera.position.pitch, Pitch.NeutralZone, Pitch.MaxInput); - output_camera.position.yaw = Yaw.invert * getOutputFromCurve(&Yaw.curve, new_camera.position.yaw, Yaw.NeutralZone, Yaw.MaxInput); - output_camera.position.roll = Roll.invert * getOutputFromCurve(&Roll.curve, new_camera.position.roll, Roll.NeutralZone, Roll.MaxInput); + output_camera.position.x = X.invert * X.curvePtr->getValue(new_camera.position.x); + output_camera.position.y = Y.invert * Y.curvePtr->getValue(new_camera.position.y); + output_camera.position.z = Z.invert * Z.curvePtr->getValue(new_camera.position.z); + int altp = new_camera.position.pitch < 0; + output_camera.position.pitch = Pitch.invert * (altp ? Pitch.curvePtrAlt : Pitch.curvePtr)->getValue(new_camera.position.pitch); + ///output_camera.position.pitch = Pitch.invert * Pitch.curvePtr->getValue(new_camera.position.pitch); + output_camera.position.yaw = Yaw.invert * Yaw.curvePtr->getValue(new_camera.position.yaw); + output_camera.position.roll = Roll.invert * Roll.curvePtr->getValue(new_camera.position.roll); + + + X.curvePtr->setTrackingActive( true ); + Y.curvePtr->setTrackingActive( true ); + Z.curvePtr->setTrackingActive( true ); + Yaw.curvePtr->setTrackingActive( true ); + Pitch.curvePtr->setTrackingActive( true ); + Pitch.curvePtrAlt->setTrackingActive( true ); + Roll.curvePtr->setTrackingActive( true ); // // Reverse Axis. @@ -583,6 +600,13 @@ T6DOF gameoutput_camera(0,0,0,0,0,0); gameoutput_camera = output_camera + gamezero_camera; pProtocol->sendHeadposeToGame( &gameoutput_camera ); // degrees & centimeters } + X.curvePtr->setTrackingActive( false ); + Y.curvePtr->setTrackingActive( false ); + Z.curvePtr->setTrackingActive( false ); + Yaw.curvePtr->setTrackingActive( false ); + Pitch.curvePtr->setTrackingActive( false ); + Pitch.curvePtrAlt->setTrackingActive( false ); + Roll.curvePtr->setTrackingActive( false ); } } @@ -731,104 +755,6 @@ float sum = 0; return sum / rawList->size(); } -// -// Correct the Raw value, with the Neutral Zone supplied -// -//float Tracker::getCorrectedNewRaw ( float NewRaw, float rotNeutral ) { -// -// // -// // Return 0, if NewRaw is within the Neutral Zone -// // -// if ( fabs( NewRaw ) < rotNeutral ) { -// return 0.0f; -// } -// -// // -// // NewRaw is outside the zone. -// // Substract rotNeutral from the NewRaw -// // -// if ( NewRaw > 0.0f ) { -// return (NewRaw - rotNeutral); -// } -// else { -// return (NewRaw + rotNeutral); // Makes sense? -// } -// -//} - -// -// Implementation of an Exponentially Weighted Moving Average, used to serve as a low-pass filter. -// The code was adopted from Melchior Franz, who created it for FlightGear (aircraft.nas). -// -// The function takes the new value, the delta-time (sec) and a weighing coefficient (>0 and <1) -// All previous values are taken into account, the weight of this is determined by 'coeff'. -// -//float Tracker::lowPassFilter ( float newvalue, float *oldvalue, float dt, float coeff) { -//float c = 0.0f; -//float fil = 0.0f; -// -// c = dt / (coeff + dt); -// fil = (newvalue * c) + (*oldvalue * (1 - c)); -// *oldvalue = fil; -// -// return fil; -//} - -// -// Implementation of a Rate Limiter, used to eliminate spikes in the raw data. -// -// The function takes the new value, the delta-time (sec) and the positive max. slew-rate (engineering units/sec) -// -//float Tracker::rateLimiter ( float newvalue, float *oldvalue, float dt, float max_rate) { -//float rate = 0.0f; -//float clamped_value = 0.0f; -// -// rate = (newvalue - *oldvalue) / dt; -// clamped_value = newvalue; // If all is well, the newvalue is returned -// -// // -// // One max-rate is used for ramp-up and ramp-down -// // If the rate exceeds max_rate, return the maximum value that the max_rate allows -// // -// if (fabs(rate) > max_rate) { -// // -// // For ramp-down, apply a factor -1 to the max_rate -// // -// if (rate < 0.0f) { -// clamped_value = (-1.0f * dt * max_rate) + *oldvalue; -// } -// else { -// clamped_value = (dt * max_rate) + *oldvalue; -// } -// } -// *oldvalue = clamped_value; -// -// return clamped_value; -//} - -// -// Get the output from the curve. -// -float Tracker::getOutputFromCurve ( QPainterPath *curve, float input, float neutralzone, float maxinput ) { -float sign; - - sign = 1.0f; - if (input < 0.0f) { - sign = -1.0f; - } - - // - // Always return 0 inside the NeutralZone - // Always return max. when input larger than expected - // - if (fabs(input) > maxinput) return sign * curve->pointAtPercent(1.0).x(); - - // - // Return the value, derived from the Bezier-curve - // - return sign * curve->pointAtPercent((fabs(input))/maxinput).x(); -} - // // Load the current Settings from the currently 'active' INI-file. // @@ -836,7 +762,6 @@ void Tracker::loadSettings() { int NeutralZone; int sensYaw, sensPitch, sensRoll; int sensX, sensY, sensZ; -QPointF point1, point2, point3, point4; qDebug() << "Tracker::loadSettings says: Starting "; QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) @@ -859,83 +784,6 @@ QPointF point1, point2, point3, point4; sensZ = iniFile.value ( "sensZ", 100 ).toInt(); iniFile.endGroup (); - // - // Read the curve-settings from the file. Use the (deprecated) settings, if the curves are not there. - // - iniFile.beginGroup ( "Curves" ); - - // - // Create a new path and assign it to the curve. - // - getCurvePoints( &iniFile, "Yaw_", &point1, &point2, &point3, &point4, NeutralZone, sensYaw, 50, 180 ); - QPainterPath newYawCurve; - newYawCurve.moveTo( QPointF(0,0) ); - newYawCurve.lineTo( point1 ); - newYawCurve.cubicTo(point2, point3, point4); - - Yaw.NeutralZone = point1.y(); // Get the Neutral Zone - Yaw.MaxInput = point4.y(); // Get Maximum Input - Yaw.curve = newYawCurve; - - qDebug() << "loadSettings says: curve-elementcount = " << Yaw.curve.elementCount(); - - // Pitch - getCurvePoints( &iniFile, "Pitch_", &point1, &point2, &point3, &point4, NeutralZone, sensPitch, 50, 180 ); - QPainterPath newPitchCurve; - newPitchCurve.moveTo( QPointF(0,0) ); - newPitchCurve.lineTo( point1 ); - newPitchCurve.cubicTo(point2, point3, point4); - - Pitch.NeutralZone = point1.y(); // Get the Neutral Zone - Pitch.MaxInput = point4.y(); // Get Maximum Input - Pitch.curve = newPitchCurve; - - // Roll - getCurvePoints( &iniFile, "Roll_", &point1, &point2, &point3, &point4, NeutralZone, sensRoll, 50, 180 ); - QPainterPath newRollCurve; - newRollCurve.moveTo( QPointF(0,0) ); - newRollCurve.lineTo( point1 ); - newRollCurve.cubicTo(point2, point3, point4); - - Roll.NeutralZone = point1.y(); // Get the Neutral Zone - Roll.MaxInput = point4.y(); // Get Maximum Input - Roll.curve = newRollCurve; - - // X - getCurvePoints( &iniFile, "X_", &point1, &point2, &point3, &point4, NeutralZone, sensX, 50, 180 ); - QPainterPath newXCurve; - newXCurve.moveTo( QPointF(0,0) ); - newXCurve.lineTo( point1 ); - newXCurve.cubicTo(point2, point3, point4); - - X.NeutralZone = point1.y(); // Get the Neutral Zone - X.MaxInput = point4.y(); // Get Maximum Input - X.curve = newXCurve; - - // Y - getCurvePoints( &iniFile, "Y_", &point1, &point2, &point3, &point4, NeutralZone, sensY, 50, 180 ); - QPainterPath newYCurve; - newYCurve.moveTo( QPointF(0,0) ); - newYCurve.lineTo( point1 ); - newYCurve.cubicTo(point2, point3, point4); - - Y.NeutralZone = point1.y(); // Get the Neutral Zone - Y.MaxInput = point4.y(); // Get Maximum Input - Y.curve = newYCurve; - - // Z - getCurvePoints( &iniFile, "Z_", &point1, &point2, &point3, &point4, NeutralZone, sensZ, 50, 180 ); - QPainterPath newZCurve; - newZCurve.moveTo( QPointF(0,0) ); - newZCurve.lineTo( point1 ); - newZCurve.cubicTo(point2, point3, point4); - - Z.NeutralZone = point1.y(); // Get the Neutral Zone - Z.MaxInput = point4.y(); // Get Maximum Input - Z.curve = newZCurve; - - iniFile.endGroup (); - // // Read the keyboard shortcuts. // diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h index a69218a1..c1eb61c6 100644 --- a/FaceTrackNoIR/tracker.h +++ b/FaceTrackNoIR/tracker.h @@ -3,8 +3,8 @@ * gamers from Holland, who don't like to pay much for * * head-tracking. * * * -* Copyright (C) 2010 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * +* Copyright (C) 2010 - 2012 Wim Vriend (Developing) * +* Ron Hendriks (Researching and Testing) * * * * Homepage * * * This program is free software; you can redistribute it and/or modify it * @@ -20,6 +20,10 @@ * You should have received a copy of the GNU General Public License along * * with this program; if not, see . * *********************************************************************************/ +/* + Modifications (last one on top): + 20120717 - WVR: FunctionConfig is now used for the Curves, instead of BezierConfig. +*/ #ifndef __TRACKER_H__ #define __TRACKER_H__ @@ -37,6 +41,7 @@ #include "ExcelServer.h" // Excel-server (for analysing purposes) #include "FTNoIR_cxx_protocolserver.h" +#include "FunctionConfig.h" #include "..\ftnoir_tracker_base\FTNoIR_Tracker_base.h" #include "..\ftnoir_protocol_base\FTNoIR_Protocol_base.h" @@ -94,6 +99,20 @@ class FaceTrackNoIR; // pre-define parent-class to avoid circular includes // class THeadPoseDOF { public: + + THeadPoseDOF(QString primary, QString secondary = "") { + 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) + + curvePtr = new FunctionConfig(primary); // Create the Function-config for input-output translation + curvePtr->loadSettings(iniFile); // Load the settings from the INI-file + if (secondary != "") { + curvePtrAlt = new FunctionConfig(secondary); + curvePtrAlt->loadSettings(iniFile); + } + } + void initHeadPoseData(){ headPos = 0.0f; offset_headPos = 0.0f; @@ -116,7 +135,11 @@ public: int maxItems; // Maximum number of elements in rawList float prevPos; // Previous Position float prevRawPos; // Previous Raw Position - QPainterPath curve; // Bezier curve to translate input -> output +// QPainterPath curve; // Bezier curve to translate input -> output + + FunctionConfig* curvePtr; // Function to translate input -> output + FunctionConfig* curvePtrAlt; + int NeutralZone; // Neutral zone int MaxInput; // Maximum raw input float confidence; // Current confidence @@ -162,14 +185,6 @@ private: static void addHeadPose( THeadPoseData head_pose ); static void addRaw2List ( QList *rawList, float maxIndex, float raw ); - /** static member variables for saving the head pose **/ - static THeadPoseDOF Pitch; // Head-rotation X-direction (Up/Down) - static THeadPoseDOF Yaw; // Head-rotation Y-direction () - static THeadPoseDOF Roll; // Head-rotation Z-direction () - static THeadPoseDOF X; // Head-movement X-direction (Left/Right) - static THeadPoseDOF Y; // Head-movement Y-direction (Up/Down) - static THeadPoseDOF Z; // Head-movement Z-direction (To/From camera) - static TShortKey CenterKey; // ShortKey to Center headposition static TShortKey StartStopKey; // ShortKey to Start/stop tracking static TShortKey InhibitKey; // ShortKey to disable one or more axis during tracking @@ -207,6 +222,14 @@ public: Tracker( FaceTrackNoIR *parent ); ~Tracker(); + /** static member variables for saving the head pose **/ + static THeadPoseDOF Pitch; // Head-rotation X-direction (Up/Down) + static THeadPoseDOF Yaw; // Head-rotation Y-direction () + static THeadPoseDOF Roll; // Head-rotation Z-direction () + static THeadPoseDOF X; // Head-movement X-direction (Left/Right) + static THeadPoseDOF Y; // Head-movement Y-direction (Up/Down) + static THeadPoseDOF Z; // Head-movement Z-direction (To/From camera) + void setup(); // void registerHeadPoseCallback(); @@ -240,7 +263,7 @@ public: static float getSmoothFromList ( QList *rawList ); static float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); } static float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); } - static float getOutputFromCurve ( QPainterPath *curve, float input, float neutralzone, float maxinput ); +// static float getOutputFromCurve ( QPainterPath *curve, float input, float neutralzone, float maxinput ); // For now, use one slider for all void setSmoothing(int x) { diff --git a/bin/FunctionConfig.h b/bin/FunctionConfig.h new file mode 100644 index 00000000..9777d887 Binary files /dev/null and b/bin/FunctionConfig.h differ diff --git a/bin/QBezierConfigurator.dll b/bin/QBezierConfigurator.dll deleted file mode 100644 index a550b132..00000000 Binary files a/bin/QBezierConfigurator.dll and /dev/null differ diff --git a/bin/QBezierConfigurator.lib b/bin/QBezierConfigurator.lib deleted file mode 100644 index df3cc4e9..00000000 Binary files a/bin/QBezierConfigurator.lib and /dev/null differ diff --git a/bin/QFunctionConfigurator.lib b/bin/QFunctionConfigurator.lib new file mode 100644 index 00000000..05f4afa1 Binary files /dev/null and b/bin/QFunctionConfigurator.lib differ diff --git a/bin/Settings/ArmA.ini b/bin/Settings/ArmA.ini index e7ef044c..7777dbfc 100644 --- a/bin/Settings/ArmA.ini +++ b/bin/Settings/ArmA.ini @@ -33,12 +33,12 @@ Roll_point2=@Variant(\0\0\0\x1a@R\xc0\0\0\0\0\0@A\x80\0\0\0\0\0) Roll_point3=@Variant(\0\0\0\x1a@e`\0\0\0\0\0@G\0\0\0\0\0\0) Roll_point4=@Variant(\0\0\0\x1a@e`\0\0\0\0\0@I\0\0\0\0\0\0) Yaw_point1=@Variant(\0\0\0\x1a@ \0\0\0\0\0\0@&\0\0\0\0\0\0) -Yaw_point2=@Variant(\0\0\0\x1a@@@\0\0\0\0\0@:\x80\0\0\0\0\0) +Yaw_point2="@Variant(\0\0\0\x1a@@\x80\0\0\0\0\0@;\0\0\0\0\0\0)" Yaw_point3=@Variant(\0\0\0\x1a@L\x80\0\0\0\0\0@C\0\0\0\0\0\0) Yaw_point4=@Variant(\0\0\0\x1a@U\0\0\0\0\0\0@I\0\0\0\0\0\0) Pitch_point1=@Variant(\0\0\0\x1a@\x1c\0\0\0\0\0\0@ \0\0\0\0\0\0) -Pitch_point2=@Variant(\0\0\0\x1a@C\xc0\0\0\0\0\0@>\x80\0\0\0\0\0) -Pitch_point3=@Variant(\0\0\0\x1a@P \0\0\0\0\0@D\x80\0\0\0\0\0) +Pitch_point2=@Variant(\0\0\0\x1a@D\0\0\0\0\0\0@?\0\0\0\0\0\0) +Pitch_point3=@Variant(\0\0\0\x1a@P@\0\0\0\0\0@D\x80\0\0\0\0\0) Pitch_point4=@Variant(\0\0\0\x1a@T\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@\0\0\0\0\0\0\0) X_point2=@Variant(\0\0\0\x1a@Z@\0\0\0\0\0@1\0\0\0\0\0\0) @@ -49,9 +49,15 @@ Y_point2=@Variant(\0\0\0\x1a@F\x80\0\0\0\0\0@E\0\0\0\0\0\0) Y_point3=@Variant(\0\0\0\x1a@6\0\0\0\0\0\0@9\0\0\0\0\0\0) Y_point4=@Variant(\0\0\0\x1a@P@\0\0\0\0\0@I\0\0\0\0\0\0) Z_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@&\0\0\0\0\0\0) -Z_point2=@Variant(\0\0\0\x1a@1\0\0\0\0\0\0@H@\0\0\0\0\0) +Z_point2=@Variant(\0\0\0\x1a@1\0\0\0\0\0\0@H\x80\0\0\0\0\0) Z_point3=@Variant(\0\0\0\x1a@6\0\0\0\0\0\0@D\x80\0\0\0\0\0) Z_point4=@Variant(\0\0\0\x1a@K\x80\0\0\0\0\0@I\0\0\0\0\0\0) +fixup_mx=0 +fixup_my=0 +fixup_mz=0 +fixup_x=0 +fixup_y=0 +fixup_z=0 [KB_Shortcuts] Keycode_Center=199 @@ -78,10 +84,64 @@ Keycode_GameZero=0 Shift_GameZero=false Ctrl_GameZero=false Alt_GameZero=false -Enable_ReverseAxis=true +Enable_ReverseAxis=false RA_Yaw=40 RA_ZPos=0 RA_ToZPos=100 [TrackerSource] -Selection=0 +Selection=2 + +[Curves-Yaw] +point-count=1 +point-0-x=44.7297297297297 +point-0-y=134.357142857143 + +[Curves-PitchUp] +point-count=1 +point-0-x=45.2702702702703 +point-0-y=169.714285714286 +point-1-x=22.1621621621622 +point-1-y=164.571428571429 +point-2-x=32.027027027027 +point-2-y=118.285714285714 +point-3-x=37.8378378378378 +point-3-y=150.428571428571 + +[Curves-PitchDown] +point-count=1 +point-0-x=47.2972972972973 +point-0-y=169.714285714286 +point-1-x=24.4594594594595 +point-1-y=70.7142857142857 +point-2-x=25.1351351351351 +point-2-y=137.571428571429 + +[Curves-Roll] +point-count=1 +point-0-x=37.7027027027027 +point-0-y=135 + +[Curves-X] +point-count=1 +point-0-x=37.4324324324324 +point-0-y=83.5714285714286 + +[Curves-Y] +point-count=1 +point-0-x=34.1891891891892 +point-0-y=82.9285714285714 + +[Curves-Z] +point-count=1 +point-0-x=34.3243243243243 +point-0-y=75.2142857142857 + +[FTIR] +useTIRViews=false +useDummyExe=true + +[FaceDetectTracker] +RedetectMs=500 +CameraId=0 +VideoWidget=1 diff --git a/bin/Settings/FreeFalcon.ini b/bin/Settings/FreeFalcon.ini index 5b486b11..928a74ce 100644 --- a/bin/Settings/FreeFalcon.ini +++ b/bin/Settings/FreeFalcon.ini @@ -79,3 +79,7 @@ Enable_ReverseAxis=false RA_Yaw=40 RA_ZPos=-20 RA_ToZPos=50 + +[FTIR] +useTIRViews=true +useDummyExe=true diff --git a/bin/qbezierconfigurator.h b/bin/qbezierconfigurator.h deleted file mode 100644 index 81ce013a..00000000 --- a/bin/qbezierconfigurator.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef QBEZIERCONFIGURATOR_H -#define QBEZIERCONFIGURATOR_H - -#include -#include -#include - -class QDESIGNER_WIDGET_EXPORT QBezierConfigurator : public QWidget -{ - Q_OBJECT - Q_PROPERTY(int maxInputEGU READ maxInputEGU WRITE setmaxInputEGU); - Q_PROPERTY(int maxOutputEGU READ maxOutputEGU WRITE setmaxOutputEGU); - Q_PROPERTY(int pixPerEGU READ pixPerEGU WRITE setpixPerEGU); - - Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier); - Q_PROPERTY(QColor colorBackground READ colorBackground WRITE setColorBackground); - Q_PROPERTY(QString stringInputEGU READ stringInputEGU WRITE setInputEGU); - Q_PROPERTY(QString stringOutputEGU READ stringOutputEGU WRITE setOutputEGU); - Q_PROPERTY(QString stringCaption READ stringCaption WRITE setCaption); - - // Return the current value to Designer - int maxInputEGU() const - { - return MaxInput; - } - int maxOutputEGU() const - { - return MaxOutput; - } - int pixPerEGU() const - { - return pPerEGU; - } - - // Return the current color to Designer - QColor colorBezier() const - { - return colBezier; - } - // Return the current color to Designer - QColor colorBackground() const - { - return colBackground; - } - // Return the current string to Designer - QString stringInputEGU() const - { - return strInputEGU; - } - // Return the current string to Designer - QString stringOutputEGU() const - { - return strOutputEGU; - } - // Return the current string to Designer - QString stringCaption() const - { - return strCaption; - } - -public: - QBezierConfigurator(QWidget *parent = 0); - ~QBezierConfigurator(); - -signals: - void valueNeutralZoneChanged(int); - void BezierCurveChanged(bool); - -public slots: - void setmaxInputEGU(int); - void setmaxOutputEGU(int); - void setpixPerEGU(int); - - QPointF getPointOne(); - QPointF getPointTwo(); - QPointF getPointThree(); - QPointF getPointFour(); - - void setPointOne(QPointF); - void setPointTwo(QPointF); - void setPointThree(QPointF); - void setPointFour(QPointF); - - void setNeutralZone(int zone); - - void setColorBezier(QColor); - void setColorBackground(QColor); - void setInputEGU(QString); - void setOutputEGU(QString); - void setCaption(QString); - -protected slots: - void paintEvent(QPaintEvent *e); - void mousePressEvent(QMouseEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void mouseReleaseEvent(QMouseEvent *e); - -protected: - void drawBackground(QPainter *painter, const QRectF &rect); - void drawPoint(QPainter *painter, const QPointF &pt); - void drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen pen); - bool markContains(const QPointF &pt, const QPointF &coord) const; - bool withinRange( const QPointF &coord ) const; - -protected: - virtual void resizeEvent(QResizeEvent *); - -private: - QRectF range; // The actual rectangle for the Bezier-curve - QPointF one, two, three, four; // The four points, that define the curve - QPointF normalizePoint (QPointF point) const; // Convert the graphical Point to a real-life Point - QPointF graphicalizePoint (QPointF point) const; // Convert the Point to a graphical Point - - QPointF mouseStart; - QPointF *moving; - int movingPoint; - - int MaxInput; // Maximum input limit - int MaxOutput; // Maximum output limit - int pPerEGU; // Number of pixels, per EGU - - QColor colBezier; // Color of Bezier curve - QColor colBackground; // Color of widget background - QString strInputEGU; // Engineering Units input (vertical axis) - QString strOutputEGU; // Engineering Units output (horizontal axis) - QString strCaption; // Caption of the graph - -}; - -#endif // QBEZIERCONFIGURATOR_H diff --git a/bin/qfunctionconfigurator.h b/bin/qfunctionconfigurator.h new file mode 100644 index 00000000..c2a2f25b --- /dev/null +++ b/bin/qfunctionconfigurator.h @@ -0,0 +1,177 @@ +/******************************************************************************** +* 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 . * +* * +* The FunctionConfigurator was made by Stanislaw Halik, and adapted to * +* FaceTrackNoIR. * +* * +* All credits for this nice piece of code should go to Stanislaw. * +* * +* Copyright (c) 2011-2012, Stanislaw Halik * +* Permission to use, copy, modify, and/or distribute this * +* software for any purpose with or without fee is hereby granted, * +* provided that the above copyright notice and this permission * +* notice appear in all copies. * +********************************************************************************/ +#ifndef QFUNCTIONCONFIGURATOR_H +#define QFUNCTIONCONFIGURATOR_H + +#include +#include +#include +#include "FunctionConfig.h" + +// +// The FunctionConfigurator Widget is used to display and configure a function (curve). +// The Function is used by FaceTrackNoIR to 'translate' the actual head-pose to the virtual headpose. Every axis is configured by a separate Function. +// +// The Function is coded in a separate Class and can exists, without the Widget. When the widget is displayed (therefore 'created'), the Function can be attached to the +// Widget and the Widget used to change the Function. +// +class QDESIGNER_WIDGET_EXPORT QFunctionConfigurator : public QWidget +{ + Q_OBJECT + Q_PROPERTY(int maxInputEGU READ maxInputEGU WRITE setmaxInputEGU); + Q_PROPERTY(int maxOutputEGU READ maxOutputEGU WRITE setmaxOutputEGU); + Q_PROPERTY(int pixPerEGU_Input READ pixPerEGU_Input WRITE setpixPerEGU_Input); + + Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier); + Q_PROPERTY(QColor colorBackground READ colorBackground WRITE setColorBackground); + Q_PROPERTY(QString stringInputEGU READ stringInputEGU WRITE setInputEGU); + Q_PROPERTY(QString stringOutputEGU READ stringOutputEGU WRITE setOutputEGU); + Q_PROPERTY(QString stringCaption READ stringCaption WRITE setCaption); + + // Return the current value to Designer + int maxInputEGU() const + { + return MaxInput; + } + int maxOutputEGU() const + { + return MaxOutput; + } + int pixPerEGU_Input() const + { + return pPerEGU_Input; + } + int pixPerEGU_Output() const + { + return pPerEGU_Output; + } + + // Return the current color to Designer + QColor colorBezier() const + { + return colBezier; + } + // Return the current color to Designer + QColor colorBackground() const + { + return colBackground; + } + // Return the current string to Designer + QString stringInputEGU() const + { + return strInputEGU; + } + // Return the current string to Designer + QString stringOutputEGU() const + { + return strOutputEGU; + } + // Return the current string to Designer + QString stringCaption() const + { + return strCaption; + } + +public: + QFunctionConfigurator(QWidget *parent = 0); + ~QFunctionConfigurator(); + FunctionConfig* config(); + + void setConfig(FunctionConfig* config); // Connect the FunctionConfig to the Widget. + void loadSettings(QSettings& settings); // Load the FunctionConfig (points) from the INI-file + void saveSettings(QSettings& settings); // Save the FunctionConfig (points) to the INI-file + +signals: + void CurveChanged(bool); + +public slots: + void setmaxInputEGU(int); + void setmaxOutputEGU(int); + void setpixPerEGU_Input(int); + void setpixPerEGU_Output(int); + + void setColorBezier(QColor); + void setColorBackground(QColor); + void setInputEGU(QString); + void setOutputEGU(QString); + void setCaption(QString); + +protected slots: + void paintEvent(QPaintEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + +protected: + void drawBackground(QPainter *painter, const QRectF &rect); + void drawPoint(QPainter *painter, const QPointF &pt, QColor colBG ); + void drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen pen); + bool markContains(const QPointF &pt, const QPointF &coord) const; + bool withinRange( const QPointF &coord ) const; + +protected: + virtual void resizeEvent(QResizeEvent *); + +private: + QRectF range; // The actual rectangle for the Bezier-curve + QPointF lastPoint; // The right-most point of the Function + QPointF normalizePoint (QPointF point) const; // Convert the graphical Point to a real-life Point + QPointF graphicalizePoint (QPointF point) const; // Convert the Point to a graphical Point + + QPointF *moving; + int movingPoint; + + int MaxInput; // Maximum input limit + int MaxOutput; // Maximum output limit + int pPerEGU_Input; // Number of pixels, per EGU of Input + int pPerEGU_Output; // Number of pixels, per EGU of Output + + QColor colBezier; // Color of Bezier curve + QColor colBackground; // Color of widget background + QString strInputEGU; // Engineering Units input (vertical axis) + QString strOutputEGU; // Engineering Units output (horizontal axis) + QString strCaption; // Caption of the graph + + // + // Properties of the CurveConfigurator Widget + // + QString _title; // Title do display in Widget and to load Settings + FunctionConfig* _config; + QList _points; // Function-points + QList _draw_points; // Curve-points needed for drawing + HANDLE _mutex; +}; + +#endif // QFUNCTIONCONFIGURATOR_H diff --git a/bin/zlib1.dll b/bin/zlib1.dll index 81704ab9..4eb8adb9 100644 Binary files a/bin/zlib1.dll and b/bin/zlib1.dll differ diff --git a/faceAPI/FaceAPI2FSX.vcproj b/faceAPI/FaceAPI2FSX.vcproj index 6ce63d45..9437e3d0 100644 --- a/faceAPI/FaceAPI2FSX.vcproj +++ b/faceAPI/FaceAPI2FSX.vcproj @@ -124,7 +124,7 @@ />