summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-04-26 22:14:34 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-04-26 22:14:34 +0200
commit57d3b7902a8f2a9785ca22b97a0c743795414077 (patch)
treed30b968062c16e35b59ed53b51d432836b95c4d9
parentab23b322e575474856620c4bb92bb95aed2f3e69 (diff)
Hillcrest tracker, untested, waiting for confirmation
-rw-r--r--CMakeLists.txt52
-rw-r--r--ftnoir_tracker_hillcrest/ftnoir_hillcrest_clientcontrols.ui240
-rw-r--r--ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest.cpp256
-rw-r--r--ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest.h75
-rw-r--r--ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest_dialog.cpp168
-rw-r--r--ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest_dll.cpp80
6 files changed, 870 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47a48851..752e3964 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -103,6 +103,8 @@ if(NOT SDK_FACEAPI_ONLY)
endif()
endif(WIN32)
+ set(SDK_HILLCREST "" CACHE PATH "Path to libfreespace")
+
if(SDK_FSUIPC AND WIN32)
include_directories("${SDK_FSUIPC}")
link_directories("${SDK_FSUIPC}")
@@ -231,6 +233,14 @@ if(NOT SDK_FACEAPI_ONLY)
QT4_WRAP_UI(ftnoir-tracker-udp-uih ${ftnoir-tracker-udp-ui})
QT4_ADD_RESOURCES(ftnoir-tracker-udp-rcc ${ftnoir-tracker-udp-rc})
+ file(GLOB ftnoir-tracker-hillcrest-c "ftnoir_tracker_hillcrest/*.cpp")
+ file(GLOB ftnoir-tracker-hillcrest-h "ftnoir_tracker_hillcrest/*.h")
+ QT4_WRAP_CPP(ftnoir-tracker-hillcrest-moc ${ftnoir-tracker-hillcrest-h})
+ file(GLOB ftnoir-tracker-hillcrest-ui "ftnoir_tracker_hillcrest/*.ui")
+ file(GLOB ftnoir-tracker-hillcrest-rc "ftnoir_tracker_hillcrest/*.qrc")
+ QT4_WRAP_UI(ftnoir-tracker-hillcrest-uih ${ftnoir-tracker-hillcrest-ui})
+ QT4_ADD_RESOURCES(ftnoir-tracker-hillcrest-rcc ${ftnoir-tracker-hillcrest-rc})
+
file(GLOB ftnoir-tracker-faceapi-c "ftnoir_tracker_sm/*.cpp")
file(GLOB ftnoir-tracker-faceapi-h "ftnoir_tracker_sm/*.h")
QT4_WRAP_CPP(ftnoir-tracker-faceapi-moc ${ftnoir-tracker-faceapi-h})
@@ -413,6 +423,31 @@ endif()
PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt")
endif()
+ if(SDK_HILLCREST)
+ include_directories("${SDK_HILLCREST}/include")
+ if(WIN32)
+ set(HILLCREST_LIBDIR ${SDK_HILLCREST}/lib/Release)
+ if(MSVC)
+ set(HILLCREST_LIBNAME libfreespace.lib)
+ else()
+ set(HILLCREST_LIBNAME libfreespace.a)
+ endif()
+ else()
+ link_directories(${SDK_HILLCREST}/lib)
+ endif()
+ add_library(ftnoir-tracker-hillcrest SHARED ${ftnoir-tracker-hillcrest-c} ${ftnoir-tracker-hillcrest-moc} ${ftnoir-tracker-hillcrest-uih} ${ftnoir-tracker-hillcrest-rcc})
+ if(WIN32)
+ set(HILLCREST_LIB "${HILLCREST_LIBDIR}/${HILLCREST_LIBNAME}")
+ else()
+ set(HILLCREST_LIB freespace)
+ endif()
+ target_link_libraries(ftnoir-tracker-hillcrest ${MY_QT_LIBS} ${HILLCREST_LIB})
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
+ SET_TARGET_PROPERTIES(ftnoir-tracker-hillcrest
+ PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt")
+ endif()
+ endif()
+
add_executable(ftnoir ${ftnoir-bin-c} ${ftnoir-bin-moc} ${ftnoir-bin-uih} ${ftnoir-bin-rcc})
if(WIN32)
target_link_libraries(ftnoir ftnoir-pose-widget ftnoir-spline-widget ${MY_QT_LIBS} "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib")
@@ -481,13 +516,22 @@ if(NOT SDK_FACEAPI_ONLY)
ftnoir-proto-fgfs
ftnoir-proto-udp
ftnoir-tracker-ht
- ftnoir-tracker-udp
+ ftnoir-tracker-udp
ftnoir
RUNTIME DESTINATION .
LIBRARY DESTINATION .
NAMELINK_SKIP
)
+ if(SDK_HILLCREST)
+ install(
+ TARGETS ftnoir-tracker-hillcrest
+ RUNTIME DESTINATION .
+ LIBRARY DESTINATION .
+ NAMELINK_SKIP
+ )
+ endif()
+
if(WIN32)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
file(GLOB mingw-libgcc-s "${SDK_MINGW_PATH}/bin/libgcc_s_*.dll")
@@ -564,6 +608,12 @@ if(WIN32 AND NOT SDK_FACEAPI_ONLY)
)
endif()
+if(SDK_HILLCREST)
+ if(WIN32)
+ install(FILES "${HILLCREST_LIBDIR}/libfreespace.dll" DESTINATION .)
+ endif()
+endif()
+
if(WIN32 AND SDK_SM_FACEAPI_PATH)
if(MSVC80)
install(TARGETS ftnoir-faceapi-wrapper
diff --git a/ftnoir_tracker_hillcrest/ftnoir_hillcrest_clientcontrols.ui b/ftnoir_tracker_hillcrest/ftnoir_hillcrest_clientcontrols.ui
new file mode 100644
index 00000000..711ef68e
--- /dev/null
+++ b/ftnoir_tracker_hillcrest/ftnoir_hillcrest_clientcontrols.ui
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>UICFTNClientControls</class>
+ <widget class="QWidget" name="UICFTNClientControls">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>268</width>
+ <height>142</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>FTNoIR tracker settings FaceTrackNoIR</string>
+ </property>
+ <property name="windowIcon">
+ <iconset>
+ <normaloff>images/FaceTrackNoIR.png</normaloff>images/FaceTrackNoIR.png</iconset>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="_vertical_layout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>85</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Enable Axis</string>
+ </property>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>81</width>
+ <height>60</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="chkEnableYaw">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Roll:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Pitch:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="chkEnablePitch">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="chkEnableRoll">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Yaw:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <item>
+ <widget class="QPushButton" name="btnOK">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnCancel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>btnOK</tabstop>
+ <tabstop>btnCancel</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+ <slots>
+ <slot>startEngineClicked()</slot>
+ <slot>stopEngineClicked()</slot>
+ <slot>cameraSettingsClicked()</slot>
+ </slots>
+</ui>
diff --git a/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest.cpp b/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest.cpp
new file mode 100644
index 00000000..e7ef4c0f
--- /dev/null
+++ b/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest.cpp
@@ -0,0 +1,256 @@
+/********************************************************************************
+* 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 <http://www.gnu.org/licenses/>. *
+* *
+********************************************************************************/
+/**
+ * This file is part of libfreespace-examples.
+ *
+ * Copyright (c) 2009-2012, Hillcrest Laboratories, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of the Hillcrest Laboratories, Inc. nor the names
+ * of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <float.h>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#ifdef WIN32
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows XP or later.
+#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
+#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
+#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
+#endif
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
+#include "ftnoir_tracker_hillcrest.h"
+#include "facetracknoir/global-settings.h"
+
+static struct freespace_BodyFrame cachedBodyFrame;
+
+static void receiveMessageCallback(FreespaceDeviceId id,
+ struct freespace_message* message,
+ void* cookie,
+ int result) {
+ if (result == FREESPACE_SUCCESS && message != NULL && message->messageType == FREESPACE_MESSAGE_BODYFRAME) {
+ cachedBodyFrame = message->bodyFrame;
+ }
+}
+
+static FreespaceDeviceId initializeFreespace() {
+ struct freespace_message message;
+ FreespaceDeviceId device;
+ int numIds;
+ int rc;
+
+ // Initialize the freespace library
+ rc = freespace_init();
+ if (rc != FREESPACE_SUCCESS) {
+ qDebug() << "Initialization error" << rc;
+ return -1;
+ }
+
+ /** --- START EXAMPLE INITIALIZATION OF DEVICE -- **/
+ rc = freespace_getDeviceList(&device, 1, &numIds);
+ if (numIds == 0) {
+ qDebug() << "freespaceInputThread: Didn't find any device";
+ return -1;
+ }
+
+ rc = freespace_openDevice(device);
+ if (rc != FREESPACE_SUCCESS) {
+ qDebug() << "freespaceInputThread: Error opening device" << rc;
+ return -1;
+ }
+ freespace_setReceiveMessageCallback(device, receiveMessageCallback, NULL);
+
+ rc = freespace_flush(device);
+ if (rc != FREESPACE_SUCCESS) {
+ qDebug() << "freespaceInputThread: Error flushing device" << rc;
+ return -1;
+ }
+
+ memset(&cachedBodyFrame, 0, sizeof(cachedBodyFrame));
+ memset(&message, 0, sizeof(message));
+ if (FREESPACE_SUCCESS == freespace_isNewDevice(device)) {
+ message.messageType = FREESPACE_MESSAGE_DATAMODECONTROLV2REQUEST;
+ message.dataModeControlV2Request.packetSelect = 2;
+ message.dataModeControlV2Request.modeAndStatus |= 0 << 1;
+ } else {
+ message.messageType = FREESPACE_MESSAGE_DATAMODEREQUEST;
+ message.dataModeRequest.enableBodyMotion = 1;
+ message.dataModeRequest.inhibitPowerManager = 1;
+ }
+ rc = freespace_sendMessage(device, &message);
+ if (rc != FREESPACE_SUCCESS) {
+ qDebug() << "freespaceInputThread: Could not send message" << rc;
+ }
+ /** --- END EXAMPLE INITIALIZATION OF DEVICE -- **/
+
+ return device;
+}
+
+static void finalizeFreespace(FreespaceDeviceId device) {
+ struct freespace_message message;
+ int rc;
+
+ if (device != -1)
+ {
+ /** --- START EXAMPLE FINALIZATION OF DEVICE --- **/
+ memset(&message, 0, sizeof(message));
+ if (FREESPACE_SUCCESS == freespace_isNewDevice(device)) {
+ message.messageType = FREESPACE_MESSAGE_DATAMODECONTROLV2REQUEST;
+ message.dataModeControlV2Request.packetSelect = 1;
+ } else {
+ message.messageType = FREESPACE_MESSAGE_DATAMODEREQUEST;
+ message.dataModeRequest.enableMouseMovement = 1;
+ }
+ rc = freespace_sendMessage(device, &message);
+ if (rc != FREESPACE_SUCCESS) {
+ qDebug() << "freespaceInputThread: Could not send message" << rc;
+ }
+
+ freespace_closeDevice(device);
+ }
+ /** --- END EXAMPLE FINALIZATION OF DEVICE --- **/
+
+ freespace_exit();
+}
+
+FTNoIR_Tracker::FTNoIR_Tracker()
+{
+ device = initializeFreespace();
+}
+
+FTNoIR_Tracker::~FTNoIR_Tracker()
+{
+ finalizeFreespace(device);
+}
+
+void FTNoIR_Tracker::StartTracker(QFrame* videoFrame)
+{
+ loadSettings();
+}
+
+#define TO_DEG (180. / M_PI / 1e3 / 3.6)
+
+bool FTNoIR_Tracker::GiveHeadPoseData(double *data)
+{
+ if (device != -1)
+ {
+ struct freespace_BodyFrame body;
+ freespace_perform();
+ body = cachedBodyFrame;
+ if (bEnableYaw)
+ data[RX] = body.angularVelZ * TO_DEG;
+ if (bEnablePitch)
+ data[RY] = body.angularVelY * TO_DEG;
+ if (bEnableRoll)
+ data[RZ] = body.angularVelX * TO_DEG;
+ }
+ return device != -1;
+}
+
+//
+// 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)
+
+ iniFile.beginGroup ( "hillcrest-tracker" );
+ bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool();
+ bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool();
+ bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool();
+ iniFile.endGroup ();
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// 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")
+
+extern "C" FTNOIR_TRACKER_BASE_EXPORT void* CALLING_CONVENTION GetConstructor()
+{
+ return (ITracker*) new FTNoIR_Tracker;
+}
diff --git a/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest.h b/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest.h
new file mode 100644
index 00000000..b7490d42
--- /dev/null
+++ b/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest.h
@@ -0,0 +1,75 @@
+#include "ftnoir_tracker_base/ftnoir_tracker_base.h"
+#include "ui_ftnoir_hillcrest_clientcontrols.h"
+#include <QThread>
+#include <QUdpSocket>
+#include <QMessageBox>
+#include <QSettings>
+#include <QMutex>
+#include <QWaitCondition>
+#include <math.h>
+#include "facetracknoir/global-settings.h"
+#include <freespace/freespace.h>
+
+class FTNoIR_Tracker : public ITracker
+{
+public:
+ FTNoIR_Tracker();
+ ~FTNoIR_Tracker();
+
+ void StartTracker( QFrame *videoframe );
+ bool GiveHeadPoseData(double *data);
+ void loadSettings();
+ void WaitForExit() {
+ }
+
+private:
+ bool bEnableRoll;
+ bool bEnablePitch;
+ bool bEnableYaw;
+ FreespaceDeviceId device;
+};
+
+// Widget that has controls for FTNoIR protocol client-settings.
+class TrackerControls: public QWidget, public ITrackerDialog
+{
+ Q_OBJECT
+public:
+
+ explicit TrackerControls();
+ ~TrackerControls();
+ void showEvent ( QShowEvent * event );
+
+ void Initialize(QWidget *parent);
+ void registerTracker(ITracker *tracker) {}
+ void unRegisterTracker() {}
+
+private:
+ Ui::UICFTNClientControls ui;
+ void loadSettings();
+ void save();
+ bool settingsDirty;
+
+private slots:
+ void doOK();
+ void doCancel();
+ void settingChanged() { settingsDirty = true; }
+ void settingChanged(int) { settingsDirty = true; }
+};
+
+//*******************************************************************************************************
+// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker
+//*******************************************************************************************************
+class FTNoIR_TrackerDll : public Metadata
+{
+public:
+ FTNoIR_TrackerDll();
+ ~FTNoIR_TrackerDll();
+
+ void Initialize();
+
+ void getFullName(QString *strToBeFilled);
+ void getShortName(QString *strToBeFilled);
+ void getDescription(QString *strToBeFilled);
+ void getIcon(QIcon *icon);
+};
+
diff --git a/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest_dialog.cpp b/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest_dialog.cpp
new file mode 100644
index 00000000..0cb486fe
--- /dev/null
+++ b/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest_dialog.cpp
@@ -0,0 +1,168 @@
+/********************************************************************************
+* 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 <http://www.gnu.org/licenses/>. *
+* *
+********************************************************************************/
+#include "ftnoir_tracker_hillcrest.h"
+#include "facetracknoir/global-settings.h"
+
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+TrackerControls::TrackerControls() :
+QWidget()
+{
+ ui.setupUi( this );
+
+ // Connect Qt signals to member-functions
+ connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
+ connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
+
+ 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)));
+
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+TrackerControls::~TrackerControls() {
+ qDebug() << "~TrackerControls() says: started";
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void TrackerControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void TrackerControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void TrackerControls::showEvent ( QShowEvent * event ) {
+ 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 ( "hillcrest-tracker" );
+ ui.chkEnableRoll->setChecked(iniFile.value ( "EnableRoll", 1 ).toBool());
+ ui.chkEnablePitch->setChecked(iniFile.value ( "EnablePitch", 1 ).toBool());
+ ui.chkEnableYaw->setChecked(iniFile.value ( "EnableYaw", 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 ( "hillcrest-tracker" );
+ iniFile.setValue ( "EnableRoll", ui.chkEnableRoll->isChecked() );
+ iniFile.setValue ( "EnablePitch", ui.chkEnablePitch->isChecked() );
+ iniFile.setValue ( "EnableYaw", ui.chkEnableYaw->isChecked() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+////////////////////////////////////////////////////////////////////////////////
+// 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")
+
+extern "C" FTNOIR_TRACKER_BASE_EXPORT void* CALLING_CONVENTION GetDialog( )
+{
+ return (ITrackerDialog*) new TrackerControls;
+}
diff --git a/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest_dll.cpp b/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest_dll.cpp
new file mode 100644
index 00000000..447bc120
--- /dev/null
+++ b/ftnoir_tracker_hillcrest/ftnoir_tracker_hillcrest_dll.cpp
@@ -0,0 +1,80 @@
+/********************************************************************************
+* 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 <http://www.gnu.org/licenses/>. *
+* *
+********************************************************************************/
+/*
+ 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_hillcrest.h"
+#include <QDebug>
+#include "facetracknoir/global-settings.h"
+
+FTNoIR_TrackerDll::FTNoIR_TrackerDll() {
+}
+
+FTNoIR_TrackerDll::~FTNoIR_TrackerDll()
+{
+}
+
+void FTNoIR_TrackerDll::Initialize()
+{
+}
+
+void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled)
+{
+ *strToBeFilled = "Hillcrest";
+}
+
+void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled)
+{
+ *strToBeFilled = "Hillcrest";
+}
+
+void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled)
+{
+ *strToBeFilled = "Hillcrest";
+}
+
+void FTNoIR_TrackerDll::getIcon(QIcon *icon)
+{
+ *icon = QIcon(":/images/facetracknoir.png");
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// 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")
+
+extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata()
+{
+ return new FTNoIR_TrackerDll;
+}