adding first version of keyframe functionality for interactionhandler

This commit is contained in:
Joakim Kilby
2015-06-17 09:52:12 +02:00
parent 74ab05ec37
commit 9d6b9a3ad1
2 changed files with 16 additions and 0 deletions
@@ -76,6 +76,7 @@
#include <openspace/interaction/keyboardcontroller.h>
#include <openspace/interaction/mousecontroller.h>
#include <openspace/network/osparallelconnection.h>
#include <mutex>
@@ -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<Controller*> _controllers;
//remote controller
std::vector<network::Keyframe> _keyframes;
};
} // namespace interaction
+9
View File
@@ -254,6 +254,9 @@ InteractionHandler::InteractionHandler()
, _keyboardController(nullptr)
, _mouseController(nullptr)
{
network::Keyframe kf;
kf._timeStamp = std::numeric_limits<double>::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