diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2012-09-28 13:40:18 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2012-09-28 13:40:18 +0000 |
commit | 75360443eb879b49a72c11b2a3d2d299ca61f9d7 (patch) | |
tree | fdab3ff501710e19f31f63815957a1fe86dbcb88 | |
parent | ee53c49af9789553fb51987bd6003ce30344e173 (diff) |
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
59 files changed, 2189 insertions, 3169 deletions
diff --git a/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h b/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h index 742b4d1e..0a57eb88 100644 --- a/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h +++ b/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h @@ -135,18 +135,11 @@ public: FTNoIR_FilterDll();
~FTNoIR_FilterDll();
- void Release();
- void Initialize();
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Filter Mk2"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Mk2"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Accela filter Mk2"); };
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
-
-private:
- QString filterFullName; // Filters' name and description
- QString filterShortName;
- QString filterDescription;
+ void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); };
};
diff --git a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dll.cpp b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dll.cpp index ccd1aaae..e1452bf2 100644 --- a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dll.cpp +++ b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dll.cpp @@ -34,10 +34,6 @@ #include <QDebug>
FTNoIR_FilterDll::FTNoIR_FilterDll() {
- //populate the description strings
- filterFullName = "Accela Filter Mk2";
- filterShortName = "Accela Mk2";
- filterDescription = "Accela filter Mk2";
}
FTNoIR_FilterDll::~FTNoIR_FilterDll()
@@ -45,36 +41,6 @@ FTNoIR_FilterDll::~FTNoIR_FilterDll() }
-void FTNoIR_FilterDll::Release()
-{
- delete this;
-}
-
-void FTNoIR_FilterDll::Initialize()
-{
- return;
-}
-
-void FTNoIR_FilterDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = filterFullName;
-};
-
-void FTNoIR_FilterDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = filterShortName;
-};
-
-void FTNoIR_FilterDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = filterDescription;
-};
-
-void FTNoIR_FilterDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/filter-16.png");
-};
-
////////////////////////////////////////////////////////////////////////////////
// Factory function that creates instances if the Filter object.
diff --git a/FTNoIR_Filter_Base/ftnoir_filter_base.h b/FTNoIR_Filter_Base/ftnoir_filter_base.h index 71d2faf0..44ce3d72 100644 --- a/FTNoIR_Filter_Base/ftnoir_filter_base.h +++ b/FTNoIR_Filter_Base/ftnoir_filter_base.h @@ -71,7 +71,6 @@ GetFilterDialog(void); struct IFilterDll
{
virtual ~IFilterDll() {}
- virtual void Initialize() = 0;
virtual void getFullName(QString *strToBeFilled) = 0;
virtual void getShortName(QString *strToBeFilled) = 0;
diff --git a/FTNoIR_Filter_DZ1/FTNoIR_FilterControls.ui b/FTNoIR_Filter_DZ1/FTNoIR_FilterControls.ui deleted file mode 100644 index 7de21537..00000000 --- a/FTNoIR_Filter_DZ1/FTNoIR_FilterControls.ui +++ /dev/null @@ -1,772 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UICFilterControls</class>
- <widget class="QWidget" name="UICFilterControls">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>411</width>
- <height>366</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>DZ1 Filter settings FaceTrackNoIR</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>images/FaceTrackNoIR.ico</normaloff>images/FaceTrackNoIR.ico</iconset>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <layout class="QVBoxLayout" name="_vertical_layout">
- <item>
- <widget class="QGroupBox" name="groupGeneral">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>45</height>
- </size>
- </property>
- <property name="title">
- <string>General Settings</string>
- </property>
- <widget class="QWidget" name="gridLayoutWidget">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>10</y>
- <width>371</width>
- <height>31</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="lblInvert1_6">
- <property name="minimumSize">
- <size>
- <width>123</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>120</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>Camera frequency</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSlider" name="slideHz">
- <property name="minimumSize">
- <size>
- <width>45</width>
- <height>15</height>
- </size>
- </property>
- <property name="minimum">
- <number>5</number>
- </property>
- <property name="maximum">
- <number>200</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>30</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QSpinBox" name="spinHz">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">background:none;</string>
- </property>
- <property name="minimum">
- <number>5</number>
- </property>
- <property name="maximum">
- <number>200</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="value">
- <number>30</number>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QLabel" name="lblInvert1">
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>30</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>Hz</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>90</height>
- </size>
- </property>
- <property name="title">
- <string>High sensitivity settings</string>
- </property>
- <widget class="QWidget" name="gridLayoutWidget_2">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>10</y>
- <width>371</width>
- <height>61</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <widget class="QLabel" name="lblInvert1_7">
- <property name="minimumSize">
- <size>
- <width>90</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>110</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>Deadzone</string>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QLabel" name="lblInvert1_4">
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>degrees</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="lblInvert1_8">
- <property name="minimumSize">
- <size>
- <width>110</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>130</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>Move toward last position</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSlider" name="slideMoveLast">
- <property name="minimumSize">
- <size>
- <width>45</width>
- <height>15</height>
- </size>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>24</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QSpinBox" name="spinMoveLast">
- <property name="minimumSize">
- <size>
- <width>40</width>
- <height>22</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">background:none;</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="value">
- <number>24</number>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="QLabel" name="lblInvert1_5">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>30</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>%</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QDoubleSpinBox" name="spinDeadZone">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximum">
- <double>10.000000000000000</double>
- </property>
- <property name="singleStep">
- <double>0.100000000000000</double>
- </property>
- <property name="value">
- <double>0.240000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>90</height>
- </size>
- </property>
- <property name="title">
- <string>Low sensitivity settings</string>
- </property>
- <widget class="QWidget" name="gridLayoutWidget_3">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>10</y>
- <width>371</width>
- <height>61</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QLabel" name="lblInvert1_9">
- <property name="minimumSize">
- <size>
- <width>90</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>110</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>Maximum difference</string>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QLabel" name="lblInvert1_10">
- <property name="minimumSize">
- <size>
- <width>35</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>degrees</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="lblInvert1_11">
- <property name="minimumSize">
- <size>
- <width>123</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>130</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>Move toward saved pos.</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSlider" name="slideMoveSaved">
- <property name="minimumSize">
- <size>
- <width>45</width>
- <height>15</height>
- </size>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>35</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QSpinBox" name="spinMoveSaved">
- <property name="minimumSize">
- <size>
- <width>40</width>
- <height>22</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">background:none;</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="value">
- <number>35</number>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="QLabel" name="lblInvert1_12">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>30</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string>%</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QDoubleSpinBox" name="spinMaxDiff">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximum">
- <double>10.000000000000000</double>
- </property>
- <property name="singleStep">
- <double>0.100000000000000</double>
- </property>
- <property name="value">
- <double>1.750000000000000</double>
- </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="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>The filter-settings may need some explanation...</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Maybe Stanislaw can make one in laymans terms?</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </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>52</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>52</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>
- <connection>
- <sender>slideHz</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinHz</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>291</x>
- <y>45</y>
- </hint>
- <hint type="destinationlabel">
- <x>347</x>
- <y>44</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinHz</sender>
- <signal>valueChanged(int)</signal>
- <receiver>slideHz</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>347</x>
- <y>44</y>
- </hint>
- <hint type="destinationlabel">
- <x>291</x>
- <y>45</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>slideMoveLast</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinMoveLast</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>287</x>
- <y>126</y>
- </hint>
- <hint type="destinationlabel">
- <x>343</x>
- <y>125</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinMoveLast</sender>
- <signal>valueChanged(int)</signal>
- <receiver>slideMoveLast</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>343</x>
- <y>125</y>
- </hint>
- <hint type="destinationlabel">
- <x>287</x>
- <y>126</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>slideMoveSaved</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinMoveSaved</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>202</x>
- <y>213</y>
- </hint>
- <hint type="destinationlabel">
- <x>312</x>
- <y>212</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinMoveSaved</sender>
- <signal>valueChanged(int)</signal>
- <receiver>slideMoveSaved</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>309</x>
- <y>203</y>
- </hint>
- <hint type="destinationlabel">
- <x>260</x>
- <y>203</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>startEngineClicked()</slot>
- <slot>stopEngineClicked()</slot>
- <slot>cameraSettingsClicked()</slot>
- </slots>
-</ui>
diff --git a/FTNoIR_Filter_DZ1/FTNoIR_Filter_DZ1.h b/FTNoIR_Filter_DZ1/FTNoIR_Filter_DZ1.h deleted file mode 100644 index 35a5fcb6..00000000 --- a/FTNoIR_Filter_DZ1/FTNoIR_Filter_DZ1.h +++ /dev/null @@ -1,147 +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 <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#pragma once
-#ifndef INCLUDED_FTN_FILTER_H
-#define INCLUDED_FTN_FILTER_H
-
-#include "..\ftnoir_filter_base\ftnoir_filter_base.h"
-#include "ui_FTNoIR_FilterControls.h"
-
-static int compare_double(const void *one, const void *two) {
- double foo = (*((double*) one) - *((double*) two));
- if (foo > 0)
- return 1;
- if (foo < 0)
- return -1;
- return 0;
-}
-
-//#define HZ 30
-
-//#define DEADZONE 0.1
-//#define MOVE_LAST 0.24
-//#define MOVE_SAVED (0.35 / HZ)
-#define SLOW_SPEED 0.1
-
-//#define MAXDIFF 1.75
-#define INITIAL_SMOOTH_SPEED 0.00834
-#define SMOOTH_FACTOR 2.5
-#define REMEMBER_SMOOTHNESS 5 // Changed from HZ/5
-
-#define MULT_Y_POS 1.7
-#define MULT_Y_NEG 0.8
-#define MULT_X 1.5
-
-#define COCKPIT_PITCH 8.7
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// DZ1 Filter: Stanislaw wrote a new filter, which makes the view more stable, when not moving your face.
-//
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-class FTNoIR_Filter : public IFilter
-{
-public:
- FTNoIR_Filter();
- ~FTNoIR_Filter();
-
- void Release();
- void Initialize();
- void StartFilter();
- void FilterHeadPoseData(THeadPoseData *current_camera_position, THeadPoseData *target_camera_position, THeadPoseData *new_camera_position, bool newTarget);
-
- void getFilterFullName(QString *strToBeFilled);
- void getFilterShortName(QString *strToBeFilled);
- void getFilterDescription(QString *strToBeFilled);
-
-private:
- void loadSettings(); // Load the settings from the INI-file
- THeadPoseData newHeadPose; // Structure with new headpose
-
- bool first_run;
- double last_positions[6];
- double saved_positions[6];
- double prev_positions[6];
- bool smoothing[6];
- double smooth_start[6];
- double smooth_speed[6];
- int smooth_remember[6];
-
- float kCameraHz; // Hz
- float kDeadZone; // degrees
- float kMoveLast; // %
- float kMaxDiff; // degrees
- float kMoveSaved; // %
-
- QString filterFullName; // Filters' name and description
- QString filterShortName;
- QString filterDescription;
-};
-
-//*******************************************************************************************************
-// FaceTrackNoIR Filter Settings-dialog.
-//*******************************************************************************************************
-
-// Widget that has controls for FTNoIR protocol filter-settings.
-class FilterControls: public QWidget, Ui::UICFilterControls, public IFilterDialog
-{
- Q_OBJECT
-public:
-
- explicit FilterControls();
- virtual ~FilterControls();
- void showEvent ( QShowEvent * event );
-
- void Release(); // Member functions which are accessible from outside the DLL
- void Initialize(QWidget *parent, IFilterPtr ptr);
- void getFilterFullName(QString *strToBeFilled);
- void getFilterShortName(QString *strToBeFilled);
- void getFilterDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
-
-private:
- Ui::UICFilterControls ui;
- void loadSettings();
- void save();
-
- /** helper **/
- bool settingsDirty;
-
- QString filterFullName; // Filters' name and description
- QString filterShortName;
- QString filterDescription;
- IFilterPtr pFilter; // If the filter was active when the dialog was opened, this will hold a pointer to the Filter instance
-
-private slots:
- void doOK();
- void doCancel();
- void settingChanged() { settingsDirty = true; };
- void settingChanged( int ) { settingsDirty = true; };
- void settingChanged( double ) { settingsDirty = true; };
-};
-
-#endif //INCLUDED_FTN_FILTER_H
-//END
-
diff --git a/FTNoIR_Filter_DZ1/FTNoIR_Filter_DZ1.vcproj b/FTNoIR_Filter_DZ1/FTNoIR_Filter_DZ1.vcproj deleted file mode 100644 index a09aa9bd..00000000 --- a/FTNoIR_Filter_DZ1/FTNoIR_Filter_DZ1.vcproj +++ /dev/null @@ -1,377 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="FTNoIR_Filter_dz1"
- ProjectGUID="{2212857A-7634-4E30-BA83-539EC70176E6}"
- Keyword="Qt4VSv1.0"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)/bin"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=".\GeneratedFiles;"$(QTDIR)\include";".\GeneratedFiles\$(ConfigurationName)";"$(QTDIR)\include\qtmain";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";.\"
- PreprocessorDefinitions="UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_THREAD_SUPPORT;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;FTNOIR_FILTER_BASE_LIB;QT_DLL"
- RuntimeLibrary="2"
- TreatWChar_tAsBuiltInType="false"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="qtmain.lib QtCore4.lib QtGui4.lib QtNetwork4.lib"
- OutputFile="$(OutDir)\$(ProjectName).dll"
- AdditionalLibraryDirectories="$(QTDIR)\lib"
- GenerateDebugInformation="false"
- SubSystem="2"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=".\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;.\"
- PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_THREAD_SUPPORT,QT_CORE_LIB,FTNOIR_FILTER_dz1_LIB;QT_DLL"
- RuntimeLibrary="3"
- TreatWChar_tAsBuiltInType="false"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="qtmaind.lib QtCored4.lib"
- OutputFile="$(OutDir)\$(ProjectName).dll"
- AdditionalLibraryDirectories="$(QTDIR)\lib"
- GenerateDebugInformation="true"
- SubSystem="2"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;cxx;c;def"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\ftnoir_filter_dz1.cpp"
- >
- </File>
- <File
- RelativePath=".\ftnoir_filter_dz1_dialog.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\FTNoIR_Filter_Base\ftnoir_filter_base.h"
- >
- </File>
- <File
- RelativePath="..\FTNoIR_Filter_Base\ftnoir_filter_base_global.h"
- >
- </File>
- <File
- RelativePath=".\FTNoIR_Filter_dz1.h"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputFileName)..."
- CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -D_WINDLL -DFTNOIR_FILTER_BASE_LIB -DNDEBUG -DQT_CORE_LIB -DQT_DLL -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I"$(QTDIR)\include\." -I"$(QTDIR)\include\QtCore\." -I"$(QTDIR)\include\QtGui\." -I"$(QTDIR)\include\qtmain\." -I".\." -I".\GeneratedFiles\$(ConfigurationName)\." -I".\GeneratedFiles\."
"
- AdditionalDependencies=""$(QTDIR)\bin\moc.exe";$(InputPath)"
- Outputs="".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputFileName)..."
- CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -D_WINDLL -DFTNOIR_FILTER_dz1_LIB -DQT_CORE_LIB -DQT_DLL -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I"$(QTDIR)\include\." -I"$(QTDIR)\include\QtCore\." -I"$(QTDIR)\include\qtmain\." -I".\." -I".\GeneratedFiles\$(ConfigurationName)\." -I".\GeneratedFiles\."
"
- AdditionalDependencies=""$(QTDIR)\bin\moc.exe";$(InputPath)"
- Outputs="".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp""
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Form Files"
- Filter="ui"
- UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
- >
- <File
- RelativePath=".\FTNoIR_FilterControls.ui"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic'ing $(InputFileName)..."
- CommandLine=""$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_$(InputName).h" "$(InputPath)"
"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="".\GeneratedFiles\ui_$(InputName).h""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic'ing $(InputFileName)..."
- CommandLine=""$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_$(InputName).h" "$(InputPath)"
"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="".\GeneratedFiles\ui_$(InputName).h""
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="qrc;*"
- UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
- ParseFiles="false"
- >
- <File
- RelativePath=".\Filter.qrc"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Rcc'ing $(InputFileName)..."
- CommandLine=""$(QTDIR)\bin\rcc.exe" -name "$(InputName)" -no-compress "$(InputPath)" -o .\GeneratedFiles\qrc_$(InputName).cpp
"
- AdditionalDependencies="$(InputPath);.\images\Settings16.png;.\images\SettingsOpen16.png;.\UIElements\Donate.png;.\UIElements\Curves.png;.\images\rotation_DOFs.png;.\images\translation_DOFs.png;.\images\FlightGear.ico;.\images\330px-6DOF_en.png;.\images\Freetrack.ico;.\images\FaceTrackNoIR.ico;.\images\SeeingMachines.ico;.\images\Mouse.ico;.\images\FS9.ico;.\images\FSX.ico;.\images\PPJoy.ico;.\images\TrackIR.ico;.\UIElements\aboutFaceTrackNoIR.png"
- Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Rcc'ing $(InputFileName)..."
- CommandLine=""$(QTDIR)\bin\rcc.exe" -name "$(InputName)" -no-compress "$(InputPath)" -o .\GeneratedFiles\qrc_$(InputName).cpp
"
- AdditionalDependencies="$(InputPath);.\images\Settings16.png;.\images\SettingsOpen16.png;.\UIElements\Donate.png;.\UIElements\Curves.png;.\images\rotation_DOFs.png;.\images\translation_DOFs.png;.\images\FlightGear.ico;.\images\330px-6DOF_en.png;.\images\Freetrack.ico;.\images\FaceTrackNoIR.ico;.\images\SeeingMachines.ico;.\images\Mouse.ico;.\images\FS9.ico;.\images\FSX.ico;.\images\PPJoy.ico;.\images\TrackIR.ico;.\UIElements\aboutFaceTrackNoIR.png"
- Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Generated Files"
- Filter="moc;h;cpp"
- UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
- SourceControlFiles="false"
- >
- <File
- RelativePath=".\GeneratedFiles\qrc_Filter.cpp"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\generatedfiles\ui_FTNoIR_FilterControls.h"
- >
- </File>
- <Filter
- Name="Release"
- Filter="cpp;moc"
- SourceControlFiles="false"
- >
- <File
- RelativePath=".\GeneratedFiles\Release\moc_FTNoIR_Filter_dz1.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Debug"
- Filter="cpp;moc"
- SourceControlFiles="false"
- >
- <File
- RelativePath=".\GeneratedFiles\Debug\moc_FTNoIR_Filter_dz1.cpp"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- </Filter>
- </Filter>
- </Files>
- <Globals>
- <Global
- Name="lupdateOnBuild"
- Value="0"
- />
- <Global
- Name="MocDir"
- Value=".\GeneratedFiles\$(ConfigurationName)"
- />
- <Global
- Name="MocOptions"
- Value=""
- />
- <Global
- Name="QtVersion Win32"
- Value="$(DefaultQtVersion)"
- />
- <Global
- Name="RccDir"
- Value=".\GeneratedFiles"
- />
- <Global
- Name="UicDir"
- Value=".\GeneratedFiles"
- />
- </Globals>
-</VisualStudioProject>
diff --git a/FTNoIR_Filter_DZ1/Filter.qrc b/FTNoIR_Filter_DZ1/Filter.qrc deleted file mode 100644 index e64ec35a..00000000 --- a/FTNoIR_Filter_DZ1/Filter.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>images/filter-16.png</file> - </qresource> -</RCC> diff --git a/FTNoIR_Filter_DZ1/ftnoir_filter_dz1.cpp b/FTNoIR_Filter_DZ1/ftnoir_filter_dz1.cpp deleted file mode 100644 index ce1b4063..00000000 --- a/FTNoIR_Filter_DZ1/ftnoir_filter_dz1.cpp +++ /dev/null @@ -1,251 +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 <http://www.gnu.org/licenses/>. *
-* *
-********************************************************************************/
-#include "ftnoir_filter_DZ1.h"
-#include "math.h"
-#include <QDebug>
-
-//#define LOG_OUTPUT
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// EWMA Filter: Exponentially Weighted Moving Average filter with dynamic smoothing parameter
-//
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-FTNoIR_Filter::FTNoIR_Filter()
-{
- //populate the description strings
- filterFullName = "Deadzone Filter Mk1";
- filterShortName = "DZ1";
- filterDescription = "Deadzone Filter";
-
- first_run = true;
- loadSettings(); // Load the Settings
-
-}
-
-FTNoIR_Filter::~FTNoIR_Filter()
-{
-
-}
-
-void FTNoIR_Filter::Release()
-{
- delete this;
-}
-
-void FTNoIR_Filter::Initialize()
-{
- qDebug() << "FTNoIR_Filter::Initialize says: Starting ";
- loadSettings();
- return;
-}
-
-//
-// Load the current Settings from the currently 'active' INI-file.
-//
-void FTNoIR_Filter::loadSettings() {
- qDebug() << "FTNoIR_Filter::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_Filter::loadSettings says: iniFile = " << currentFile;
-
- //
- // The EWMA2-filter-settings are in the Tracking group: this is because they used to be on the Main Form of FaceTrackNoIR
- //
- iniFile.beginGroup ( "Filter_DZ1" );
- kCameraHz = iniFile.value ( "cameraHz", 30 ).toInt();
- kDeadZone = iniFile.value ( "DeadZone", 0.1f ).toFloat();
- kMoveLast = (iniFile.value ( "MoveLast", 24 ).toFloat()) / 100; // Convert from int to float percentage
- kMaxDiff = iniFile.value ( "MaxDiff", 1.75f ).toFloat();
- kMoveSaved = ((iniFile.value ( "MoveSaved", 35 ).toFloat()) / 100) / kCameraHz; // Convert from int to float percentage and divide by Hz
- iniFile.endGroup ();
-
-}
-
-void FTNoIR_Filter::FilterHeadPoseData(THeadPoseData *current_camera_position, THeadPoseData *target_camera_position, THeadPoseData *new_camera_position, bool newTarget)
-{
- //non-optimised version for clarity - double target[6]; - double prev_output[6]; - double scale[]={3.0, 3.0, 3.0, 3.0, 3.0, 3.0}; -// static double deadzones[] = { DEADZONE, DEADZONE, DEADZONE, DEADZONE, DEADZONE, DEADZONE }; - float output[6]; - int i=0, j=0; - - //find out how far the head has moved - prev_output[0]=current_camera_position->x; - prev_output[1]=current_camera_position->y; - prev_output[2]=current_camera_position->z; - prev_output[3]=current_camera_position->yaw; - prev_output[4]=current_camera_position->pitch; - prev_output[5]=current_camera_position->roll; - - target[0]=target_camera_position->x; - target[1]=target_camera_position->y; - target[2]=target_camera_position->z; - target[3]=target_camera_position->yaw; - target[4]=target_camera_position->pitch; - target[5]=target_camera_position->roll; - - if (first_run) - { - //on the first run, output=target - for (i=0;i<6;i++) - { - last_positions[i] = target[i]; - saved_positions[i] = target[i]; - prev_positions[i] = target[i]; - smooth_remember[i] = 0; - smoothing[i] = false; - smooth_speed[i] = -1.0; - } - - new_camera_position->x=target[0]; - new_camera_position->y=target[1]; - new_camera_position->z=target[2]; - new_camera_position->yaw=target[3]; - new_camera_position->pitch=target[4]; - new_camera_position->roll=target[5]; - - first_run=false; - - //we can bail - return; - } else if (!newTarget) { - int i; - for (i = 0; i < 6; i++) { - output[i] = prev_positions[i]; - } - goto end; - } - - for (i=0;i<6;i++) - { - double e2 = target[i]; - bool slowp = fabs(last_positions[i] - e2) < kDeadZone && fabs(e2 - saved_positions[i]) < kMaxDiff; // DeadZone and MAXDIFF from INI-file - if (smoothing[i] || !slowp) { - double start = smooth_start[i]; - double vec = e2 - start; - int sign = vec < 0 ? -1 : 1; - int sign2 = e2 < 0 ? -1 : 1; - if (sign != sign2) - sign2 = -sign2; - double diff = (kCameraHz / REMEMBER_SMOOTHNESS) - smooth_remember[i]; - smooth_speed[i] *= -(diff * diff) / (double) ((kCameraHz / REMEMBER_SMOOTHNESS) * (kCameraHz / REMEMBER_SMOOTHNESS)) + 1.001; - if (smooth_speed[i] < INITIAL_SMOOTH_SPEED) - smooth_speed[i] = INITIAL_SMOOTH_SPEED; - vec = fabs(vec); - double iter = vec * SMOOTH_FACTOR / (double) kCameraHz; - smooth_speed[i] += iter; - double bleh = smooth_speed[i] * sign; - double foo = smooth_start[i] + bleh; - bool done = sign2 > 0 ? foo > e2 : foo < e2; - smooth_remember[i] = (kCameraHz / REMEMBER_SMOOTHNESS); - if (done) { - smoothing[i] = false; - output[i] = e2; - saved_positions[i] = e2; - last_positions[i] = e2; - prev_positions[i] = e2; - } else { - smoothing[i] = true; - prev_positions[i] = output[i] = foo; - } - } else { - if (smooth_remember[i] <= 0) { - smooth_speed[i] = -1.0; - } else { - smooth_remember[i]--; - } - last_positions[i] = last_positions[i] + (e2 - last_positions[i]) * kMoveLast; // MOVE_LAST from INI-file - saved_positions[i] = saved_positions[i] + (e2 - saved_positions[i]) * kMoveSaved; // MOVE_SAVED from INI-file - output[i] = prev_positions[i] = prev_positions[i] + (e2 - prev_positions[i]) * (SLOW_SPEED/kCameraHz); // Get CameraHz from INI - smooth_start[i] = output[i]; - smoothing[i] = false; -#if 0 - if (i == 3) { - FILE* dlog = fopen("debug-log.txt", "a"); - fprintf(dlog, "slowed=%f frames=%d diff=%f\n", output[i], slow_move_count[i], e1 - last_positions[i]); - fclose(dlog); - } -#endif - } - } - -end: - new_camera_position->x=output[0]; - new_camera_position->y=output[1]; - new_camera_position->z=output[2]; - new_camera_position->yaw=output[3] * MULT_X; - new_camera_position->pitch=output[4] * (output[4] < 0 ? MULT_Y_NEG : MULT_Y_POS) - COCKPIT_PITCH; - new_camera_position->roll=output[5]; - -#if 1 - // - // Also update the 'current' position, for the next iteration. - // - current_camera_position->x=output[0]; - current_camera_position->y=output[1]; - current_camera_position->z=output[2]; - current_camera_position->yaw=output[3] * MULT_X; - current_camera_position->pitch=output[4] * (output[4] < 0 ? MULT_Y_NEG : MULT_Y_POS) + COCKPIT_PITCH; - current_camera_position->roll=output[5]; -#endif -}
-
-void FTNoIR_Filter::getFilterFullName(QString *strToBeFilled)
-{
- *strToBeFilled = filterFullName;
-};
-
-
-void FTNoIR_Filter::getFilterShortName(QString *strToBeFilled)
-{
- *strToBeFilled = filterShortName;
-};
-
-
-void FTNoIR_Filter::getFilterDescription(QString *strToBeFilled)
-{
- *strToBeFilled = filterDescription;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Filter object.
-
-// Export both decorated and undecorated names.
-// GetFilter - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetFilter@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetFilter=_GetFilter@0")
-
-FTNOIR_FILTER_BASE_EXPORT FILTERHANDLE __stdcall GetFilter()
-{
- return new FTNoIR_Filter;
-}
diff --git a/FTNoIR_Filter_DZ1/images/filter-16.png b/FTNoIR_Filter_DZ1/images/filter-16.png Binary files differdeleted file mode 100644 index ecde6a10..00000000 --- a/FTNoIR_Filter_DZ1/images/filter-16.png +++ /dev/null diff --git a/FTNoIR_Filter_EWMA2/FTNoIR_Filter_EWMA2.h b/FTNoIR_Filter_EWMA2/FTNoIR_Filter_EWMA2.h index f313d154..18afe3bd 100644 --- a/FTNoIR_Filter_EWMA2/FTNoIR_Filter_EWMA2.h +++ b/FTNoIR_Filter_EWMA2/FTNoIR_Filter_EWMA2.h @@ -107,15 +107,11 @@ public: void Release();
void Initialize();
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("EWMA Filter Mk2"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("EWMA"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Exponentially Weighted Moving Average filter with dynamic smoothing parameter"); };
-private:
- QString filterFullName; // Filters' name and description
- QString filterShortName;
- QString filterDescription;
+ void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); };
};
#endif //INCLUDED_FTN_FILTER_H
diff --git a/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma_dll.cpp b/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma_dll.cpp index c9867f1b..4e644446 100644 --- a/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma_dll.cpp +++ b/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma_dll.cpp @@ -34,10 +34,6 @@ #include <QDebug>
FTNoIR_FilterDll::FTNoIR_FilterDll() {
- //populate the description strings
- filterFullName = "EWMA Filter Mk2";
- filterShortName = "EWMA";
- filterDescription = "Exponentially Weighted Moving Average filter with dynamic smoothing parameter";
}
FTNoIR_FilterDll::~FTNoIR_FilterDll()
@@ -45,36 +41,6 @@ FTNoIR_FilterDll::~FTNoIR_FilterDll() }
-void FTNoIR_FilterDll::Release()
-{
- delete this;
-}
-
-void FTNoIR_FilterDll::Initialize()
-{
- return;
-}
-
-void FTNoIR_FilterDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = filterFullName;
-};
-
-void FTNoIR_FilterDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = filterShortName;
-};
-
-void FTNoIR_FilterDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = filterDescription;
-};
-
-void FTNoIR_FilterDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/filter-16.png");
-};
-
////////////////////////////////////////////////////////////////////////////////
// Factory function that creates instances if the Filter object.
diff --git a/FTNoIR_Protocol_Base/ftnoir_protocol_base.h b/FTNoIR_Protocol_Base/ftnoir_protocol_base.h index 76f5ecc7..214aae7f 100644 --- a/FTNoIR_Protocol_Base/ftnoir_protocol_base.h +++ b/FTNoIR_Protocol_Base/ftnoir_protocol_base.h @@ -58,12 +58,8 @@ struct IProtocol virtual ~IProtocol() {}
virtual void Initialize() = 0;
virtual bool checkServerInstallationOK ( HANDLE handle ) = 0;
- virtual void sendHeadposeToGame( THeadPoseData *headpose ) = 0;
+ virtual void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) = 0;
virtual void getNameFromGame( char *dest ) = 0; // Take care dest can handle up to 100 chars...
-
- virtual void getFullName(QString *strToBeFilled) = 0;
- virtual void getShortName(QString *strToBeFilled) = 0;
- virtual void getDescription(QString *strToBeFilled) = 0;
};
typedef IProtocol* IProtocolPtr;
@@ -85,6 +81,26 @@ struct IProtocolDialog {
virtual ~IProtocolDialog() {}
virtual void Initialize(QWidget *parent) = 0;
+};
+
+typedef IProtocolDialog* IProtocolDialogPtr;
+
+// Factory function that creates instances of the Protocol object.
+EXTERN_C
+FTNOIR_PROTOCOL_BASE_EXPORT
+IProtocolDialogPtr
+__stdcall
+GetProtocolDialog(void);
+
+////////////////////////////////////////////////////////////////////////////////
+// COM-Like abstract interface.
+// This interface doesn't require __declspec(dllexport/dllimport) specifier.
+// Method calls are dispatched via virtual table.
+// Any C++ compiler can use it.
+// Instances are obtained via factory function.
+struct IProtocolDll
+{
+ virtual ~IProtocolDll() {}
virtual void getFullName(QString *strToBeFilled) = 0;
virtual void getShortName(QString *strToBeFilled) = 0;
@@ -92,14 +108,14 @@ struct IProtocolDialog virtual void getIcon(QIcon *icon) = 0;
};
-typedef IProtocolDialog* IProtocolDialogPtr;
+typedef IProtocolDll* IProtocolDllPtr;
// Factory function that creates instances of the Protocol object.
EXTERN_C
FTNOIR_PROTOCOL_BASE_EXPORT
-IProtocolDialogPtr
+IProtocolDllPtr
__stdcall
-GetProtocolDialog(void);
+GetProtocolDll(void);
#endif // FTNOIR_PROTOCOL_BASE_H
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp index 9234c4d4..0eba8333 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp @@ -97,7 +97,7 @@ void FTNoIR_Protocol_FG::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FG::sendHeadposeToGame( THeadPoseData *headpose ) {
+void FTNoIR_Protocol_FG::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
int no_bytes;
QHostAddress sender;
quint16 senderPort;
@@ -243,191 +243,3 @@ FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() {
return new FTNoIR_Protocol_FG;
}
-
-//*******************************************************************************************************
-// FaceTrackNoIR Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-FGControls::FGControls() :
-QWidget()
-{
- ui.setupUi( this );
-
- QPoint offsetpos(100, 100);
- //if (parent) {
- // this->move(parent->pos() + offsetpos);
- //}
-
- // Connect Qt signals to member-functions
- connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
- connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- connect(ui.chkLocalPC, SIGNAL(stateChanged(int)), this, SLOT(chkLocalPCOnlyChanged()));
- connect(ui.spinIPFirstNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPSecondNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPThirdNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
-
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-FGControls::~FGControls() {
- qDebug() << "~FGControls() says: started";
-}
-
-void FGControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void FGControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void FGControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void FGControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void FGControls::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 FGControls::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 ( "FG" );
- ui.chkLocalPC->setChecked (iniFile.value ( "LocalPCOnly", 1 ).toBool());
-
- ui.spinIPFirstNibble->setValue( iniFile.value ( "IP-1", 192 ).toInt() );
- ui.spinIPSecondNibble->setValue( iniFile.value ( "IP-2", 168 ).toInt() );
- ui.spinIPThirdNibble->setValue( iniFile.value ( "IP-3", 2 ).toInt() );
- ui.spinIPFourthNibble->setValue( iniFile.value ( "IP-4", 1 ).toInt() );
-
- ui.spinPortNumber->setValue( iniFile.value ( "PortNumber", 5550 ).toInt() );
- iniFile.endGroup ();
-
- chkLocalPCOnlyChanged();
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void FGControls::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 ( "FG" );
- iniFile.setValue ( "LocalPCOnly", ui.chkLocalPC->isChecked() );
- iniFile.setValue ( "IP-1", ui.spinIPFirstNibble->value() );
- iniFile.setValue ( "IP-2", ui.spinIPSecondNibble->value() );
- iniFile.setValue ( "IP-3", ui.spinIPThirdNibble->value() );
- iniFile.setValue ( "IP-4", ui.spinIPFourthNibble->value() );
- iniFile.setValue ( "PortNumber", ui.spinPortNumber->value() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Handle change of the checkbox.
-//
-void FGControls::chkLocalPCOnlyChanged() {
-
- if ( ui.chkLocalPC->isChecked() ) {
- ui.spinIPFirstNibble->setValue( 127 );
- ui.spinIPFirstNibble->setEnabled ( false );
- ui.spinIPSecondNibble->setValue( 0 );
- ui.spinIPSecondNibble->setEnabled ( false );
- ui.spinIPThirdNibble->setValue( 0 );
- ui.spinIPThirdNibble->setEnabled ( false );
- ui.spinIPFourthNibble->setValue( 1 );
- ui.spinIPFourthNibble->setEnabled ( false );
- }
- else {
- ui.spinIPFirstNibble->setEnabled ( true );
- ui.spinIPSecondNibble->setEnabled ( true );
- ui.spinIPThirdNibble->setEnabled ( true );
- ui.spinIPFourthNibble->setEnabled ( true );
- }
-
- settingsDirty = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Protocol-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
-{
- return new FGControls;
-}
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h index ff3be6bd..b836d321 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h @@ -49,13 +49,9 @@ public: void Initialize();
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame( THeadPoseData *headpose );
+ void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear UDP protocol"); };
-
private:
// Tracker *headTracker; // For upstream messages...
TFlightGearData FlightData;
@@ -82,11 +78,6 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear UDP protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/FlightGear.ico"); };
-
private:
Ui::UICFGControls ui;
void loadSettings();
@@ -102,5 +93,22 @@ private slots: void settingChanged() { settingsDirty = true; };
};
+//*******************************************************************************************************
+// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
+//*******************************************************************************************************
+class FTNoIR_ProtocolDll : public IProtocolDll
+{
+public:
+ FTNoIR_ProtocolDll();
+ ~FTNoIR_ProtocolDll();
+
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear UDP protocol"); };
+
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/FlightGear.ico"); };
+};
+
+
#endif//INCLUDED_FGSERVER_H
//END
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj index 9e34aa64..c37903ad 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj @@ -171,6 +171,14 @@ RelativePath=".\ftnoir_Protocol_FG.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_protocol_fg_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_protocol_fg_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dialog.cpp b/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dialog.cpp new file mode 100644 index 00000000..987a81f9 --- /dev/null +++ b/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dialog.cpp @@ -0,0 +1,223 @@ +/********************************************************************************
+* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2010 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/>. *
+* *
+* FGServer FGServer is the Class, that communicates headpose-data *
+* to FlightGear, using UDP. *
+* It is based on the (Linux) example made by Melchior FRANZ. *
+********************************************************************************/
+/*
+ Modifications (last one on top):
+ 20110401 - WVR: Moved protocol to a DLL, convenient for installation etc.
+ 20101224 - WVR: Base class is no longer inheriting QThread. sendHeadposeToGame
+ is called from run() of Tracker.cpp
+*/
+#include "ftnoir_protocol_fg.h"
+#include <QFile>
+
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+FGControls::FGControls() :
+QWidget()
+{
+ ui.setupUi( this );
+
+ QPoint offsetpos(100, 100);
+ //if (parent) {
+ // this->move(parent->pos() + offsetpos);
+ //}
+
+ // Connect Qt signals to member-functions
+ connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
+ connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
+ connect(ui.chkLocalPC, SIGNAL(stateChanged(int)), this, SLOT(chkLocalPCOnlyChanged()));
+ connect(ui.spinIPFirstNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinIPSecondNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinIPThirdNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+FGControls::~FGControls() {
+ qDebug() << "~FGControls() says: started";
+}
+
+void FGControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void FGControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void FGControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void FGControls::showEvent ( QShowEvent * event ) {
+ loadSettings();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void FGControls::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 FGControls::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 ( "FG" );
+ ui.chkLocalPC->setChecked (iniFile.value ( "LocalPCOnly", 1 ).toBool());
+
+ ui.spinIPFirstNibble->setValue( iniFile.value ( "IP-1", 192 ).toInt() );
+ ui.spinIPSecondNibble->setValue( iniFile.value ( "IP-2", 168 ).toInt() );
+ ui.spinIPThirdNibble->setValue( iniFile.value ( "IP-3", 2 ).toInt() );
+ ui.spinIPFourthNibble->setValue( iniFile.value ( "IP-4", 1 ).toInt() );
+
+ ui.spinPortNumber->setValue( iniFile.value ( "PortNumber", 5550 ).toInt() );
+ iniFile.endGroup ();
+
+ chkLocalPCOnlyChanged();
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void FGControls::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 ( "FG" );
+ iniFile.setValue ( "LocalPCOnly", ui.chkLocalPC->isChecked() );
+ iniFile.setValue ( "IP-1", ui.spinIPFirstNibble->value() );
+ iniFile.setValue ( "IP-2", ui.spinIPSecondNibble->value() );
+ iniFile.setValue ( "IP-3", ui.spinIPThirdNibble->value() );
+ iniFile.setValue ( "IP-4", ui.spinIPFourthNibble->value() );
+ iniFile.setValue ( "PortNumber", ui.spinPortNumber->value() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Handle change of the checkbox.
+//
+void FGControls::chkLocalPCOnlyChanged() {
+
+ if ( ui.chkLocalPC->isChecked() ) {
+ ui.spinIPFirstNibble->setValue( 127 );
+ ui.spinIPFirstNibble->setEnabled ( false );
+ ui.spinIPSecondNibble->setValue( 0 );
+ ui.spinIPSecondNibble->setEnabled ( false );
+ ui.spinIPThirdNibble->setValue( 0 );
+ ui.spinIPThirdNibble->setEnabled ( false );
+ ui.spinIPFourthNibble->setValue( 1 );
+ ui.spinIPFourthNibble->setEnabled ( false );
+ }
+ else {
+ ui.spinIPFirstNibble->setEnabled ( true );
+ ui.spinIPSecondNibble->setEnabled ( true );
+ ui.spinIPThirdNibble->setEnabled ( true );
+ ui.spinIPFourthNibble->setEnabled ( true );
+ }
+
+ settingsDirty = true;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+{
+ return new FGControls;
+}
\ No newline at end of file diff --git a/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dll.cpp b/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dll.cpp new file mode 100644 index 00000000..ca71063b --- /dev/null +++ b/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dll.cpp @@ -0,0 +1,56 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_fg.h"
+#include <QDebug>
+
+FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
+}
+
+FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+{
+ return new FTNoIR_ProtocolDll;
+}
diff --git a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp index c88e7ec0..9bada9da 100644 --- a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp +++ b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp @@ -103,7 +103,7 @@ void FTNoIR_Protocol_FSUIPC::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FSUIPC::sendHeadposeToGame( THeadPoseData *headpose ) {
+void FTNoIR_Protocol_FSUIPC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
DWORD result;
TFSState pitch;
TFSState yaw;
@@ -228,165 +228,3 @@ FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() {
return new FTNoIR_Protocol_FSUIPC;
}
-
-//*******************************************************************************************************
-// FaceTrackNoIR Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-FSUIPCControls::FSUIPCControls() :
-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.btnFindDLL, SIGNAL(clicked()), this, SLOT(getLocationOfDLL()));
-
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-FSUIPCControls::~FSUIPCControls() {
- qDebug() << "~FSUIPCControls() says: started";
-}
-
-void FSUIPCControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void FSUIPCControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void FSUIPCControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void FSUIPCControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void FSUIPCControls::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 FSUIPCControls::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 ( "FSUIPC" );
- ui.txtLocationOfDLL->setText(iniFile.value ( "LocationOfDLL", FSUIPC_FILENAME ).toString() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void FSUIPCControls::save() {
-
- qDebug() << "save() says: started";
-
- 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 ( "FSUIPC" );
- iniFile.setValue ( "LocationOfDLL", ui.txtLocationOfDLL->text() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Show the Dialog to set the DLL's location
-//
-void FSUIPCControls::getLocationOfDLL()
-{
- //
- // Get the new filename of the INI-file.
- //
- QString fileName = QFileDialog::getOpenFileName(this, tr("Locate file"),
- ui.txtLocationOfDLL->text(),
- tr("FSUIPC DLL file (FSUIPC*.dll);;All Files (*)"));
- if (!fileName.isEmpty()) {
- ui.txtLocationOfDLL->setText( fileName );
- settingsDirty = true;
- }
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Protocol-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
-{
- return new FSUIPCControls;
-}
diff --git a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h index 15ef9209..d073c823 100644 --- a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h +++ b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h @@ -65,13 +65,9 @@ public: void Initialize();
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame( THeadPoseData *headpose );
+ void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FS2002/FS2004"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FSUIPC"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft FS2004 protocol"); };
-
private:
// Private properties
QString ProgramName;
@@ -96,11 +92,6 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FS2002/FS2004"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FSUIPC"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft FS2004 protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/FS9.ico"); };
-
private:
Ui::UICFSUIPCControls ui;
void loadSettings();
@@ -116,5 +107,22 @@ private slots: void getLocationOfDLL();
};
+//*******************************************************************************************************
+// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
+//*******************************************************************************************************
+class FTNoIR_ProtocolDll : public IProtocolDll
+{
+public:
+ FTNoIR_ProtocolDll();
+ ~FTNoIR_ProtocolDll();
+
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FS2002/FS2004"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FSUIPC"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft FS2004 protocol"); };
+
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/FS9.ico"); };
+};
+
+
#endif//INCLUDED_FSUIPCSERVER_H
//END
diff --git a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.vcproj b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.vcproj index 9722f354..57466728 100644 --- a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.vcproj +++ b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.vcproj @@ -172,6 +172,14 @@ RelativePath=".\ftnoir_Protocol_FSUIPC.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_protocol_FSUIPC_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_protocol_FSUIPC_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp b/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp new file mode 100644 index 00000000..27d99e04 --- /dev/null +++ b/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp @@ -0,0 +1,195 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_fsuipc.h"
+
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+FSUIPCControls::FSUIPCControls() :
+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.btnFindDLL, SIGNAL(clicked()), this, SLOT(getLocationOfDLL()));
+
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+FSUIPCControls::~FSUIPCControls() {
+ qDebug() << "~FSUIPCControls() says: started";
+}
+
+void FSUIPCControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void FSUIPCControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void FSUIPCControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void FSUIPCControls::showEvent ( QShowEvent * event ) {
+ loadSettings();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void FSUIPCControls::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 FSUIPCControls::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 ( "FSUIPC" );
+ ui.txtLocationOfDLL->setText(iniFile.value ( "LocationOfDLL", FSUIPC_FILENAME ).toString() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void FSUIPCControls::save() {
+
+ qDebug() << "save() says: started";
+
+ 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 ( "FSUIPC" );
+ iniFile.setValue ( "LocationOfDLL", ui.txtLocationOfDLL->text() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Show the Dialog to set the DLL's location
+//
+void FSUIPCControls::getLocationOfDLL()
+{
+ //
+ // Get the new filename of the INI-file.
+ //
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Locate file"),
+ ui.txtLocationOfDLL->text(),
+ tr("FSUIPC DLL file (FSUIPC*.dll);;All Files (*)"));
+ if (!fileName.isEmpty()) {
+ ui.txtLocationOfDLL->setText( fileName );
+ settingsDirty = true;
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+{
+ return new FSUIPCControls;
+}
diff --git a/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dll.cpp b/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dll.cpp new file mode 100644 index 00000000..d61c2d83 --- /dev/null +++ b/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dll.cpp @@ -0,0 +1,56 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_fsuipc.h"
+#include <QDebug>
+
+FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
+}
+
+FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+{
+ return new FTNoIR_ProtocolDll;
+}
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp index f4018c2e..ad532120 100644 --- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp +++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp @@ -78,7 +78,7 @@ void FTNoIR_Protocol_FT::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FT::sendHeadposeToGame( THeadPoseData *headpose ) {
+void FTNoIR_Protocol_FT::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float virtPosX;
float virtPosY;
float virtPosZ;
@@ -338,145 +338,3 @@ FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() {
return new FTNoIR_Protocol_FT;
}
-
-//*******************************************************************************************************
-// FaceTrackNoIR Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-FTControls::FTControls() :
-QWidget()
-{
- QString aFileName; // File Path and Name
-
- 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.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(chkTIRViewsChanged()));
-
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-FTControls::~FTControls() {
- qDebug() << "~FTControls() says: started";
-}
-
-void FTControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void FTControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void FTControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void FTControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void FTControls::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 FTControls::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 ( "FT" );
-// ui.chkTIRViews->setChecked (iniFile.value ( "useTIRViews", 0 ).toBool());
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void FTControls::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 ( "FT" );
-// iniFile.setValue ( "useTIRViews", ui.chkTIRViews->isChecked() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Protocol-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
-{
- return new FTControls;
-}
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h index 736b8600..f6daa226 100644 --- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h +++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h @@ -52,13 +52,9 @@ public: void Initialize();
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame( THeadPoseData *headpose );
+ void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack protocol"); };
-
private:
bool FTCreateMapping(HANDLE handle);
void FTDestroyMapping();
@@ -92,11 +88,6 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/Freetrack.ico"); };
-
private:
Ui::UICFTControls ui;
void loadSettings();
@@ -111,5 +102,22 @@ private slots: void settingChanged() { settingsDirty = true; };
};
+//*******************************************************************************************************
+// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
+//*******************************************************************************************************
+class FTNoIR_ProtocolDll : public IProtocolDll
+{
+public:
+ FTNoIR_ProtocolDll();
+ ~FTNoIR_ProtocolDll();
+
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack protocol"); };
+
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/Freetrack.ico"); };
+};
+
+
#endif//INCLUDED_FTSERVER_H
//END
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.vcproj b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.vcproj index 80fcdfed..9a11270a 100644 --- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.vcproj +++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.vcproj @@ -171,6 +171,14 @@ RelativePath=".\ftnoir_Protocol_FT.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_protocol_FT_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_protocol_FT_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp new file mode 100644 index 00000000..a42963e4 --- /dev/null +++ b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp @@ -0,0 +1,176 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_ft.h"
+#include <QDebug>
+
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+FTControls::FTControls() :
+QWidget()
+{
+ QString aFileName; // File Path and Name
+
+ 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.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(chkTIRViewsChanged()));
+
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+FTControls::~FTControls() {
+ qDebug() << "~FTControls() says: started";
+}
+
+void FTControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void FTControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void FTControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void FTControls::showEvent ( QShowEvent * event ) {
+ loadSettings();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void FTControls::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 FTControls::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 ( "FT" );
+// ui.chkTIRViews->setChecked (iniFile.value ( "useTIRViews", 0 ).toBool());
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void FTControls::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 ( "FT" );
+// iniFile.setValue ( "useTIRViews", ui.chkTIRViews->isChecked() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+{
+ return new FTControls;
+}
diff --git a/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dll.cpp b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dll.cpp new file mode 100644 index 00000000..4513c6ba --- /dev/null +++ b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dll.cpp @@ -0,0 +1,56 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_ft.h"
+#include <QDebug>
+
+FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
+}
+
+FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+{
+ return new FTNoIR_ProtocolDll;
+}
diff --git a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp index 0c8b2fbf..f3585b0e 100644 --- a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp +++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp @@ -124,7 +124,7 @@ void FTNoIR_Protocol_FTIR::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FTIR::sendHeadposeToGame( THeadPoseData *headpose ) {
+void FTNoIR_Protocol_FTIR::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float virtPosX;
float virtPosY;
float virtPosZ;
@@ -399,159 +399,3 @@ FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() {
return new FTNoIR_Protocol_FTIR;
}
-
-//*******************************************************************************************************
-// FaceTrackNoIR Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-FTIRControls::FTIRControls() :
-QWidget()
-{
- QString aFileName; // File Path and Name
-
- 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.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(chkTIRViewsChanged()));
- connect(ui.chkStartDummy, SIGNAL(stateChanged(int)), this, SLOT(settingChanged()));
-
- aFileName = QCoreApplication::applicationDirPath() + "/";
- aFileName.append(FTIR_VIEWS_FILENAME);
- if ( !QFile::exists( aFileName ) ) {
- ui.chkTIRViews->setChecked( false );
- ui.chkTIRViews->setEnabled ( false );
- }
- else {
- ui.chkTIRViews->setEnabled ( true );
- }
-
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-FTIRControls::~FTIRControls() {
- qDebug() << "~FTIRControls() says: started";
-}
-
-void FTIRControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void FTIRControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void FTIRControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void FTIRControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void FTIRControls::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 FTIRControls::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 ( "FTIR" );
- ui.chkTIRViews->setChecked (iniFile.value ( "useTIRViews", 0 ).toBool());
- ui.chkStartDummy->setChecked (iniFile.value ( "useDummyExe", 1 ).toBool());
-
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void FTIRControls::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 ( "FTIR" );
- iniFile.setValue ( "useTIRViews", ui.chkTIRViews->isChecked() );
- iniFile.setValue ( "useDummyExe", ui.chkStartDummy->isChecked() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Protocol-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
-{
- return new FTIRControls;
-}
diff --git a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h index 7478f405..951a2fa8 100644 --- a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h +++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h @@ -56,13 +56,9 @@ public: void Initialize();
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame( THeadPoseData *headpose );
+ void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("fake TrackIR"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FTIR"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("TrackIR V4 protocol"); };
-
private:
bool FTIRCreateMapping(HANDLE handle);
void FTIRDestroyMapping();
@@ -102,11 +98,6 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("fake TrackIR"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FTIR"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("TrackIR V4 protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/TrackIR.ico"); };
-
private:
Ui::UICFTIRControls ui;
void loadSettings();
@@ -122,5 +113,21 @@ private slots: void settingChanged() { settingsDirty = true; };
};
+//*******************************************************************************************************
+// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
+//*******************************************************************************************************
+class FTNoIR_ProtocolDll : public IProtocolDll
+{
+public:
+ FTNoIR_ProtocolDll();
+ ~FTNoIR_ProtocolDll();
+
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("fake TrackIR"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FTIR"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("TrackIR V4 protocol"); };
+
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/TrackIR.ico"); };
+};
+
#endif//INCLUDED_FTIRSERVER_H
//END
diff --git a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.vcproj b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.vcproj index d258f30e..19ba5c8f 100644 --- a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.vcproj +++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.vcproj @@ -171,6 +171,14 @@ RelativePath=".\ftnoir_Protocol_FTIR.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_protocol_FTIR_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_protocol_FTIR_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dialog.cpp b/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dialog.cpp new file mode 100644 index 00000000..022ca93e --- /dev/null +++ b/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dialog.cpp @@ -0,0 +1,190 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_ftir.h"
+#include <QDebug>
+
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+FTIRControls::FTIRControls() :
+QWidget()
+{
+ QString aFileName; // File Path and Name
+
+ 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.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(chkTIRViewsChanged()));
+ connect(ui.chkStartDummy, SIGNAL(stateChanged(int)), this, SLOT(settingChanged()));
+
+ aFileName = QCoreApplication::applicationDirPath() + "/";
+ aFileName.append(FTIR_VIEWS_FILENAME);
+ if ( !QFile::exists( aFileName ) ) {
+ ui.chkTIRViews->setChecked( false );
+ ui.chkTIRViews->setEnabled ( false );
+ }
+ else {
+ ui.chkTIRViews->setEnabled ( true );
+ }
+
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+FTIRControls::~FTIRControls() {
+ qDebug() << "~FTIRControls() says: started";
+}
+
+void FTIRControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void FTIRControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void FTIRControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void FTIRControls::showEvent ( QShowEvent * event ) {
+ loadSettings();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void FTIRControls::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 FTIRControls::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 ( "FTIR" );
+ ui.chkTIRViews->setChecked (iniFile.value ( "useTIRViews", 0 ).toBool());
+ ui.chkStartDummy->setChecked (iniFile.value ( "useDummyExe", 1 ).toBool());
+
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void FTIRControls::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 ( "FTIR" );
+ iniFile.setValue ( "useTIRViews", ui.chkTIRViews->isChecked() );
+ iniFile.setValue ( "useDummyExe", ui.chkStartDummy->isChecked() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+{
+ return new FTIRControls;
+}
diff --git a/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dll.cpp b/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dll.cpp new file mode 100644 index 00000000..9af0f7ab --- /dev/null +++ b/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dll.cpp @@ -0,0 +1,56 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_ftir.h"
+#include <QDebug>
+
+FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
+}
+
+FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+{
+ return new FTNoIR_ProtocolDll;
+}
diff --git a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp index 55888484..bcda3dbc 100755 --- a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp +++ b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp @@ -86,7 +86,7 @@ void FTNoIR_Protocol_FTN::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FTN::sendHeadposeToGame( THeadPoseData *headpose ) {
+void FTNoIR_Protocol_FTN::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
int no_bytes;
QHostAddress sender;
quint16 senderPort;
@@ -198,161 +198,3 @@ FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() {
return new FTNoIR_Protocol_FTN;
}
-
-//*******************************************************************************************************
-// FaceTrackNoIR Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-FTNControls::FTNControls() :
-QWidget()
-{
- ui.setupUi( this );
-
- QPoint offsetpos(100, 100);
- //if (parent) {
- // this->move(parent->pos() + offsetpos);
- //}
-
- // Connect Qt signals to member-functions
- connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
- connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- connect(ui.spinIPFirstNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPSecondNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPThirdNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
-
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-FTNControls::~FTNControls() {
- qDebug() << "~FTNControls() says: started";
-}
-
-void FTNControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void FTNControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void FTNControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void FTNControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void FTNControls::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 FTNControls::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 ( "FTN" );
- ui.spinIPFirstNibble->setValue( iniFile.value ( "IP-1", 192 ).toInt() );
- ui.spinIPSecondNibble->setValue( iniFile.value ( "IP-2", 168 ).toInt() );
- ui.spinIPThirdNibble->setValue( iniFile.value ( "IP-3", 2 ).toInt() );
- ui.spinIPFourthNibble->setValue( iniFile.value ( "IP-4", 1 ).toInt() );
-
- ui.spinPortNumber->setValue( iniFile.value ( "PortNumber", 5550 ).toInt() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void FTNControls::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 ( "FTN" );
- iniFile.setValue ( "IP-1", ui.spinIPFirstNibble->value() );
- iniFile.setValue ( "IP-2", ui.spinIPSecondNibble->value() );
- iniFile.setValue ( "IP-3", ui.spinIPThirdNibble->value() );
- iniFile.setValue ( "IP-4", ui.spinIPFourthNibble->value() );
- iniFile.setValue ( "PortNumber", ui.spinPortNumber->value() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Protocol-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
-{
- return new FTNControls;
-}
diff --git a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h index b460563c..3eb65f5f 100644 --- a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h +++ b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h @@ -49,13 +49,9 @@ public: void Initialize();
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame( THeadPoseData *headpose );
+ void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FaceTrackNoIR"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FTN Client"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FaceTrackNoIR Client protocol"); };
-
private:
THeadPoseData TestData;
long frame_counter;
@@ -82,11 +78,6 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FaceTrackNoIR"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FTN Client"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FaceTrackNoIR Client protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/FaceTrackNoIR.ico"); };
-
private:
Ui::UICFTNControls ui;
void loadSettings();
@@ -101,5 +92,21 @@ private slots: void settingChanged() { settingsDirty = true; };
};
+//*******************************************************************************************************
+// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
+//*******************************************************************************************************
+class FTNoIR_ProtocolDll : public IProtocolDll
+{
+public:
+ FTNoIR_ProtocolDll();
+ ~FTNoIR_ProtocolDll();
+
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FaceTrackNoIR"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FTN Client"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FaceTrackNoIR Client protocol"); };
+
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/FaceTrackNoIR.ico"); };
+};
+
#endif//INCLUDED_FTNSERVER_H
//END
diff --git a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.vcproj b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.vcproj index 3a59a74b..ca8d8a16 100644 --- a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.vcproj +++ b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.vcproj @@ -171,6 +171,14 @@ RelativePath=".\ftnoir_Protocol_FTN.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_protocol_ftn_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_protocol_FTN_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Protocol_FTN/ftnoir_protocol_FTN_dll.cpp b/FTNoIR_Protocol_FTN/ftnoir_protocol_FTN_dll.cpp new file mode 100644 index 00000000..00badedf --- /dev/null +++ b/FTNoIR_Protocol_FTN/ftnoir_protocol_FTN_dll.cpp @@ -0,0 +1,56 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_ftn.h"
+#include <QDebug>
+
+FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
+}
+
+FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+{
+ return new FTNoIR_ProtocolDll;
+}
diff --git a/FTNoIR_Filter_DZ1/ftnoir_filter_dz1_dialog.cpp b/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp index 88b4b04b..a2e7813b 100644 --- a/FTNoIR_Filter_DZ1/ftnoir_filter_dz1_dialog.cpp +++ b/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp @@ -22,26 +22,29 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
-#include "ftnoir_filter_DZ1.h"
-#include "math.h"
+/*
+ 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_ftn.h"
#include <QDebug>
//*******************************************************************************************************
-// FaceTrackNoIR Filter Settings-dialog.
+// FaceTrackNoIR Client Settings-dialog.
//*******************************************************************************************************
+
//
// Constructor for server-settings-dialog
//
-FilterControls::FilterControls() :
+FTNControls::FTNControls() :
QWidget()
{
ui.setupUi( this );
- //populate the description strings
- filterFullName = "Deadzone Filter Mk1";
- filterShortName = "DZ1";
- filterDescription = "Deadzone Filter";
-
QPoint offsetpos(100, 100);
//if (parent) {
// this->move(parent->pos() + offsetpos);
@@ -50,13 +53,11 @@ QWidget() // Connect Qt signals to member-functions
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
-
- // Connect sliders for reduction factor
- connect(ui.slideHz, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.spinDeadZone, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double)));
- connect(ui.slideMoveLast, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
-
- qDebug() << "FilterControls() says: started";
+ connect(ui.spinIPFirstNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinIPSecondNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinIPThirdNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
// Load the settings from the current .INI-file
loadSettings();
@@ -65,11 +66,11 @@ QWidget() //
// Destructor for server-dialog
//
-FilterControls::~FilterControls() {
- qDebug() << "~FilterControls() says: started";
+FTNControls::~FTNControls() {
+ qDebug() << "~FTNControls() says: started";
}
-void FilterControls::Release()
+void FTNControls::Release()
{
delete this;
}
@@ -77,18 +78,8 @@ void FilterControls::Release() //
// Initialize tracker-client-dialog
//
-void FilterControls::Initialize(QWidget *parent, IFilterPtr ptr) {
+void FTNControls::Initialize(QWidget *parent) {
- //
- // The dialog can be opened, while the Tracker is running.
- // In that case, ptr will point to the active Filter-instance.
- // This can be used to update settings, while Tracking and may also be handy to display logging-data and such...
- //
- pFilter = ptr;
-
- //
- //
- //
QPoint offsetpos(100, 100);
if (parent) {
this->move(parent->pos() + offsetpos);
@@ -99,23 +90,20 @@ void FilterControls::Initialize(QWidget *parent, IFilterPtr ptr) { //
// OK clicked on server-dialog
//
-void FilterControls::doOK() {
+void FTNControls::doOK() {
save();
- if (pFilter) {
- pFilter->Initialize();
- }
this->close();
}
// override show event
-void FilterControls::showEvent ( QShowEvent * event ) {
+void FTNControls::showEvent ( QShowEvent * event ) {
loadSettings();
}
//
// Cancel clicked on server-dialog
//
-void FilterControls::doCancel() {
+void FTNControls::doCancel() {
//
// Ask if changed Settings should be saved
//
@@ -148,24 +136,22 @@ void FilterControls::doCancel() { //
// Load the current Settings from the currently 'active' INI-file.
//
-void FilterControls::loadSettings() {
- qDebug() << "FilterControls::loadSettings says: Starting ";
+void FTNControls::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() << "FilterControls::loadSettings says: iniFile = " << currentFile;
+// qDebug() << "loadSettings says: iniFile = " << currentFile;
- //
- // The DZ1-filter-settings
- //
- iniFile.beginGroup ( "Filter_DZ1" );
- ui.slideHz->setValue (iniFile.value ( "cameraHz", 30 ).toInt());
- ui.spinDeadZone->setValue (iniFile.value ( "DeadZone", 0.1f ).toDouble());
- ui.slideMoveLast->setValue (iniFile.value ( "MoveLast", 24 ).toInt());
- ui.spinMaxDiff->setValue (iniFile.value ( "MaxDiff", 1.75f ).toDouble());
- ui.slideMoveSaved->setValue (iniFile.value ( "MoveSaved", 35 ).toFloat());
+ iniFile.beginGroup ( "FTN" );
+ ui.spinIPFirstNibble->setValue( iniFile.value ( "IP-1", 192 ).toInt() );
+ ui.spinIPSecondNibble->setValue( iniFile.value ( "IP-2", 168 ).toInt() );
+ ui.spinIPThirdNibble->setValue( iniFile.value ( "IP-3", 2 ).toInt() );
+ ui.spinIPFourthNibble->setValue( iniFile.value ( "IP-4", 1 ).toInt() );
+
+ ui.spinPortNumber->setValue( iniFile.value ( "PortNumber", 5550 ).toInt() );
iniFile.endGroup ();
settingsDirty = false;
@@ -174,55 +160,33 @@ void FilterControls::loadSettings() { //
// Save the current Settings to the currently 'active' INI-file.
//
-void FilterControls::save() {
+void FTNControls::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 ( "Filter_DZ1" );
- iniFile.setValue ( "cameraHz", ui.slideHz->value() );
- iniFile.setValue ( "DeadZone", ui.spinDeadZone->value() );
- iniFile.setValue ( "MoveLast", ui.slideMoveLast->value() );
- iniFile.setValue ( "MaxDiff", ui.spinMaxDiff->value() );
- iniFile.setValue ( "MoveSaved", ui.slideMoveSaved->value() );
+ iniFile.beginGroup ( "FTN" );
+ iniFile.setValue ( "IP-1", ui.spinIPFirstNibble->value() );
+ iniFile.setValue ( "IP-2", ui.spinIPSecondNibble->value() );
+ iniFile.setValue ( "IP-3", ui.spinIPThirdNibble->value() );
+ iniFile.setValue ( "IP-4", ui.spinIPFourthNibble->value() );
+ iniFile.setValue ( "PortNumber", ui.spinPortNumber->value() );
iniFile.endGroup ();
settingsDirty = false;
}
-void FilterControls::getFilterFullName(QString *strToBeFilled)
-{
- *strToBeFilled = filterFullName;
-};
-
-
-void FilterControls::getFilterShortName(QString *strToBeFilled)
-{
- *strToBeFilled = filterShortName;
-};
-
-
-void FilterControls::getFilterDescription(QString *strToBeFilled)
-{
- *strToBeFilled = filterDescription;
-};
-
-void FilterControls::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/filter-16.png");
-};
-
////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Filter-settings dialog object.
+// Factory function that creates instances if the Protocol-settings dialog object.
// Export both decorated and undecorated names.
-// GetFilterDialog - Undecorated name, which can be easily used with GetProcAddress
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
-// _GetFilterDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetFilterDialog=_GetFilterDialog@0")
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_FILTER_BASE_EXPORT FILTERDIALOGHANDLE __stdcall GetFilterDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
- return new FilterControls;
+ return new FTNControls;
}
diff --git a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp index e431348d..7c75cd26 100644 --- a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp +++ b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp @@ -105,7 +105,7 @@ void FTNoIR_Protocol_MOUSE::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_MOUSE::sendHeadposeToGame( THeadPoseData *headpose ) {
+void FTNoIR_Protocol_MOUSE::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float fMouse_X; // The actual value
float fMouse_Y;
float fMouse_Wheel;
@@ -292,202 +292,3 @@ FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() {
return new FTNoIR_Protocol_MOUSE;
}
-
-//*******************************************************************************************************
-// FaceTrackNoIR Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-MOUSEControls::MOUSEControls() :
-QWidget()
-{
- ui.setupUi( this );
-
- //
- // Setup the choices
- //
- ui.cbxSelectMouseStyle->addItem("Absolute");
- ui.cbxSelectMouseStyle->addItem("Relative");
-
- ui.cbxSelectMouse_X->addItem("None");
- ui.cbxSelectMouse_X->addItem("Pitch");
- ui.cbxSelectMouse_X->addItem("Yaw");
- ui.cbxSelectMouse_X->addItem("Roll");
- ui.cbxSelectMouse_X->addItem("X");
- ui.cbxSelectMouse_X->addItem("Y");
- ui.cbxSelectMouse_X->addItem("Z");
-
- ui.cbxSelectMouse_Y->addItem("None");
- ui.cbxSelectMouse_Y->addItem("Pitch");
- ui.cbxSelectMouse_Y->addItem("Yaw");
- ui.cbxSelectMouse_Y->addItem("Roll");
- ui.cbxSelectMouse_Y->addItem("X");
- ui.cbxSelectMouse_Y->addItem("Y");
- ui.cbxSelectMouse_Y->addItem("Z");
-
- ui.cbxSelectMouse_Wheel->addItem("None");
- ui.cbxSelectMouse_Wheel->addItem("Pitch");
- ui.cbxSelectMouse_Wheel->addItem("Yaw");
- ui.cbxSelectMouse_Wheel->addItem("Roll");
- ui.cbxSelectMouse_Wheel->addItem("X");
- ui.cbxSelectMouse_Wheel->addItem("Y");
- ui.cbxSelectMouse_Wheel->addItem("Z");
-
- // Connect Qt signals to member-functions
- connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
- connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- connect(ui.cbxSelectMouse_X, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int )));
- connect(ui.cbxSelectMouse_Y, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int )));
- connect(ui.cbxSelectMouse_Wheel, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int )));
-
- connect(ui.spinSensX, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.spinSensY, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.spinSensWheel, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
-
- connect(ui.chkUseVirtualDesk, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
-
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-MOUSEControls::~MOUSEControls() {
- qDebug() << "~MOUSEControls() says: started";
-}
-
-void MOUSEControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void MOUSEControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void MOUSEControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void MOUSEControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void MOUSEControls::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 MOUSEControls::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 ( "Mouse" );
- ui.cbxSelectMouseStyle->setCurrentIndex(iniFile.value ( "Style", 1 ).toInt() - 1);
- ui.cbxSelectMouse_X->setCurrentIndex(iniFile.value ( "Mouse_X", 1 ).toInt() - 1);
- ui.cbxSelectMouse_Y->setCurrentIndex(iniFile.value ( "Mouse_Y", 1 ).toInt() - 1);
- ui.cbxSelectMouse_Wheel->setCurrentIndex(iniFile.value ( "Mouse_Wheel", 1 ).toInt() - 1);
-
- ui.slideSensX->setValue(iniFile.value("SensX", 10).toInt());
- ui.slideSensY->setValue(iniFile.value("SensY", 10).toInt());
- ui.slideSensWheel->setValue(iniFile.value("SensWheel", 10).toInt());
-
- ui.chkUseVirtualDesk->setChecked( iniFile.value ( "useVirtualDesk", 0 ).toBool() );
-
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void MOUSEControls::save() {
- qDebug() << "save() says: started";
-
- 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 ( "Mouse" );
- iniFile.setValue ( "Style", ui.cbxSelectMouseStyle->currentIndex() + 1 );
- iniFile.setValue ( "Mouse_X", ui.cbxSelectMouse_X->currentIndex() + 1 );
- iniFile.setValue ( "Mouse_Y", ui.cbxSelectMouse_Y->currentIndex() + 1 );
- iniFile.setValue ( "Mouse_Wheel", ui.cbxSelectMouse_Wheel->currentIndex() + 1 );
-
- iniFile.setValue ( "SensX", ui.slideSensX->value() );
- iniFile.setValue ( "SensY", ui.slideSensY->value() );
- iniFile.setValue ( "SensWheel", ui.slideSensWheel->value() );
-
- iniFile.setValue( "useVirtualDesk", ui.chkUseVirtualDesk->isChecked() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Protocol-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
-{
- return new MOUSEControls;
-}
diff --git a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h index c2c16abb..a7915780 100644 --- a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h +++ b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h @@ -70,13 +70,9 @@ public: void Initialize();
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame( THeadPoseData *headpose );
+ void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look protocol"); };
-
private:
HANDLE h;
INPUT MouseStruct;
@@ -113,11 +109,6 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/Mouse.ico"); };
-
private:
Ui::UICMOUSEControls ui;
void loadSettings();
@@ -132,5 +123,22 @@ private slots: void settingChanged( int setting ) { settingsDirty = true; };
};
+//*******************************************************************************************************
+// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
+//*******************************************************************************************************
+class FTNoIR_ProtocolDll : public IProtocolDll
+{
+public:
+ FTNoIR_ProtocolDll();
+ ~FTNoIR_ProtocolDll();
+
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look protocol"); };
+
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/Mouse.ico"); };
+};
+
+
#endif//INCLUDED_MOUSESERVER_H
//END
diff --git a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.vcproj b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.vcproj index ec50f7ad..4fb03cda 100644 --- a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.vcproj +++ b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.vcproj @@ -171,6 +171,14 @@ RelativePath=".\ftnoir_Protocol_MOUSE.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_protocol_MOUSE_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_protocol_MOUSE_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dialog.cpp b/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dialog.cpp new file mode 100644 index 00000000..75f96660 --- /dev/null +++ b/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dialog.cpp @@ -0,0 +1,233 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_MOUSE.h"
+#include <QDebug>
+
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+MOUSEControls::MOUSEControls() :
+QWidget()
+{
+ ui.setupUi( this );
+
+ //
+ // Setup the choices
+ //
+ ui.cbxSelectMouseStyle->addItem("Absolute");
+ ui.cbxSelectMouseStyle->addItem("Relative");
+
+ ui.cbxSelectMouse_X->addItem("None");
+ ui.cbxSelectMouse_X->addItem("Pitch");
+ ui.cbxSelectMouse_X->addItem("Yaw");
+ ui.cbxSelectMouse_X->addItem("Roll");
+ ui.cbxSelectMouse_X->addItem("X");
+ ui.cbxSelectMouse_X->addItem("Y");
+ ui.cbxSelectMouse_X->addItem("Z");
+
+ ui.cbxSelectMouse_Y->addItem("None");
+ ui.cbxSelectMouse_Y->addItem("Pitch");
+ ui.cbxSelectMouse_Y->addItem("Yaw");
+ ui.cbxSelectMouse_Y->addItem("Roll");
+ ui.cbxSelectMouse_Y->addItem("X");
+ ui.cbxSelectMouse_Y->addItem("Y");
+ ui.cbxSelectMouse_Y->addItem("Z");
+
+ ui.cbxSelectMouse_Wheel->addItem("None");
+ ui.cbxSelectMouse_Wheel->addItem("Pitch");
+ ui.cbxSelectMouse_Wheel->addItem("Yaw");
+ ui.cbxSelectMouse_Wheel->addItem("Roll");
+ ui.cbxSelectMouse_Wheel->addItem("X");
+ ui.cbxSelectMouse_Wheel->addItem("Y");
+ ui.cbxSelectMouse_Wheel->addItem("Z");
+
+ // Connect Qt signals to member-functions
+ connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
+ connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
+ connect(ui.cbxSelectMouse_X, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int )));
+ connect(ui.cbxSelectMouse_Y, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int )));
+ connect(ui.cbxSelectMouse_Wheel, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int )));
+
+ connect(ui.spinSensX, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.spinSensY, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.spinSensWheel, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+
+ connect(ui.chkUseVirtualDesk, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+MOUSEControls::~MOUSEControls() {
+ qDebug() << "~MOUSEControls() says: started";
+}
+
+void MOUSEControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void MOUSEControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void MOUSEControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void MOUSEControls::showEvent ( QShowEvent * event ) {
+ loadSettings();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void MOUSEControls::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 MOUSEControls::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 ( "Mouse" );
+ ui.cbxSelectMouseStyle->setCurrentIndex(iniFile.value ( "Style", 1 ).toInt() - 1);
+ ui.cbxSelectMouse_X->setCurrentIndex(iniFile.value ( "Mouse_X", 1 ).toInt() - 1);
+ ui.cbxSelectMouse_Y->setCurrentIndex(iniFile.value ( "Mouse_Y", 1 ).toInt() - 1);
+ ui.cbxSelectMouse_Wheel->setCurrentIndex(iniFile.value ( "Mouse_Wheel", 1 ).toInt() - 1);
+
+ ui.slideSensX->setValue(iniFile.value("SensX", 10).toInt());
+ ui.slideSensY->setValue(iniFile.value("SensY", 10).toInt());
+ ui.slideSensWheel->setValue(iniFile.value("SensWheel", 10).toInt());
+
+ ui.chkUseVirtualDesk->setChecked( iniFile.value ( "useVirtualDesk", 0 ).toBool() );
+
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void MOUSEControls::save() {
+ qDebug() << "save() says: started";
+
+ 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 ( "Mouse" );
+ iniFile.setValue ( "Style", ui.cbxSelectMouseStyle->currentIndex() + 1 );
+ iniFile.setValue ( "Mouse_X", ui.cbxSelectMouse_X->currentIndex() + 1 );
+ iniFile.setValue ( "Mouse_Y", ui.cbxSelectMouse_Y->currentIndex() + 1 );
+ iniFile.setValue ( "Mouse_Wheel", ui.cbxSelectMouse_Wheel->currentIndex() + 1 );
+
+ iniFile.setValue ( "SensX", ui.slideSensX->value() );
+ iniFile.setValue ( "SensY", ui.slideSensY->value() );
+ iniFile.setValue ( "SensWheel", ui.slideSensWheel->value() );
+
+ iniFile.setValue( "useVirtualDesk", ui.chkUseVirtualDesk->isChecked() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+{
+ return new MOUSEControls;
+}
diff --git a/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dll.cpp b/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dll.cpp new file mode 100644 index 00000000..cc6ddc17 --- /dev/null +++ b/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dll.cpp @@ -0,0 +1,56 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_MOUSE.h"
+#include <QDebug>
+
+FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
+}
+
+FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+{
+ return new FTNoIR_ProtocolDll;
+}
diff --git a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp index f533fdf3..4689c92f 100644 --- a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp +++ b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp @@ -128,7 +128,7 @@ void FTNoIR_Protocol_PPJOY::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_PPJOY::sendHeadposeToGame( THeadPoseData *headpose ) {
+void FTNoIR_Protocol_PPJOY::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float virtPosX;
float virtPosY;
float virtPosZ;
@@ -217,157 +217,3 @@ FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() {
return new FTNoIR_Protocol_PPJOY;
}
-
-//*******************************************************************************************************
-// FaceTrackNoIR Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-PPJOYControls::PPJOYControls() :
-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.cbxSelectPPJoyNumber, SIGNAL(currentIndexChanged(int)), this, SLOT(virtualJoystickSelected( int )));
-
- for (int i = 1 ; i < 17; i++) {
- QString cbxText = QString("Virtual Joystick %1").arg(i);
- ui.cbxSelectPPJoyNumber->addItem(QIcon("images/PPJoy.ico"), cbxText);
- }
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-PPJOYControls::~PPJOYControls() {
- qDebug() << "~PPJOYControls() says: started";
-}
-
-void PPJOYControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void PPJOYControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void PPJOYControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void PPJOYControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void PPJOYControls::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 PPJOYControls::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 ( "PPJoy" );
- ui.cbxSelectPPJoyNumber->setCurrentIndex(iniFile.value ( "Selection", 1 ).toInt() - 1);
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void PPJOYControls::save() {
- qDebug() << "save() says: started";
-
- 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 ( "PPJoy" );
- iniFile.setValue ( "Selection", ui.cbxSelectPPJoyNumber->currentIndex() + 1 );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Handle changes of the Virtual Joystick selection
-//
-void PPJOYControls::virtualJoystickSelected( int index )
-{
- settingsDirty = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Protocol-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
-{
- return new PPJOYControls;
-}
diff --git a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h index 266fd877..b9220916 100644 --- a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h +++ b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h @@ -69,13 +69,9 @@ public: void Initialize();
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame( THeadPoseData *headpose );
+ void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy Virtual Joystick"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy virtual joystick protocol"); };
-
private:
HANDLE h;
JOYSTICK_STATE JoyState;
@@ -107,11 +103,6 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy Virtual Joystick"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy virtual joystick protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/PPJoy.ico"); };
-
private:
Ui::UICPPJOYControls ui;
void loadSettings();
@@ -127,5 +118,22 @@ private slots: void settingChanged() { settingsDirty = true; };
};
+//*******************************************************************************************************
+// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
+//*******************************************************************************************************
+class FTNoIR_ProtocolDll : public IProtocolDll
+{
+public:
+ FTNoIR_ProtocolDll();
+ ~FTNoIR_ProtocolDll();
+
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy Virtual Joystick"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("PPJoy virtual joystick protocol"); };
+
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/PPJoy.ico"); };
+};
+
+
#endif//INCLUDED_PPJOYSERVER_H
//END
diff --git a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.vcproj b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.vcproj index e8332f65..7a42d19f 100644 --- a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.vcproj +++ b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.vcproj @@ -171,6 +171,14 @@ RelativePath=".\ftnoir_Protocol_PPJOY.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_protocol_PPJOY_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_protocol_PPJOY_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp b/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp new file mode 100644 index 00000000..fb9e1bd5 --- /dev/null +++ b/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp @@ -0,0 +1,189 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_PPJOY.h"
+#include <QDebug>
+
+
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+PPJOYControls::PPJOYControls() :
+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.cbxSelectPPJoyNumber, SIGNAL(currentIndexChanged(int)), this, SLOT(virtualJoystickSelected( int )));
+
+ for (int i = 1 ; i < 17; i++) {
+ QString cbxText = QString("Virtual Joystick %1").arg(i);
+ ui.cbxSelectPPJoyNumber->addItem(QIcon("images/PPJoy.ico"), cbxText);
+ }
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+PPJOYControls::~PPJOYControls() {
+ qDebug() << "~PPJOYControls() says: started";
+}
+
+void PPJOYControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void PPJOYControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void PPJOYControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void PPJOYControls::showEvent ( QShowEvent * event ) {
+ loadSettings();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void PPJOYControls::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 PPJOYControls::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 ( "PPJoy" );
+ ui.cbxSelectPPJoyNumber->setCurrentIndex(iniFile.value ( "Selection", 1 ).toInt() - 1);
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void PPJOYControls::save() {
+ qDebug() << "save() says: started";
+
+ 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 ( "PPJoy" );
+ iniFile.setValue ( "Selection", ui.cbxSelectPPJoyNumber->currentIndex() + 1 );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Handle changes of the Virtual Joystick selection
+//
+void PPJOYControls::virtualJoystickSelected( int index )
+{
+ settingsDirty = true;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+{
+ return new PPJOYControls;
+}
diff --git a/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dll.cpp b/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dll.cpp new file mode 100644 index 00000000..67536857 --- /dev/null +++ b/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dll.cpp @@ -0,0 +1,56 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_PPJOY.h"
+#include <QDebug>
+
+FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
+}
+
+FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+{
+ return new FTNoIR_ProtocolDll;
+}
diff --git a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp index 6c0cf42f..3399955a 100644 --- a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp +++ b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp @@ -96,7 +96,7 @@ void FTNoIR_Protocol_SC::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_SC::sendHeadposeToGame( THeadPoseData *headpose ) {
+void FTNoIR_Protocol_SC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
virtSCRotX = -1.0f * headpose->pitch; // degrees
@@ -385,128 +385,3 @@ FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() {
return new FTNoIR_Protocol_SC;
}
-
-//*******************************************************************************************************
-// FaceTrackNoIR Client Settings-dialog.
-//*******************************************************************************************************
-
-//
-// Constructor for server-settings-dialog
-//
-SCControls::SCControls() :
-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.cbxSelectPPJoyNumber, SIGNAL(currentIndexChanged(int)), this, SLOT(virtualJoystickSelected( int )));
-
- //for (int i = 1 ; i < 17; i++) {
- // QString cbxText = QString("Virtual Joystick %1").arg(i);
- // ui.cbxSelectPPJoyNumber->addItem(QIcon("images/PPJoy.ico"), cbxText);
- //}
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-SCControls::~SCControls() {
- qDebug() << "~SCControls() says: started";
-}
-
-void SCControls::Release()
-{
- delete this;
-}
-
-//
-// Initialize tracker-client-dialog
-//
-void SCControls::Initialize(QWidget *parent) {
-
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
- show();
-}
-
-//
-// OK clicked on server-dialog
-//
-void SCControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void SCControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void SCControls::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 SCControls::loadSettings() {
-
- settingsDirty = false;
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void SCControls::save() {
-
- settingsDirty = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Protocol-settings dialog object.
-
-// Export both decorated and undecorated names.
-// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
-{
- return new SCControls;
-}
diff --git a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h index cf8c3e5c..cfdde6a6 100644 --- a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h +++ b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h @@ -87,13 +87,9 @@ public: void Initialize();
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame( THeadPoseData *headpose );
+ void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FSX SimConnect"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("SimConnect"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft SimConnect protocol"); };
-
private:
// Private properties
QString ProgramName;
@@ -144,11 +140,6 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FSX SimConnect"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("SimConnect"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft SimConnect protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/FSX.ico"); };
-
private:
Ui::UICSCControls ui;
void loadSettings();
@@ -163,5 +154,21 @@ private slots: void settingChanged() { settingsDirty = true; };
};
+//*******************************************************************************************************
+// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
+//*******************************************************************************************************
+class FTNoIR_ProtocolDll : public IProtocolDll
+{
+public:
+ FTNoIR_ProtocolDll();
+ ~FTNoIR_ProtocolDll();
+
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FSX SimConnect"); };
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("SimConnect"); };
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft SimConnect protocol"); };
+
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/FSX.ico"); };
+};
+
#endif//INCLUDED_SCSERVER_H
//END
diff --git a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.vcproj b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.vcproj index c37c64e1..579c8bea 100644 --- a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.vcproj +++ b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.vcproj @@ -172,6 +172,14 @@ RelativePath=".\ftnoir_Protocol_SC.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_protocol_SC_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_protocol_SC_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dialog.cpp b/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dialog.cpp new file mode 100644 index 00000000..08013486 --- /dev/null +++ b/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dialog.cpp @@ -0,0 +1,159 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_SC.h"
+#include <QDebug>
+
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+SCControls::SCControls() :
+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.cbxSelectPPJoyNumber, SIGNAL(currentIndexChanged(int)), this, SLOT(virtualJoystickSelected( int )));
+
+ //for (int i = 1 ; i < 17; i++) {
+ // QString cbxText = QString("Virtual Joystick %1").arg(i);
+ // ui.cbxSelectPPJoyNumber->addItem(QIcon("images/PPJoy.ico"), cbxText);
+ //}
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+SCControls::~SCControls() {
+ qDebug() << "~SCControls() says: started";
+}
+
+void SCControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void SCControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void SCControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void SCControls::showEvent ( QShowEvent * event ) {
+ loadSettings();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void SCControls::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 SCControls::loadSettings() {
+
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void SCControls::save() {
+
+ settingsDirty = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+{
+ return new SCControls;
+}
diff --git a/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dll.cpp b/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dll.cpp new file mode 100644 index 00000000..f67f95db --- /dev/null +++ b/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dll.cpp @@ -0,0 +1,56 @@ +/********************************************************************************
+* 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 ProtocolDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_protocol_SC.h"
+#include <QDebug>
+
+FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
+}
+
+FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+{
+ return new FTNoIR_ProtocolDll;
+}
diff --git a/FaceTrackNoIR.sln b/FaceTrackNoIR.sln index c4ac19ec..2cc1053e 100644 --- a/FaceTrackNoIR.sln +++ b/FaceTrackNoIR.sln @@ -45,6 +45,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FTNoIR_Tracker_Toradex", "F EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FTNoIR_Tracker_Arduino", "FTNoIR_Tracker_Arduino\FTNoIR_Tracker_Arduino.vcproj", "{26073935-6C44-49FD-A986-DD91FE727306}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FTNoIR_Tracker_PT", "FTNoIR_Tracker_PT\FTNoIR_Tracker_PT.vcproj", "{7A2A2560-9253-4CC8-A9D5-4B9D9C224D9D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -134,6 +136,9 @@ Global {26073935-6C44-49FD-A986-DD91FE727306}.Debug|Win32.Build.0 = Debug|Win32
{26073935-6C44-49FD-A986-DD91FE727306}.Release|Win32.ActiveCfg = Release|Win32
{26073935-6C44-49FD-A986-DD91FE727306}.Release|Win32.Build.0 = Release|Win32
+ {7A2A2560-9253-4CC8-A9D5-4B9D9C224D9D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7A2A2560-9253-4CC8-A9D5-4B9D9C224D9D}.Debug|Win32.Build.0 = Debug|Win32
+ {7A2A2560-9253-4CC8-A9D5-4B9D9C224D9D}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
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
diff --git a/bin/Settings/ArmA.ini b/bin/Settings/ArmA.ini index 2fdcf98c..350c6ec7 100644 --- a/bin/Settings/ArmA.ini +++ b/bin/Settings/ArmA.ini @@ -13,7 +13,7 @@ invertRoll=true invertX=true
invertY=false
invertZ=false
-useEWMA=true
+useEWMA=false
redYaw=60
redPitch=60
redRoll=60
@@ -89,7 +89,7 @@ Enable_ReverseAxis=false RA_Yaw=40
RA_ZPos=0
RA_ToZPos=100
-MouseKey_Center=0
+MouseKey_Center=3
MouseKey_GameZero=0
MouseKey_StartStop=0
MouseKey_Inhibit=0
diff --git a/bin/Settings/GlovePIE.ini b/bin/Settings/GlovePIE.ini index 39c0d818..317b030a 100644 --- a/bin/Settings/GlovePIE.ini +++ b/bin/Settings/GlovePIE.ini @@ -22,7 +22,8 @@ redY=75 redZ=75
[GameProtocol]
-Selection=3
+Selection=6
+DLL=FTNoIR_Protocol_PPJOY.dll
[PPJoy]
Selection=1
@@ -46,3 +47,10 @@ Inhibit_Roll=false Inhibit_X=false
Inhibit_Y=false
Inhibit_Z=false
+
+[TrackerSource]
+Selection=2
+DLL=FTNoIR_Tracker_SM.dll
+
+[Filter]
+DLL=FTNoIR_Filter_Accela.dll
diff --git a/bin/Settings/SimConnect.ini b/bin/Settings/SimConnect.ini index ae948471..6b2b3e79 100644 --- a/bin/Settings/SimConnect.ini +++ b/bin/Settings/SimConnect.ini @@ -1,5 +1,5 @@ [Tracking]
-Smooth=5
+Smooth=1
invertYaw=false
invertPitch=false
invertRoll=false
@@ -18,11 +18,11 @@ powCurve=12 maxSmooth=70
[GameProtocol]
-Selection=5
+Selection=7
DLL=FTNoIR_Protocol_SC.dll
[TrackerSource]
-Selection=0
+Selection=2
DLL=FTNoIR_Tracker_SM.dll
[Curves]
@@ -72,6 +72,18 @@ Inhibit_X=false Inhibit_Y=false
Inhibit_Z=false
SetEngineStop=true
+MouseKey_Center=3
+MouseKey_GameZero=0
+Keycode_GameZero=0
+Shift_GameZero=false
+Ctrl_GameZero=false
+Alt_GameZero=false
+MouseKey_StartStop=0
+MouseKey_Inhibit=0
+Enable_ReverseAxis=false
+RA_Yaw=40
+RA_ZPos=-20
+RA_ToZPos=50
[FTN]
LocalPCOnly=true
@@ -90,21 +102,25 @@ IP-4=1 PortNumber=5550
[Curves-Accela-Scaling-Rotation]
-point-count=1
-point-0-x=4
-point-0-y=8
-point-1-x=3.03917525773196
-point-1-y=5.40377358490566
+point-count=4
+point-0-x=0.916230366492147
+point-0-y=2.73913043478261
+point-1-x=2.13089005235602
+point-1-y=3.26086956521739
+point-2-x=3.54450261780105
+point-2-y=4.21739130434783
+point-3-x=4
+point-3-y=5.17391304347826
[Curves-Accela-Scaling-Translation]
point-count=2
-point-0-x=2
-point-0-y=4
+point-0-x=1.7434554973822
+point-0-y=3.73913043478261
point-1-x=4
point-1-y=8
[Filter]
-DLL=FTNoIR_Filter_Accela.dll
+DLL=FTNoIR_Filter_EWMA2.dll
Selection=FTNoIR_Filter_Accela.dll
[Curves-Yaw]
@@ -122,13 +138,36 @@ point-1-x=50 point-1-y=180
[Curves-PitchDown]
+point-count=3
+point-0-x=10
+point-0-y=18
+point-1-x=50
+point-1-y=28
+point-2-x=50
+point-2-y=180
+
+[Curves-Roll]
point-count=2
-point-0-x=49.75
-point-0-y=79
+point-0-x=25
+point-0-y=90
point-1-x=50
point-1-y=180
-[Curves-Roll]
+[Curves-X]
+point-count=2
+point-0-x=25
+point-0-y=90
+point-1-x=50
+point-1-y=180
+
+[Curves-Y]
+point-count=2
+point-0-x=25
+point-0-y=90
+point-1-x=50
+point-1-y=180
+
+[Curves-Z]
point-count=2
point-0-x=25
point-0-y=90
|