#include "trackballcameranode.h"

TrackBallCameraNode::TrackBallCameraNode(Input *input) :
    m_input(input),
    m_action_move(NO_ACTION),
    m_action_rotate(NO_ACTION)
{}

void TrackBallCameraNode::update()
{
    glm::vec2 diff = m_input->getDeltaPosition();
    for(Action action : m_input->getActions())
    {
        if(action.action == m_action_move)
            moveCamera(diff.x, diff.y);
        else if(action.action == m_action_rotate)
            rotateCamera(diff.x, diff.y);
    }
    zoom(m_input->getDeltaVerticalScroll()*120.f);
}
