mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 13:08:49 -05:00
Remove support for sticky axis and sensitivity to Property type
This commit is contained in:
@@ -56,7 +56,7 @@ local unbindRoll = function(name, axis)
|
||||
return [[
|
||||
-- Reset previous state
|
||||
if(Joystick.State.Axis.Type == "Property") then
|
||||
openspace.navigation.bindJoystickAxisProperty("]] .. name .. "\", " .. axis .. [[, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.Inverted, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.IsRemote);
|
||||
openspace.navigation.bindJoystickAxisProperty("]] .. name .. "\", " .. axis .. [[, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.Inverted, Joystick.State.Axis.IsRemote);
|
||||
else
|
||||
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity);
|
||||
end
|
||||
|
||||
@@ -96,8 +96,7 @@ public:
|
||||
|
||||
void setAxisMappingProperty(const std::string& joystickName, int axis,
|
||||
const std::string& propertyUri, float min = 0.f, float max = 1.f,
|
||||
AxisInvert shouldInvert = AxisInvert::No,
|
||||
bool isSticky = false, double sensitivity = 0.0, bool isRemote = true
|
||||
AxisInvert shouldInvert = AxisInvert::No, bool isRemote = true
|
||||
);
|
||||
|
||||
AxisInformation axisMapping(const std::string& joystickName, int axis) const;
|
||||
|
||||
@@ -111,8 +111,7 @@ public:
|
||||
int axis, const std::string& propertyUri,
|
||||
float min = 0.f, float max = 1.f,
|
||||
JoystickCameraStates::AxisInvert shouldInvert =
|
||||
JoystickCameraStates::AxisInvert::No,
|
||||
bool isSticky = false, double sensitivity = 0.0, bool isRemote = true
|
||||
JoystickCameraStates::AxisInvert::No, bool isRemote = true
|
||||
);
|
||||
|
||||
JoystickCameraStates::AxisInformation joystickAxisMapping(
|
||||
|
||||
@@ -97,12 +97,13 @@ void JoystickCameraStates::updateStateFromInput(
|
||||
if (t.type == AxisType::Property) {
|
||||
value = value * (t.maxValue - t.minValue) + t.minValue;
|
||||
}
|
||||
|
||||
if (std::abs(t.sensitivity) > std::numeric_limits<double>::epsilon()) {
|
||||
value = static_cast<float>(value * t.sensitivity * _sensitivity);
|
||||
}
|
||||
else {
|
||||
value = static_cast<float>(value * _sensitivity);
|
||||
if (std::abs(t.sensitivity) > std::numeric_limits<double>::epsilon()) {
|
||||
value = static_cast<float>(value * t.sensitivity * _sensitivity);
|
||||
}
|
||||
else {
|
||||
value = static_cast<float>(value * _sensitivity);
|
||||
}
|
||||
}
|
||||
|
||||
switch (t.type) {
|
||||
@@ -245,7 +246,6 @@ void JoystickCameraStates::setAxisMappingProperty(const std::string& joystickNam
|
||||
const std::string& propertyUri,
|
||||
float min, float max,
|
||||
AxisInvert shouldInvert,
|
||||
bool isSticky, double sensitivity,
|
||||
bool isRemote)
|
||||
{
|
||||
ghoul_assert(axis < JoystickInputState::MaxAxes, "axis must be < MaxAxes");
|
||||
@@ -257,8 +257,6 @@ void JoystickCameraStates::setAxisMappingProperty(const std::string& joystickNam
|
||||
|
||||
joystickCameraState->axisMapping[axis].type = AxisType::Property;
|
||||
joystickCameraState->axisMapping[axis].invert = shouldInvert;
|
||||
joystickCameraState->axisMapping[axis].isSticky = isSticky;
|
||||
joystickCameraState->axisMapping[axis].sensitivity = sensitivity;
|
||||
joystickCameraState->axisMapping[axis].propertyUri = propertyUri;
|
||||
joystickCameraState->axisMapping[axis].minValue = min;
|
||||
joystickCameraState->axisMapping[axis].maxValue = max;
|
||||
|
||||
@@ -521,7 +521,6 @@ void NavigationHandler::setJoystickAxisMappingProperty(const std::string& joysti
|
||||
const std::string& propertyUri,
|
||||
float min, float max,
|
||||
JoystickCameraStates::AxisInvert shouldInvert,
|
||||
bool isSticky, double sensitivity,
|
||||
bool isRemote)
|
||||
{
|
||||
_orbitalNavigator.joystickStates().setAxisMappingProperty(
|
||||
@@ -531,8 +530,6 @@ void NavigationHandler::setJoystickAxisMappingProperty(const std::string& joysti
|
||||
min,
|
||||
max,
|
||||
shouldInvert,
|
||||
isSticky,
|
||||
sensitivity,
|
||||
isRemote
|
||||
);
|
||||
}
|
||||
@@ -672,12 +669,9 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
|
||||
"identified by the third argument. 'min' and 'max' is the minimum and "
|
||||
"the maximum allowed value for the given property and the axis value is "
|
||||
"rescaled from [-1, 1] to [min, max], default is [0, 1]. If 'isInverted' "
|
||||
"is 'true', the axis value is inverted. If 'isSticky' is 'true', the "
|
||||
"value is calculated relative to the previous value. If 'sensitivity' is "
|
||||
"given then that value will affect the sensitivity of the axis together "
|
||||
"with the global sensitivity. The last argument determines whether the "
|
||||
"property change is going to be executed locally or remotely, where the "
|
||||
"latter is the default."
|
||||
"is 'true', the axis value is inverted. The last argument determines "
|
||||
"whether the property change is going to be executed locally or "
|
||||
"remotely, where the latter is the default."
|
||||
},
|
||||
{
|
||||
"joystickAxis",
|
||||
|
||||
@@ -177,18 +177,14 @@ int bindJoystickAxis(lua_State* L) {
|
||||
|
||||
int bindJoystickAxisProperty(lua_State* L) {
|
||||
ghoul::lua::checkArgumentsAndThrow(L, { 3, 9 }, "lua::bindJoystickAxisProperty");
|
||||
auto [joystickName, axis, propertyUri, min, max, shouldInvert, isSticky, sensitivity,
|
||||
isRemote] =
|
||||
auto [joystickName, axis, propertyUri, min, max, shouldInvert, isRemote] =
|
||||
ghoul::lua::values<
|
||||
std::string, int, std::string, std::optional<float>, std::optional<float>,
|
||||
std::optional<bool>, std::optional<bool>, std::optional<double>,
|
||||
std::optional<bool>
|
||||
std::optional<bool>, std::optional<bool>
|
||||
>(L);
|
||||
min = min.value_or(0.f);
|
||||
max = max.value_or(1.f);
|
||||
shouldInvert = shouldInvert.value_or(false);
|
||||
isSticky = isSticky.value_or(false);
|
||||
sensitivity = sensitivity.value_or(0.0);
|
||||
isRemote = isRemote.value_or(true);
|
||||
|
||||
global::navigationHandler->setJoystickAxisMappingProperty(
|
||||
@@ -198,8 +194,6 @@ int bindJoystickAxisProperty(lua_State* L) {
|
||||
*min,
|
||||
*max,
|
||||
interaction::JoystickCameraStates::AxisInvert(*shouldInvert),
|
||||
*isSticky,
|
||||
*sensitivity,
|
||||
*isRemote
|
||||
);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user