summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-10-23 08:44:26 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-10-23 08:44:36 +0200
commitda9cec1a426d6ef3139d02794c5e1b8690808161 (patch)
tree1dec32b8b8ab4d3b456671260c98da30203d75a3
parented9316744519fadf113f8c8ee280b1c5d6267f1e (diff)
accela: configurable axis speed
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
-rw-r--r--ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui229
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp25
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.h1
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp60
4 files changed, 302 insertions, 13 deletions
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
index ba77f1a8..2dac7a51 100644
--- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
+++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>615</width>
- <height>68</height>
+ <width>623</width>
+ <height>293</height>
</rect>
</property>
<property name="sizePolicy">
@@ -21,8 +21,8 @@
</property>
<property name="maximumSize">
<size>
- <width>616</width>
- <height>68</height>
+ <width>42000</width>
+ <height>42000</height>
</size>
</property>
<property name="windowTitle">
@@ -160,7 +160,7 @@ background:none;</string>
<rect>
<x>541</x>
<y>10</y>
- <width>42</width>
+ <width>51</width>
<height>22</height>
</rect>
</property>
@@ -225,6 +225,225 @@ background:none;</string>
<string>Cancel</string>
</property>
</widget>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="geometry">
+ <rect>
+ <x>440</x>
+ <y>70</y>
+ <width>151</width>
+ <height>214</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Axis speed</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <property name="horizontalSpacing">
+ <number>20</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>X</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox">
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="minimum">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>3.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Y</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox_2">
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="minimum">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>3.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Z</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox_3">
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="minimum">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>3.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Yaw</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox_4">
+ <property name="accelerated">
+ <bool>false</bool>
+ </property>
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="minimum">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>3.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox_5">
+ <property name="accelerated">
+ <bool>false</bool>
+ </property>
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="minimum">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>3.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Roll</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox_6">
+ <property name="accelerated">
+ <bool>false</bool>
+ </property>
+ <property name="decimals">
+ <number>4</number>
+ </property>
+ <property name="minimum">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>3.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QLabel" name="label_9">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>100</y>
+ <width>371</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>Accela filter by Stanisław Halik &lt;sthalik@misaki.pl&gt;
+With kind help from Donovan Baarda.
+2012-2013</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::AutoText</enum>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignJustify|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ </widget>
</widget>
<resources/>
<connections>
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
index 76f6e687..25716973 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -34,6 +34,22 @@ void FTNoIR_Filter::loadSettings() {
rotation_alpha = iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble();
translation_alpha = iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble();
iniFile.endGroup ();
+
+ iniFile.beginGroup("Accela-Scaling");
+ // bigger means less filtering
+ static const double init_scaling[] = {
+ 1.5, // X
+ 1.5, // Y
+ 1, // Z
+ 0.8, // Yaw
+ 0.9, // Pitch
+ 1.25 // Roll
+ };
+ for (int i = 0; i < 6; i++)
+ {
+ scaling[i] = iniFile.value(QString("axis-%1").arg(QString::number(i)), init_scaling[i]).toDouble();
+ }
+ iniFile.endGroup();
}
void FTNoIR_Filter::receiveSettings(double rot, double trans, double zoom_fac)
@@ -69,14 +85,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position,
QMutexLocker foo(&mutex);
- static const double scaling[] = {
- 1.5,
- 1.5,
- 1,
- 1,
- 1,
- 1
- };
+
for (int i=0;i<6;i++)
{
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h
index f1807fd0..512b4576 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.h
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.h
@@ -54,6 +54,7 @@ private:
bool first_run;
double rotation_alpha, translation_alpha, zoom_factor;
double current_camera_position[6];
+ double scaling[6];
};
//*******************************************************************************************************
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
index 6ae1e4bc..4cd45910 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
@@ -26,6 +26,7 @@
#include <math.h>
#include <QDebug>
#include <algorithm>
+#include <QDoubleSpinBox>
#include "facetracknoir/global-settings.h"
//*******************************************************************************************************
@@ -49,6 +50,20 @@ FilterControls::FilterControls() :
connect(ui.slideZoom, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
connect(ui.spinZoom, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ QDoubleSpinBox* boxen[] = {
+ ui.doubleSpinBox,
+ ui.doubleSpinBox_2,
+ ui.doubleSpinBox_3,
+ ui.doubleSpinBox_4,
+ ui.doubleSpinBox_5,
+ ui.doubleSpinBox_6,
+ };
+
+ for (int i = 0; i < 6; i++)
+ {
+ connect(boxen[i], SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double)));
+ }
+
qDebug() << "FilterControls() says: started";
}
@@ -147,6 +162,34 @@ void FilterControls::loadSettings() {
ui.translation_alpha->setValue(iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble());
iniFile.endGroup ();
+ iniFile.beginGroup("Accela-Scaling");
+ // bigger means less filtering
+ static const double init_scaling[] = {
+ 1.5, // X
+ 1.5, // Y
+ 1, // Z
+ 0.8, // Yaw
+ 0.9, // Pitch
+ 1.25 // Roll
+ };
+
+ QDoubleSpinBox* boxen[] = {
+ ui.doubleSpinBox,
+ ui.doubleSpinBox_2,
+ ui.doubleSpinBox_3,
+ ui.doubleSpinBox_4,
+ ui.doubleSpinBox_5,
+ ui.doubleSpinBox_6,
+ };
+
+ for (int i = 0; i < 6; i++)
+ {
+ boxen[i]->setValue(iniFile.value(QString("axis-%1").arg(QString::number(i)), init_scaling[i]).toDouble());
+ }
+ iniFile.endGroup();
+
+
+
settingsDirty = false;
}
@@ -169,6 +212,23 @@ void FilterControls::save() {
iniFile.setValue("translation-alpha", trans = ui.translation_alpha->value());
iniFile.endGroup ();
+ iniFile.beginGroup("Accela-Scaling");
+
+ QDoubleSpinBox* boxen[] = {
+ ui.doubleSpinBox,
+ ui.doubleSpinBox_2,
+ ui.doubleSpinBox_3,
+ ui.doubleSpinBox_4,
+ ui.doubleSpinBox_5,
+ ui.doubleSpinBox_6,
+ };
+
+ for (int i = 0; i < 6; i++)
+ {
+ iniFile.setValue(QString("axis-%1").arg(QString::number(i)), boxen[i]->value());
+ }
+ iniFile.endGroup();
+
settingsDirty = false;
if (accela_filter)