Add support for joypad motion sensors
This commit is contained in:
parent
481f36ed20
commit
a3eb202b25
10 changed files with 1940 additions and 0 deletions
15
thirdparty/README.md
vendored
15
thirdparty/README.md
vendored
|
|
@ -368,6 +368,21 @@ Files extracted from upstream source:
|
|||
- `LICENSE.TXT` and `docs/FTL.TXT`
|
||||
|
||||
|
||||
## gamepadmotionhelpers
|
||||
|
||||
- Upstream: https://github.com/JibbSmart/GamepadMotionHelpers
|
||||
- Version: 39b578aacf34c3a1c584d8f7f194adc776f88055, 2023
|
||||
- License: MIT
|
||||
|
||||
Files extracted from upstream source:
|
||||
|
||||
- `GamepadMotion.hpp`
|
||||
- `LICENSE.TXT`
|
||||
|
||||
Patches:
|
||||
|
||||
- `0001-fix-warnings.patch` ([GH-111679](https://github.com/godotengine/godot/pull/111679))
|
||||
|
||||
## glad
|
||||
|
||||
- Upstream: https://github.com/Dav1dde/glad
|
||||
|
|
|
|||
1298
thirdparty/gamepadmotionhelpers/GamepadMotion.hpp
vendored
Normal file
1298
thirdparty/gamepadmotionhelpers/GamepadMotion.hpp
vendored
Normal file
File diff suppressed because it is too large
Load diff
21
thirdparty/gamepadmotionhelpers/LICENSE.txt
vendored
Normal file
21
thirdparty/gamepadmotionhelpers/LICENSE.txt
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020-2023 Julian "Jibb" Smart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
37
thirdparty/gamepadmotionhelpers/patches/0001-fix-warnings.patch
vendored
Normal file
37
thirdparty/gamepadmotionhelpers/patches/0001-fix-warnings.patch
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
diff --git a/thirdparty/gamepadmotionhelpers/GamepadMotion.hpp b/thirdparty/gamepadmotionhelpers/GamepadMotion.hpp
|
||||
index 02497ac953..7d89f86d7f 100644
|
||||
--- a/thirdparty/gamepadmotionhelpers/GamepadMotion.hpp
|
||||
+++ b/thirdparty/gamepadmotionhelpers/GamepadMotion.hpp
|
||||
@@ -810,11 +810,6 @@ namespace GamepadMotionHelpers
|
||||
{
|
||||
if (MinMaxWindow.NumSamples >= minStillnessSamples && MinMaxWindow.TimeSampled >= minStillnessCorrectionTime)
|
||||
{
|
||||
- /*if (TimeSteadyStillness == 0.f)
|
||||
- {
|
||||
- printf("Still!\n");
|
||||
- }/**/
|
||||
-
|
||||
TimeSteadyStillness = std::min(TimeSteadyStillness + deltaTime, stillnessCalibrationEaseInTime);
|
||||
const float calibrationEaseIn = stillnessCalibrationEaseInTime <= 0.f ? 1.f : TimeSteadyStillness / stillnessCalibrationEaseInTime;
|
||||
|
||||
@@ -973,20 +968,11 @@ namespace GamepadMotionHelpers
|
||||
// apply corrections
|
||||
if (gyroAccelerationMag > sensorFusionAngularAccelerationThreshold || CalibrationData == nullptr)
|
||||
{
|
||||
- /*if (TimeSteadySensorFusion > 0.f)
|
||||
- {
|
||||
- printf("Shaken!\n");
|
||||
- }/**/
|
||||
TimeSteadySensorFusion = 0.f;
|
||||
//printf("No calibration due to acceleration of %.4f\n", gyroAccelerationMag);
|
||||
}
|
||||
else
|
||||
{
|
||||
- /*if (TimeSteadySensorFusion == 0.f)
|
||||
- {
|
||||
- printf("Steady!\n");
|
||||
- }/**/
|
||||
-
|
||||
TimeSteadySensorFusion = std::min(TimeSteadySensorFusion + deltaTime, sensorFusionCalibrationEaseInTime);
|
||||
const float calibrationEaseIn = sensorFusionCalibrationEaseInTime <= 0.f ? 1.f : TimeSteadySensorFusion / sensorFusionCalibrationEaseInTime;
|
||||
const Vec oldGyroBias = Vec(CalibrationData->X, CalibrationData->Y, CalibrationData->Z) / std::max((float)CalibrationData->NumSamples, 1.f);
|
||||
Loading…
Add table
Add a link
Reference in a new issue