summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--filter-nm/ftnoir_filter_nm.cpp10
-rw-r--r--filter-nm/ftnoir_filter_nm.h8
-rw-r--r--filter-nm/ftnoir_nm_filtercontrols.ui4
3 files changed, 12 insertions, 10 deletions
diff --git a/filter-nm/ftnoir_filter_nm.cpp b/filter-nm/ftnoir_filter_nm.cpp
index 5d274790..b222184b 100644
--- a/filter-nm/ftnoir_filter_nm.cpp
+++ b/filter-nm/ftnoir_filter_nm.cpp
@@ -42,17 +42,19 @@ void filter_nm::filter(const double* input, double* output)
const double pos_tau = 1. / *s.pos_responsiveness;
double alpha = dt / (dt + pos_tau);
last_pos_speed += (pos_speed - last_pos_speed) * alpha;
- alpha *= min(1.0, VectorLength(last_pos_speed) / *s.pos_drift_speed);
+ const double factor_pos = min(1.0, VectorLength(last_pos_speed) / (*s.pos_drift_speed * 3.0));
+ alpha *= factor_pos * factor_pos;
last_pos_out += (position - last_pos_out) * alpha;
const tQuat rot_delta = QuatDivide(rotation, last_rot_in);
- const double ms_per_s = 1000.0; // angular speed quaternions need to be small to work so use °/ms
- const tQuat rot_speed = Slerp(tQuat(), rot_delta, 1.0 / dt / ms_per_s);
+ constexpr double ms_per_s = 1000.0; // angular speed quaternions need to be small to work so use °/ms
+ const tQuat rot_speed = Slerp(tQuat(), rot_delta, 1.0 / ms_per_s / dt );
const double rot_tau = 1. / *s.rot_responsiveness;
alpha = dt / (dt + rot_tau);
last_rot_speed = Slerp(last_rot_speed, rot_speed, alpha);
const double angular_speed = AngleBetween(tQuat(), last_rot_speed) * ms_per_s;
- alpha *= min(1.0, angular_speed / *s.rot_drift_speed);
+ const double factor_rot = min(1.0, angular_speed / (*s.rot_drift_speed * 3.0));
+ alpha *= factor_rot * factor_rot;
last_rot_out = Slerp(last_rot_out, rotation, alpha);
}
diff --git a/filter-nm/ftnoir_filter_nm.h b/filter-nm/ftnoir_filter_nm.h
index 7bf012a6..84775207 100644
--- a/filter-nm/ftnoir_filter_nm.h
+++ b/filter-nm/ftnoir_filter_nm.h
@@ -24,10 +24,10 @@ struct settings_nm : opts
settings_nm() :
opts("nm-filter"),
- pos_responsiveness(value<slider_value>(b, "pos-responsiveness", { 15.0, .0, 20.0 })),
- rot_responsiveness(value<slider_value>(b, "rot-responsiveness", { 18.0, .0, 20.0 })),
- pos_drift_speed(value<slider_value>(b, "pos-drift-speed", { 30.0, 1.0, 200.0 })),
- rot_drift_speed(value<slider_value>(b, "rot-drift-speed", { 45.0, 1.0, 400.0 }))
+ pos_responsiveness(value<slider_value>(b, "pos-responsiveness", { 13.0, .0, 20.0 })),
+ rot_responsiveness(value<slider_value>(b, "rot-responsiveness", { 16.0, .0, 20.0 })),
+ pos_drift_speed(value<slider_value>(b, "pos-drift-speed", { 5.0, 0.1, 50.0 })),
+ rot_drift_speed(value<slider_value>(b, "rot-drift-speed", { 7.0, 0.1, 50.0 }))
{
}
};
diff --git a/filter-nm/ftnoir_nm_filtercontrols.ui b/filter-nm/ftnoir_nm_filtercontrols.ui
index ad307daf..7e317e74 100644
--- a/filter-nm/ftnoir_nm_filtercontrols.ui
+++ b/filter-nm/ftnoir_nm_filtercontrols.ui
@@ -171,7 +171,7 @@
<number>1</number>
</property>
<property name="maximum">
- <number>400</number>
+ <number>500</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -220,7 +220,7 @@
<number>1</number>
</property>
<property name="maximum">
- <number>200</number>
+ <number>500</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>