Remove unused Roll Y movement for camera

This commit is contained in:
Malin E
2023-05-17 11:12:18 +02:00
parent c0a1dc7e79
commit ec15624ab0
11 changed files with 39 additions and 69 deletions

View File

@@ -5,10 +5,8 @@
-- "Zoom" -- both in and out
-- "Zoom In"
-- "Zoom Out"
-- "LocalRoll X"
-- "LocalRoll Y"
-- "GlobalRoll X"
-- "GlobalRoll Y"
-- "LocalRoll"
-- "GlobalRoll"
-- "Pan X"
-- "Pan Y"
-- Fourth parameter determines whether the axis should be inverted

View File

@@ -13,7 +13,7 @@ local bindLocalRoll = function(name, axis)
end
-- Set new axis state
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "LocalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "LocalRoll", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
Joystick.State.IsInRollMode = true
]]
end
@@ -27,7 +27,7 @@ local bindGlobalRoll = function(name, axis)
end
-- Set new axis state
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "GlobalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "GlobalRoll", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
Joystick.State.IsInRollMode = true
]]
end
@@ -38,7 +38,7 @@ local permaBindLocalRoll = function(name, axis)
Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
-- Set new axis state
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "LocalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "LocalRoll", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
]]
end
@@ -48,7 +48,7 @@ local permaBindGlobalRoll = function(name, axis)
Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
-- Set new axis state
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "GlobalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "GlobalRoll", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
]]
end

View File

@@ -8,10 +8,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- "Zoom" -- both in and out
-- "Zoom In"
-- "Zoom Out"
-- "LocalRoll X"
-- "LocalRoll Y"
-- "GlobalRoll X"
-- "GlobalRoll Y"
-- "LocalRoll"
-- "GlobalRoll"
-- "Pan X"
-- "Pan Y"
-- Fourth parameter determines whether the axis should be inverted

View File

@@ -8,10 +8,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- "Zoom" -- both in and out
-- "Zoom In"
-- "Zoom Out"
-- "LocalRoll X"
-- "LocalRoll Y"
-- "GlobalRoll X"
-- "GlobalRoll Y"
-- "LocalRoll"
-- "GlobalRoll"
-- "Pan X"
-- "Pan Y"
-- Fourth parameter determines whether the axis should be inverted
@@ -43,7 +41,7 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true, "JoystickLike", true, false, 40.0);
openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y", false, "JoystickLike", true, false, 35.0);
openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom", false, "JoystickLike", true, false, 40.0);
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X", false, "JoystickLike", true, false, 35.0);
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll", false, "JoystickLike", true, false, 35.0);
openspace.navigation.bindJoystickButton(
name,

View File

@@ -8,10 +8,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- "Zoom" -- both in and out
-- "Zoom In"
-- "Zoom Out"
-- "LocalRoll X"
-- "LocalRoll Y"
-- "GlobalRoll X"
-- "GlobalRoll Y"
-- "LocalRoll"
-- "GlobalRoll"
-- "Pan X"
-- "Pan Y"
-- Fourth parameter determines whether the axis should be inverted
@@ -43,7 +41,7 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true, "JoystickLike", true, false, 40.0);
openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y", false, "JoystickLike", true, false, 35.0);
openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom", false, "JoystickLike", true, false, 40.0);
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X", false, "JoystickLike", true, false, 35.0);
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll", false, "JoystickLike", true, false, 35.0);
openspace.navigation.bindJoystickButton(
name,

View File

@@ -8,10 +8,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- "Zoom" -- both in and out
-- "Zoom In"
-- "Zoom Out"
-- "LocalRoll X"
-- "LocalRoll Y"
-- "GlobalRoll X"
-- "GlobalRoll Y"
-- "LocalRoll"
-- "GlobalRoll"
-- "Pan X"
-- "Pan Y"
-- Fourth parameter determines whether the axis should be inverted
@@ -51,5 +49,5 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true);
openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y");
openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom");
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X");
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll");
end)

View File

@@ -8,10 +8,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- "Zoom" -- both in and out
-- "Zoom In"
-- "Zoom Out"
-- "LocalRoll X"
-- "LocalRoll Y"
-- "GlobalRoll X"
-- "GlobalRoll Y"
-- "LocalRoll"
-- "GlobalRoll"
-- "Pan X"
-- "Pan Y"
-- Fourth parameter determines whether the axis should be inverted
@@ -51,5 +49,5 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true);
openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y");
openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom");
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X");
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll");
end)

View File

@@ -8,10 +8,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- "Zoom" -- both in and out
-- "Zoom In"
-- "Zoom Out"
-- "LocalRoll X"
-- "LocalRoll Y"
-- "GlobalRoll X"
-- "GlobalRoll Y"
-- "LocalRoll"
-- "GlobalRoll"
-- "Pan X"
-- "Pan Y"
-- Fourth parameter determines whether the axis should be inverted

View File

@@ -8,10 +8,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- "Zoom" -- both in and out
-- "Zoom In"
-- "Zoom Out"
-- "LocalRoll X"
-- "LocalRoll Y"
-- "GlobalRoll X"
-- "GlobalRoll Y"
-- "LocalRoll"
-- "GlobalRoll"
-- "Pan X"
-- "Pan Y"
-- Fourth parameter determines whether the axis should be inverted
@@ -71,7 +69,7 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickButton(
name,
controller.DPad.Up,
joystickHelper.bindLocalRoll(name, controller.RightThumbStick[1]) ..
joystickHelper.bindGlobalRoll(name, controller.RightThumbStick[1]) ..
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick[2] .. ", 'None');",
"Switch to roll mode"
)

View File

@@ -44,10 +44,8 @@ public:
ZoomIn,
ZoomOut,
Zoom,
LocalRollX,
LocalRollY,
GlobalRollX,
GlobalRollY,
LocalRoll,
GlobalRoll,
PanX,
PanY,
Property
@@ -171,10 +169,8 @@ inline std::string to_string(
case T::ZoomIn: return "Zoom In";
case T::ZoomOut: return "Zoom Out";
case T::Zoom: return "Zoom In and Out";
case T::LocalRollX: return "LocalRoll X";
case T::LocalRollY: return "LocalRoll Y";
case T::GlobalRollX: return "GlobalRoll X";
case T::GlobalRollY: return "GlobalRoll Y";
case T::LocalRoll: return "LocalRoll";
case T::GlobalRoll: return "GlobalRoll";
case T::PanX: return "Pan X";
case T::PanY: return "Pan Y";
case T::Property: return "Property";
@@ -194,10 +190,8 @@ from_string(std::string_view string)
if (string == "Zoom In") { return T::ZoomIn; }
if (string == "Zoom Out") { return T::ZoomOut; }
if (string == "Zoom") { return T::Zoom; }
if (string == "LocalRoll X") { return T::LocalRollX; }
if (string == "LocalRoll Y") { return T::LocalRollY; }
if (string == "GlobalRoll X") { return T::GlobalRollX; }
if (string == "GlobalRoll Y") { return T::GlobalRollY; }
if (string == "LocalRoll") { return T::LocalRoll; }
if (string == "GlobalRoll") { return T::GlobalRoll; }
if (string == "Pan X") { return T::PanX; }
if (string == "Pan Y") { return T::PanY; }
if (string == "Property") { return T::Property; }

View File

@@ -56,8 +56,8 @@ void JoystickCameraStates::updateStateFromInput(
std::pair<bool, glm::dvec2> globalRotation = std::pair(false, glm::dvec2(0.0));
std::pair<bool, double> zoom = std::pair(false, 0.0);
std::pair<bool, glm::dvec2> localRoll = std::pair(false, glm::dvec2(0.0));
std::pair<bool, glm::dvec2> globalRoll = std::pair(false, glm::dvec2(0.0));
std::pair<bool, double> localRoll = std::pair(false, 0.0);
std::pair<bool, double> globalRoll = std::pair(false, 0.0);
std::pair<bool, glm::dvec2> localRotation = std::pair(false, glm::dvec2(0.0));
for (const JoystickInputState& joystickInputState : joystickInputStates) {
@@ -145,21 +145,13 @@ void JoystickCameraStates::updateStateFromInput(
zoom.first = true;
zoom.second -= value;
break;
case AxisType::LocalRollX:
case AxisType::LocalRoll:
localRoll.first = true;
localRoll.second.x += value;
localRoll.second+= value;
break;
case AxisType::LocalRollY:
localRoll.first = true;
localRoll.second.y += value;
break;
case AxisType::GlobalRollX:
case AxisType::GlobalRoll:
globalRoll.first = true;
globalRoll.second.x += value;
break;
case AxisType::GlobalRollY:
globalRoll.first = true;
globalRoll.second.y += value;
globalRoll.second += value;
break;
case AxisType::PanX:
localRotation.first = true;
@@ -220,14 +212,14 @@ void JoystickCameraStates::updateStateFromInput(
}
if (localRoll.first) {
_localRollState.velocity.set(localRoll.second, deltaTime);
_localRollState.velocity.set(glm::dvec2(localRoll.second), deltaTime);
}
else {
_localRollState.velocity.decelerate(deltaTime);
}
if (globalRoll.first) {
_globalRollState.velocity.set(globalRoll.second, deltaTime);
_globalRollState.velocity.set(glm::dvec2(globalRoll.second), deltaTime);
}
else {
_globalRollState.velocity.decelerate(deltaTime);