mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Merge pull request #1593 from OpenSpace/feature/space-mouse
Feature/space mouse
This commit is contained in:
@@ -43,6 +43,7 @@ public:
|
||||
OrbitY,
|
||||
ZoomIn,
|
||||
ZoomOut,
|
||||
Zoom,
|
||||
LocalRollX,
|
||||
LocalRollY,
|
||||
GlobalRollX,
|
||||
@@ -60,7 +61,15 @@ public:
|
||||
AxisInvert invert = AxisInvert::No;
|
||||
AxisNormalize normalize = AxisNormalize::No;
|
||||
|
||||
// The axis values can either go back to 0 when the joystick is released or it can
|
||||
// stay at the value it was before the joystick was released.
|
||||
// The latter is called a sticky axis, when the values don't go back to 0.
|
||||
bool isSticky = false;
|
||||
|
||||
float deadzone = 0.f;
|
||||
|
||||
// Every axis can have their own sensitivity
|
||||
double sensitivity = 0.0;
|
||||
};
|
||||
|
||||
JoystickCameraStates(double sensitivity, double velocityScaleFactor);
|
||||
@@ -69,7 +78,8 @@ public:
|
||||
|
||||
void setAxisMapping(int axis, AxisType mapping,
|
||||
AxisInvert shouldInvert = AxisInvert::No,
|
||||
AxisNormalize shouldNormalize = AxisNormalize::No
|
||||
AxisNormalize shouldNormalize = AxisNormalize::No,
|
||||
bool isSticky = false, double sensitivity = 0.0
|
||||
);
|
||||
|
||||
AxisInformation axisMapping(int axis) const;
|
||||
@@ -91,6 +101,10 @@ private:
|
||||
|
||||
std::array<AxisInformation, JoystickInputState::MaxAxes> _axisMapping;
|
||||
|
||||
// This array is used to store the old axis values from the previous frame,
|
||||
// it is used to calculate the difference in the values in the case of a sticky axis
|
||||
std::array<float, JoystickInputState::MaxAxes> _prevAxisValues;
|
||||
|
||||
struct ButtonInformation {
|
||||
std::string command;
|
||||
JoystickAction action;
|
||||
@@ -135,6 +149,7 @@ from_string(std::string_view string)
|
||||
if (string == "None") { return T::None; }
|
||||
if (string == "Orbit X") { return T::OrbitX; }
|
||||
if (string == "Orbit Y") { return T::OrbitY; }
|
||||
if (string == "Zoom") { return T::Zoom; }
|
||||
if (string == "Zoom In") { return T::ZoomIn; }
|
||||
if (string == "Zoom Out") { return T::ZoomOut; }
|
||||
if (string == "LocalRoll X") { return T::LocalRollX; }
|
||||
|
||||
@@ -71,6 +71,11 @@ struct JoystickInputState {
|
||||
/// \c nAxes values are defined values, the rest are undefined
|
||||
std::array<float, MaxAxes> axes;
|
||||
|
||||
/// The axis values can either go back to 0 when the joystick is released or it can
|
||||
/// stay at the value it was before the joystick was released.
|
||||
/// The latter is called a sticky axis, when the values don't go back to 0.
|
||||
bool isSticky = false;
|
||||
|
||||
/// The number of buttons that this joystick possesses
|
||||
int nButtons = 0;
|
||||
/// The status of each button. Only the first \c nButtons values are defined, the rest
|
||||
|
||||
@@ -115,7 +115,8 @@ public:
|
||||
JoystickCameraStates::AxisInvert shouldInvert =
|
||||
JoystickCameraStates::AxisInvert::No,
|
||||
JoystickCameraStates::AxisNormalize shouldNormalize =
|
||||
JoystickCameraStates::AxisNormalize::No
|
||||
JoystickCameraStates::AxisNormalize::No,
|
||||
bool isSticky = false, double sensitivity = 0.0
|
||||
);
|
||||
|
||||
JoystickCameraStates::AxisInformation joystickAxisMapping(int axis) const;
|
||||
|
||||
Reference in New Issue
Block a user