From 9d6b9a3ad151d566a213e3610c41f0cb2d23e493 Mon Sep 17 00:00:00 2001 From: Joakim Kilby Date: Wed, 17 Jun 2015 09:52:12 +0200 Subject: [PATCH] adding first version of keyframe functionality for interactionhandler --- include/openspace/interaction/interactionhandler.h | 7 +++++++ src/interaction/interactionhandler.cpp | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/include/openspace/interaction/interactionhandler.h b/include/openspace/interaction/interactionhandler.h index 2b56ebe881..0a0a9fa71e 100644 --- a/include/openspace/interaction/interactionhandler.h +++ b/include/openspace/interaction/interactionhandler.h @@ -76,6 +76,7 @@ #include #include +#include #include @@ -139,6 +140,8 @@ public: void setInvertRotation(bool invert); bool invertRotation() const; + void addKeyframe(const network::Keyframe &kf); + /** * Returns the Lua library that contains all Lua functions available to affect the * interaction. The functions contained are @@ -149,6 +152,7 @@ public: static scripting::ScriptEngine::LuaLibrary luaLibrary(); private: + friend class Controller; InteractionHandler(const InteractionHandler&) = delete; @@ -172,6 +176,9 @@ private: KeyboardController* _keyboardController; MouseController* _mouseController; std::vector _controllers; + + //remote controller + std::vector _keyframes; }; } // namespace interaction diff --git a/src/interaction/interactionhandler.cpp b/src/interaction/interactionhandler.cpp index 11148e379f..ddf5f6fda0 100644 --- a/src/interaction/interactionhandler.cpp +++ b/src/interaction/interactionhandler.cpp @@ -254,6 +254,9 @@ InteractionHandler::InteractionHandler() , _keyboardController(nullptr) , _mouseController(nullptr) { + network::Keyframe kf; + kf._timeStamp = std::numeric_limits::min(); + _keyframes.assign(4, kf); } InteractionHandler::~InteractionHandler() { @@ -347,6 +350,7 @@ void InteractionHandler::unlockControls() { void InteractionHandler::update(double deltaTime) { _deltaTime = deltaTime; _mouseController->update(deltaTime); + printf("Current keys:\n, %s\n %s\n %s\n %s\n\n\n", _keyframes[0].to_string(), _keyframes[1].to_string(), _keyframes[2].to_string(), _keyframes[3].to_string()); } void InteractionHandler::setFocusNode(SceneGraphNode* node) { @@ -919,6 +923,11 @@ bool InteractionHandler::invertRotation() const { return _invertRotation; } +void InteractionHandler::addKeyframe(const network::Keyframe &kf){ + _keyframes.push_back(kf); + _keyframes.erase(_keyframes.begin()); +} + } // namespace interaction //>>>>>>> feature/interactionhandler } // namespace openspace