Remove old parts of the interface to interaction handler.

This commit is contained in:
Kalle Bladin
2016-05-20 18:50:11 -04:00
parent c2ef5cca58
commit 9d235f42b2
5 changed files with 24 additions and 83 deletions

View File

@@ -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

View File

@@ -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) {
}

View File

@@ -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<float>(d1), static_cast<float>(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<float>(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;
}

View File

@@ -44,6 +44,7 @@ namespace interaction {
void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier modifier) {
// TODO package in script
/*
const float dt = static_cast<float>( _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");

View File

@@ -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<float>(_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<float>(_middleMouseButtonDown) * static_cast<float>(dt) * _currentCursorDiff[MouseButtons::ButtonMiddle].x * interactionSpeed * (rollInvert ? -1.f : 1.f),
static_cast<float>(_rightMouseButtonDown) * static_cast<float>(dt) * _currentCursorDiff[MouseButtons::ButtonRight].y * _navigationSpeed);
//}
*/
// if (_leftMouseButtonDown){
// _handler->orbit(static_cast<float>(dt)* _currentCursorDiff[MouseButtons::ButtonLeft].x * _rotationSpeed, static_cast<float>(dt)* _currentCursorDiff[MouseButtons::ButtonLeft].y * _rotationSpeed, 0.f);