summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-04-01 17:16:11 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-04-01 17:16:11 +0000
commit28c091a886e6c98f41d3f5f8b153768b4a589fcd (patch)
treee9744191a2926366b194c47230a91439fe4f3e07 /FaceTrackNoIR
parent43734bf0f9fa8531b817943756157a2c459886a8 (diff)
Started with placing the protocol's in DLL's. First one: FlightGear.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@60 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp7
-rw-r--r--FaceTrackNoIR/tracker.cpp56
-rw-r--r--FaceTrackNoIR/tracker.h4
3 files changed, 57 insertions, 10 deletions
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 51acf6ec..d2373824 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -23,6 +23,7 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20110401 - WVR: The about-dialog was shown 'misplaced'. It was corrected.
20110328 - WVR: Added the display for output-pose.
20110207 - WVR: RadioButtons for 'Stop engine' added. It is now possible to choose Stop or Keep tracking.
20110109 - WVR: Added minimizeTaskBar option added. It is now possible to choose minimized or tray.
@@ -478,9 +479,9 @@ void FaceTrackNoIR::openurl_donation() {
/** show about dialog **/
void FaceTrackNoIR::about() {
- aboutDialog.move(this->width()/2-135,
- this->height()/2-220);
-
+
+ QPoint offsetpos(100, 100);
+ aboutDialog.move(this->pos() + offsetpos);
aboutDialog.show();
/** ABOUT DIALOG **/
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index 38c72437..cb881201 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -86,6 +86,7 @@ TShortKey Tracker::StartStopKey; // ShortKey to Start/stop tracking
TShortKey Tracker::InhibitKey; // ShortKey to inhibit axis while tracking
ITrackerPtr Tracker::pTracker; // Pointer to Tracker instance (in DLL)
+IProtocolPtr Tracker::pProtocol; // Pointer to Protocol instance (in DLL)
IFilterPtr Tracker::pFilter; // Pointer to Filter instance (in DLL)
@@ -95,6 +96,8 @@ importGetTracker getIT;
QLibrary *trackerLib;
importGetFilter getFilter;
QLibrary *filterLib;
+importGetProtocol getProtocol;
+QLibrary *protocolLib;
QFrame *video_frame;
// Retieve the pointer to the parent
@@ -184,7 +187,28 @@ QFrame *video_frame;
break;
case FLIGHTGEAR:
- server_Game = QSharedPointer<FGServer>(new FGServer ( this )); // Create FlightGear protocol-server
+ server_Game = QSharedPointer<FTServer>(new FTServer ( )); // Create Free-track protocol-server
+// server_Game = QSharedPointer<FGServer>(new FGServer ( this )); // Create FlightGear protocol-server
+// server_Game = NULL;
+ //
+ // Load the DLL with the protocol-logic and retrieve a pointer to the Protocol-class.
+ //
+ protocolLib = new QLibrary("FTNoIR_Protocol_FG.dll");
+
+ getProtocol = (importGetProtocol) protocolLib->resolve("GetProtocol");
+ if (getProtocol) {
+ IProtocolPtr ptrXyz(getProtocol());
+ if (ptrXyz)
+ {
+ pProtocol = ptrXyz;
+ pProtocol->Initialize();
+ qDebug() << "Protocol::setup Function Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
+ return;
+ }
break;
case FTNOIR:
@@ -297,6 +321,19 @@ void Tracker::setup() {
}
+ //
+ // Check if the Protocol-server files were installed OK.
+ // 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 (pProtocol) {
+
+ DLL_Ok = pProtocol->checkServerInstallationOK( mainApp->winId() );
+ if (!DLL_Ok) {
+ QMessageBox::information(mainApp, "FaceTrackNoIR error", "Protocol is not (correctly) installed!");
+ }
+ }
+
# ifdef USE_DEBUG_CLIENT
DLL_Ok = debug_Client->checkServerInstallationOK( mainApp->winId() ); // Check installation
if (!DLL_Ok) {
@@ -499,12 +536,12 @@ void Tracker::run() {
pFilter->FilterHeadPoseData(&current_camera.position, &target_camera.position, &new_camera.position, Tracker::Pitch.newSample);
}
else {
- output_camera.position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos;
- output_camera.position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos;
- output_camera.position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos;
- output_camera.position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
- output_camera.position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos;
- output_camera.position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos;
+ new_camera.position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos;
+ new_camera.position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos;
+ new_camera.position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos;
+ new_camera.position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
+ 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);
@@ -549,6 +586,11 @@ void Tracker::run() {
server_Game->setVirtPosZ ( output_camera.position.z );
}
+ // All Protocol server(s)
+ if (pProtocol) {
+ pProtocol->sendHeadposeToGame( &output_camera ); // degrees & centimeters
+ }
+
// headRotXLine->setText(QString("%1").arg( new_camera.position.pitch, 0, 'f', 1)); // show degrees
// headRotYLine->setText(QString("%1").arg( new_camera.position.yaw, 0, 'f', 1));
// headRotZLine->setText(QString("%1").arg( new_camera.position.roll, 0, 'f', 1));
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 3b7d7ca8..1ffed69c 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -46,6 +46,7 @@
#include "FTNoIR_cxx_protocolserver.h"
#include "..\ftnoir_tracker_base\FTNoIR_Tracker_base.h"
+#include "..\ftnoir_protocol_base\FTNoIR_Protocol_base.h"
#include "FTNoIR_Filter_base.h"
#include "AutoClosePtr.h"
@@ -54,6 +55,8 @@
// be released automatically in destructor of the smart pointer.
typedef AutoClosePtr<ITracker, void, &ITracker::Release> ITrackerPtr;
typedef ITracker *(WINAPI *importGetTracker)(void);
+typedef AutoClosePtr<IProtocol, void, &IProtocol::Release> IProtocolPtr;
+typedef IProtocol *(WINAPI *importGetProtocol)(void);
typedef AutoClosePtr<IFilter, void, &IFilter::Release> IFilterPtr;
typedef IFilter *(WINAPI *importGetFilter)(void);
@@ -157,6 +160,7 @@ private:
static T6DOF output_camera;
static ITrackerPtr pTracker; // Pointer to Tracker instance (in DLL)
+ static IProtocolPtr pProtocol; // Pointer to Protocol instance (in DLL)
static IFilterPtr pFilter; // Pointer to Filter instance (in DLL)
static void addHeadPose( THeadPoseData head_pose );