From 9d235f42b208c258ef06dc5ba591e3598c40d326 Mon Sep 17 00:00:00 2001 From: Kalle Bladin Date: Fri, 20 May 2016 18:50:11 -0400 Subject: [PATCH] Remove old parts of the interface to interaction handler. --- .../interaction/interactionhandler.h | 17 ----- src/interaction/interactionhandler.cpp | 62 ++----------------- src/interaction/interactionhandler_lua.inl | 20 +++--- src/interaction/keyboardcontroller.cpp | 2 + src/interaction/mousecontroller.cpp | 6 +- 5 files changed, 24 insertions(+), 83 deletions(-) diff --git a/include/openspace/interaction/interactionhandler.h b/include/openspace/interaction/interactionhandler.h index 962f74e2e0..406f2f69eb 100644 --- a/include/openspace/interaction/interactionhandler.h +++ b/include/openspace/interaction/interactionhandler.h @@ -152,17 +152,12 @@ public: void setFocusNode(SceneGraphNode* node); void setCamera(Camera* camera); - void setInteractionSensitivity(float sensitivity); - void setInvertRoll(bool invert); - void setInvertRotation(bool invert); void resetKeyBindings(); - void addController(Controller* controller); void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf); void clearKeyframes(); void bindKey(Key key, KeyModifier modifier, std::string lua); - void lockControls(); void unlockControls(); @@ -172,9 +167,6 @@ public: const SceneGraphNode* const focusNode() const; const Camera* const camera() const; double deltaTime() const; - float interactionSensitivity() const; - bool invertRoll() const; - bool invertRotation() const; /** * Returns the Lua library that contains all Lua functions available to affect the @@ -191,19 +183,10 @@ public: void mousePositionCallback(double x, double y); void mouseScrollWheelCallback(double pos); - // Interaction functions - void orbitDelta(const glm::quat& rotation); - void orbit(const float &dx, const float &dy, const float &dz, const float &dist); - void rotateDelta(const glm::quat& rotation); - void distanceDelta(const PowerScaledScalar& distance, size_t iterations = 0); - void lookAt(const glm::quat& rotation); - void setRotation(const glm::quat& rotation); - private: }; - } // namespace interaction } // namespace openspace diff --git a/src/interaction/interactionhandler.cpp b/src/interaction/interactionhandler.cpp index baf4039403..6a7c5aec0e 100644 --- a/src/interaction/interactionhandler.cpp +++ b/src/interaction/interactionhandler.cpp @@ -602,6 +602,7 @@ InteractionHandler::~InteractionHandler() } +// Mutators void InteractionHandler::setKeyboardController(KeyboardController* controller) { @@ -612,7 +613,11 @@ void InteractionHandler::setMouseController(MouseController* controller) } -void InteractionHandler::addController(Controller* controller) { +void InteractionHandler::setFocusNode(SceneGraphNode* node) { + +} + +void InteractionHandler::setCamera(Camera* camera) { } @@ -628,17 +633,10 @@ void InteractionHandler::update(double deltaTime) { } -void InteractionHandler::setFocusNode(SceneGraphNode* node) { - -} - const SceneGraphNode* const InteractionHandler::focusNode() const { return nullptr; } -void InteractionHandler::setCamera(Camera* camera) { - -} const Camera* const InteractionHandler::camera() const { return nullptr; } @@ -655,29 +653,6 @@ void InteractionHandler::mouseScrollWheelCallback(double pos) { } -void InteractionHandler::orbit(const float &dx, const float &dy, const float &dz, const float &dist) { - -} - -void InteractionHandler::orbitDelta(const glm::quat& rotation) -{ - -} - -void InteractionHandler::rotateDelta(const glm::quat& rotation) -{ - -} - -void InteractionHandler::distanceDelta(const PowerScaledScalar& distance, size_t iterations) -{ - -} - -void InteractionHandler::lookAt(const glm::quat& rotation) -{ -} - void InteractionHandler::keyboardCallback(Key key, KeyModifier modifier, KeyAction action) { } @@ -694,35 +669,10 @@ scripting::ScriptEngine::LuaLibrary InteractionHandler::luaLibrary() { return{}; } -void InteractionHandler::setRotation(const glm::quat& rotation) -{ -} - double InteractionHandler::deltaTime() const { return 0; } -void InteractionHandler::setInteractionSensitivity(float sensitivity) { -} - -float InteractionHandler::interactionSensitivity() const { - return 0; -} - -void InteractionHandler::setInvertRoll(bool invert) { -} - -bool InteractionHandler::invertRoll() const { - return false; -} - -void InteractionHandler::setInvertRotation(bool invert) { -} - -bool InteractionHandler::invertRotation() const { - return false; -} - void InteractionHandler::addKeyframe(const network::datamessagestructures::PositionKeyframe &kf) { } diff --git a/src/interaction/interactionhandler_lua.inl b/src/interaction/interactionhandler_lua.inl index cf133964b2..3cf2a06471 100644 --- a/src/interaction/interactionhandler_lua.inl +++ b/src/interaction/interactionhandler_lua.inl @@ -131,6 +131,7 @@ int dt(lua_State* L) { * Change distance to origin */ int distance(lua_State* L) { + /* int nArguments = lua_gettop(L); if (nArguments != 2) return luaL_error(L, "Expected %i arguments, got %i", 2, nArguments); @@ -139,6 +140,7 @@ int distance(lua_State* L) { double d2 = luaL_checknumber(L, -1); PowerScaledScalar dist(static_cast(d1), static_cast(d2)); OsEng.interactionHandler().distanceDelta(dist); + */ return 0; } @@ -153,7 +155,7 @@ int setInteractionSensitivity(lua_State* L) { return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments); float sensitivity = static_cast(luaL_checknumber(L, -1)); - OsEng.interactionHandler().setInteractionSensitivity(sensitivity); + //OsEng.interactionHandler().setInteractionSensitivity(sensitivity); return 0; } @@ -163,8 +165,8 @@ int setInteractionSensitivity(lua_State* L) { * Returns the current, global interaction sensitivity */ int interactionSensitivity(lua_State* L) { - float sensitivity = OsEng.interactionHandler().interactionSensitivity(); - lua_pushnumber(L, sensitivity); + //float sensitivity = OsEng.interactionHandler().interactionSensitivity(); + //lua_pushnumber(L, sensitivity); return 1; } @@ -179,7 +181,7 @@ int setInvertRoll(lua_State* L) { return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments); bool invert = lua_toboolean(L, -1) == 1; - OsEng.interactionHandler().setInvertRoll(invert); + //OsEng.interactionHandler().setInvertRoll(invert); return 0; } @@ -189,8 +191,8 @@ int setInvertRoll(lua_State* L) { * Returns the current setting for inversion of roll movement */ int invertRoll(lua_State* L) { - bool invert = OsEng.interactionHandler().invertRoll(); - lua_pushboolean(L, invert); + //bool invert = OsEng.interactionHandler().invertRoll(); + //lua_pushboolean(L, invert); return 1; } @@ -205,7 +207,7 @@ int setInvertRotation(lua_State* L) { return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments); bool invert = lua_toboolean(L, -1) == 1; - OsEng.interactionHandler().setInvertRotation(invert); + //OsEng.interactionHandler().setInvertRotation(invert); return 0; } @@ -215,8 +217,8 @@ int setInvertRotation(lua_State* L) { * Returns the current setting for inversion of rotation movement */ int invertRotation(lua_State* L) { - bool invert = OsEng.interactionHandler().invertRotation(); - lua_pushboolean(L, invert); + //bool invert = OsEng.interactionHandler().invertRotation(); + //lua_pushboolean(L, invert); return 1; } diff --git a/src/interaction/keyboardcontroller.cpp b/src/interaction/keyboardcontroller.cpp index ba7dd478f2..0a5d69bc76 100644 --- a/src/interaction/keyboardcontroller.cpp +++ b/src/interaction/keyboardcontroller.cpp @@ -44,6 +44,7 @@ namespace interaction { void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier modifier) { // TODO package in script + /* const float dt = static_cast( _handler->deltaTime()); if(action == KeyAction::Press|| action == KeyAction::Repeat) { const float speed = 2.75; @@ -127,6 +128,7 @@ void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier OsEng.renderEngine().camera()->setScaling(s); } } + */ /* if (key == '1') { SceneGraphNode* node = getSceneGraphNode("sun"); diff --git a/src/interaction/mousecontroller.cpp b/src/interaction/mousecontroller.cpp index 67dacbd26e..e50ef856db 100644 --- a/src/interaction/mousecontroller.cpp +++ b/src/interaction/mousecontroller.cpp @@ -102,7 +102,7 @@ void MouseController::trackballRotate(int x, int y) { glm::quat quaternion = glm::angleAxis(rotationAngle, rotationAxis); // Apply quaternion to camera - _handler->orbitDelta(quaternion); + //_handler->orbitDelta(quaternion); _lastTrackballPos = curTrackballPos; } @@ -129,6 +129,7 @@ void TrackballMouseController::move(float x, float y) { } void TrackballMouseController::scrollWheel(int pos) { + /* const float speed = 4.75f; const float dt = static_cast(_handler->deltaTime()); if (pos < 0) { @@ -139,6 +140,7 @@ void TrackballMouseController::scrollWheel(int pos) { PowerScaledScalar dist(-speed * dt, 0.0f); _handler->distanceDelta(dist); } + */ } void TrackballMouseController::update(const double& dt){ @@ -219,6 +221,7 @@ void OrbitalMouseController::scrollWheel(int pos) { } void OrbitalMouseController::update(const double& dt){ + /* const float interactionSpeed = OsEng.interactionHandler().interactionSensitivity(); const bool rotationInvert = OsEng.interactionHandler().invertRotation(); const bool rollInvert = OsEng.interactionHandler().invertRoll(); @@ -230,6 +233,7 @@ void OrbitalMouseController::update(const double& dt){ static_cast(_middleMouseButtonDown) * static_cast(dt) * _currentCursorDiff[MouseButtons::ButtonMiddle].x * interactionSpeed * (rollInvert ? -1.f : 1.f), static_cast(_rightMouseButtonDown) * static_cast(dt) * _currentCursorDiff[MouseButtons::ButtonRight].y * _navigationSpeed); //} + */ // if (_leftMouseButtonDown){ // _handler->orbit(static_cast(dt)* _currentCursorDiff[MouseButtons::ButtonLeft].x * _rotationSpeed, static_cast(dt)* _currentCursorDiff[MouseButtons::ButtonLeft].y * _rotationSpeed, 0.f);