diff --git a/include/openspace/util/constants.h b/include/openspace/util/constants.h index 9b102f8957..58555328d6 100644 --- a/include/openspace/util/constants.h +++ b/include/openspace/util/constants.h @@ -61,6 +61,7 @@ namespace scenegraph { const std::string keyCamera = "Camera"; const std::string keyFocusObject = "Focus"; const std::string keyPositionObject = "Position"; + const std::string keyViewOffset = "Offset"; const std::string keyPathModule = "ModulePath"; } // namespace scenegraph diff --git a/scripts/bind_keys.lua b/scripts/bind_keys.lua index 2d90bb73ed..d793a8439a 100644 --- a/scripts/bind_keys.lua +++ b/scripts/bind_keys.lua @@ -13,7 +13,10 @@ openspace.bindKey("f2", "openspace.setPerformanceMeasurement(true)") openspace.bindKey("f3", "openspace.setPerformanceMeasurement(false)") openspace.bindKey("f5", "loadKeyBindings()") - +openspace.bindKey("T", "openspace.distance(-interaction_speed * openspace.dt(), 6.0)") +openspace.bindKey("G", "openspace.distance(interaction_speed * openspace.dt(), 6.0)") +openspace.bindKey("Y", "openspace.distance(-interaction_speed * openspace.dt(), 10.0)") +openspace.bindKey("H", "openspace.distance(interaction_speed * openspace.dt(), 10.0)") openspace.bindKey("U", "openspace.distance(-interaction_speed * openspace.dt(), 13.0)") openspace.bindKey("J", "openspace.distance(interaction_speed * openspace.dt(), 13.0)") diff --git a/src/scenegraph/scenegraph.cpp b/src/scenegraph/scenegraph.cpp index 8ebaccbee8..dc77e5b95f 100644 --- a/src/scenegraph/scenegraph.cpp +++ b/src/scenegraph/scenegraph.cpp @@ -441,6 +441,13 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath) glm::mat4 la = glm::lookAt(c->position().vec3(), fn->worldPosition().vec3(), c->lookUpVector()); c->setRotation(la); + glm::vec3 viewOffset; + if (cameraDictionary.hasKey(constants::scenegraph::keyViewOffset) + && cameraDictionary.getValue(constants::scenegraph::keyViewOffset, viewOffset)) { + glm::quat rot = glm::quat(viewOffset); + c->rotate(rot); + } + for (SceneGraphNode* node : _nodes) { std::vector properties = node->propertiesRecursive();