From 75360443eb879b49a72c11b2a3d2d299ca61f9d7 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Fri, 28 Sep 2012 13:40:18 +0000 Subject: Modified sendHeadposeToGame, so it also sends raw data. Unified the code by adding the Dll class to the protocols and moving the dialog to a separate source. git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@173 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FaceTrackNoIR/FaceTrackNoIR.cpp | 23 ++++++++--------------- FaceTrackNoIR/FaceTrackNoIR.h | 4 ++-- FaceTrackNoIR/tracker.cpp | 37 +++++-------------------------------- 3 files changed, 15 insertions(+), 49 deletions(-) (limited to 'FaceTrackNoIR') diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp index 00e3a87c..340b80d5 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.cpp +++ b/FaceTrackNoIR/FaceTrackNoIR.cpp @@ -1143,11 +1143,12 @@ void FaceTrackNoIR::exit() { // void FaceTrackNoIR::createIconGroupBox() { -importGetProtocolDialog getProtocol; +importGetProtocolDll getProtocol; +IProtocolDllPtr pProtocolDll; // Pointer to Protocol info instance (in DLL) importGetFilterDll getFilter; IFilterDllPtr pFilterDll; // Pointer to Filter info instance (in DLL) importGetTrackerDll getTracker; -ITrackerDll *pTrackerDll; // Pointer to Filter info instance (in DLL) +ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL) QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) @@ -1173,27 +1174,19 @@ ITrackerDll *pTrackerDll; // Pointer to Filter info instance (in DLL) // qDebug() << "createIconGroupBox says: ProtocolName = " << protocolFileList.at(i); - // - // Delete the existing QDialog - // - if (pProtocolDialog) { - delete pProtocolDialog; - pProtocolDialog = NULL; - } - // Show the appropriate Protocol-server Settings QLibrary *protocolLib = new QLibrary(protocolFileList.at(i)); QString *protocolName = new QString(""); QIcon *protocolIcon = new QIcon(); - getProtocol = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog"); + getProtocol = (importGetProtocolDll) protocolLib->resolve("GetProtocolDll"); if (getProtocol) { - IProtocolDialogPtr ptrXyz(getProtocol()); + IProtocolDllPtr ptrXyz(getProtocol()); if (ptrXyz) { - pProtocolDialog = ptrXyz; - pProtocolDialog->getFullName( protocolName ); - pProtocolDialog->getIcon( protocolIcon ); + pProtocolDll = ptrXyz; + pProtocolDll->getFullName( protocolName ); + pProtocolDll->getIcon( protocolIcon ); // qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!"; } else { diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h index e3cf798e..a7992bbb 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.h +++ b/FaceTrackNoIR/FaceTrackNoIR.h @@ -49,7 +49,7 @@ typedef ITrackerDialogPtr (WINAPI *importGetTrackerDialog)(void); typedef ITrackerDllPtr (WINAPI *importGetTrackerDll)(void); typedef IProtocolDialogPtr (WINAPI *importGetProtocolDialog)(void); -//typedef IProtocolDllPtr (WINAPI *importGetProtocolDll)(void); +typedef IProtocolDllPtr (WINAPI *importGetProtocolDll)(void); typedef IFilterDialogPtr (WINAPI *importGetFilterDialog)(void); typedef IFilterDllPtr (WINAPI *importGetFilterDll)(void); @@ -83,7 +83,7 @@ private: QStringList filterFileList; // List of Filter-DLL-files, that are present in the program-folder QStringList trackerFileList; // List of Tracker-DLL-files, that are present in the program-folder - ITrackerDialogPtr pTrackerDialog; // Pointer to Tracker dialog instance (in DLL) + ITrackerDialogPtr pTrackerDialog; // Pointer to Tracker dialog instance (in DLL) IProtocolDialogPtr pProtocolDialog; // Pointer to Protocol dialog instance (in DLL) IFilterDialogPtr pFilterDialog; // Pointer to Filter dialog instance (in DLL) diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp index c78644c1..6153433f 100755 --- a/FaceTrackNoIR/tracker.cpp +++ b/FaceTrackNoIR/tracker.cpp @@ -664,30 +664,13 @@ T6DOF gameoutput_camera(0,0,0,0,0,0); if (InhibitKey.doZ) output_camera.z = 0.0f; } - // All Protocol server(s) + // + // Send the headpose to the game + // if (pProtocol) { gameoutput_camera = output_camera + gamezero_camera; - pProtocol->sendHeadposeToGame( &gameoutput_camera ); // degrees & centimeters + pProtocol->sendHeadposeToGame( &gameoutput_camera, &newpose ); // degrees & centimeters } - -# 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 ( new_camera.pitch ); // degrees - debug_Client->setVirtRotY ( new_camera.yaw ); - debug_Client->setVirtRotZ ( new_camera.roll ); - debug_Client->setVirtPosX ( new_camera.x ); // centimeters - debug_Client->setVirtPosY ( new_camera.y ); - debug_Client->setVirtPosZ ( new_camera.z ); -# endif - - } else { // @@ -701,7 +684,7 @@ T6DOF gameoutput_camera(0,0,0,0,0,0); output_camera.y = 0.0f; output_camera.z = 0.0f; gameoutput_camera = output_camera + gamezero_camera; - pProtocol->sendHeadposeToGame( &gameoutput_camera ); // degrees & centimeters + pProtocol->sendHeadposeToGame( &gameoutput_camera, &newpose ); // degrees & centimeters } X.curvePtr->setTrackingActive( false ); Y.curvePtr->setTrackingActive( false ); @@ -713,17 +696,7 @@ T6DOF gameoutput_camera(0,0,0,0,0,0); } } -# ifdef USE_DEBUG_CLIENT - debug_Client->confidence = Tracker::Pitch.confidence; - debug_Client->newSample = Tracker::Pitch.newSample; - debug_Client->smoothvalue = getSmoothFromList( &Pitch.rawList ); - debug_Client->prev_value = Tracker::Pitch.prevPos; - debug_Client->dT = dT; - debug_Client->sendHeadposeToGame(); // Log to Excel -# endif - Tracker::Pitch.newSample = false; - ReleaseMutex(Tracker::hTrackMutex); //for lower cpu load -- cgit v1.2.3