diff options
| author | a1xd <[email protected]> | 2021-03-29 17:14:49 -0400 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-03-29 17:14:49 -0400 |
| commit | 16dc4df3d438142ae378c9c6983585d06e0c6a33 (patch) | |
| tree | 1080b11b6ec98d6f47509ced922f2c338e0068bd /common/accel-base.hpp | |
| parent | Merge pull request #81 from a1xd/log-unhandled-ex (diff) | |
| download | rawaccel-16dc4df3d438142ae378c9c6983585d06e0c6a33.tar.xz rawaccel-16dc4df3d438142ae378c9c6983585d06e0c6a33.zip | |
refactor common/settings
only driver compiles
remove accel-base types
merge linear + classic
move gain cap logic into classic impl, cap is now set in terms of output
use cap/limit to determine negation
remove weight, add replacement for power mode only
remove legacy offset option
remove naturalgain mode
add legacy mode flag
naturalgain -> natural
natural -> natural + legacy flag
add dpi setting and more accel args + defaults (prep for ips mode)
replace output speed cap with input cap
Diffstat (limited to 'common/accel-base.hpp')
| -rw-r--r-- | common/accel-base.hpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/common/accel-base.hpp b/common/accel-base.hpp deleted file mode 100644 index 42b3bb1..0000000 --- a/common/accel-base.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -namespace rawaccel { - - /// <summary> Struct to hold arguments for an acceleration function. </summary> - struct accel_args { - double offset = 0; - bool legacy_offset = false; - double accel = 0; - double scale = 1; - double limit = 2; - double exponent = 2; - double midpoint = 10; - double weight = 1; - double scale_cap = 0; - double gain_cap = 0; - double speed_cap = 0; - }; - - struct domain_args { - vec2d domain_weights = { 1, 1 }; - double lp_norm = 2; - }; - - template <typename Func> - struct accel_val_base { - bool legacy_offset = false; - double offset = 0; - double weight = 1; - Func fn; - - accel_val_base(const accel_args& args) : fn(args) {} - - }; - - template <typename Func> - struct additive_accel : accel_val_base<Func> { - - additive_accel(const accel_args& args) : accel_val_base(args) { - this->legacy_offset = args.legacy_offset; - this->offset = args.offset; - this->weight = args.weight; - } - - inline double operator()(double speed) const { - double offset_speed = speed - this->offset; - if (offset_speed <= 0) return 1; - if (this->legacy_offset) return 1 + this->fn.legacy_offset(offset_speed) * this->weight; - return 1 + this->fn(offset_speed) * this->weight; - } - }; - - template <typename Func> - struct nonadditive_accel : accel_val_base<Func> { - - nonadditive_accel(const accel_args& args) : accel_val_base(args) { - if (args.weight > 0) this->weight = args.weight; - } - - inline double operator()(double speed) const { - return this->fn(speed) * this->weight; - } - - }; - -} |