mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-10 13:40:08 -06:00
Fixed failed merging of master.
This commit is contained in:
@@ -67,7 +67,7 @@ namespace openspace::interaction {
|
||||
|
||||
|
||||
ghoul::Dictionary
|
||||
openspace::interaction::NavigationHandler::NavigationState::dictionary() const
|
||||
openspace::interaction::NavigationHandler::NavigationState::dictionary() const
|
||||
{
|
||||
ghoul::Dictionary cameraDict;
|
||||
cameraDict.setValue(KeyPosition, position);
|
||||
@@ -94,7 +94,7 @@ openspace::interaction::NavigationHandler::NavigationState::dictionary() const
|
||||
}
|
||||
|
||||
openspace::interaction::NavigationHandler::NavigationState::NavigationState(
|
||||
const ghoul::Dictionary& dictionary)
|
||||
const ghoul::Dictionary& dictionary)
|
||||
{
|
||||
const bool hasAnchor = dictionary.hasValue<std::string>(KeyAnchor);
|
||||
const bool hasPosition = dictionary.hasValue<glm::dvec3>(KeyPosition);
|
||||
@@ -130,13 +130,13 @@ openspace::interaction::NavigationHandler::NavigationState::NavigationState(
|
||||
}
|
||||
|
||||
openspace::interaction::NavigationHandler::NavigationState::NavigationState(
|
||||
std::string anchor,
|
||||
std::string aim,
|
||||
std::string referenceFrame,
|
||||
glm::dvec3 position,
|
||||
std::optional<glm::dvec3> up,
|
||||
double yaw,
|
||||
double pitch)
|
||||
std::string anchor,
|
||||
std::string aim,
|
||||
std::string referenceFrame,
|
||||
glm::dvec3 position,
|
||||
std::optional<glm::dvec3> up,
|
||||
double yaw,
|
||||
double pitch)
|
||||
: anchor(std::move(anchor))
|
||||
, aim(std::move(aim))
|
||||
, referenceFrame(std::move(referenceFrame))
|
||||
@@ -214,7 +214,8 @@ void NavigationHandler::updateCamera(double deltaTime) {
|
||||
applyNavigationState(_pendingNavigationState.value());
|
||||
_orbitalNavigator.resetVelocities();
|
||||
_pendingNavigationState.reset();
|
||||
} else if (!_playbackModeEnabled && _camera) {
|
||||
}
|
||||
else if (!_playbackModeEnabled && _camera) {
|
||||
if (_useKeyFrameInteraction) {
|
||||
_keyframeNavigator.updateCamera(*_camera, _playbackModeEnabled);
|
||||
}
|
||||
@@ -272,7 +273,7 @@ void NavigationHandler::applyNavigationState(const NavigationHandler::Navigation
|
||||
// Construct vectors of a "neutral" view, i.e. when the aim is centered in view.
|
||||
glm::dvec3 neutralView =
|
||||
glm::normalize(aimNode->worldPosition() - cameraPositionWorld);
|
||||
|
||||
|
||||
glm::dquat neutralCameraRotation = glm::inverse(glm::quat_cast(glm::lookAt(
|
||||
glm::dvec3(0.0),
|
||||
neutralView,
|
||||
@@ -331,7 +332,7 @@ void NavigationHandler::keyboardCallback(Key key, KeyModifier modifier, KeyActio
|
||||
}
|
||||
|
||||
NavigationHandler::NavigationState NavigationHandler::navigationState(
|
||||
const SceneGraphNode& referenceFrame) const
|
||||
const SceneGraphNode& referenceFrame) const
|
||||
{
|
||||
const SceneGraphNode* anchor = _orbitalNavigator.anchorNode();
|
||||
const SceneGraphNode* aim = _orbitalNavigator.aimNode();
|
||||
@@ -355,7 +356,7 @@ NavigationHandler::NavigationState NavigationHandler::navigationState(
|
||||
// Need to compensate by redisual roll left in local rotation:
|
||||
const glm::dquat unroll = glm::angleAxis(eulerAngles.z, glm::dvec3(0, 0, 1));
|
||||
const glm::dvec3 neutralUp =
|
||||
glm::inverse(invNeutralRotation) * unroll * _camera->lookUpVectorCameraSpace();
|
||||
glm::inverse(invNeutralRotation) * unroll * _camera->lookUpVectorCameraSpace();
|
||||
|
||||
const glm::dmat3 invReferenceFrameTransform =
|
||||
glm::inverse(referenceFrame.worldRotationMatrix());
|
||||
@@ -366,7 +367,7 @@ NavigationHandler::NavigationState NavigationHandler::navigationState(
|
||||
return NavigationState(
|
||||
_orbitalNavigator.anchorNode()->identifier(),
|
||||
_orbitalNavigator.aimNode() ?
|
||||
_orbitalNavigator.aimNode()->identifier() : "",
|
||||
_orbitalNavigator.aimNode()->identifier() : "",
|
||||
referenceFrame.identifier(),
|
||||
position,
|
||||
invReferenceFrameTransform * neutralUp, yaw, pitch
|
||||
@@ -374,7 +375,7 @@ NavigationHandler::NavigationState NavigationHandler::navigationState(
|
||||
}
|
||||
|
||||
void NavigationHandler::saveNavigationState(const std::string& filepath,
|
||||
const std::string& referenceFrameIdentifier)
|
||||
const std::string& referenceFrameIdentifier)
|
||||
{
|
||||
const SceneGraphNode* referenceFrame = _orbitalNavigator.followingNodeRotation() ?
|
||||
_orbitalNavigator.anchorNode() :
|
||||
@@ -428,9 +429,9 @@ void NavigationHandler::loadNavigationState(const std::string& filepath) {
|
||||
}
|
||||
|
||||
void NavigationHandler::setJoystickAxisMapping(int axis,
|
||||
JoystickCameraStates::AxisType mapping,
|
||||
JoystickCameraStates::AxisInvert shouldInvert,
|
||||
JoystickCameraStates::AxisNormalize shouldNormalize)
|
||||
JoystickCameraStates::AxisType mapping,
|
||||
JoystickCameraStates::AxisInvert shouldInvert,
|
||||
JoystickCameraStates::AxisNormalize shouldNormalize)
|
||||
{
|
||||
_orbitalNavigator.joystickStates().setAxisMapping(
|
||||
axis,
|
||||
@@ -440,8 +441,22 @@ void NavigationHandler::setJoystickAxisMapping(int axis,
|
||||
);
|
||||
}
|
||||
|
||||
void NavigationHandler::setWebsocketAxisMapping(int axis,
|
||||
WebsocketCameraStates::AxisType mapping,
|
||||
WebsocketCameraStates::AxisInvert shouldInvert,
|
||||
WebsocketCameraStates::AxisNormalize shouldNormalize)
|
||||
{
|
||||
_orbitalNavigator.websocketStates().setAxisMapping(
|
||||
axis,
|
||||
mapping,
|
||||
shouldInvert,
|
||||
shouldNormalize
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
JoystickCameraStates::AxisInformation
|
||||
NavigationHandler::joystickAxisMapping(int axis) const
|
||||
NavigationHandler::joystickAxisMapping(int axis) const
|
||||
{
|
||||
return _orbitalNavigator.joystickStates().axisMapping(axis);
|
||||
}
|
||||
@@ -455,9 +470,9 @@ float NavigationHandler::joystickAxisDeadzone(int axis) const {
|
||||
}
|
||||
|
||||
void NavigationHandler::bindJoystickButtonCommand(int button, std::string command,
|
||||
JoystickAction action,
|
||||
JoystickCameraStates::ButtonCommandRemote remote,
|
||||
std::string documentation)
|
||||
JoystickAction action,
|
||||
JoystickCameraStates::ButtonCommandRemote remote,
|
||||
std::string documentation)
|
||||
{
|
||||
_orbitalNavigator.joystickStates().bindButtonCommand(
|
||||
button,
|
||||
@@ -635,6 +650,41 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
|
||||
"int",
|
||||
"Returns the script that is currently bound to be executed when the "
|
||||
"provided button is pressed"
|
||||
},
|
||||
{
|
||||
"addGlobalRotation",
|
||||
&luascriptfunctions::addGlobalRotation,
|
||||
{},
|
||||
"double, double",
|
||||
"Directly adds to the global rotation of the camera"
|
||||
},
|
||||
{
|
||||
"addLocalRotation",
|
||||
&luascriptfunctions::addLocalRotation,
|
||||
{},
|
||||
"double, double",
|
||||
"Directly adds to the local rotation of the camera"
|
||||
},
|
||||
{
|
||||
"addTruckMovement",
|
||||
&luascriptfunctions::addTruckMovement,
|
||||
{},
|
||||
"double, double",
|
||||
"Directly adds to the truck movement of the camera"
|
||||
},
|
||||
{
|
||||
"addLocalRoll",
|
||||
&luascriptfunctions::addLocalRoll,
|
||||
{},
|
||||
"double, double",
|
||||
"Directly adds to the local roll of the camera"
|
||||
},
|
||||
{
|
||||
"addGlobalRoll",
|
||||
&luascriptfunctions::addGlobalRoll,
|
||||
{},
|
||||
"double, double",
|
||||
"Directly adds to the global roll of the camera"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user