mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-10 05:30:17 -06:00
Code cleanup branch (#618)
* Make height map fallback layer work again * Add documentation to joystick button bindings * Removed grouped property headers * Add new version number constant generated by CMake * Make Joystick deadzone work properly * Change the startup date on Earth to today * Fix key modifier handling * Add debugging indices for TreeNodeDebugging * Fix script schedule for OsirisRex * Do not open Mission schedule automatically * Upload default projection texture automatically * General code cleanup * Fix check_style_guide warnings * Remove .clang-format * MacOS compile fixes * Clang analyzer fixes
This commit is contained in:
@@ -24,22 +24,18 @@
|
||||
|
||||
#include <openspace/interaction/navigationhandler.h>
|
||||
|
||||
#include <openspace/openspace.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/query/query.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/keys.h>
|
||||
|
||||
#include <openspace/scripting/lualibrary.h>
|
||||
#include <openspace/interaction/orbitalnavigator.h>
|
||||
#include <openspace/interaction/keyframenavigator.h>
|
||||
#include <openspace/interaction/inputstate.h>
|
||||
#include <openspace/network/parallelpeer.h>
|
||||
#include <openspace/util/camera.h>
|
||||
#include <ghoul/filesystem/file.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace {
|
||||
@@ -49,7 +45,7 @@ namespace {
|
||||
constexpr const char* KeyPosition = "Position";
|
||||
constexpr const char* KeyRotation = "Rotation";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OriginInfo = {
|
||||
const openspace::properties::Property::PropertyInfo OriginInfo = {
|
||||
"Origin",
|
||||
"Origin",
|
||||
"The name of the scene graph node that is the origin of the camera interaction. "
|
||||
@@ -57,7 +53,7 @@ namespace {
|
||||
"towards this object. Any scene graph node can be the origin node."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo KeyFrameInfo = {
|
||||
const openspace::properties::Property::PropertyInfo KeyFrameInfo = {
|
||||
"UseKeyFrameInteraction",
|
||||
"Use keyframe interaction",
|
||||
"If this is set to 'true' the entire interaction is based off key frames rather "
|
||||
@@ -100,10 +96,10 @@ NavigationHandler::NavigationHandler()
|
||||
addPropertySubOwner(*_orbitalNavigator);
|
||||
}
|
||||
|
||||
NavigationHandler::~NavigationHandler() {}
|
||||
NavigationHandler::~NavigationHandler() {} // NOLINT
|
||||
|
||||
void NavigationHandler::initialize() {
|
||||
OsEng.parallelPeer().connectionEvent()->subscribe(
|
||||
OsEng.parallelPeer().connectionEvent().subscribe(
|
||||
"NavigationHandler",
|
||||
"statusChanged",
|
||||
[this]() {
|
||||
@@ -114,7 +110,7 @@ void NavigationHandler::initialize() {
|
||||
}
|
||||
|
||||
void NavigationHandler::deinitialize() {
|
||||
OsEng.parallelPeer().connectionEvent()->unsubscribe("NavigationHandler");
|
||||
OsEng.parallelPeer().connectionEvent().unsubscribe("NavigationHandler");
|
||||
}
|
||||
|
||||
void NavigationHandler::setFocusNode(SceneGraphNode* node) {
|
||||
@@ -124,7 +120,6 @@ void NavigationHandler::setFocusNode(SceneGraphNode* node) {
|
||||
|
||||
void NavigationHandler::setCamera(Camera* camera) {
|
||||
_camera = camera;
|
||||
//setFocusNode(_camera->parent());
|
||||
}
|
||||
|
||||
void NavigationHandler::resetCameraDirection() {
|
||||
@@ -141,8 +136,8 @@ KeyframeNavigator& NavigationHandler::keyframeNavigator() const {
|
||||
}
|
||||
|
||||
void NavigationHandler::updateCamera(double deltaTime) {
|
||||
ghoul_assert(_inputState != nullptr, "InputState cannot be null!");
|
||||
ghoul_assert(_camera != nullptr, "Camera cannot be null!");
|
||||
ghoul_assert(_inputState != nullptr, "InputState must not be nullptr");
|
||||
ghoul_assert(_camera != nullptr, "Camera must not be nullptr");
|
||||
|
||||
if (_cameraUpdatedFromScript) {
|
||||
_cameraUpdatedFromScript = false;
|
||||
@@ -282,8 +277,9 @@ void NavigationHandler::saveCameraStateToFile(const std::string& filepath) {
|
||||
|
||||
void NavigationHandler::restoreCameraStateFromFile(const std::string& filepath) {
|
||||
LINFO(fmt::format("Reading camera state from file: {}", filepath));
|
||||
if (!FileSys.fileExists(filepath))
|
||||
if (!FileSys.fileExists(filepath)) {
|
||||
throw ghoul::FileNotFoundError(filepath, "CameraFilePath");
|
||||
}
|
||||
|
||||
ghoul::Dictionary cameraDict;
|
||||
try {
|
||||
@@ -326,13 +322,15 @@ float NavigationHandler::joystickAxisDeadzone(int axis) const {
|
||||
|
||||
void NavigationHandler::bindJoystickButtonCommand(int button, std::string command,
|
||||
JoystickAction action,
|
||||
JoystickCameraStates::ButtonCommandRemote remote)
|
||||
JoystickCameraStates::ButtonCommandRemote remote,
|
||||
std::string documentation)
|
||||
{
|
||||
_orbitalNavigator->joystickStates().bindButtonCommand(
|
||||
button,
|
||||
std::move(command),
|
||||
action,
|
||||
remote
|
||||
remote,
|
||||
std::move(documentation)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -344,8 +342,6 @@ std::vector<std::string> NavigationHandler::joystickButtonCommand(int button) co
|
||||
return _orbitalNavigator->joystickStates().buttonCommand(button);
|
||||
}
|
||||
|
||||
|
||||
|
||||
scripting::LuaLibrary NavigationHandler::luaLibrary() {
|
||||
return {
|
||||
"navigation",
|
||||
|
||||
Reference in New Issue
Block a user